Since the late 90's it has been standard to use 3D models in video games to represent characters and geometry. The advantages are pretty clear with being able to rotate in any direction. With the advent of skeletal animation the superiority of animating characters this way becomes the standard. Both of these technologies took a long time to get right and have made games better.
Older computers in the early 90's and late 80's would not have the processing power to render characters as 3D models with any sort of speed required for real-time rendering that a real video game needed. At the time it was impressive to just render your environments using models, this was before the creation of modern lighting and shadow casting systems also.
Space Trucker wanted to revive some of these aspects for aesthetic reasons since it's storyline takes place in the 90's with an alternate Cold War theme. It fit the tone of the levels we were generating and made the pacing feel overall more complete. This is not an attempt at being retro as much as it is a practical way to have more than 10 enemies on the screen at 4k resolutions without major performance degradation while maintaining a constant 60FPS.
The way older rendering methods would work is to use a texture atlas which contained various poses the character would be in at all stages. So facing you directly, you have walking, this is 3 frames of moving one leg in front of the other played in sequence in the game engine. You would have all of these animations for every bit of rotation in 8 different degrees such as front, front-left, side, back-left, back (same for other side) such as walking, running, shooting, standing idle, dying, and corpses.
The technical term is a directional sprite, which changes displayed material offsets based on the viewing angle of the camera that is looking at it. All of this together makes for a pseudo 3D effect which is known collectively as a 2.5D sprite. An example of what this systems looks like using numbers to display the faces as the camera rotates around it in the resource editor.
This system works good for objects like barrels, crates, characters, lights, and some other effects used throughout the game. However, the effect don't lend well to weapons or characters which are viewed from extreme angles such as 90 degrees straight down towards your feet. Since the billboard sprite is at it's heart a 2D image it would become invisible when viewed from this angle or worse a line from the top of the polygon used to render the billboard.
Another example of this would be a weapon being held by the player from a first-person perspective. These are not so much directional sprites as they are perpendicular to the camera at all times, so the effect would be wasted there is no rotation on the Y or Z axis for these types of sprites. A different type of sprite rendering class is used for weapons and special critters like bugs on the floor and rats so that they will look right when being looked down at or straight on from FPS camera.
The above animation may seem a little strange but it is rotating around the cockroach in the same way we did with the directional sprite but this time the sprite is not changing its material offsets and instead loops through a series of frames that make up a given animation name, in the case of our buggy friend here it would be his walk cycle.
Animated sprites and the directional sprites are both used extensively in Space Trucker for things like weapons, characters, decorations, blood and gibs, corpses, bullet casings, light flares, and even machines and equipment sometimes. It is great for adding detail to existing 3D models to combine both the old and the new school items into a model which gives the game a unique style that stands out from other indie games on the market right now.
Next post we talk about how it is possible for Space Trucker to have thousands of lights on a level without dropping below the desired 60FPS target. This is accomplished with static lighting!