Gears-C/README.md
2025-05-19 20:22:48 +10:00

63 lines
4.1 KiB
Markdown

# 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.
## Current Status
(Updated 2025-05-19, will be updated when milestones are hit)
The engine currently has some basic code for handling GUI interactions but not much else in terms of interactive functionality, most current work is architectural.
Windows is a bit behind but has caught up a bit, it currently doesn't do inputs but should otherwise functions the same as linux.
The next stage will be gameplay/shader code with most of the Vulkan work required for a basic renderer being implemented.
## 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, was having some issues around it and didn't have the time for figuring it out or dealing with Microsoft documentation). 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.
I also got some inspiration from Travis Vroman's series on his [Kohi Game Engine](https://www.youtube.com/travisvroman), while I didn't really follow his ideas exactly he helped me understand how to architect a game engine in a more modular way so you're able to support multiple platforms and renderer backends.
Very appreciative of the educational material both these people have put out, many others have had an influence too such as Jonathan Blow and Ryan J Fleury.
## Current technical features
- No usage of libc outside of things like stdint.h, etc (for the main game engine not including some linux system libraries (e.g. xcb), asset packer uses some libc but will be fixed in the future).
- 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)