Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dodge the Creeps Example Needs Signals Connected #935

Conversation

daniel-mitchell011
Copy link

@daniel-mitchell011 daniel-mitchell011 commented Nov 2, 2024

When I ran the example for Dodge the Creeps in Godot 4.3, the 'start_game' signal was not connected to the function 'new_game' and the 'hit' signal was not connected to function 'game_over'.

This is a simple fix that corrects the behavior from not running the new_game function and just making the start button disappear upon clicking it:
game_start_error,

to having the game run properly (spawning enemies, etc):
game_start_proper.

@Bromeon
Copy link
Member

Bromeon commented Nov 3, 2024

Hi, have you tested the example from the repo?

These signals are connected in the scene, see:

[connection signal="hit" from="Player" to="." method="game_over"]
[connection signal="timeout" from="MobTimer" to="." method="on_mob_timer_timeout"]
[connection signal="timeout" from="ScoreTimer" to="." method="on_score_timer_timeout"]
[connection signal="timeout" from="StartTimer" to="." method="on_start_timer_timeout"]
[connection signal="start_game" from="Hud" to="." method="new_game" flags=3]

@daniel-mitchell011
Copy link
Author

daniel-mitchell011 commented Nov 3, 2024

Hi Bromeon, I ran the example in Godot 4.3 and that seems to be the issue. When I migrate the project to 4.3 (since it says that it was last edited in 4.2), it nukes the connections that you showed above. My solution probably isn't the best way to go about this (since it's just a band-aid).

To be clear, the steps I ran were:

  1. Run git clone <gdext_repo_ssh_url>
  2. Go into examples/dodge_the_creeps/rust folder and run cargo build
  3. Open project in Godot 4.3 (hitting confirm on the dialog box when asked to update the project for 4.3 from 4.2).
  4. Then I found that Main.tscn was missing two connections and only had these three remaining:
[connection signal="timeout" from="MobTimer" to="." method="on_mob_timer_timeout"]
[connection signal="timeout" from="ScoreTimer" to="." method="on_score_timer_timeout"]
[connection signal="timeout" from="StartTimer" to="." method="on_start_timer_timeout"]

Sorry for any confusion.

@Bromeon
Copy link
Member

Bromeon commented Nov 5, 2024

I just tested with Godot 4.3 on Linux, and cannot reproduce this.

Direct start

Launching from command line with godot4 command.

I get some UID warnings (a known issue in Godot), but the game works as intended.

Initialize godot-rust (API v4.3.stable.official, runtime v4.3.stable.official)
Godot Engine v4.3.stable.official.77dcf97d8 - https://godotengine.org
...

WARNING: res://Player.tscn:3 - ext_resource, invalid UID: uid://co0y23xy1j4bv - using text path instead: res://art/playerGrey_walk1.png
     at: load (scene/resources/resource_format_text.cpp:453)
WARNING: res://Player.tscn:4 - ext_resource, invalid UID: uid://dx27fpt8s4b76 - using text path instead: res://art/playerGrey_walk2.png
     at: load (scene/resources/resource_format_text.cpp:453)

Direct start, fresh clone

cargo build and then running godot4 from the command line won't work indeed -- however with different errors, such as:

WARNING: res://Player.tscn:3 - ext_resource, invalid UID: uid://co0y23xy1j4bv - using text path instead: res://art/playerGrey_walk1.png
     at: load (scene/resources/resource_format_text.cpp:453)
ERROR: No loader found for resource: res://art/playerGrey_walk1.png (expected type: Texture2D)
   at: _load (core/io/resource_loader.cpp:291)
WARNING: res://Player.tscn:4 - ext_resource, invalid UID: uid://dx27fpt8s4b76 - using text path instead: res://art/playerGrey_walk2.png
     at: load (scene/resources/resource_format_text.cpp:453)
ERROR: No loader found for resource: res://art/playerGrey_walk2.png (expected type: Texture2D)
   at: _load (core/io/resource_loader.cpp:291)

So I'm not sure if this is related. Once I open the game in the editor once, things work.

Open editor

From command line with godot4 -e.

Editor opens with warnings, I open several scene files and re-save them.
I launch the game, works as intended.

I don't get any migration dialog -- how do you get this?

@daniel-mitchell011
Copy link
Author

I think I understand what's happening a bit better now. First, I do get the migration dialog like I have below, but I'm not sure why I see that and you don't. I'm using Pop!_OS and opened Godot 4.3 through the file manager GUI.

However, I figured out when the connections get thrown away. I opened the project in Godot before building the Rust code, and I get this on the scene view.
image

When I try to run the project (still without running cargo build), it deletes the connections in the Main.tscn file (presumably because Godot thinks that the Player and Hud objects don't exist). If I build the Rust code before opening the project in Godot, it works just fine.

So sorry about all that; I thinks it's just a user error on my end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants