The Swapper is an atmospheric 2D puzzle platformer, constructed using clay models and other everyday materials for a uniquely detailed look and feel. The game takes place on an abandoned space station and tackles the implications of the ‘Swapper’ - a device that can clone the user and transfer consciousness between different bodies. Coming Spring 2013!
The Swapper is incoming single- and multiplayer 2d-platformer with heavy emphasis on surreal and scary atmosphere and tricky puzzles. In this article I'm talking about implementing of fog effects into the engine and ranting about Game Maker.
Posted by FacepalmGames on Sep 30th, 2009
The main reason for adding the fog was that it makes it mostly unneeded to separate the shadows from backgrounds that represent objects further away from the player. With fog it doesn't look that weird when shadows are cast into air. And of course it does look good!
It could have been possible and pretty simple to code a mask system that cuts shadows away from areas where they should not be visible. Only problem that makes it hard is that The Swapper is coded using Game Maker. There are some things like simple casual games for which it is a great system, but when it comes to more complex things it really shows it's limits. Using GM it's really important to optimize things as much as possible as it itself is as unoptimized pile of poo as it could be.. That makes some interesting programming challenges. A thing as simple as fog is one of them.
The fog was first implemented using a sort of cellular automaton. The whole map was divided into cells which had a value from 0 to 1. Those values described the position's fog density. Using some predetermited rules the cells slowly transferred their values to each other, so it looked like the fog was floating around. The almost only problem was that because of GM's restrictions it ate CPU's for breakfast..
The current fog system works using huge blended fog particles. They might not be the greatest thing ever made, but they also lack the stupid looking jitteryness of the cellular automaton. Pretty big maps can be filled with fog of varying density's, which really adds to the atmosphere.
That allows some interesting gameplay possibilities especially for the multiplayer. Fog can be a strategical element allowing moving unnoticed. One can hide and camp in fog. There could be fog removing and creation devices.. It allows numerous possibilities and creative ways of use. Only problem is that the fog needs to be completely deterministic, so that each and every player sees it the same way, but that's not really a problem as the fog system is so simple. With pseudorandom numbers the fog can easily be made floating the same way million times.