Mercurial > games > semicongine
annotate README.md @ 289:0eef4eba9c17
add: another completed feature
author | Sam <sam@basx.dev> |
---|---|
date | Wed, 14 Jun 2023 22:56:43 +0700 |
parents | c6bfe0eacb5c |
children | f25e9e19b5fa |
rev | line source |
---|---|
289 | 1 # Semicongine |
41 | 2 |
8 | 3 Hi there |
4 | |
213
b5d9410a8184
add: resource packaging and loading for different resource types, simplify build commands, update readme
Sam <sam@basx.dev>
parents:
202
diff
changeset
|
5 This is a little game engine, mainly trying to wrap around vulkan and the |
b5d9410a8184
add: resource packaging and loading for different resource types, simplify build commands, update readme
Sam <sam@basx.dev>
parents:
202
diff
changeset
|
6 operating system's windowing, input and audio system. I am using the last |
b5d9410a8184
add: resource packaging and loading for different resource types, simplify build commands, update readme
Sam <sam@basx.dev>
parents:
202
diff
changeset
|
7 programming language you will ever need, [Nim](https://nim-lang.org/) |
41 | 8 |
289 | 9 ## Building |
48 | 10 |
289 | 11 Requires Nim to be installed and `glslangValidator` to be downloaded to the |
12 directory of the main compilation file (e.g. into `examples/` in order to | |
95
8011e4d6372d
add: consistent way to define platform-specific code
Sam <sam@basx.dev>
parents:
73
diff
changeset
|
13 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
|
14 https://github.com/KhronosGroup/glslang/releases/. |
45 | 15 |
289 | 16 Run `nim help` to see a list of available build commands. |
48 | 17 |
289 | 18 ## Roadmap |
41 | 19 |
194
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
20 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
|
21 updated frequently (marking those checkboxes just feels to good to stop working). |
41 | 22 |
23 Rendering: | |
24 | |
25 - [x] Vertex attributes, vertex data | |
26 - [x] Shaders (allow for predefined and custom shaders) | |
27 - [x] Uniforms | |
28 - [x] Per-instance vertex attributes (required to be able to draw scene graph) | |
119 | 29 - [x] Fixed framerate |
130 | 30 - [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
|
31 - [x] Textures |
232
408d68fbcbee
did: restructure roadmap a bit, update progress
Sam <sam@basx.dev>
parents:
223
diff
changeset
|
32 - [x] Materials (vertices with material indices) |
194
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
33 - [ ] 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
|
34 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
35 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
|
36 |
41 | 37 - [ ] Depth buffering |
289 | 38 - [ ] Mipmaps |
41 | 39 |
40 Asset handling: | |
289 | 41 |
42 - [x] Resource loading - [x] Mod/resource-pack concept - [x] Load from directory - [x] Load from zip - [x] Load from exe-embeded | |
232
408d68fbcbee
did: restructure roadmap a bit, update progress
Sam <sam@basx.dev>
parents:
223
diff
changeset
|
43 - [x] Mesh/material files (glTF, but incomplete, not all features supported) |
221
2a2367d289dd
did: update progress, change roadmap to use glTF instead of OBJ (this seems to be super cool!)
Sam <sam@basx.dev>
parents:
216
diff
changeset
|
44 - [x] Image files (BMP RGBA) |
2a2367d289dd
did: update progress, change roadmap to use glTF instead of OBJ (this seems to be super cool!)
Sam <sam@basx.dev>
parents:
216
diff
changeset
|
45 - [x] Audio files (AU) |
232
408d68fbcbee
did: restructure roadmap a bit, update progress
Sam <sam@basx.dev>
parents:
223
diff
changeset
|
46 - [x] API to transform/recalculate mesh data |
41 | 47 |
119 | 48 Other (required for alpha release): |
289 | 49 |
119 | 50 - [x] Config files ala \*.ini files (use std/parsecfg) |
41 | 51 - [x] Mouse/Keyboard input handling |
52 - [x] X11 | |
53 - [x] Win32 | |
170 | 54 - [x] Enable/disable hardware cursor |
289 | 55 - [x] Fullscreen mode + switch between modes - [x] Linux - [x] Window |
56 - [x] Audio playing - [x] Linux - [x] Windows Waveform API | |
187 | 57 - [ ] Generic configuration concept (engine defaults, per-user, etc) |
41 | 58 - [ ] Input-mapping configuration |
101 | 59 - [ ] Telemetry |
289 | 60 - [x] Add simple event logging service |
61 - [ ] Add exception reporting | |
41 | 62 |
232
408d68fbcbee
did: restructure roadmap a bit, update progress
Sam <sam@basx.dev>
parents:
223
diff
changeset
|
63 Other important features: |
289 | 64 |
232
408d68fbcbee
did: restructure roadmap a bit, update progress
Sam <sam@basx.dev>
parents:
223
diff
changeset
|
65 - [ ] Multisampling |
274
c6bfe0eacb5c
this: feels sooooo good, font rendering working great (for a novice at least)
Sam <sam@basx.dev>
parents:
232
diff
changeset
|
66 - [x] Text rendering |
289 | 67 - [x] Animation system |
41 | 68 - [ ] Sprite system |
69 - [ ] Particle system | |
232
408d68fbcbee
did: restructure roadmap a bit, update progress
Sam <sam@basx.dev>
parents:
223
diff
changeset
|
70 |
289 | 71 Other less important features: |
72 | |
232
408d68fbcbee
did: restructure roadmap a bit, update progress
Sam <sam@basx.dev>
parents:
223
diff
changeset
|
73 - [ ] Viewport scaling (e.g. framebuffer resolution != window resolution) |
182 | 74 - [ ] Query and display rendering information from Vulkan? |
232
408d68fbcbee
did: restructure roadmap a bit, update progress
Sam <sam@basx.dev>
parents:
223
diff
changeset
|
75 - [ ] Game controller input handling |
408d68fbcbee
did: restructure roadmap a bit, update progress
Sam <sam@basx.dev>
parents:
223
diff
changeset
|
76 - [ ] Allow multipel Uniform blocks |
408d68fbcbee
did: restructure roadmap a bit, update progress
Sam <sam@basx.dev>
parents:
223
diff
changeset
|
77 - [ ] Documentation |
119 | 78 |
79 Quality improvments: | |
80 | |
81 - [x] Better scenegraph API | |
82 - [x] Better rendering pipeline API | |
83 | |
84 Build-system: | |
289 | 85 |
119 | 86 - [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
|
87 |
289 | 88 # Documentation |
194
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 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
|
91 |
289 | 92 ## Engine parts |
194
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
93 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
94 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
|
95 |
289 | 96 - Rendering: rendering.nim vulkan/\* |
194
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
97 - 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
|
98 - 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
|
99 - Input: events.nim |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
100 - Settings: settings.nim |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
101 - Meshes: mesh.nim |
223 | 102 - Math: math/\* |
194
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
103 - Telemetry: telemetry.nim (wip) |
223 | 104 - Resources (loading, mods): resources.nim |
194
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
105 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
106 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
|
107 |
289 | 108 ## Handling of assets |
202 | 109 |
110 A short description how I want to handle assets. | |
111 | |
112 Support for file formats (super limited, no external dependencies, uses quite a bit of space, hoping for zip): | |
113 | |
114 - Images: BMP | |
115 - Audio: AU | |
223 | 116 - Mesh: glTF (\*.gld) |
202 | 117 |
118 In-memory layout of assets (everything needs to be converted to those while loading): | |
119 | |
120 - Images: 4 channel with each uint8 = 32 bit RGBA, little endian (R is low bits, A is high bits) | |
121 - Audio: 2 Channel 16 bit signed little endian, 44100Hz | |
122 - Meshes: non-interleaved, lists of values for each vertex, one list per attribute | |
123 | |
289 | 124 ## Configuration |
194
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
125 |
223 | 126 Or: How to organize s\*\*t that is not code |
194
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
127 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
128 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
|
129 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
|
130 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
|
131 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
|
132 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
133 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
|
134 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
|
135 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
136 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
|
137 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
|
138 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
|
139 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
|
140 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
141 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
|
142 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
143 **1. Build configuration** |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
144 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
145 **2. Runtime settings** |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
146 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
147 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
|
148 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
|
149 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
|
150 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
151 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
|
152 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
|
153 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
154 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
|
155 |
289 | 156 `a.b` refers to the settings directory `./a/b/` (from the settings-root) |
157 `c` refers to the file `c.ini` inside `./a/b/` | |
158 `d` refers to the ini-section inside the file `./a/b/c.ini` | |
159 `e` refers to the key inside section `d` inside the file `./a/b/c.ini` | |
194
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
160 |
289 | 161 `a.b` are optional, they just allow larger configuration trees. |
162 `d` is optional, if it is not give, `e` refers to the top-level section | |
194
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
163 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
|
164 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
165 **3. Mods** |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
166 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
167 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
|
168 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
|
169 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
170 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
|
171 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
172 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
|
173 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
|
174 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
|
175 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
176 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
|
177 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
|
178 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
|
179 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
180 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
|
181 resource packaging. |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
182 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
183 **4. Save data** |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
184 |
93f661a20f74
did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents:
187
diff
changeset
|
185 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
|
186 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
|
187 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
|
188 https://nee.lv/2021/02/28/How-I-cut-GTA-Online-loading-times-by-70/ |