Open BatteryAcid opened 9 months ago
not sure why the ball is stopped but the player isn't when they "drop in" to the level..
If this happens in addition to it working fine in non-exported game, then I'm not sure what the terrain/plugin would have to do with it 🤔 I have no idea, sorry. There is no special logic in the plugin that would make it behave differently in server exports, but even if it did, the ball working and the character not working still makes no sense.
Is your issue happening server-side? Or is your physics client side? Did you export your server headless (no window/graphics)? Do you have any way of testing if this works if your simulation is exported NOT as a server? If you export as DEBUG server and file logging, do you get errors?
Did you exclude some resources from your server export preset?
How fast is your character falling onto the terrain? Does it fall from above AFTER the terrain is added to the scene? Does it actually spawn above it server side? Which collision shape is it using?
Are you able to reproduce the issue with a HeightMapShape3D
setup instead of the terrain? (the plugin uses it under the hood)
Does this happen with another physics engine such as Jolt?
Thanks for the quick follow up!
This is a server authoritative setup, so the items that fall through are spawned on the server and synched to the clients. So the physics is calculated on the server.
The test I did with the ball wasn't a good test, because the ball was a statically placed object, not spawned. So I changed the test to spawn the ball during game play and it too, fell through the ground.
I exported it as a dedicated server so it was headless, there's no client, just the terminal where I started it from. I also deployed this on an EC2 instance as linux, same result.
I do not see any errors
The only thing I exclude are the tools as mentioned in the docs, but I also tried a build with them for giggles, same result.
The ground is spawned first when the server starts, when the client connects, the character falls with the physics gravity and the ground is visible for at least a second, but it should be ready for a few seconds on the server, as that's where the level gets spawned into the game, then synced to the clients. Maybe there's some lag there? It's on the same machine so shouldn't be...
My player is a CharacterBody3D and is using a CapsuleShape3. I upped the Margin to 0.5m
I will try the HeightMapShape3D shortly.
I'm not familiar with Jolt.
Just like you said above: there's no special logic that would make this behave differently, my gut says it's likely not a problem with the terrain, but it's the common denominator here so I wasn't sure where else to go. I'll try some more experiments and get back to you with what I find.
Thank you for your time!
My suspicion is that Godot behaves in a certain way in headless that makes the plugin fail to setup something, but you saw no error (even with file logging AND debug enabled?) so it's hard to even understand what's going on...
Ok, I guess I can play around with it more.
Yea, I'm not seeing any errors in the output file for the server build or in the client's debug tabs. I did enable verbose logging, this is the server:
And client:
Maybe there's a race condition? Here's a link to a short clip. It appears that the camera's SpringArm does collide with the ground, you can see it move in real quick right before falling through: https://x.com/BatteryAcidDev/status/1726281221209203010?s=20
terrain data not set
Do you see this in the exports that work, with verbose output?
I do not see that anywhere
Wait, I'm going to have to retest that, I have to run out but I'll do it later today, thanks!
That is printing on your server. It means for some reason the terrain's data failed to load, or did not load at all for whatever reason.
If you export your server with graphics, does it still print?
When verbose mode is enabled, there should be a Loading terrain data...
in the log at some point. If that doesnt print, it means Godot litterally skipped over the loading of that resource (why, I have no idea, I'm not in control of that unfortunately).
For the dedicated build, I thought maybe I'm stripping visuals so I kept them in the Terrain data folder, but I don't think that applies here.
This is the only idea I have as to why it would not load it at all. If it still doesn't load it even after keeping the assets (in particular data.hterrain
) then it's likely a weird Godot bug of some sort...
I tried doing a server export of a test scene, and I checked EVERYTHING as keep
in resources.
Nothing makes sense:
This time the terrain does receive a non-null HTerrainData
, but somehow Godot is still not even running the logic that loads it (so where did it got that resource from, I wonder). So it obviously fails too because it's empty... NONE of the functions of hterrain_resource_loader.gd
are called, they are supposed to be called by Godot... so I'm leaning more and more towards Godot having a bug in server exports, which means you can't use server exports... I'm baffled that there would even be a relation between server exports and custom ResourceLoader
...
I posted an issue on Godot's repo https://github.com/godotengine/godot/issues/85101 Because at this point either I'm missing something but I don't know what, or Godot has a bug.
I ran the export with a full project build and the server does print Loading terrain data...
and doesn't print terrain data not set
, which is I guess what you were expecting.
Thank you for looking into this and reporting the bug to Godot, because I wasn't sure where else to go with it!!!
I guess we'll see...
Describe the bug I created a very simple map with some height adjustments. The player successfully walks on the ground when working in the editor, but when I export for Linux or Mac, the player (CharacterBody3D) falls through.
This is a multiplayer setup. My level is spawned into the Tree and then the player(s) are spawned into the level. They both have Collision layers set to 1.
However, I also created a test Sphere RigidBody3D but this is NOT spawned, it is statically placed in the world, but when it falls down when the level loads, it IS stopped by the terrain. So not sure why the ball is stopped but the player isn't when they "drop in" to the level.
I even once added another plane under the Terrain to see if that would collide and support the player, and it does, see last screenshot.
If anyone has any ideas or something they'd like me to experiment or test with, please let me know.
Thanks!
Environment
Player:
Test Ball:
Terrain Settings:
Terrain:
.
Test Plane collider under Terrain: