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