Mercurial > games > semicongine
annotate README.md @ 194:93f661a20f74
did: a bit of cleanup with the config, also add some documentation
author | Sam <sam@basx.dev> |
---|---|
date | Sun, 07 May 2023 00:23:46 +0700 |
parents | b14e078690dc |
children | e4ba91da416b |
rev | line source |
---|---|
41 | 1 Semicongine |
2 =========== | |
3 | |
8 | 4 Hi there |
5 | |
41 | 6 This is a very simplistic little game engine, mainly trying to wrap around vulkan and the operating system's windowing, input and audio system. |
95
8011e4d6372d
add: consistent way to define platform-specific code
Sam <sam@basx.dev>
parents:
73
diff
changeset
|
7 I am using the last programming language you will ever need, [Nim](https://nim-lang.org/) |
41 | 8 |
48 | 9 Building |
10 -------- | |
11 | |
95
8011e4d6372d
add: consistent way to define platform-specific code
Sam <sam@basx.dev>
parents:
73
diff
changeset
|
12 Requires Nim to be installed and ```glslangValidator``` to be downloaded to the |
8011e4d6372d
add: consistent way to define platform-specific code
Sam <sam@basx.dev>
parents:
73
diff
changeset
|
13 directory of the main compilation file (e.g. into ```examples/``` in order to |
8011e4d6372d
add: consistent way to define platform-specific code
Sam <sam@basx.dev>
parents:
73
diff
changeset
|
14 compile the examples). It can be downloaded at |
8011e4d6372d
add: consistent way to define platform-specific code
Sam <sam@basx.dev>
parents:
73
diff
changeset
|
15 https://github.com/KhronosGroup/glslang/releases/. |
45 | 16 |
95
8011e4d6372d
add: consistent way to define platform-specific code
Sam <sam@basx.dev>
parents:
73
diff
changeset
|
17 Run ```nim help``` to see a list of available build commands. |
48 | 18 |
41 | 19 Roadmap |
20 ------- | |
21 | |
194
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
22 Here a bit to see what has been planed and what is done already. Is being |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
23 updated frequently (marking those checkboxes just feels to good to stop working). |
41 | 24 |
25 Rendering: | |
26 | |
27 - [x] Vertex attributes, vertex data | |
28 - [x] Shaders (allow for predefined and custom shaders) | |
29 - [x] Uniforms | |
30 - [x] Per-instance vertex attributes (required to be able to draw scene graph) | |
119 | 31 - [x] Fixed framerate |
130 | 32 - [x] Instanced drawing (currently can use instance attributes, but we only support a single instance per draw call) |
194
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
33 - [x] Textures |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
34 - [ ] Multisampling |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
35 - [ ] Allow different shaders (ie pipelines) for different meshes |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
36 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
37 Required for 3D rendering: |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
38 |
41 | 39 - [ ] Depth buffering |
40 - [ ] Mipmaps | |
41 | |
42 Asset handling: | |
170 | 43 - [ ] Resource concept: load from directory, zip or in-memory-zip, select "mod" as root |
41 | 44 - [ ] Mesh files (Wavefront OBJ, MTL) (use something from sketchfab for testing, https://sketchfab.com/) |
45 - [ ] Image files (BMP RGB + BMP Graysscale for transparency) | |
95
8011e4d6372d
add: consistent way to define platform-specific code
Sam <sam@basx.dev>
parents:
73
diff
changeset
|
46 - [ ] Audio files (AU) |
41 | 47 |
119 | 48 Other (required for alpha release): |
49 - [x] Config files ala \*.ini files (use std/parsecfg) | |
41 | 50 - [x] Mouse/Keyboard input handling |
51 - [x] X11 | |
52 - [x] Win32 | |
170 | 53 - [x] Enable/disable hardware cursor |
187 | 54 - [x] Fullscreen mode + switch between modes |
55 - [x] Linux | |
56 - [x] Window | |
182 | 57 - [x] Audio playing |
187 | 58 - [x] Linux |
59 - [x] Windows Waveform API | |
60 - [ ] Generic configuration concept (engine defaults, per-user, etc) | |
41 | 61 - [ ] Input-mapping configuration |
101 | 62 - [ ] Telemetry |
194
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
63 - [x] Add simple event logging service |
187 | 64 - [ ] Add exception reporting |
65 - [ ] Documentation? | |
41 | 66 |
119 | 67 Advanced features (very low priority): |
41 | 68 - [ ] Text rendering |
69 - [ ] Animation system | |
70 - [ ] Sprite system | |
71 - [ ] Particle system | |
182 | 72 - [ ] Query and display rendering information from Vulkan? |
73 - [ ] Game controller input handling? | |
74 - [ ] Allow multipel Uniform blocks? | |
119 | 75 |
76 Quality improvments: | |
77 | |
78 - [x] Better scenegraph API | |
79 - [x] Better rendering pipeline API | |
80 | |
81 Build-system: | |
82 - [x] move all of Makefile to config.nims | |
194
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
83 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
84 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
85 Documentation |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
86 ============= |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
87 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
88 Okay, here is first quick-n-dirty documentation, the only purpose to organize my thoughts a bit. |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
89 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
90 Engine parts |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
91 ------------ |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
92 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
93 Currently we have at least the following: |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
94 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
95 - Rendering: rendering.nim vulkan/* |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
96 - Scene graph: entity.nim |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
97 - Audio: audio.nim audiotypes.nim |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
98 - Input: events.nim |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
99 - Settings: settings.nim |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
100 - Meshes: mesh.nim |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
101 - Math: math/* |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
102 - Telemetry: telemetry.nim (wip) |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
103 - Resources/mods: resources.nim (wip) |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
104 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
105 Got you: Everything is wip, but (wip) here means work has not started yet. |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
106 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
107 Configuration |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
108 ------------- |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
109 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
110 Or: How to organize s**t that is not code |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
111 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
112 Not sure why, but this feels super important to get done right. The engine is |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
113 being designed with a library-mindset, not a framework mindset. And with that, |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
114 ensuring the configuration of the build, runtime and settings in general |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
115 becomes a bit less straight-forward. |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
116 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
117 So here is the idea: There are three to four different kinds of configurations |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
118 that the engine should be able to handle: |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
119 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
120 1. Build configuration: Engine version, project name, log level, etc. |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
121 2. Runtime engine/project settings: Video/audio settings, telemetry, log-output, etc. |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
122 3. Mods: Different sets of assets and configuration to allow easy testing of different scenarios |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
123 4. Save data: Saving world state of the game |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
124 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
125 Okay, let's look at each of those and how I plan to implement them: |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
126 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
127 **1. Build configuration** |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
128 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
129 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
130 **2. Runtime settings** |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
131 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
132 This is mostly implemented already. I am using the Nim module std/parsecfg. |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
133 There is also the option to watch the filesystem and update values at runtime, |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
134 mostly usefull for development. |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
135 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
136 The engine scans all files in the settings-root directory and builds a |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
137 settings tree that can be access via a setting-hierarchy like this: |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
138 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
139 setting("a.b.c.d.e") |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
140 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
141 ```a.b``` refers to the settings directory ```./a/b/``` (from the settings-root) |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
142 ```c``` refers to the file ```c.ini``` inside ```./a/b/``` |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
143 ```d``` refers to the ini-section inside the file ```./a/b/c.ini``` |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
144 ```e``` refers to the key inside section ```d``` inside the file ```./a/b/c.ini``` |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
145 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
146 ```a.b``` are optional, they just allow larger configuration trees. |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
147 ```d``` is optional, if it is not give, ```e``` refers to the top-level section |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
148 of the ini-file. |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
149 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
150 **3. Mods** |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
151 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
152 A mod is just a collection of resources for a game. Can maybe switched from |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
153 inside a game. Current mod can be defined via "2. Runtime settings" |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
154 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
155 I want to support mods from: |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
156 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
157 a) a directory on the filesystem |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
158 b) a zip-file on the filesystem |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
159 c) a zip-file that is embeded in the executable |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
160 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
161 The reasoning is simple: a) is helpfull for development, testing of |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
162 new/replaced assets, b) is the default deployment with mod-support and c) is |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
163 deployment without mod-support, demo-versions and similar. |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
164 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
165 Should not be that difficult but give us everything we ever need in terms of |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
166 resource packaging. |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
167 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
168 **4. Save data** |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
169 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
170 Not too much thought here yet. Maybe we can use Nim's std/marshal module. It |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
171 produces JSON from nim objects. Pretty dope, but maybe pretty slow. However, we |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
172 are indie-JSON here, not 10M of GTA Online JSON: |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
173 https://nee.lv/2021/02/28/How-I-cut-GTA-Online-loading-times-by-70/ |