RogueLight - A traditional roguelike with modern features
Introduction
This is a C++/SDL2 project made to explore the limits of the traditional roguelike genre. Traditional roguelikes are ASCII games, inspired by the original game Rogue (1980). Rogue was originally played in the terminal, so it was graphically limited to utilizing only ASCII characters for displaying the world.
Though visually archaic, much of the appeal of roguelikes does not come from its graphics, as one might expect, but from the underlying complexity of the gameplay. The games that followed original Rogue, such as NetHack (1987), possessed a large number of mechanics and interactions which granted the game unprecedented emergent gameplay where player creativity was a requirement for surviving the encountered unpredictable circumstances.
Even to this day there are newly released games which fit into the traditional roguelike category, such as Caves of Qud (2015) and Dwarf Fortress (2006) which shows the resilient relevance (though niche) of this genre, even among a new generation of gamers.
For this reason, I set out to attempt to enhance the aesthetics of the traditional ASCII look by keeping it grounded in its roots while introducing modern features.
Furthermore, I think roguelikes are the perfect platform for solo programmers as adding new features in the game is not bound by the need for assets.
Dynamic Lighting
My first goal with this project was to introduce lighting into the game. With roguelikes, we don't have a lot of tools to make them look good, all we can do is basically choose which ASCII character to render and their color. So, naturally, I thought of how I can set the color of the characters in the best way possible.
Also, lighting opens up multiple possibilities to enhance the visual mood of the game. The use of lightning is a natural evolution since roguelikes were originally designed to emulate tabletop roleplaying games where players would often wander into dark caves lit only by their dim torches.
In modern graphics applications, path tracing has been demonstrated to greatly enhance the look of computer graphics. This has inspired me to recreate these photorealistic techniques in the 2D roguelike world.
To achieve this, entities can be given a light emitter component. When the light emitters are updated the game calculates every cell every light emitter can see (which is where it can cast light into). Casting rays to every cell is extremely slow and comes with artifacts, for this reason I had to research the issue and look for a fast algorithm.
The roguelike community has discussed at length about the different algorithms for calculating field of view in a two-dimensional grid, each has their own characteristics. I've implemented the symmetric shadowcasting algorithm by Albert Ford for the lighting system since it's very fast and has useful properties such as no discontinuities in the vision field.
With this fast algorithm we can update the light emitters frequently, allowing for moving dynamic lights, fun stuff like spells that light up their surroundings and continuously randomized light colors. An example of this is the above gif of a campfire, the color of the campfire has a randomized component which allows it to simulate the gentle fluctuations of a light from a fire. The lights will also respond automatically to changes of the environment like new light-blocking walls being built or destroyed. A future enhancement would be to add baked-in lighting as a separate system from the dynamic lights.
Sub-ASCII
Roguelike games are normally limited to rendering a single ASCII on each "square" or grid cell. For some of the next systems I needed to have a way to display more detail without having to reduce the size of the characters in the game. So for this, I've added a way to render smaller ASCII characters on top of the main ASCII characters. Each main ASCII character cell has a 2x2 grid of half-sized ASCII characters.
These sub-ASCII characters can be used for visual flourishes such as animations and particles while keeping the game in relatively large ASCII for better gameplay clarity.
Animations
The usual roguelike works in discrete timesteps, you step one block forward and suddenly the whole world snaps into a new state. This is great for fast play, but it looks unappealing. My goal with this feature was to create some sort of visual feedback through animations while not blocking the fast play of roguelikes. For this reason, you don't need to wait for the animations to end to give new input to the game, and most of them are very short.
With the stepping animations it's far easier to understand how characters move. Also, there are combat animations such as sword swings, which work to better indicate who attacked who clearly.
Particle System
A particle system is another feature present in all modern game engines.Here it's capable of greatly enhancing the visual feedback of the roguelike. The gif above shows the player drinking a healing potion, this effect combines all features discussed until now. The healing potion produces a red glow around the player when drunk, which fades away with time while emitting multiple particles made up of sub-ASCII characters that float away. Also, an animation of a green number floats up to indicate how much the player was healed for.