A simple first person shooter that may or may not have anything to do with the concept of symmetry.
The game has a similar struct to older games like Quake where the objective is usually to survive and get to end of the level while killing monsters/demons.
The purpose of this project is to serve as an exercise in creating a game from the ground up using as few libraries as possible. The game uses the following
The game uses the [GENie](https://github.com/bkaradzic/GENie) build system. The game can be build by following steps:
- ### Windows
Execute the following command in the project's root directory by opening a visual studio developer command prompt:
```
> cd build
> ..\tools\genie.exe vs2017
```
This will generate a visual studio 2017 solution in the *build/vs2017* folder which can be opened in visual studio and built and run as ususal.
- ### Linux(Ubuntu)
Execute the following in the project's root directory
```
> cd build
> ../tools/genie gmake
```
This will generate makefiles in the *build/gmake* directory. Then,
```
> cd gmake
> make all
```
- ## License
- ## License
All the code in this repository is under GPLv3, see LICENSE for more information
All the code in this repository is under GPLv3, see LICENSE for more information
@ -44,7 +78,6 @@
- ### Keybindings
- ### Keybindings
```
```
# All keys are parsed by comparing the output of SDL_GetKeyname
# All keys are parsed by comparing the output of SDL_GetKeyname
# Each line represents a keybinding
# Each line represents a keybinding
Move_Forward: W
Move_Forward: W
@ -101,8 +134,7 @@
- Fat entites with all related properties, i.e. position, mesh etc in them. Easy to serialize, memory friendly, simple to implement but would require significant changes to the current codebase, for example:
- Fat entites with all related properties, i.e. position, mesh etc in them. Easy to serialize, memory friendly, simple to implement but would require significant changes to the current codebase, for example:
```
```C
struct Entity
struct Entity
{
{
int type;
int type;
@ -129,13 +161,11 @@
}
}
}
}
};
};
```
```
- Change component implementation by using anonymous unions to simulate interfaces. e.g
- Change component implementation by using anonymous unions to simulate interfaces. e.g
```
```C
struct Component
struct Component
{
{
int type;
int type;
@ -152,274 +182,3 @@
- Use handles for assets
- Use handles for assets
- Use something similar to Variant to use as entity, not sure what or how
- Use something similar to Variant to use as entity, not sure what or how
- Don't forget to think of the actual use-case and usage when coming up with a solution, don't build castles in the air!
- Don't forget to think of the actual use-case and usage when coming up with a solution, don't build castles in the air!
- ## TODO
- String data-type that is based on array implementation
- Remove all malloc calls/free and move them into custom memory allocator/deallocator functions that only tag/track usage for now
- Rethink/remove the game executable and game library split.
- Remove all previous build system files and implement cross-compilation to windows in current build system or move to a build system that supports it as a first-class citizen
- Refactor all global application state into 'Application_Context' struct. A single global instance of which is available everywhere
- Fix mouse button press/release behaviour by investigating how sdl handles mouse release or by explicitly caching mouse state by using event callbacks recieved when a mousebutton release event is reported by sdl
- Improve bounding sphere calculation
- Change the way lights are set as uniforms to remove snprintf calls per frame for every light attribute
- Screen mouse coordinates to world-coordinates for aiming
- Player projectiles and sounds
- Console commands
- Console fix bug when enabled in editor mode
- Console command history
- Console command help
- Space partitioning and scene handling
- Move Gui_State and Editor_State into game_state and modify usage as needed
- Remove model and replace all usages with static mesh
- Get editor camera speed and other settings from config file
- Recompile Soloud on windows to use static sdl2 backend
- Figure out a way to reduce of remove snprintf calls from render code
- Re-Implement player logic
- Re-Implement saving/loading scene to/from files
- Bring back functionality and complete overhaul
- Break-up entity into base and derived entities
- Move/Modify logic as necessary
- Scene should contain fixed size lists of entites according to their types for example, separate lists of Lights, Static_Meshes,
AI entities, Particles etc
- Entity post-update logic would move to scene as well, after update scene iterates through each specific list and does whatever
is necessary
- All this would enable us to hold valid poiniters to other entites, I suspect that would result in some other changes as well
- Make materials/uniforms simpler. No need for generic materials defined in text
- Possibly embed material into model somehow to make it easier to set material uniforms like colour etc
- Create new system inside game_state to handle non-spatial sounds for music/ui etc
- Setup scene such that player and editor camera are always added to every scene
- Try to remove as much unnecessary global state as possible for example move textures/shaders/framebuffers or create a resource
system and move textures/shaders/sounds/geometry etc to that and framebuffer/shaders to renderer
- Work on (yet another)entity refactor before moving on to serialization
- Implement cross-hatching shader
- Implement storing console's scroll location and restore it when console is toggled
- Update README's TODO section to reflect the current state of things and the things that are actually left to do
- Implement collision/physics data serialization, read and write.
- Physics forces/torque etc
- Implement physics debug visualizations for other primitives and tri mesh shapes
- Replace all renderer_check_gl calls with GL_CHECK macro
- Fix lights type not being correctly saved/loaded from file
- Physics Trimesh support
- Serializing/Deserializing physics data
- Storing entity reference/id in rigidbody
- Storing rigidbody in entity
- Expose complete physics api with forces/joints etc
- Complete ODE integration
- Proper implementation of Scene struct with per-scene settings and configurations that can be loaded/saved to file instead of just dumping entities into a file
- Test physics code on linux
- Pipeline improvements, getting models/materials etc to/from other programs
- Re-order lib folder for linux by putting all libraries in one folder
- Figure out a better way for handling libs on linux, current method DOES NOT work on other computers
- Fix 30fps bug on windows
- Change compilation so that that external libraries are compiled along with the project code(like Urho3d)
- Add fallback shader
- Implement Game States
- Store Materials in new format supported by parser
- Add model description file which has the same syntax supported by parser and modify old blender exporter to conform to new standards
- Update makefiles to be able to compile the code in it's current state
- Find a solution for the asset import/export situation by either updating the blender exporter or adding assimp as dependancy
- Fix bugs with sound sources not updating
- Add creating distributable build and uploading to itch.io account support to GENie under windows and linux.
- Remove hardcoded numerical values from sscanf and other format strings.
- Finish entity loading from file then move on to 2D rendering
- First class 2d rendering
- Sprite batching (XNA like)
- Font rendering(2d/3d) with stb_ttf or freetype
? Minimal custom UI for in-game usage that can be rendered to a texture or modify nuklear for that?
- Bounding Boxes
? Recalculated bounding boxes for rotated meshes
- Wrap malloc and free calls in custom functions to track usage
- File extension checking for asset loading
- Only allocate hashmap bucket when required
- Mapping actions to keybindings, for example map action "Jump" to Space key etc
- Ability to mark meshes for debug rendering with possibility of different color for each?
- Switch to completely static allocation of entites i.e. have a static array of MAX_ENTITIES size. This way we can store pointers to entites and they'll still be in an array and fast to process.
- Add marking or queuing up custom meshes for debug render with particular transform and color for rendering bounding spheres for example
- Interleaved vbos for meshes and changes to blender exporter accordingly
- Enumerate and save all the uniform and attribute positions in shader when it is added and cache them in shader object?
- Physics/Collision detection in 2d
- Complete gui integration
- Decoupled event handling of gui and input if possible
- Custom rendering for gui
- Allow passsing base path as commandline argument?
- Remove components and switch to "Fat Entities" i.e. one entity struct contains all combinations
- Use variants for material params
- Improve Material Parameters/Pipeline Uniforms/Instance Uniforms are handled
- Fix light rotation/direction bugs
- Better handling incase assets folder is not found?
- Allow binding/unbinding input maps to functions at runtime, for example if input map "Recompute" is triggered, it would call some function that can recompute bounding spheres.
- Better handling of wav format checking at load time
- Sprite sheet animations
- Ray picking
- Shadow maps
- Print processor stats and machine capabilites RAM etc on every run to log.
- Milestone: Pong!
- In order to put things into perspective and get a feel for what really needs to be prioritized, a very small but actual game release is necessary.
- Release platforms: Windows and Linux
- Makefile additions. Try to compile game as a dynamically loaded library with ability to reload on recompile
- Separation between game and engine base
? Game .so with init, update and cleanup functions
x Configuration files and "cvars" load/reload
x Keybindings in config
x Log output on every run.
- Implement entity load/save to file
? Prefab load/save to file
- Do input maps really need to be queried by their string names?
- Reloading all the things! (textures/shaders/models/settings/entities etc)
- Separate Debug/Editor camera from the active camera in the scene that can be switched to at any time
- Make logging to file and console toggleable at complie-time or run-time
- Add default keybindings
- Write default config/keybindings etc to file if none are found in preferences dir
- Flatpak packaging for linux releases
- Use hashmap for debugvar slots in editor
- Use hashmap to store input maps
- Multisampled textures and framebuffers
- Validate necessary assets at game launch
- Gamma correctness
- Log and debug/stats output in gui
- Editor automatic window layout adjusting to the current window resolution
- Event Subsystem
- Keybindings for gui?
- Textual/Binary format for data serialization and persistance
- Better logging
- Hatching/Ink rendering style
- Array based string type comptible with cstring(char*)
- Separate game, engine and assets into different repositories. Combine as sub-repositories
? Positive and negative values for input_maps and returning corresponding values when they are true
? CANCELED Image based lighting?
? CANCELED Deferred rendering?
- ???
- Profit!
- ## Completed
* Input
* Shaders
* Geometry
* change struct usage
* change Array implementation
* resolve vec-types sizes
* Transform
* Deltatime
* Investigate about Exit() and at_exit() functions and whether to use them or not.
* Fix readme markdown
* Framebuffer and resolution independent rendering
* A simpler build system without dependencies
* Remove dependencies
* Remove Kazmath dependency
* Entity
* Find a permanent solution for build system
* Textures
* Camera
* Test render
* Fix input lag and other framerate related issues
* Materials
* Mesh/Model
* Add modifiers to input maps to enable combinations for example, c-x, m-k etc
* Heirarchical Transforms
* Materials with textures
* Lights!
* Fix problems with texture units
* Fix problems with frustrum culling
* Gui
* Fix mouse bugs on windows
* Configuration/Settings load/save handling
* Fix mousewheel bugs and gui not responding to mousewheel input
* Setup cross compilation with mingw or stick to msvc?
* Toggleable debug drawing for meshes
* Font selection
* Font atlas proper cleanup
* In second refactor pass, use entities everywhere, no need to pass in transform and model separately for example since they're both part of the same entity anyway
* Show SDL dialogbox if we cannot launch at all?
* Writing back to config file
* Reading from config file
* Variant -> String conversion procedure. Use in editor for debug var slots
* Add strings and booleans to variant types
* Fix Key release not being reported
* OpenAL not working in releasebuilds
* 3d sound using OpenAL
* Fix frustum culling bugs
* Array-based Hashmaps
* Fix bugs with heirarchical transformations
* Remove reduntant "settings" structures and move all configuration stuff to config variables
* Log output to file on every run
* Add option to specify where to read/write files from instead of being hard-coded assets dir
* Fix input map bugs
* Live data views in editor
* Camera resize on window reisze
* Resizable framebuffers and textures
* Support for multiple color attachments in framebuffers?
* Better way to store and manage textures attached to framebuffers
* Variant type
* Editor
* Fix frustum culling sometimes not working
* Compile and test on windows
* Fix mouse bugs
* Fix issues with opengl context showing 2.1 only
* Improve this readme
* Replace orgfile with simple text readme and reduce duplication
* Fix camera acting all weird when right click is held
* Fix README to conform with markdown syntax
* Added video driver selection to make game launch under wayland or x11 on linux.
* Separate game code into a dynamical library that can be reloaded at runtime.
* Move game, common and game library related code into separate folders.
* Fixed game crashing on exit after game library has been reloaded more than once.
* Made game compile and run under windows with visual studio 2017 using GENie
* Implemented file copy and file delete on windows and linux.
* Implemented a work-around for dll locking on windows by creating a copy of the game lib at launch and when reloading,
unloading the current dll, deleting it and creating new copy of the updated dll and loading that
* Added file copy and delete to platform api
* Made dll reloading workaround compatilble on linux
* Default keybindings as fallback
* Implemented writing scene to file
* Fixed space not being added after light entities are written to file by adding missing new-line
* Fixed error caused by the way eof was checked in scene file
* Camera fbo params are now written to file when entity is saved
* Fixed several bugs with entity loading
* Removed duplicate parsing logic
* Fixed bugs in stripping key name for input map
* Modify entity loading logic to use the new parsing code by parsing all entity properties into a hashmap first then recreating entity from that
* Implmented writing to file through the new Parser and Parser_Objects
* Changed Config to read/write using new Parser and Parser_Objects
* Implemented Reading/Writing keybindings using new parser object
* Replaced OpenAL with Soloud with SDL2 backend
* Implemented sound/listener loading from scene file
* Finished loading scene from file
* Initial implementation of immediate-mode batched sprite render
* Fixed bugs with shader include file pre-processor
* Fixed bugs with editor's camera property viewer
* Fixed bugs related to changing camera projection
* Fixed bugs with sprite batch renderer not working with projection matrix
* Fixed broken orthographic camera
* Implement necessary changes to run Soloud on linux
* Moved third party libs/include directories into root/lib and root/include. Put common includes like header-only libs into root/include/common and others which require platform specific stuff into root/include/linux etc.
* Got rid of pkg-confg and system-installed SDL2 dependancy on linux and instead put custom compiled SDL libs in libs folder similar to how we're handling it in windows
* Proper physics time-step and speed
* Proper handling of rigidbody associated with an entity and notifying it of movement or collision
* Added physics spheres and other primitive shapes
- Add warning to genie build script when running on windows and WindowsSdkVersion cannot be found. This happens when the script is not run from vcvarsall command prompt
? Rethink/remove the game executable and game library split.
- Refactor all global application state into 'Application_Context' struct. A single global instance of which is available everywhere
? Improve bounding sphere calculation
- Change the way lights are set as uniforms to remove snprintf calls per frame for every light attribute
- Screen mouse coordinates to world-coordinates for aiming
- Player projectiles and sounds
- Console commands
- Console command history
- Console command help
- Space partitioning and scene handling
- Move Gui_State and Editor_State into game_state and modify usage as needed
- Get editor camera speed and other settings from config file
- Recompile Soloud on windows to use static sdl2 backend
- Figure out a way to reduce of remove snprintf calls from render code
- Re-Implement saving/loading scene to/from files
- Implement storing console's scroll location and restore it when console is toggled
- Implement collision/physics data serialization, read and write.
- Physics forces/torque etc
- Implement physics debug visualizations for other primitives and tri mesh shapes
- Serializing/Deserializing physics data
- Proper implementation of Scene struct with per-scene settings and configurations that can be loaded/saved to file instead of just dumping entities into a file
- Print processor stats and machine capabilites RAM etc on every run to log.
- Do input maps really need to be queried by their string names?
- Write default config/keybindings etc to file if none are found in preferences dir
- Multisampled textures and framebuffers
- Validate necessary assets at game launch
- Gamma correctness
- Log and debug/stats output in gui
- Event Subsystem
- Textual/Binary format for data serialization and persistance
- Array based string type comptible with cstring(char*)
- ???
- Profit!
Bugs:
- Better handling of wav format checking at load time
- Fix light rotation/direction bugs
- Fix lights type not being correctly saved/loaded from file
- Console fix bug when enabled in editor mode
- Fix mouse button press/release behaviour by investigating how sdl handles mouse release or by explicitly caching mouse state by using event callbacks recieved when a mousebutton release event is reported by sdl
Done:
* Input
* Shaders
* Geometry
* change struct usage
* change Array implementation
* resolve vec-types sizes
* Transform
* Deltatime
* Investigate about Exit() and at_exit() functions and whether to use them or not.
* Fix readme markdown
* Framebuffer and resolution independent rendering
* A simpler build system without dependencies
* Remove dependencies
* Remove Kazmath dependency
* Entity
* Find a permanent solution for build system
* Textures
* Camera
* Test render
* Fix input lag and other framerate related issues
* Materials
* Mesh/Model
* Add modifiers to input maps to enable combinations for example, c-x, m-k etc
* Heirarchical Transforms
* Materials with textures
* Lights!
* Fix problems with texture units
* Fix problems with frustrum culling
* Gui
* Fix mouse bugs on windows
* Configuration/Settings load/save handling
* Fix mousewheel bugs and gui not responding to mousewheel input
* Setup cross compilation with mingw or stick to msvc?
* Toggleable debug drawing for meshes
* Font selection
* Font atlas proper cleanup
* In second refactor pass, use entities everywhere, no need to pass in transform and model separately for example since they're both part of the same entity anyway
* Show SDL dialogbox if we cannot launch at all?
* Writing back to config file
* Reading from config file
* Variant -> String conversion procedure. Use in editor for debug var slots
* Add strings and booleans to variant types
* Fix Key release not being reported
* OpenAL not working in releasebuilds
* 3d sound using OpenAL
* Fix frustum culling bugs
* Array-based Hashmaps
* Fix bugs with heirarchical transformations
* Remove reduntant "settings" structures and move all configuration stuff to config variables
* Log output to file on every run
* Add option to specify where to read/write files from instead of being hard-coded assets dir
* Fix input map bugs
* Live data views in editor
* Camera resize on window reisze
* Resizable framebuffers and textures
* Support for multiple color attachments in framebuffers?
* Better way to store and manage textures attached to framebuffers
* Variant type
* Editor
* Fix frustum culling sometimes not working
* Compile and test on windows
* Fix mouse bugs
* Fix issues with opengl context showing 2.1 only
* Improve this readme
* Replace orgfile with simple text readme and reduce duplication
* Fix camera acting all weird when right click is held
* Fix README to conform with markdown syntax
* Added video driver selection to make game launch under wayland or x11 on linux.
* Separate game code into a dynamical library that can be reloaded at runtime.
* Move game, common and game library related code into separate folders.
* Fixed game crashing on exit after game library has been reloaded more than once.
* Made game compile and run under windows with visual studio 2017 using GENie
* Implemented file copy and file delete on windows and linux.
* Implemented a work-around for dll locking on windows by creating a copy of the game lib at launch and when reloading,
unloading the current dll, deleting it and creating new copy of the updated dll and loading that
* Added file copy and delete to platform api
* Made dll reloading workaround compatilble on linux
* Default keybindings as fallback
* Implemented writing scene to file
* Fixed space not being added after light entities are written to file by adding missing new-line
* Fixed error caused by the way eof was checked in scene file
* Camera fbo params are now written to file when entity is saved
* Fixed several bugs with entity loading
* Removed duplicate parsing logic
* Fixed bugs in stripping key name for input map
* Modify entity loading logic to use the new parsing code by parsing all entity properties into a hashmap first then recreating entity from that
* Implmented writing to file through the new Parser and Parser_Objects
* Changed Config to read/write using new Parser and Parser_Objects
* Implemented Reading/Writing keybindings using new parser object
* Replaced OpenAL with Soloud with SDL2 backend
* Implemented sound/listener loading from scene file
* Finished loading scene from file
* Initial implementation of immediate-mode batched sprite render
* Fixed bugs with shader include file pre-processor
* Fixed bugs with editor's camera property viewer
* Fixed bugs related to changing camera projection
* Fixed bugs with sprite batch renderer not working with projection matrix
* Fixed broken orthographic camera
* Implement necessary changes to run Soloud on linux
* Moved third party libs/include directories into root/lib and root/include. Put common includes like header-only libs into root/include/common and others which require platform specific stuff into root/include/linux etc.
* Got rid of pkg-confg and system-installed SDL2 dependancy on linux and instead put custom compiled SDL libs in libs folder similar to how we're handling it in windows
* Proper physics time-step and speed
* Proper handling of rigidbody associated with an entity and notifying it of movement or collision
* Added physics spheres and other primitive shapes