annotate README.md @ 719:f52bac7a1c73

fix: few issues with sound and resource loading
author Sam <sam@basx.dev>
date Wed, 24 May 2023 23:24:52 +0700
parents 86048c6ed6fd
children c6bfe0eacb5c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
502
e52bfb0b98ce fix: organize notes a bit
Sam <sam@basx.dev>
parents: 469
diff changeset
1 Semicongine
e52bfb0b98ce fix: organize notes a bit
Sam <sam@basx.dev>
parents: 469
diff changeset
2 ===========
e52bfb0b98ce fix: organize notes a bit
Sam <sam@basx.dev>
parents: 469
diff changeset
3
469
ed49f1cdd8b7 add: a few missing changes
Sam <sam@basx.dev>
parents:
diff changeset
4 Hi there
ed49f1cdd8b7 add: a few missing changes
Sam <sam@basx.dev>
parents:
diff changeset
5
674
496b328faa43 add: resource packaging and loading for different resource types, simplify build commands, update readme
Sam <sam@basx.dev>
parents: 663
diff changeset
6 This is a little game engine, mainly trying to wrap around vulkan and the
496b328faa43 add: resource packaging and loading for different resource types, simplify build commands, update readme
Sam <sam@basx.dev>
parents: 663
diff changeset
7 operating system's windowing, input and audio system. I am using the last
496b328faa43 add: resource packaging and loading for different resource types, simplify build commands, update readme
Sam <sam@basx.dev>
parents: 663
diff changeset
8 programming language you will ever need, [Nim](https://nim-lang.org/)
502
e52bfb0b98ce fix: organize notes a bit
Sam <sam@basx.dev>
parents: 469
diff changeset
9
509
330dbc449e96 add: some more instructions
Sam <sam@basx.dev>
parents: 506
diff changeset
10 Building
330dbc449e96 add: some more instructions
Sam <sam@basx.dev>
parents: 506
diff changeset
11 --------
330dbc449e96 add: some more instructions
Sam <sam@basx.dev>
parents: 506
diff changeset
12
556
21f15523fda0 add: consistent way to define platform-specific code
Sam <sam@basx.dev>
parents: 534
diff changeset
13 Requires Nim to be installed and ```glslangValidator``` to be downloaded to the
21f15523fda0 add: consistent way to define platform-specific code
Sam <sam@basx.dev>
parents: 534
diff changeset
14 directory of the main compilation file (e.g. into ```examples/``` in order to
21f15523fda0 add: consistent way to define platform-specific code
Sam <sam@basx.dev>
parents: 534
diff changeset
15 compile the examples). It can be downloaded at
21f15523fda0 add: consistent way to define platform-specific code
Sam <sam@basx.dev>
parents: 534
diff changeset
16 https://github.com/KhronosGroup/glslang/releases/.
506
b159fcdd36b9 add: some build instructions for windows
Sam <sam@basx.dev>
parents: 502
diff changeset
17
556
21f15523fda0 add: consistent way to define platform-specific code
Sam <sam@basx.dev>
parents: 534
diff changeset
18 Run ```nim help``` to see a list of available build commands.
509
330dbc449e96 add: some more instructions
Sam <sam@basx.dev>
parents: 506
diff changeset
19
502
e52bfb0b98ce fix: organize notes a bit
Sam <sam@basx.dev>
parents: 469
diff changeset
20 Roadmap
e52bfb0b98ce fix: organize notes a bit
Sam <sam@basx.dev>
parents: 469
diff changeset
21 -------
e52bfb0b98ce fix: organize notes a bit
Sam <sam@basx.dev>
parents: 469
diff changeset
22
655
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
23 Here a bit to see what has been planed and what is done already. Is being
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
24 updated frequently (marking those checkboxes just feels to good to stop working).
502
e52bfb0b98ce fix: organize notes a bit
Sam <sam@basx.dev>
parents: 469
diff changeset
25
e52bfb0b98ce fix: organize notes a bit
Sam <sam@basx.dev>
parents: 469
diff changeset
26 Rendering:
e52bfb0b98ce fix: organize notes a bit
Sam <sam@basx.dev>
parents: 469
diff changeset
27
e52bfb0b98ce fix: organize notes a bit
Sam <sam@basx.dev>
parents: 469
diff changeset
28 - [x] Vertex attributes, vertex data
e52bfb0b98ce fix: organize notes a bit
Sam <sam@basx.dev>
parents: 469
diff changeset
29 - [x] Shaders (allow for predefined and custom shaders)
e52bfb0b98ce fix: organize notes a bit
Sam <sam@basx.dev>
parents: 469
diff changeset
30 - [x] Uniforms
e52bfb0b98ce fix: organize notes a bit
Sam <sam@basx.dev>
parents: 469
diff changeset
31 - [x] Per-instance vertex attributes (required to be able to draw scene graph)
580
3c4be9e13570 did: update progress
Sam <sam@basx.dev>
parents: 578
diff changeset
32 - [x] Fixed framerate
591
20aeaaf3dc40 did: update readme
Sam <sam@basx.dev>
parents: 580
diff changeset
33 - [x] Instanced drawing (currently can use instance attributes, but we only support a single instance per draw call)
655
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
34 - [x] Textures
693
86048c6ed6fd did: restructure roadmap a bit, update progress
Sam <sam@basx.dev>
parents: 684
diff changeset
35 - [x] Materials (vertices with material indices)
655
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
36 - [ ] Allow different shaders (ie pipelines) for different meshes
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
37
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
38 Required for 3D rendering:
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
39
502
e52bfb0b98ce fix: organize notes a bit
Sam <sam@basx.dev>
parents: 469
diff changeset
40 - [ ] Depth buffering
e52bfb0b98ce fix: organize notes a bit
Sam <sam@basx.dev>
parents: 469
diff changeset
41 - [ ] Mipmaps
e52bfb0b98ce fix: organize notes a bit
Sam <sam@basx.dev>
parents: 469
diff changeset
42
e52bfb0b98ce fix: organize notes a bit
Sam <sam@basx.dev>
parents: 469
diff changeset
43 Asset handling:
677
b6c8c7e25bfd add: sekeleton to start working on resource loading, updated readme
Sam <sam@basx.dev>
parents: 674
diff changeset
44 - [x] Resource loading
674
496b328faa43 add: resource packaging and loading for different resource types, simplify build commands, update readme
Sam <sam@basx.dev>
parents: 663
diff changeset
45 - [x] Mod/resource-pack concept
496b328faa43 add: resource packaging and loading for different resource types, simplify build commands, update readme
Sam <sam@basx.dev>
parents: 663
diff changeset
46 - [x] Load from directory
496b328faa43 add: resource packaging and loading for different resource types, simplify build commands, update readme
Sam <sam@basx.dev>
parents: 663
diff changeset
47 - [x] Load from zip
496b328faa43 add: resource packaging and loading for different resource types, simplify build commands, update readme
Sam <sam@basx.dev>
parents: 663
diff changeset
48 - [x] Load from exe-embeded
693
86048c6ed6fd did: restructure roadmap a bit, update progress
Sam <sam@basx.dev>
parents: 684
diff changeset
49 - [x] Mesh/material files (glTF, but incomplete, not all features supported)
682
9767dec81193 did: update progress, change roadmap to use glTF instead of OBJ (this seems to be super cool!)
Sam <sam@basx.dev>
parents: 677
diff changeset
50 - [x] Image files (BMP RGBA)
9767dec81193 did: update progress, change roadmap to use glTF instead of OBJ (this seems to be super cool!)
Sam <sam@basx.dev>
parents: 677
diff changeset
51 - [x] Audio files (AU)
693
86048c6ed6fd did: restructure roadmap a bit, update progress
Sam <sam@basx.dev>
parents: 684
diff changeset
52 - [x] API to transform/recalculate mesh data
502
e52bfb0b98ce fix: organize notes a bit
Sam <sam@basx.dev>
parents: 469
diff changeset
53
580
3c4be9e13570 did: update progress
Sam <sam@basx.dev>
parents: 578
diff changeset
54 Other (required for alpha release):
3c4be9e13570 did: update progress
Sam <sam@basx.dev>
parents: 578
diff changeset
55 - [x] Config files ala \*.ini files (use std/parsecfg)
502
e52bfb0b98ce fix: organize notes a bit
Sam <sam@basx.dev>
parents: 469
diff changeset
56 - [x] Mouse/Keyboard input handling
e52bfb0b98ce fix: organize notes a bit
Sam <sam@basx.dev>
parents: 469
diff changeset
57 - [x] X11
e52bfb0b98ce fix: organize notes a bit
Sam <sam@basx.dev>
parents: 469
diff changeset
58 - [x] Win32
631
2c106a77ada3 did: update progress
Sam <sam@basx.dev>
parents: 591
diff changeset
59 - [x] Enable/disable hardware cursor
648
4374c13b9b95 add: progress update
Sam <sam@basx.dev>
parents: 643
diff changeset
60 - [x] Fullscreen mode + switch between modes
4374c13b9b95 add: progress update
Sam <sam@basx.dev>
parents: 643
diff changeset
61 - [x] Linux
4374c13b9b95 add: progress update
Sam <sam@basx.dev>
parents: 643
diff changeset
62 - [x] Window
643
e810faa2eea8 did: update progress
Sam <sam@basx.dev>
parents: 640
diff changeset
63 - [x] Audio playing
648
4374c13b9b95 add: progress update
Sam <sam@basx.dev>
parents: 643
diff changeset
64 - [x] Linux
4374c13b9b95 add: progress update
Sam <sam@basx.dev>
parents: 643
diff changeset
65 - [x] Windows Waveform API
4374c13b9b95 add: progress update
Sam <sam@basx.dev>
parents: 643
diff changeset
66 - [ ] Generic configuration concept (engine defaults, per-user, etc)
502
e52bfb0b98ce fix: organize notes a bit
Sam <sam@basx.dev>
parents: 469
diff changeset
67 - [ ] Input-mapping configuration
562
bfb75f2cd493 add: really need telemetry at some point
Sam <sam@basx.dev>
parents: 556
diff changeset
68 - [ ] Telemetry
655
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
69 - [x] Add simple event logging service
648
4374c13b9b95 add: progress update
Sam <sam@basx.dev>
parents: 643
diff changeset
70 - [ ] Add exception reporting
502
e52bfb0b98ce fix: organize notes a bit
Sam <sam@basx.dev>
parents: 469
diff changeset
71
693
86048c6ed6fd did: restructure roadmap a bit, update progress
Sam <sam@basx.dev>
parents: 684
diff changeset
72 Other important features:
86048c6ed6fd did: restructure roadmap a bit, update progress
Sam <sam@basx.dev>
parents: 684
diff changeset
73 - [ ] Multisampling
502
e52bfb0b98ce fix: organize notes a bit
Sam <sam@basx.dev>
parents: 469
diff changeset
74 - [ ] Text rendering
e52bfb0b98ce fix: organize notes a bit
Sam <sam@basx.dev>
parents: 469
diff changeset
75 - [ ] Animation system
e52bfb0b98ce fix: organize notes a bit
Sam <sam@basx.dev>
parents: 469
diff changeset
76 - [ ] Sprite system
e52bfb0b98ce fix: organize notes a bit
Sam <sam@basx.dev>
parents: 469
diff changeset
77 - [ ] Particle system
693
86048c6ed6fd did: restructure roadmap a bit, update progress
Sam <sam@basx.dev>
parents: 684
diff changeset
78
86048c6ed6fd did: restructure roadmap a bit, update progress
Sam <sam@basx.dev>
parents: 684
diff changeset
79 Other less features:
86048c6ed6fd did: restructure roadmap a bit, update progress
Sam <sam@basx.dev>
parents: 684
diff changeset
80 - [ ] Viewport scaling (e.g. framebuffer resolution != window resolution)
643
e810faa2eea8 did: update progress
Sam <sam@basx.dev>
parents: 640
diff changeset
81 - [ ] Query and display rendering information from Vulkan?
693
86048c6ed6fd did: restructure roadmap a bit, update progress
Sam <sam@basx.dev>
parents: 684
diff changeset
82 - [ ] Game controller input handling
86048c6ed6fd did: restructure roadmap a bit, update progress
Sam <sam@basx.dev>
parents: 684
diff changeset
83 - [ ] Allow multipel Uniform blocks
86048c6ed6fd did: restructure roadmap a bit, update progress
Sam <sam@basx.dev>
parents: 684
diff changeset
84 - [ ] Documentation
580
3c4be9e13570 did: update progress
Sam <sam@basx.dev>
parents: 578
diff changeset
85
3c4be9e13570 did: update progress
Sam <sam@basx.dev>
parents: 578
diff changeset
86 Quality improvments:
3c4be9e13570 did: update progress
Sam <sam@basx.dev>
parents: 578
diff changeset
87
3c4be9e13570 did: update progress
Sam <sam@basx.dev>
parents: 578
diff changeset
88 - [x] Better scenegraph API
3c4be9e13570 did: update progress
Sam <sam@basx.dev>
parents: 578
diff changeset
89 - [x] Better rendering pipeline API
3c4be9e13570 did: update progress
Sam <sam@basx.dev>
parents: 578
diff changeset
90
3c4be9e13570 did: update progress
Sam <sam@basx.dev>
parents: 578
diff changeset
91 Build-system:
3c4be9e13570 did: update progress
Sam <sam@basx.dev>
parents: 578
diff changeset
92 - [x] move all of Makefile to config.nims
655
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
93
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
94
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
95 Documentation
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
96 =============
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
97
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
98 Okay, here is first quick-n-dirty documentation, the only purpose to organize my thoughts a bit.
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
99
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
100 Engine parts
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
101 ------------
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
102
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
103 Currently we have at least the following:
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
104
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
105 - Rendering: rendering.nim vulkan/*
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
106 - Scene graph: entity.nim
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
107 - Audio: audio.nim audiotypes.nim
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
108 - Input: events.nim
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
109 - Settings: settings.nim
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
110 - Meshes: mesh.nim
684
3e81b82852b2 did: update progress
Sam <sam@basx.dev>
parents: 682
diff changeset
111 - Math: math/\*
655
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
112 - Telemetry: telemetry.nim (wip)
684
3e81b82852b2 did: update progress
Sam <sam@basx.dev>
parents: 682
diff changeset
113 - Resources (loading, mods): resources.nim
655
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
114
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
115 Got you: Everything is wip, but (wip) here means work has not started yet.
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
116
663
af9ab61aa87e add: documentation
Sam <sam@basx.dev>
parents: 659
diff changeset
117 Handling of assets
af9ab61aa87e add: documentation
Sam <sam@basx.dev>
parents: 659
diff changeset
118 ------------------
af9ab61aa87e add: documentation
Sam <sam@basx.dev>
parents: 659
diff changeset
119
af9ab61aa87e add: documentation
Sam <sam@basx.dev>
parents: 659
diff changeset
120 A short description how I want to handle assets.
af9ab61aa87e add: documentation
Sam <sam@basx.dev>
parents: 659
diff changeset
121
af9ab61aa87e add: documentation
Sam <sam@basx.dev>
parents: 659
diff changeset
122 Support for file formats (super limited, no external dependencies, uses quite a bit of space, hoping for zip):
af9ab61aa87e add: documentation
Sam <sam@basx.dev>
parents: 659
diff changeset
123
af9ab61aa87e add: documentation
Sam <sam@basx.dev>
parents: 659
diff changeset
124 - Images: BMP
af9ab61aa87e add: documentation
Sam <sam@basx.dev>
parents: 659
diff changeset
125 - Audio: AU
684
3e81b82852b2 did: update progress
Sam <sam@basx.dev>
parents: 682
diff changeset
126 - Mesh: glTF (\*.gld)
663
af9ab61aa87e add: documentation
Sam <sam@basx.dev>
parents: 659
diff changeset
127
af9ab61aa87e add: documentation
Sam <sam@basx.dev>
parents: 659
diff changeset
128 In-memory layout of assets (everything needs to be converted to those while loading):
af9ab61aa87e add: documentation
Sam <sam@basx.dev>
parents: 659
diff changeset
129
af9ab61aa87e add: documentation
Sam <sam@basx.dev>
parents: 659
diff changeset
130 - Images: 4 channel with each uint8 = 32 bit RGBA, little endian (R is low bits, A is high bits)
af9ab61aa87e add: documentation
Sam <sam@basx.dev>
parents: 659
diff changeset
131 - Audio: 2 Channel 16 bit signed little endian, 44100Hz
af9ab61aa87e add: documentation
Sam <sam@basx.dev>
parents: 659
diff changeset
132 - Meshes: non-interleaved, lists of values for each vertex, one list per attribute
af9ab61aa87e add: documentation
Sam <sam@basx.dev>
parents: 659
diff changeset
133
655
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
134 Configuration
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
135 -------------
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
136
684
3e81b82852b2 did: update progress
Sam <sam@basx.dev>
parents: 682
diff changeset
137 Or: How to organize s\*\*t that is not code
655
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
138
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
139 Not sure why, but this feels super important to get done right. The engine is
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
140 being designed with a library-mindset, not a framework mindset. And with that,
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
141 ensuring the configuration of the build, runtime and settings in general
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
142 becomes a bit less straight-forward.
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
143
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
144 So here is the idea: There are three to four different kinds of configurations
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
145 that the engine should be able to handle:
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
146
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
147 1. Build configuration: Engine version, project name, log level, etc.
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
148 2. Runtime engine/project settings: Video/audio settings, telemetry, log-output, etc.
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
149 3. Mods: Different sets of assets and configuration to allow easy testing of different scenarios
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
150 4. Save data: Saving world state of the game
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
151
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
152 Okay, let's look at each of those and how I plan to implement them:
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
153
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
154 **1. Build configuration**
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
155
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
156
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
157 **2. Runtime settings**
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
158
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
159 This is mostly implemented already. I am using the Nim module std/parsecfg.
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
160 There is also the option to watch the filesystem and update values at runtime,
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
161 mostly usefull for development.
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
162
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
163 The engine scans all files in the settings-root directory and builds a
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
164 settings tree that can be access via a setting-hierarchy like this:
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
165
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
166 setting("a.b.c.d.e")
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
167
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
168 ```a.b``` refers to the settings directory ```./a/b/``` (from the settings-root)
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
169 ```c``` refers to the file ```c.ini``` inside ```./a/b/```
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
170 ```d``` refers to the ini-section inside the file ```./a/b/c.ini```
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
171 ```e``` refers to the key inside section ```d``` inside the file ```./a/b/c.ini```
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
172
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
173 ```a.b``` are optional, they just allow larger configuration trees.
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
174 ```d``` is optional, if it is not give, ```e``` refers to the top-level section
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
175 of the ini-file.
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
176
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
177 **3. Mods**
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
178
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
179 A mod is just a collection of resources for a game. Can maybe switched from
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
180 inside a game. Current mod can be defined via "2. Runtime settings"
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
181
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
182 I want to support mods from:
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
183
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
184 a) a directory on the filesystem
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
185 b) a zip-file on the filesystem
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
186 c) a zip-file that is embeded in the executable
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
187
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
188 The reasoning is simple: a) is helpfull for development, testing of
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
189 new/replaced assets, b) is the default deployment with mod-support and c) is
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
190 deployment without mod-support, demo-versions and similar.
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
191
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
192 Should not be that difficult but give us everything we ever need in terms of
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
193 resource packaging.
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
194
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
195 **4. Save data**
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
196
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
197 Not too much thought here yet. Maybe we can use Nim's std/marshal module. It
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
198 produces JSON from nim objects. Pretty dope, but maybe pretty slow. However, we
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
199 are indie-JSON here, not 10M of GTA Online JSON:
53e08e6c5ae6 did: a bit of cleanup with the config, also add some documentation
Sam <sam@basx.dev>
parents: 648
diff changeset
200 https://nee.lv/2021/02/28/How-I-cut-GTA-Online-loading-times-by-70/