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

Dynamic Gridmap unloading causes physics engine errors and FPS issues #33648

Closed
Tracked by #45333
rumangerst opened this issue Nov 15, 2019 · 7 comments · Fixed by #50052
Closed
Tracked by #45333

Dynamic Gridmap unloading causes physics engine errors and FPS issues #33648

rumangerst opened this issue Nov 15, 2019 · 7 comments · Fixed by #50052

Comments

@rumangerst
Copy link

Godot version: 3.1.1

OS/device including version: Ubuntu 19.10, AMD RX580, Mesa 19.2.1

Issue description:
Dynamically unloading GridMap tiles via set_cell_item(x,y,z,-1) (e.g. in a project that manages a large world) causes errors in the internal physics engine that are then shown in the editor error log. At the same time, unloading seems to not have the expected effect, as the FPS slows down noticeable the more world has been "covered" - even when the tiles actually have been removed.

Following errors are spammed in my error log (over 1000 errors in a short time; depending on how much unloading is done):

E 0:00:01:0791   Condition ' !id_map.has(p_rid.get_data()) ' is true. returned: __null
  <C Source>     ./core/rid.h:154 @ get()

E 0:00:01:0791   Condition ' !body ' is true.
  <C Source>     modules/bullet/bullet_physics_server.cpp:567 @ body_clear_shapes()

E 0:00:01:0791   Invalid ID
  <C Source>     modules/bullet/bullet_physics_server.cpp:1552 @ free()

Although the errors seem to be related to the physics server, they still come up if only mesh instances without physics or navigation are used as tiles.

Steps to reproduce:
Please see example project

Minimal reproduction project:
reproduce.zip

@pedronasser
Copy link

pedronasser commented Apr 26, 2020

Its also happening in my project. Running on Windows (Godot v3.21.stable)
Any updates on this error?

@Calinou
Copy link
Member

Calinou commented Apr 26, 2020

@pedronasser Does this occur if you change the physics engine to GodotPhysics instead of Bullet physics in the Project Settings? See #34963 and #28801.

@pedronasser
Copy link

@Calinou even changing it, it continues happening.
After some investigation I found out that it was because I was manually removing the cell item when based on distance, and it seems that when the PhysicsServer tries to remove if the mesh instance is outside of the screen then the errors starts happening.

@exe4que
Copy link

exe4que commented Jul 11, 2020

It happens to me also in my procedural world project. @pedronasser have you found any work around to it?

@rumangerst
Copy link
Author

@exe4que I worked around it by creating multiple gridmaps, separating the world into chunks. Deleting a chunk works as expected.

@kzerot
Copy link

kzerot commented Oct 6, 2020

Have same bug, godot 3.2.3
Have no issues with FPS but also have these errors in console

@SoloCodeNet
Copy link

for an endless runner create and delete a lot of tiles with gridmap, adding a -1 value on a loop with non physic tile (no collisionShape instead) create lot of error debug and finally crash.
with an idle_frame the problem seem to be clear but it s a bad solution when removing lot of tiles.

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

Successfully merging a pull request may close this issue.

7 participants