# Gears Engine

A game engine started in a pursuit of improving at programming and learning more about the things I've always been curious about. The name is inspired by the paper written on the Final Fantasy 7 engine named "Gears" as it was one of the earliest things that made me curious about programming and technology.

This game engine is built with minimal libraries including no usage of libc except for within the file packer, which I will remove eventually.

It was mostly built in c99 with later changing to c23 for some features (embed directive, typed enums) but I will soon remove usage of these features and move it back to c17 for MSVC compatibility, choosing c17 for static assert functionality but otherwise the style being mostly in line with c99.

## Building

On Linux it can be built using the below command, it requires GCC > 15.0 or a relatively recent version of Clang, the Vulkan SDK, xcb and x11 libraries.

```
// Release build
./build.sh release

// Debug build
./build.sh 
```

On Windows you can build it with the Powershell script, it will require that you enable the script to be run (build.bat will be fixed eventually to work around this). It requires the Vulkan SDK to be installed and currently needs to have the directory to the SDK includes folder in the build.ps1 script.

```
// Release build
.\build.ps1 release

// Debug build
.\build.ps1
```

## Inspiration/Resources

I learned this style of programming primarily through Casey Muratori's series [Handmade Hero](https://guide.handmadehero.org/), I mostly picked up on the style from the earlier episodes and watched a couple of others at different points in the series as a way to learn about certain things or get ideas, though I think I have strayed somewhat from his style though the heart of it is inspired by the same core ideas.

## Current technical features

- No usage of libc outside of things like stdint.h, etc.
- Multiplatform (though the Windows side has fallen behind but will catch up soon)
- Vulkan renderer implementation, abstracted out in a way where it could be replaced with a different backend renderer
- Asynchronous Vulkan asset loading using pthreads and atomic operations using the c++11 memory model as defined [here](https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html)
- Very basic setup for an Immediate Mode GUI that so far only includes dragging boxes around and clicking buttons, functionality will be expanded on.
- Window creation
- Input handling
- Things like asynchronous features and memory allocation used through platform APIs (e.g. mmap/VirtualAlloc)
- Memory allocators including a Free List allocator and Arena allocator, with memory allocated primarily through arenas to avoid the pitfalls and downsides of the malloc/free style
- Math utility functions
- Asset packer to pack assets into a singular file which will be used to avoid constant accesses to the OS file reading functions
- And more (will be expanded on)
