Sigma 3D Engine

Back to the homepage

What is the Sigma Engine?

This is my newest project, my game engine which I call "Sigma Engine". Sigma engine is a 3D game engine written in C. Right now, I am creating a first person shooter with this game engine. Sigma engine can render true 3D enviroments, however the entities in the game world are rendered in "2.5D". Sigma engine has path-finding AI that can generate a path to the player, allowing enemies to chase the player around the level without getting lost. Sigma Engine also has basic physics. Because light-maps would take a long time to implement, I decided to add them into a future game engine because the project was abmitious enough. Currently I have been working on Sigma Engine since November 2015. I expect to finish my game by the end of the year.

Video of Sigma Engine 0.6.1:

Downloads

You can download the diffrent releases of the game here, to see its progression. However, a lot of the early versions are very buggy and unstable, although they are the most interesting.

How does the Sigma engine work?

Level Editor

Sigma Engine has its own level editor software, which is used to make 3D levels for the game. Currently the level editor can only be used to create and manipulate blocks, such as transformations and translations. However it is unable to create 3D things with sloped edges. This is because it took me three months to create the software and I cannot be bothered to spend more time working on major features or else I would never finish anything. So sloped surfaces could not be implemented. The level editor can be used to add textures and entities into the game world as well, so it is very useful, even though it crashes a LOT and it is easy to create illegal geometry with it. It would be a whole other page explaining how my level editor works, so I will not go into details. Here is a youtube video timelapse of me making a level with the editor:

Rendering engine

Sigma engine sorts the polygons in the game world using a BSP Tree. The BSP tree is also used for collision detection and line-of-sight tests. Then, entities (such as enemies and props) are rendered using a Z-Buffer. Any kinds of special Debug information is rendered this way as well. The game engine uses openGL for rendering the actual polygons. The HUD is then drawn on top of everything. Enemies are stored as sprite sheets, and then get cropped based on how the player is looking at them, and what frame in the animation they are currently on.

Enemy AI

The enemies use basic AI states, such as attack the player, walk towards the player, etc. However Sigma Engine is capable of path-finding when the player is no longer visible. Sigma engine uses a graph as a refrence for the 3D world that the enemies can use. First nodes are plotted out in the level editor, and then are sight-tested against the BSP tree, so that only valid routes are left. The enemies then use Dijkstra's algorithm to find the player when they cannot see where the player is.

A Screenshot with some debug information turned on... This is showing the Enemy AI's path-finding graph. Notice how there are valid paths over the bridge- but NOT over the empty gap, even though the two nodes there can see each other.

Enemy AI

Loading game assets

Textures in the game are encoded in the webp codec, and audio files are encoded with the opus codec. I use the libwebp and libopusfile libraries to load them into the game. I am using these formats because they have very good Compression- although I heard that the flif codec might be better than the webp codec. The map files are formatted text files that hold the BSP tree, the AI graph, the entity linked list - and at the start of each one there is a list of the textures that will be used for the map, and an ID number wich will be given to polygons that use the texture.

An example of this texture system in the map files ( .s3bsp )

tex cache

Useful resources for developing rendering engines

There are other parts of this game engine that I have left out because they are the kind of thing that someone could probably just figure out on their own. The BSP rendering is really the most complicated part of the engine and to make it I mostly followed this tutorial. which has errors in it, by the way! However these tutorials are currently the BEST tutorials that I could find on such a complicated topic that does not get explained enough. You should also look at the part 2 of his tutorial. I have not implemented anything from part 2 of the tutorial. It is what I will be using to help me write the rendering engine for my next game engine. Its some very useful stuff, and I probably would not have gotten as far as I have without it. If you read and UNDERSTAND the material you should be able to fix the errors in the code examples.