Hi there,
I'm currently working on one of the most complicated features coming to the Universe of StarMade: Soft Borders.
This basically means, that sectors won't load in right when you change it, but you will be always surrounded by preloading sectors. You will be able to see the objects (even moving ones) of adjacent sectors from your position. This feature will mark a milestone for the engine's core.
However, it's very complex and complicated to implement. Here are some of the problems the system has to solve:
[*]
Object positions have to be calculated relatively
[*]
Physics dilemma: To keep StarMade as modular and extensible, the sector system described above is used. Every sector is using it's own physics context to handle scalability and number limits (float/double problem).
Well, so much for what I'm currently working on,
Thanks for playing StarMade,
- schema
I'm currently working on one of the most complicated features coming to the Universe of StarMade: Soft Borders.
This basically means, that sectors won't load in right when you change it, but you will be always surrounded by preloading sectors. You will be able to see the objects (even moving ones) of adjacent sectors from your position. This feature will mark a milestone for the engine's core.
However, it's very complex and complicated to implement. Here are some of the problems the system has to solve:
Every player effectively now loads 27 (3x3x3) sectors.
This means a lot more memory used per player on the server (not a client problem). Current State: I managed to almost cut the size down to the size of one sector
a lot more sectors and objects have to be able to load in at the same time. Current State: improved performance by a lot, but still a problem at the moment
a lot more data has to be transferred to clients, since the simultaneous "available" objects by player is much bigger. Most of the data is only one time data (e.g. not moving objects don't need updates, and the number of moving objects won't increase from this) Current State: improved performance, though still concerning.
every object loaded has be updated, which will beat on the performance. Current State: working single player for fresh universe, not tested for populated universe.
Clean up functions: the clean up has to be done a lot more often since more sectors get inactive at once. Current State: good performance for normal universe in single player. not tested with more
[*]
Object positions have to be calculated relatively
As floating point (even double precision ) values are by far not big enough for the StarMade Universe, the sectors are used to represent a relative system. This means every sector is handled around the absolute zero, which allows for the virtual infinity of the universe. The function that has to be the most robust for the new system is to calculate the positions of objects in the surrounding sectors on the clients. For the server the relative positions don't play any role, since each sector has their own context. Current State: done
relative positions also influence sector requests by the client. Current State: working, but sometimes buggy (some objects only start being requested when the client is very near to it)
[*]
Physics dilemma: To keep StarMade as modular and extensible, the sector system described above is used. Every sector is using it's own physics context to handle scalability and number limits (float/double problem).
There has to be a function for secure transitions of objects from one in the next physics context. This is one of the most complex procedures (although it sounds easy at first): Bigger Objects can intersect the sector border: what sector does it belong to? The sector that has the bigger part of it of course. But now what happens if another object in the sector which the big object doesn't belong to collides with it? ... I basically have implement some kind of "bubble" which is formed around near objects to make sure they are in the same physics context. Current State: none
Well, so much for what I'm currently working on,
Thanks for playing StarMade,
- schema