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

Different behaivor between debug mode and release mode. #34023

Closed
kakoeimon opened this issue Nov 30, 2019 · 7 comments
Closed

Different behaivor between debug mode and release mode. #34023

kakoeimon opened this issue Nov 30, 2019 · 7 comments

Comments

@kakoeimon
Copy link

Godot version:
3.1.1 3.1.2
OS/device including version:
Windows 10
Issue description:
I do not know what the bug is, the problem is that in release mode the ai do not work as expected.
Steps to reproduce:
export in release mode and run the game with bots.
Minimal reproduction project:
The project is GNU so anyone can check it out.
https://github.com/kakoeimon/Y.E.A.R.-3044

@KoBeWi
Copy link
Member

KoBeWi commented Dec 14, 2019

Uh, any chance you could extract some minimal project where this can be reproduced? I can confirm that something strange happens, but not sure where to even look for debugging this.

@kakoeimon
Copy link
Author

I cannot make any minimal project cause everything is tighted up rigth now.
The problem must be in hovercraft.tscn, my initial guess was that something is wrong with the ray trace of the hovercraft but AI and human players are using the same object so this does not explain why human players have no problem.
Thanks for looking.

@Calinou
Copy link
Member

Calinou commented Oct 23, 2020

@kakoeimon Can you (or anyone else) still reproduce this bug in Godot 3.2.3 or any later release?

If yes, please ensure that an up-to-date Minimal Reproduction Project (MRP) is included in this report (a MRP is a zipped Godot project with the minimal elements necessary to reliably trigger the bug). You can upload ZIP files in an issue comment with a drag and drop.

@rapenne-s
Copy link

@Calinou I've been able to reproduce something similar. My project works fine in debug but behaves weirdly in release.

I tried to make a MRP as suggested. I'm a total Godot beginner, I hope the MRP is good enough. MRP-34023.zip

@Calinou
Copy link
Member

Calinou commented Apr 29, 2022

I can confirm this on 3.5.beta 59e84be. Therefore, #59793 doesn't appear to fix this.

Editor

simplescreenrecorder-2022-04-29_21.43.10.mp4

Release export template

simplescreenrecorder-2022-04-29_21.43.54.mp4

You can notice that the objects are spawning with correct rotation for one frame, then they appear with incorrect rotation after one frame has passed.

However, this error message is spammed in both editor and release export template builds:

ERROR: Error calling method from signal 'body_entered': 'RigidBody2D::_on_Area2D_body_entered': Method not found..
   at: emit_signal (core/object.cpp:1243)

@and-rad
Copy link
Contributor

and-rad commented May 11, 2023

I vote for closing this issue. Reason one: OP hasn't worked on their game for more than 4 years now and there have only ever been made 5 commits to the repo. I assume they moved on from that project and it is very difficult to search the entire codebase for the cause of the error. Reason two: @rapenne-s 's MRP can probably be attributed to user error.

I can reproduce the issue, but fixing the errors in the output log fixes the differences between the debug and release builds. The first error goes away if we just disconnect the signal and it doesn't change the observable outcome. There is a second error, though:

get_global_transform: Condition "!is_inside_tree()" is true. Returned: get_transform()

This is the code that causes it:

zombie.look_at($Player.position)
zombie.linear_velocity = Vector2(100, 0).rotated(zombie.rotation)
add_child(zombie)

As you can see, it's trying to change the zombie's transform before it's been added to the scene. I'm assuming editor and debug builds use get_transform() as some kind of fallback mechanism and release builds don't. Hence, the differences. Sure enough, if I call add_child() first, the differences disappear and both debug and release builds behave the same, as seen in @Calinou 's second video. Replacing the velocity code with something that seems more straightforward and "correct" to me fixes the enemies targeting behavior:

add_child(zombie)
zombie.look_at($Player.position)
zombie.linear_velocity = ($Player.position - zombie.position).normalized() * 100

So I'm thinking there is probably not enough here to keep this issue open any longer.

@KoBeWi
Copy link
Member

KoBeWi commented May 11, 2023

As you can see, it's trying to change the zombie's transform before it's been added to the scene.

I remember there was debug-only check for this, which resulted in different behavior between debug and release. It's fixed in 4.0, so if that was the issue then it's resolved.

@KoBeWi KoBeWi closed this as completed May 11, 2023
@KoBeWi KoBeWi added this to the 4.0 milestone May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants