Color wave was a lot of fun to program during Global Game Jam. The wave effect was the first thing I imagined and actually programmed into the game, even before we thought of the different color effects.
A lot of people got interested in the game as soon as they saw the effect in action. Many of them complimented us on it and some people asked me how it was made. So here you go, making of Color Wave.
In the GIF above you can see the effect very clearly, during gameplay you rarely have such a vantage point, and also in this GIF the interaction is purely 2D. During gameplay the effect is 3D, and blocks also move around making it even crazier.
Some people asked me if it was a 3D array or something fancy like that. Initially I thought about doing an array, but it’s funny how the Jam mindset (“code fast, you’ve only got 48h for this!”) makes you think differently. In this case I think it was beneficial to do it the “easy way”.
It’s quite simple really, the world is made of blocks, and each block might have up to 6 neighbours (up, down, front, back, left, right). During gameplay, if a block is hit by a bullet, it propagates the effect to its neighbours, every propagation reduces the wave “strength”, limitating the range of the effect.
The visual effect is as simple as making the block scale a little bit larger once it is hit by either a bullet or an adjacent block.
Before the game starts, each block searches for neighbours, and saves them in a local ‘neighbours array’. It’s as simple as that.
The catch is, since there may be hundreds of thousands of blocks, this might take a while, so instead of doing this search during gameplay, I did it before compiling the game. Also, by sectorizing the game each block only needs to search within its own sector, making it a lot faster.
This game was a lot of fun to make and to play afterwards, it may even see other versions in the future.