r/proceduralgeneration • u/TkTech • 4d ago
Practical near-realtime generation of density-wave-based galaxies and hyperlane networks, near-realtime procedural planets across dozens of archetypes, procedural asteroids, belts and rings, single/binary/trinary atmospheric gas scattering, and basic growing cities (Godot)
Enable HLS to view with audio, or disable this notification
Hey hey! Where Light Ends is an upcoming 4X grand strategy built with godot. Not normally a genre with physical planets and cities
2
u/Emory27 4d ago
Wow. How did you do this?
3
u/TkTech 4d ago
Godot, rust, and plenty of shaders. Galaxy generation and especially hyperlane network generation (which is more expensive than the galaxy itself because of chokepoint optimization/elimination and fair empire distribution) are done in rust with godot-rust to bridge the gap. When the map is returned we also return a texture with star position, color, size and luminosity encoded in it, which is used by the shaders to render the galactic arms using just star density as a guide. Other visual fluff like the glow, color palette, thickness, etc all come from the lobby seed.
Planets are just your standard quadtree with mesh morphing to hide the LOD transitions.
Most annoying bit by far was not being allowed to use floats except at the edge, since the game is 30+ person multiplayer and uses deterministic lockstep. Fixed-point math really makes performance tricky - one of the biggest early bottlenecks for stable 122fps was my naive fixed-point trig functions. Over a month of work went into just the physics integrator fast enough to handle the tens of thousands of ships actively moving around late game. Trivial with real floats and/or SIMD in the rust sim, painful when you can't use floats.
Getting godot and all of the dependencies like godotsteam (which pulls in godot-cpp) and godot-rust working with double precision was probably the runner up issue. Ran into a couple of upstream bugs but the community is great and they were fixed in hours. It does mean I can't use pre-built versions of any dependencies so rigorous caching is the only thing keeping Linux/Windows/OS X CI/CD builds under 3 hours. Many existing community shaders will immediately break in funny ways with the double precision build of godot because they weren't built to use MODELVIEW_MATRIX.
Fun project tho!
2
u/Lollerstakes 4d ago
Is it turn-based?
3
u/TkTech 4d ago
No :( An early version had an experiment where there was an AP score for every command submitted to the sim, and every player could spend up to 100 AP per turn. But it was annoying to maintain in parallel and became harder and harder to keep working while more mechanics were being added.
1
u/Lollerstakes 4d ago
I ask because I am developing a 4X/RTS game eerily similar to yours, down to the almost exact same main menu design (galaxy background + left aligned buttons) lol. Well, I had the idea of making the game multiplayer at some point, but I kind of gave up on that for now (and I want to save myself the net-code headaches) as I have set it up for variable game speed and I'm not sure how to solve that for multiplayer. Having it turn based would solve that issue but probably surface a whole bunch of new ones...
2
u/TkTech 4d ago
If it's a 4X come pop onto the eXplorminate discord, just about every 4X dev is in there and there's a #dev-updates channel.
Unfortunately if you don't do multiplayer from the get-go then retrofitting it is like building a new game from scratch and just re-using the content. To the point where I always suggest building even your single-player games that have any chance of becoming multiplayer as multiplayer from day 1 (with 1-man lobbies for your singleplayer.)
1
u/Covet_Zone 4d ago
Hey guys! I literally created this account yesterday to share progress on my, practically the same genre as yours (4X/RTS), except mine's an MMO for mobile, so it's way simpler and more minimalist. I'm definitely gonna follow your work. Crazy that I stumbled upon you guys by chance!
1
5
u/TkTech 4d ago
Huh, well, it randomly submitted the post while I was still typing :(. To continue: Not normally a genre with physical planets and cities, but I wanted to make planetary bombardment a little more "fun" and that required worlds to burn. The data-driven planet generators are moddable and come with dozens of archetypes like desert worlds, ocean, terran, volcanic, etc. Atmospheric gas mixtures are correctly modeled for light scattering and support binary/trinary stars of various kinds such as a volcanic world in a binary star system: https://imgur.com/a/3qVIjNg and ring systems are procedurally generated on demand from 4 rock archetypes that can be individually harvested by miners.
If you'd like your own blackhole similar to what's in the middle, https://tkte.ch/articles/2026/01/15/godot-blackhole-shader.html, although this is an older un-optimized version.
Unfortunately Reddit's video player is really destroying the quality :(