o
odin.langpkg.dev
packages / library / ge

ge

12ad0dalibrary

No description provided.

No license · updated 11 months ago

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.

Directory Structure:


 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?

How to build:

  1. Install Odin: https://odin-lang.org/docs/install (I recommend building from source)
  2. Install odin-sokol: and compile it
  3. In the Odin/shared directory create a symlink to the odin-sokol directory
  4. 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.

Asset Pipeline workflow (Aseprite):

  1. Copy the assets/aseprite_asset_export.lua to the Aseprite scripts directory
  2. Create your Aseprite file and save it into the assets/ directory.
  3. 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.
  4. recompile the game to generate the res/ directory with the compiled assets.
  5. 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