Updated readme

dev
Shariq Shah 7 years ago
parent 370b58e978
commit 7339ad6834
  1. 312
      README.md

@ -1,184 +1,132 @@
# Project Symmetry # Project Symmetry
- ## About ## About
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. A simple first person shooter that may or may not have anything to do with the concept of symmetry.
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 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.
libraries: 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
libraries:
| Library | Usage |
| ---------------------------------------------| --------------------------------------- | | Library | Usage |
| [SDL2](https://www.libsdl.org/) | Windowing, Input, Platform abstraction | | ---------------------------------------------| --------------------------------------- |
| [Soloud](http://sol.gfxile.net/soloud/) | 3d positional audio | | [SDL2](https://www.libsdl.org/) | Windowing, Input, Platform abstraction |
| [ODE](http://ode.org/) | Physics | | [Soloud](http://sol.gfxile.net/soloud/) | 3d positional audio |
| [Nuklear](https://github.com/vurtun/nuklear) | In-game and editor UI | | [ODE](http://ode.org/) | Physics |
| [GLAD](https://github.com/dav1dde/glad-web) | OpenGL Extension Loading | | [Nuklear](https://github.com/vurtun/nuklear) | In-game and editor UI |
| [GLAD](https://github.com/dav1dde/glad-web) | OpenGL Extension Loading |
- ## Building ## Building
The game uses the [GENie](https://github.com/bkaradzic/GENie) build system. The game can be build by following steps:
- ### Windows The game uses the [GENie](https://github.com/bkaradzic/GENie) build system. The game can be build by llowing steps:
Execute the following command in the project's root directory by opening a visual studio developer command prompt:
``` -**Windows**: Execute the following command in the project's root directory by opening a visual studio veloper command prompt:
> cd build
> ..\tools\genie.exe vs2017 ```shell
``` cd build
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. ..\tools\genie.exe vs2017
- ### Linux(Ubuntu) ```
Execute the following in the project's root directory
``` This will generate a visual studio 2017 solution in the *build/vs2017* folder which can be opened in sual studio and built and run as ususal.
> cd build
> ../tools/genie gmake -**Linux(Ubuntu)**: Execute the following in the project's root directory
```
This will generate makefiles in the *build/gmake* directory. Then, ```bash
``` cd build
> cd gmake ../tools/genie gmake
> make all ```
```
This will generate makefiles in the *build/gmake* directory. Then,
- ## License ```bash
All the code in this repository is under GPLv3, see LICENSE for more information cd gmake
make all
- ## File format specifications ```
- ### Entity ## License
``` All the code in this repository is under GPLv3, see LICENSE for more information
# Comment, Sample entity definition in file, paremeters left out are set to defaults
# Empty line at the end specifies end of entity definition ## File format specifications
entity: "Something"
position: 0 0 0 - ### Entity
scale: 1 1 1
rotation: 0 0 0 1 ```bash
model: "suzanne.pamesh" # Comment, Sample entity definition in file, paremeters left out are set to defaults
material: "blinn_phong" # Empty line at the end specifies end of entity definition
diffuse_color: 1 0 0 1 entity: "Something"
diffuse_texture: "checkered.tga" position: 0 0 0
specular: 0.55 scale: 1 1 1
``` rotation: 0 0 0 1
model: "suzanne.pamesh"
- Add to_string functions for major structs like transform, model etc to ease in conversion? material: "blinn_phong"
- ### Configuration Variables a.k.a cfg-vars diffuse_color: 1 0 0 1
diffuse_texture: "checkered.tga"
``` specular: 0.55
# Comment ```
render_width: 1024
render_height: 1024 - ### Configuration Variables a.k.a cfg-vars
debug_draw_enabled: true
fog_color: 0.5 0.2 0.2 1 ```bash
# There can be comments or empty newlines in between unlike entity definitions # Comment
render_width: 1024
ambient_light: 0.1 0.1 0.1 1 render_height: 1024
msaa: true debug_draw_enabled: true
msaa_levels: 8 fog_color: 0.5 0.2 0.2 1
# There can be comments or empty newlines in between unlike entity definitions
``` ambient_light: 0.1 0.1 0.1 1
msaa: true
- ### Keybindings msaa_levels: 8
```
```
# All keys are parsed by comparing the output of SDL_GetKeyname - ### Keybindings
# Each line represents a keybinding
Move_Forward: W ```bash
# All keys are parsed by comparing the output of SDL_GetKeyname
# Multiple keys to a single binding are specified with commas # Each line represents a keybinding
Move_Backward: S,Down Move_Forward: W
# Multiple keys to a single binding are specified with commas
# Combinations are specified with a hyphen/dash Move_Backward: S,Down
# When specifing combinations, modifiers(shift, alt, ctrl) always come before # Combinations are specified with a hyphen/dash
# the hyphen and the actual key comes afterwards. At the moment modifier keys are # When specifing combinations, modifiers(shift, alt, ctrl) always come before
# forced to be on the left side i.e. Left Control, Left Shift and Left Alt. # the hyphen and the actual key comes afterwards. At the moment modifier keys are
Quit: Left Ctrl-Q # forced to be on the left side i.e. Left Control, Left Shift and Left Alt.
Quit: Left Ctrl-Q
# Single modifier keys are allowed but multiple modifier keys without corresponding # Single modifier keys are allowed but multiple modifier keys without corresponding
# non-modifier key are not allowed # non-modifier key are not allowed
Sprint: Left Shift Sprint: Left Shift
```
```
- ### Level/Scene
- ### Level/Scene
- Binary format with header attached at the top
- Binary format with header attached at the top - Save child entities first
- Save child entities first - Copy paste all entites in the file one by one. Since the entites all look
- Copy paste all entites in the file one by one. Since the entites all look the same in memory and are made up of tagged unions, a simple memcpy approach
the same in memory and are made up of tagged unions, a simple memcpy approach should suffice. The problem is entity heirarchies. There are multiple approaches to
should suffice. The problem is entity heirarchies. There are multiple approaches to solve this problem.
solve this problem. - Save a sorted list of entites to file i.e. before saving create a new list that does
- Save a sorted list of entites to file i.e. before saving create a new list that does not have the empty array slots in the entity list and then just copy and paste. This
not have the empty array slots in the entity list and then just copy and paste. This is the simplest way to solve the problem as we don't have to worry about indexes of
is the simplest way to solve the problem as we don't have to worry about indexes of parent/child entites in heirarchy. We can take the whole array and paste it to the
parent/child entites in heirarchy. We can take the whole array and paste it to the file but creating a copy of entity list for this purpose only would be slow and consume a lot of memory.
file but creating a copy of entity list for this purpose only would be slow and consume a lot of memory. - Instead of creating a copy of the entity list for sorting and saving, sort the actual entity list
- Instead of creating a copy of the entity list for sorting and saving, sort the actual entity list and update all references as necessary then save the array to file.
and update all references as necessary then save the array to file. - Just write the name of the parent entity as parent. Make sure that all entity names are unique.
- Just write the name of the parent entity as parent. Make sure that all entity names are unique. - Use separate EntityDefinition file that serves as a blueprint/prefab for the entity
- Use separate EntityDefinition file that serves as a blueprint/prefab for the entity to load/save. When the entity is saved in a scene file, the scene file only needs to
to load/save. When the entity is saved in a scene file, the scene file only needs to refer to the entity's EntityDefinition file/asset along with it's parent and children
refer to the entity's EntityDefinition file/asset along with it's parent and children - This approach requires seperating a scene into mutable/immutable parts.
- This approach requires seperating a scene into mutable/immutable parts. Meaning, entities that can change their state during the duaration of the level are
Meaning, entities that can change their state during the duaration of the level are mutable and those that remain the same as they were defined in their EntityDefinition
mutable and those that remain the same as they were defined in their EntityDefinition file are immutable.
file are immutable. - In each level there going to be mutable entites i.e player and player's position/orientation, objectives
- In each level there going to be mutable entites i.e player and player's position/orientation, objectives cleared/remaining, doors opened and puzzles solved etc. Instead of handling all of these in the
cleared/remaining, doors opened and puzzles solved etc. Instead of handling all of these in the scene file, we save all the mutable state in the savegame files. When restoring game's state from a save name we will need
scene file, we save all the mutable state in the savegame files. When restoring game's state from a save game we will need to handle loading of a scene and then applying the mutable state to entites after loading.
to handle loading of a scene and then applying the mutable state to entites after loading. - Entities can have (a fixed number of?) properties. Each property has a name and a corresponding
- Entities can have (a fixed number of?) properties. Each property has a name and a corresponding variant value like, health or ammo etc. But, how to save/load all of that?
variant value like, health or ammo etc. But, how to save/load all of that?
- ### Materials
- ### Materials *TODO*
- ### Mesh/Geometry - ### Mesh/Geometry
*TODO*
- ### Notes on entity Systems
- 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
{
int type;
char* name;
struct Transform {....};
struct Camera {....};
// Separate properties unique to entity types by using unions
struct Renderable
{
struct Model {....};
union
{
struct Player
{
int score;
int bullets;
};
struct Enemy
{
int target;
};
}
}
};
```
- Change component implementation by using anonymous unions to simulate interfaces. e.g
```C
struct Component
{
int type;
union
{
struct Transform {....};
struct Model {....};
struct Camera {....};
}
}
```
- Use handles for assets
- 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!

Loading…
Cancel
Save