Khaligufzel / Dimensionfall

A survival game inspired by Cataclysm: Dark Days Ahead and Bright Nights.
MIT License
12 stars 5 forks source link

MobIdle.gd:33 @ Physics_Update(): Parameter "map" is null. #316

Closed snipercup closed 2 months ago

snipercup commented 2 months ago

When playing the game the error sometimes appears in the debug output

This error appears:

E 0:07:07:0713   MobIdle.gd:33 @ Physics_Update(): Parameter "map" is null.
  <C++ Source>   modules/navigation/godot_navigation_server.cpp:1169 @ _query_path()
  <Stack Trace>  MobIdle.gd:33 @ Physics_Update()
                 StateMachine.gd:29 @ _physics_process()

This is probably because an invalid map id is set in https://github.com/Khaligufzel/CataX/blob/de2c740050134c4ef6ec448875e8bde9da702933/Scripts/Mob.gd#L58-L62

We will have to do work the way the navigation agent gets it's map id.

The map id is communicated to Helper in this line: https://github.com/Khaligufzel/CataX/blob/de2c740050134c4ef6ec448875e8bde9da702933/Scripts/Chunk.gd#L70

The helper will set the navigationmap id to it's variable: https://github.com/Khaligufzel/CataX/blob/de2c740050134c4ef6ec448875e8bde9da702933/Scripts/Helper.gd#L131-L136

This setup was created as an alternative to stitching all navigationmaps together and working with a single id. Right now all navigationareas are islands. We can either fix this setup or try to find a way to work with a single map and connected navigationmaps.

snipercup commented 2 months ago

The mobs are freed from a thread like this: https://github.com/Khaligufzel/CataX/blob/ca68b8fdea72b4ae3f75053bc677ecdd3a440a42/Scripts/Chunk.gd#L361-L365

After they are queued free, there is still time until the next frame when it's their turn to be freed. In the meantime, the map RID can already be freed.