CreatorsOk
roadtovostok
roadtovostok

patreon


Shipyard Performance (Mystery solved)

Hi!

Here's a fun little development story.

Since the last two demo, I have been getting multiple bug reports and comments about the Shipyard performance. That has been the only map that been causing issue with certain hardware (compared to other maps) and generally speaking there have been this mystery why it's much more demanding than other maps in terms of performance.

Since this upcoming demo patch is all about stability and more constant performance, I decided to spent this entire day figuring out what really is the problem with this map, since it should actually be much more easier to render than Village for example (less nature etc.)

I finally found the key issue for this and here's the explanation:

1. Once I ported the project to Godot, I implemented a "buoyancy" script from Unity. This script basically simulates floating to 4 barges that are located in that Shipyard map.

2. Two of those barges contain about 20 shipping containers each and each individual shipping container has a loot simulation component that can spawn physically based loot inside these containers. In theory, these large barges can have for example +50 physical items on top of them (even though some are not even reachable)

3. The current implementation of this physically based loot turns the item physics to "sleep" once the item keeps still, in other words once you either place item or it is spawned to the map it goes to freeze state and all the physics calculations deactivate automatically.

4. Well, you can already maybe figure out where this is going. Once the loot simulation spawns those items inside of the shipping containers the physics calculations turn off but after some small delay the buoyancy script starts moving the entire barge which "awakes" all the physical items from the sleep state.

5. This sequence can turn into situation where there can be +50 individual items that constantly recalculate the physics since they can't go back to sleep.

6. Once I deactivated the buoyancy, the performance jumped right away around +20-40fps (this number depends on the user CPU and number of items that spawned) back to "normal" which is now logical when compared to the other maps.

Basically this was a rookie mistake on my part since I only focused on profiling the rendering performance of that map and not physics performance, so the map was basically "CPU-bound" (physics) not "GPU-bound" (rendering).

I think this was quite an interesting topic related why game dev sometimes can be quite mysterious :)

ps. I will probably turn the entire buoyancy thing off for this first demo patch and implement something better after that.

-Antti (Developer)

Comments

For what's it worth the brief time I've been in the new shipyard map the fps has been higher and felt smoother. Same with the village map, apart from some a slow down for a few seconds, which you've addressed in a previous post.

Tadeusz Cantwell

Interesting REX

Justin


More Models and Creators