Premature optimization


As mentioned in change log there are multiple optimizations this time, most of them with dramatic effect.

The very first and the most important is sector unloading, which, obviously unloads sectors from memory, and completely destroys all the objects which no one can see. There is about 3000 objects in every sector now, each consuming cpu time, fully spawn new sector each time any player teleports somewhere and keep processing it forever completely killed fps before. But there has to be the way to determine whether sector object if visible or not, and this is why the second optimization is needed.

Network visibility. Its not some kind of cloaking system, its all about determination who sees what. This way it is possible to further reduce CPU and bandwidth utilization for connected clients by multiple times, by only syncing objects which they can see and destroy the rest.

I tried to show on the picture how does it work now. Each player has only one sector observed and only has objects located in this sector in his visibility scope spawned for him and only syncs whatever happens to them and has no idea what happens elsewhere.  Sector with no observers (number 4 on the picture) will be destroyed by sector unloading. Ofc multiple players can have the same sector observed and interact with each other.

Once asteroids were changed rendering performance also decreased because of thousands of draw calls. In order to fix that, I now manually combine block meshes at runtime. Works better than GPU instancing. Yep, I tried that too.

And the last thing, monobehavior methods, for most of the objects they never get called now effectively saving lots of CPU time. It was multiple dozens of thousands before per sector per frame doing almost nothing!

Files

build-win32(exp-13).zip 50 MB
Feb 22, 2018
build-linux-x86(exp-13).zip 55 MB
Feb 22, 2018

Get Ship Control

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.