Universe generation and persistence of in-game modification

A quieter space for design discussion of long-term projects
lwho
Posts: 72
Joined: Thu Jul 04, 2013 9:26 pm
Location: Germany
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Universe generation and persistence of in-game modificat

Post by lwho » Sun Feb 16, 2014 6:16 pm

There is now a very first step in lwho/galaxy_generator (note: as this is WIP commits may be rebased, amended, squashed and force pushed). It currently only deals with the Sector layer of generation (i.e. there is nothing at all about StarSystem).

A GalaxyGenerator class is introduced, which gets attached a list of Sector generation stages. When a Sector is requested, the GalaxyGenerator creates an empty one and passes it in order to the SectorGenerator stages. Currently there are two stages: SectorCustomSystemsGenerator and SectorRandomSystemsGenerator. I'm planning to make AssignFactions a third stage somehow.

The user-visible behavior is supposed to be the same as before. So, if anything changed in the generated universe, that would be a bug.

The code is currently only very lightly tested: It compiles, and from a very first look at the sector map it looks fine.

I would be grateful about comments (especially about the general approach and design).

lwho
Posts: 72
Joined: Thu Jul 04, 2013 9:26 pm
Location: Germany
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Universe generation and persistence of in-game modificat

Post by lwho » Mon Feb 17, 2014 7:45 pm

Just dumped all sectors from -100 to +100 in each dimension before and after my changes to text files. 1.7GB each (only containing Sector and Sector::System) :O
Fortunately, they had the same MD5 sum, I don't think a diff tool would have been so happy with so huge files ;)

lwho
Posts: 72
Joined: Thu Jul 04, 2013 9:26 pm
Location: Germany
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Universe generation and persistence of in-game modificat

Post by lwho » Sat Apr 26, 2014 2:02 pm

This project isn't dead, it progresses (you know, progress is a turtle ;)). I got side-tracked again and again, though the side-tracks were mostly related to this project.

The first step is to separate galaxy generation from Sector and StarSystem representation and put all related stuff in there. Once this is done I plan to have two galaxy generation tracks. One is the current (legacy) generator which is supposed to stay stable and save-game compatible. The other is supposed to be an experimental galaxy generator, which can change at any time (also in save-game incompatible ways).

The used galaxy generator (name and version) is to be put in the save-game and depending on that, further generator-related stuff can be loaded/saved (though I have no fields in mind, currently).

Certain galaxy-related stuff needs to be tight to a galaxy generator:
  • Sector and StarSystem caches (which is relatively easy)
  • Factions (this probably needs considerable cleanup of all the static stuff before, side-track I come)
  • CustomSystems (I hope, this is easy again, but haven't looked closely, yet).

Factions and CustomSystems need to be re-initialized when the galaxy generator changes (e.g. loading a game with another galaxy generator). Currently those steps are relatively early in the Pioneer initialization, but on first look it seems that the stuff behind it doesn't really depend on it. So, I hope I can move those steps to the end, and just re-initialize only those two when needed.

This is the current initialization order in Pi::Init:
  1. FileSystem, GameConfig, ModManager, Resources
  2. SDL, Renderer, Joystick
  3. EnumStrings
  4. Multi-threading and job queues
  5. ShipType
  6. Lua
  7. Gui (now we are at progress bar 0.1)
  8. Galaxy::Init (0.2)
  9. FaceGenManager::Init (0.25)
  10. Faction::Init (0.3)
  11. CustomSystem::Init (0.4)
  12. Faction::SetHomeSectors (0.45)
  13. ModelCache, Shields::Init (0.5)
  14. 0,6 seems to be empty
  15. BaseSphere::Init (0.7)
  16. CityOnPlanet::Init (0.8)
  17. SpaceStation::Init (0.9)
  18. NavLights::Init, Sfx::Init (0.95)
  19. Sound/Music (1.0)
My aim is to get 8, 10, 11, 12 at the end of the list (in fact I also have work in the pipeline to swap CustomSystems and Faction, which gets rid of step 12). Effectively, these steps will then become something like

Code: Select all

Pi::galaxyGenerator = GalaxyGenerator::Create(config->String("GalaxyGenerator"));
Comments, suggestions and such highly welcome.

Post Reply
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Who is online

Users browsing this forum: No registered users and 1 guest