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.

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.

Character Animations – Update #13

One of the biggest benefits of making a 2d game is that in regards to technical aspects there is one parameter that has to be monitored and kept in budget – video memory, as opposed to 3d games where polygon count, level of detail, draw distance, animation complexity, lighting complexity as well as video memory all have to be balanced.

One of the biggest problems with making a 2d game is that its video memory consumption can easily explode. All animations, objects, characters – everything that is visible on screen ultimately ends up in a texture atlas, with few ways to optimise them.

However regardless of difficulties, optimise we must.

One of the ways to do such optimisations is to look at animations of all characters and monsters and make sure they take as few frames as possible. However this has to be balanced with making sure they still look smooth.

After latest set of such optimisations a typical character animation atlas was reduced from over 7000 frames of animation to about 5000. During that process all animations were improved to look less jerky and have a unified look.

There will be more work needed, but at this point only smaller improvements and polish will be necessary.

Camera control – Update #12

All games utilise some sort of a camera to show the game to the player. Even though it is one of the most common aspect of games, it can still be a tricky problem to solve. Of course for some games it can be trickier than others. 3rd person 3D action games are probably the most notorious in this department, as the camera can get easily stuck in all types of geometry. 2D isometric games have less complicated problems to solve, but it doesn’t mean they are trivial.

Ultimately one has to remember that camera control (just like walking) is not a game mechanic. It’s something that just has to be there, for the player to be able to play. It has to be unobtrusive, easy to use and ideally not require player input at all. The challenge here lies in making it smart enough, so that the player doesn’t have to constantly be distracted by where the camera should be pointing, but without taking agency away from the player.

After recent round of polish, the camera in Elemental Enigma during exploration tries to anticipate where it should look, based on player input, but without taking away all control. Also additional ways to focus on party members have been added, so it’s easy to see the relevant character if they happen to be off-screen.