In this compilation of space-related things I’ve worked on…
The first was a standalone/web arena shooter, with a heavy emphasis on level design and mechanics. In the first release, up to 6 players online threw wrenches, smoke grenades (both poisonous and foggy) and remote charges around a mining station in deep orbit, with variable gravity, breakable windows, rapidly depleting oxygen and an unstable reactor core. This project was first developed for a ProBuilder showcase competition, and then moved into a testbed for FPS mechanics (see above) and rendering techniques. Things like large fog/smoke particles clipping through walls into adjacent rooms, particle lighting from the reactor core, and ultra-fast lightmapping (a proto-directional monochromatic lightmapping solution was developed).
Click on the Sunrise beta screenshot below for a preview of the ‘day-night’ cycle.
I find space is also a great place to just build some nice FX. Missiles are great fun to work with because you’ve got to balance particle count with trail length and quality. At the same time, smoke and particulate behaves so differently in space compared to the atmosphere.
This scene was built as a test for the Unity LWRP and SGE, based of some earlier demo work I did for Hydra. Effectively the planet is a multi-layered fade shader, which I thought appropriate considering 99% of SGE demos are fade shaders… In this case, I make use of additional ‘octaves’ (?) to generate the pack ice style rocks near the shores, and the rivers of lava flowing from the mountainous terrain also use the same system. Another trick used is but just generating the heightmap in-shader, but rebuilding a custom subgraph node that functions like the ‘generate normal’ node, except it takes the parameters for noise and outputs a matching normal (3) and height (1) as an output (4).
The asteroids and debris use the new-ish, correctly-lit Unity Standard Particle Shader. To make sure there weren’t just infinite copies of the same particle everywhere, I use a shader-generated particle sprite map; UVs are multiplied and frac’d, then fed into the polygon node, offset with some noise, and then combined with an imposter normal map given ‘form’. By increasing the asteroid count in the shader (shown below at 3×3), I can generate any number of different asteroids, all pixel-perfect and resolution-independent, and without authoring any textures at all.
A similar test was done for Hydra some years back – testing the gravity component for particle systems. On the left is a simple gravity well (particle attracting field for simpletons) demonstrating Newton’s Cannonball. That’s the idea that a cannonball (spawned at the purple point near the top left) would either fall to the center and/or fly off into space unless projected at the exact orbital velocity to maintain circular orbit. We now know that this isn’t quite the case (hence elliptical orbits with semi-major and minor axis), but the example shows the right effect. On the right, a disc of particles is drawn towards the center of the objects and given radial velocity, resulting in the formation of a classic disc galaxy shape. If the particles were able to apply forces on each other (imagine the cost….) it would then form the characteristic spiral galaxy arms too.
The two game dev weekends were an interesting foray into mobile indie game development, and the tricks and limitations of getting something to run well on a low-end phone in 2012. Minimizing draw calls, overdraw and dealing with compression is the name of the game, and I’ve certainly learnt a few things from it.
One of the bigger problems was the draw call limit, for low-end devices at the time this can be around 30-50 (PC limits are often well into the hundreds). So batching and texture sheet animation were abused for the star systems, both the background galaxy particles and the the central galactic core system. One of the great things about Unity is that while the particle material is simple, the amount of particles can be driven through the roof without penalty (even on mobile hardware!). Bear in mind that Shuriken was still fairly new at the time, so rather than the gravity wells, radial velocities and forces we have now, I had to work out velocity curves by hand in the curve editor….and yes, the galaxy turns, dragging stars from the arms inwards, oh and the galaxy moves across the world too.
Planet textures were updated, as were the planet meshes, to trim polys and give the planets and more iconic and identifiable look. Secondary particle systems were added for a bit more flare; shooting stars and explosions upon contact with the suns helped bring the galaxy to life, also punishing players who think they can Icarus a star and get away with it.