ge: game engine The goal is to have a simple place to start from for building games from scratch without using a pre-existing game engine.
This is my attempt to create a simple 2D "game engine" in Odin from first principles. It strives to be simple and extensible. This is a heavy work in progress. Alot of the ideas here are taken from people smarter than me, especially Casey Muratori's Handmade Hero series.
The following is a brief overview of the engine and its functionality by pkg or file. I wont describe every file in every pkg, just the ones that are most likely to be edited during game development.
assets/ - Intermediate game assets that are not included in the final binary
build/ - Compiled binaries
game/ - Game source code
build/ - Build scripts to compile the game
src/ - Game engine source code
draw/ - Rendering system implementation based on odin-sokol
sprite/ - Sprite helpers and state information management
shader.glsl - "User" shader code used for rendering sprites
input/ - Input handling system implementation based on odin-sokol event callbacks
flat-array/ - Dynamically resizing arrays stored on the stack
sound/ - Sound system implementation based on odin-fmod
steamworks/ - Steamworks integration implementation
utils/ - Utility functions and types used across the game engine
color/ - Color utilities and predefined colors
hash_storage/ - Hash storage data structure implementation
logger/ - Logging utilities
shape/ - Basic shape definitions and collison detection utilities
main.odin - Main entry point for the game, sets up the window and game loop
helpers.odin - Helper functions and type aliases typically declared in other pkgs are declared here
entity.odin - Entity system implementation
game.odin - Game logic implementation
res/ - Compiled game assets that are included in the final binary
fmod/ - fmod library files
fonts/ - Font files
images/sprites - Sprite sheets
Things that wont be done in this engine: (this list will be updated as I go)
- Determine how to handle networked games:
- This is a big topic and it is highly game specific, so I dont think it makes sense to implement a generic solution.
Things that will be done in this engine: (this list will be updated as I go)
- Decide on an immediate mode ui rendering library (i.e dear ImGUI, clay, microUI, Nuklear, etc) raw rectangles?
- Install Odin: https://odin-lang.org/docs/install (I recommend building from source)
- Install odin-sokol: and compile it
- In the Odin/shared directory create a symlink to the odin-sokol directory
- run ./build_mac.sh for mac or ./build.bat for windows (currently only debug builds are supported) Note: if you are building on windows, you will need to install the Visual Studio C++ build tools.
- Copy the assets/aseprite_asset_export.lua to the Aseprite scripts directory
- Create your Aseprite file and save it into the assets/ directory.
- Open the aseprite file and create a sprite sheet, then export it by running the script from the Aseprite menu You can also use the shortcut Ctrl+Shift+E or bind it to a different key.
- recompile the game to generate the res/ directory with the compiled assets.
- run the game to see the results.
credits: the skeleton of this engine is based on the work of this chad randy: https://github.com/baldgg/blueprint/tree/master ty sir