Lighting in an Isometric World – Part 1 – Update #18

Lighting in games

Lighting in video games is a wide, involved and a complicated concept. There have been many ways to approach it over the years, always closely tied to the capabilities of the current hardware. In the age of deferred rendering, geometry shaders and PBR, lighting in 2D games seems almost trivial. There are only two dimensions and the amount of polygons on screen is often smaller than of a single model in a 3D game.

Unless one tries to push the envelope of rendering methods or goes for a very unusual aesthetic lighting in 2D and 3D video games is a solved problem.

Isometric games are different story.

The problem with a typical isometric game is that although the game is 2D the world it’s trying to represent is 3D. There is a fundamental disconnect between how the light is to behave and what is actually being lit on the screen. After all sprites look as if they have depth but they don’t.

There are multiple way to solve this problem.

Make the game 3D

One of the simplest solutions to the problem is to just make the game 3D. This way all existing methods and workflows used for 3D games will apply. This however will remove all benefits of making the game 2D (like not worrying about polygon count).

Screenshot from Solasta: Crown of the Magister.

Make the game 2D

Another simple solution is to make the game simply 2D. In this case it will mean switching from an Isometric perspective to a top-down perspective. Then the disconnect between the world and the shape of the sprites disappears making all existing methods for 2D available. However switching of perspectives removes also the feeling of depth, which might be an unacceptable artistic compromise.

Screenshot from Graveyard Keeper.

Use tile lighting

This method is very popular in roguelikes regardless of perspective. The basic principle is to subdivide the world into tiles and simulate spreading of lights only for those tiles. Objects standing on tiles are lit the same way as the tiles.

This method has a lot of benefits. Most importantly it’s not computationally expensive and does a good job of determining occlusion. However it has one significant downside – it’s very visible. The differences in light colour and strength between tiles and objects can be jarring.

Screenshot from UnderRail.

Use diffused spherical overlays

This method uses point lights which are only used to show as circles or ellipses on the screen that colourise anything that’s behind them. This method has the benefit of being simple and giving nice smooth lighting. However it cannot do proper occlusion, might not look great for big contrasts and for it to fit well with the environment there might some additional manual work required.

Screenshot from Shadowrun Returns.

Normal map everything

This method most probably gives the most realistic results. The idea is to have all sprites normal maps and all lighting in the world be compromised of point or directional lights. By using regular normal map lighting logic the world can be very realistically lit. The few problems with this method is that it can get quite expensive computationally, might require subdivision of sprites into smaller elements and is unable to do occlusion on its own.

Screenshot from Brigador.

Lighting in Elemental Enigma

Elemental Enigma uses yet a different lighting method that is a combination of tile lighting with subdividing of sprites. More details will be in a dedicated post in the future.

Urban Legends – Update #17

Urban Legend is a type of modern folklore. They are often told around campfires, on schoolyards or by the water cooler. Often in such a way that’s unclear how true and how made up they are. These are stories that happened to a “friend of a friend” or to a distant family member. Some of them are supernatural in nature but not necessarily.

In recent years movies, series as well as comic books took them as their main themes. On the internet they took a life of their own through creepypastas and projects like the SCP Foundation.

Elemental Enigma is a game about Urban Legends. It’s a game about elevators to another world, haunted vending machines, taxis driven by faceless drivers, vengeful ghosts and other supernatural mysteries that sprawl our modern cities.

In the game the player will be the friend of the friend that makes the wrong turn on a street that wasn’t there before, they will be the one exploring the abandoned hospital at night, they will be the one sitting alone in the dark room.

And around every corner there were be a mystery waiting to be solved, that will show a bit more of what happens behind the veil and will bring the player closer to finding their missing friend.

Combat Camera – Update #16

We have briefly discussed camera during exploration in Update #12, now it’s time to discuss camera during combat.

Because exploration is done in real-time and combat is turn-based and because during combat the player is facing different challenges that during exploration, the camera control also needs to be a bit different.

In practice there are more things happening and it is even more important to clearly convey the information to the player.

Previously the camera would just automatically focus on the character who’s current turn it is. However this proved insufficient. Among others there were problems with AI controlled characters moving faster than the camera, resulting in empty, irrelevant space being shown, also monsters entering and leaving Fog Of War proved a bit of a challenge.

After a round of polish the camera behaves much better. The focusing logic has been improved, as well as it now follows the current character during their turn. All of this behaviour can be overridden immediately by the player if they choose to move the camera somewhere else. This combination of automatic behaviour with an easy way for the player to take over seems to work well so far.

Combat – Update #15

Elemental Enigma is 2D isometric RPG with turn-based combat. After months of improvements to quests, rendering and other important systems it is finally time to have a look at combat.

Combat in Elemental Enigma is inspired by modern Shadowrun and XCOM games as well Disgea and Final Fantasy Tactics. Player controls a party of 1 to 4 characters and by using various skills and positioning tries to eliminate attacking monsters.

Skills that the player controlled characters have depend on their build, and unlike most games their build is directly tied to their personality.

Positioning is relevant, not only in regards to distance to enemies, but also certain objects offer cover while some locations might offer passive buffs. Also direction in which character is facing is important, as flanking enemies can provide significant bonuses to attack.

Combat is divided into rounds which are divided into turns. Each character gets one turn in a round, when they can perform a limited amount of actions. Order of characters in a round is randomised based on their Initiative stat. The higher a character’s Initiative, the earlier in the round they will be able to act.

Combat encounters are self contained. That means that health and magick points are restored at the end of combat, KO’ed characters are revived and most status effects are removed.

Over the course of development more details will be shared. Among others on how equipment impacts combat, what kind of skills might be available and more.

System Requirements – Update #14

When making a PC game one of the trickier tasks is to determine the minimum and recommended system requirements for it. Not only the absurd amount of possible combinations of GPUs, CPUs, memory amount and OSs make this complicated, but also the developer needs to ask themselves: “What is the game supposed to look by default?”.

Even for indie games this is a relevant consideration. Too many games made by smaller teams, are developed on extremely powerful PCs without the time or budget to test and optimise for weaker platforms. This resulting in end users often finding themselves having quite an unpleasant experience.

On the other hand limiting oneself in regards to platform requires spending precious time on optimisations, or worse dropping more interesting features like more complicated AI, cool graphical effects or density of objects on screen.

For Elemental Enigma the goal, from the very beginning, was to run at a stable, locked 60 FPS even on integrated GPUs while never using no more than 3Gb of RAM+VRAM.

For a long time this was easily reached. However once more assets were being added, that target started to move away. After more recent set of optimisations mentioned in Update #9 the framerate of 60 FPS has been regained. Video Memory, however, still remained a problem.

Not anymore. After various experiments with texture compression and memory allocation optimisations, currently the game runs within 820 Mb in RAM and 530 Mb in VRAM. This will of course increase as more content is added, but currently is well within the target of combined 3 Gb. More work and optimisations are needed, and indeed planned, but at this point any changes should not be dramatic.