Understanding Serious Sam 4s' Legion System
During the buildup to Serious Sam 4 we were told about the Legion system, but all we were told is it can show hundreds of thousands of enemies on the screen and "
It's a really nice trick". I really wanted to figure this out so I bought the game.
The first thing I did was play through the game normally and just from this I couldn't spot how they did it, but enabling cheats and flying around I came to the conclusion that it's only used in the first and last levels to create a convincing epic battle.
The Legion system is only used for Octavian Gamma Troopers and essentially involves hoardes of enemies in one big rectangle, they spawn in at the far side and walk in a straight line to the allies where they are killed. These scenes must have tens of thousands of enemies in them and so far I've found two tricks which allow this to be convincingly rendered in real time.
Trick 1
Sam can only hit enemies with hitscan weapons within a certain radius of him and he must be within the rectangle, projectiles seem to have their own radius, here is a diagram and video evidence to illustrate this:
Trick 2
They're all sprites. I didn't notice this whilst playing the game normally, I think the dark and dusty nature of this level does well to keep the illusion but almost every trooper in the final scene is one of three sprites. Here is a sprite sheet and a video illustrating this:
and here are some partial frames I grabbed using
RenderDoc that show how widespread the sprite usage is, these are very dark so I've increased the brightness on them but they may need opening a bit larger to see what's going on:
Scene 1 - pre-sprite render |
Scene 1 - sprite render 1 |
Scene 1 - sprite render 2 |
Scene 1 - sprite render 3 |
Scene 1 - enemy render 1 |
Scene 1 - enemy render 2
|
Scene 1 - final render |
Scene 2 - enemy render 1 |
Scene 2 - sprite render 1 |
Scene 2 - sprite render 2 |
Scene 2 - sprite render 3 |
Scene 2 - final render |
In the first scene the sprites are loaded first and then only two 3d enemies are rendered, in the second scene the three reptiloids are the only 3d enemies rendered and the rest are sprites.
If anyone has corrections or thoughts on this I'd like to hear them