A lightweight and powerful 2D game engine developed in C++ and features an expansive LUA script engine. Built from the ground up: Delusion boasts cross-platform support; with a major focus on flexibility and security; while maintaining functionality.
Game Development
Note: Delusion is one of my favorite projects, and likely most ambitious solo project. The development of this game engine is always on-going and the amount of features has become too great to count. However, most of the key features have been listed below.
The Delusion engine was built with portability in mind. All aspects of the game engine have been developed to be completely functional on Windows, Linux, and Mac OS. In addition, the foundation has been laid out so that the engine can be ported over to an even larger amount of platforms such as, but not limited to, Nintendo Switch, iOS and Android in the future.
The Delusion engine core was developed entirely in C++, one of the fastest programming languages, as code gets compiled directly into machine code without a runtime translation required. As the engine has been built from scratch, the design and implementation of all features have been done with optimization and performance in mind. Delusion proudly boasts a wide range of utility and functionality, while being able to perform well on nearly any low-specification device.
All games need to ship with their respective asset files, this can include images, videos, sound effects, music, scripts, models, and more. Delusion takes integrity and portability seriously when it comes to assets. All game assets are encrypted and packaged within files that can use any custom file extension of choice. The encryption prevents the alteration of game files and helps protect against the theft of game assets. The engine is able read these encrypted packages and load the correct file data into memory for use the game.
Entity Component System (ECS) is a architectural pattern where game objects are represented as entities that consist of varying components that store data. Systems are then created to operate on the components of entities. ECS architecture is prevalent in the majority of high profile game engines such as Unreal Engine and Unity. Some of the key highlights of the architecture is the high speed and impressive performance it provides, alongside the ability to infinitely scale the game engine to support new functionality.
Due to the intricate nature of how video games are built, they are very taxing to the hardware they are run on. Although, object-oriented design makes life easier for the developer, it is not as efficient for the machine. The foundation and ECS architecture of the engine is built using data-oriented design. This ensures Delusion can run on computer hardware as efficient as possible, allowing the processor to access data from the memory more effectively.
Delusion employs an asset manager to handle all assets for the game. The asset manager loads the data of images, fonts, and audio files from the encrypted asset packages into memory. These assets are then accessible within the engine by their unique identifier.
Certain actions within the game engine are able to trigger events and pass data alongside these events. Another stage of the game loop is then able to catch these events and use their data to handle them accordingly.
Delusion contains a robust script engine that integrates the LUA scripting language. LUA is a very performance efficient language that can be embed into a C++ foundation. The script engine acts as the medium to allow developers to easily create games and content in Delusion. LUA scripts can be used to define game assets, as well as design stages (game levels/maps), create items, enemies, events, and so much more.
The game engine provides performance friendly cross-platform rendering with the ability to effectively render colour, transparency, shapes, images, and fonts. The render system allows for the layering of elements in any specified order, and the ability to alter the opacity or toggle visibility of an element at any given time.
A sprite sheet, otherwise known as texture atlas, is an image containing a series smaller images. Each smaller image is a sprite that can identified by an X and Y coordinate. Delusion loads sprite sheets into memory and divides them into segments each representing a certain state or animation frame of an image. Sprite sheets greatly improve performance as it is faster to fetch one larger image and load different parts of it, than it is to load and switch to a variety of smaller images.
The animation system allows for the ability to define a section of a sprite sheet as an animation sequence, where each sprite is a frame of the animation. The system can then alter the speed, pause or loop the animation.
One of the important features of any game engine, is the ability to design and build stages (game levels). The environment of a stage consists of a series of tiles with varying attributes. Similar to a sprite sheet, a tile set is a large image consisting of many smaller image, where each image is a different tile of the environment. Each tile can be identified by an X and Y coordinate, as well as an attribute that defines whether or not entities and projectiles can pass over the tile. A collection of tile identification data is then combined into a .map file which can be loaded for each stage.
Through the use of the script engine, developers can also create and place entities, such as enemies, items, non-playable characters (NPCs), and portals, at any point on the map. In addition, the script engine allows for the implementation of events and interactions specific to the stage and the ability to have multiple versions of a tile set for the support of a day/night cycle.
The movement system allows for all entities to have a velocity and/or acceleration to move around within the game environment. This can be used for player, enemy or object movements, as well as the translation effects.
An integral part of the game engine is the camera system. Part of the view manager, the camera defines itself based on the resolution of the view port. The camera has the ability to lock on and follow a specified entity as it moves around the game environment. In addition to acting as the eyes of the user, the camera plays an important part in improving performance. As it prevents the rendering of all entities and assets that are outside the current viewport, it greatly reduces the amount of work the processor and graphics unit have to do.
Delusion provides the ability to assign any entity a bounding box, defining the physical space of an entity that can be collided with. The bounding box of an entity can be larger or smaller than the visual appearance. The collision system can be used to detect if the cursor is hovering over a certain element, if entities have walked into one another or a boundary, if a a projectile collided with an entity, and many other possible scenarios.
In most video games, artificial intelligence (AI) plays a vital role. Delusion features the ability to apply artificial intelligence to specified entities. This includes the capacity for entities to perform certain actions in certain scenarios, to act randomly within a range of possible behaviours, and most importantly path find. Path finding is one of the most important aspects of video game AI, as it allows for entities to move around the game environment to a specified location in the shortest amount of walkable distance. The Delusion engine boasts a performance friendly A* path finding algorithm to accurately allow entities to move across a stage using an organized network of nodes.
For some video games, an important aspect of gameplay is combat. Delusion provides the tools to build a combat system to fit the goal of the game. These tools integrate the use of the game engine’s artificial intelligence, attribute system, collision system, and more. A few features are the ability for entity aggression towards one another, entity combat stats that alter the effects of combat, varying damaging attacks and projectiles, as well as temporary buffs and de-buffs just to name a few.
Projectiles can be created to travel with a specified velocity and/or acceleration as well as trigger specified events upon impact. Entities also have the ability to create projectiles themselves, through the use of scripted events or artificial intelligence.
The interaction system allows for the player to interact with various elements in the game environment. This includes the ability to pick up items, prompt dialogues with non-playable character, and perform certain actions with any entity within the stage. The ability for the player to interact with their surroundings is important in making the game world feel alive.
Attributes are sets of data that can be assigned to entities in order to tie into other game features. A few examples of attributes could be entity health, movement speed, or combat stats.
Minor indicators when certain actions take place can play an important role in user experience (UX). Environment indicators can range from health bars of entities, damage number pop ups, message pop ups upon certain interactions, and other similar minor visual elements.
Delusion boasts a flexible dialogue system which can be used to implement effective story telling, decision making, and add depth to any game that is being developed. The dialogue system can create a dialogue window featuring text as well as an optional name, description and portrait to represent who the dialogue is taking place with. Different types of dialogues include the option to end the dialogue by pressing “Ok”, progress the dialogue by pressing “Next”, respond to a dialogue by pressing “Yes” or “No”, or selecting an option from a provided list. The script engine allows for the ability to create thorough dialogue branches based on certain scenarios and various conditional checks.
Ticks represent the amount of time that has passed since the application started running. However, Delusion differentiates between the amount of overall ticks, and game ticks that relate specifically to the amount of game time that has passed. Game time does not include the time while the game is paused or when the user is browsing through menu interfaces. This allows for the accurate management or cool-downs and other time related activities.
The Delusion engine supports the ability to catch and handle various user input. Different keys/inputs can be assigned to specified controls, the user control system keeps track of inputs, and correctly executes controls in their respective order. An important feature of the control system is to keep track of interrupted actions to resume the original action once the interruption has completed. This allows for a smooth and enjoyable gameplay experience.
In addition to handling keyboard and mouse input, Delusion provides full support for all wired and wireless standard game controllers. This lets users choose to either play the game using the standard keyboard and mouse setup, or from the comfort of their couch using their favourite controller.
Aside from user controls and navigation, Delusion allows for the creation of text input elements where the user can provide the engine with a string of characters. Text inputs can either be displayed as standard text, or hidden for use cases such as password fields on login screens.
The game engine provides the capability of creating intricate user interfaces and menus in order to display data, and have the user interact with various elements. The interface system can be used to create pause menus, in-game shops, login screens, and any other interface imaginable.
While the interface system handles interactive menus, the heads up display (HUD) system handles interfaces overlaid over the game itself. In many games, the HUD fulfils an important role of providing the user with necessary information as they play.
The effect system relies on many other features of Delusion in order to create transitional effects. A few examples of these effects can be to fade in and out certain elements, to translate elements around the view port, or to scale up and down elements all at a variable speed.
Delusion handles the input provided by a user’s mouse or controller joystick to provide an integrated cursor for the game environment. The game engine is able to trigger certain events when an action such as a cursor hovering over or clicking an element occurs. This allows for interface elements to have hover states and click events.
In order to ensure infinite scalability of game development, Delusion employs an intricate object identity system. Working in tangent with the script engine, Delusion allows for the definition of entities and their components within scripts that are loaded within the engine. Scripts can be used to define entities such as player characters, enemies, attacks, projectiles, obstacles and more. These predefinitions let’s developers simply call upon these entities by their respective identification number. Aside from entity definitions, Delusion provides a stage entity ID to keep track of all entities on the current game level. This can be used to synchronize enemy re-spawns and provide information to a game server when necessary.
Delusion provides the user with various options they can alter that impact their local gameplay experience. This includes, but is not limited to, the ability to change the game resolution, enable VSync, display and limit frames per second (FPS), change controls, and adjust game volumes.
Another useful feature of the game engine, is the scheduled executor functionality. The scheduled executor provides the capability of executing a given function after a set amount of either system time or game time. These scheduler executions can also be layered in one another to create unique and flexible interactions.
An important tool for any development project, is the ability to debug your software. Delusion provides a variety of debug utilities in order make game development easier to deal with. One key feature of this system is the in-game debug overlay, which displays all collision bounding boxes alongside menus in order to observe and manipulate specific data.
Delusion features an extensive log system that can be used both during development and within a deployed product. The log system can output detected warnings and errors to organized text file in order to keep track of possible issues during development. In a deployed product, if the game were to unexpectedly crash, the log system can output the critical error to a text file in order for the user to accurately report the issue to developers.
Online connectivity plays a major role in games today, as seen in multiplayer games and games as a service. The Delusion engine provides online functionality through integration of the custom Delusion Client/Server system. This allows for the creation and utility of online game accounts as well as multiplayer features.
As previously stated, Delusion takes security seriously. Delusion employs the use of the custom Gladiator Security solution to implement a safe and performance friendly anti-cheat to any game. This system integrates with the Delusion Client/Server system in order to help prevent cheating and provide further analytics to continuously improve security.
Developer Portfolio
By Mazen M.