summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-01-28 08:14:00 +0100
committerskal <pascal.massimino@gmail.com>2026-01-28 08:14:00 +0100
commita606788f3699b98b26e0af27622f67f00d92d1e3 (patch)
tree1526c034044062d574df40e9398c3445d2cf1a50
parentf9eef542adc0cfdd6cfbfffa6f15bac2fd6e8e97 (diff)
add asset system description file
-rw-r--r--ASSET_SYSTEM.md49
-rw-r--r--PROJECT_CONTEXT.md1
2 files changed, 50 insertions, 0 deletions
diff --git a/ASSET_SYSTEM.md b/ASSET_SYSTEM.md
new file mode 100644
index 0000000..0644cc7
--- /dev/null
+++ b/ASSET_SYSTEM.md
@@ -0,0 +1,49 @@
+# compact asset system for the 64k demo
+
+This file describe the features of a compact asset system used in the demo.
+
+The idea is the following:
+
+# run-time asset retrieval:
+ All assets are const byte arrays. We need a 'const uint8_t* GetAsset(uint16 asset_id)'
+ The asset ID is defined in a 'assets.h' header, generated during the final
+ compile by our own assembling tool. assets.h needs to be re-generated
+ infrequently.
+
+# assembling the assets:
+
+## description file 'assets.txt'
+ All assets are just files in the assets/final/ directory
+ This directory needs a assets.txt text file to describe the asset files.
+ Each line of the assets.txt file contain, comma-separated:
+ * the name of the asset (that will be used by the #define in assets.h),
+ * the name of the file associated
+ * the compression to use for this asset (default NONE. More options later)
+ * and optionally the type of assets.
+
+## example For instance, a line in assets.txt will read:
+
+SAMPLE_142, sample_142.spec, NONE, "this is a drum kick sample"
+
+This instructs the final assembled file assets.h to have a code line:
+ #define ASSET_SAMPLE_142 6323
+
+(6323 is just an associated id)
+
+(or an enum instead of #define's)
+
+so that we can call
+```
+#include "asset.h"
+const uint8_t* mysample = GetAsset(ASSET_SAMPLE_142);
+...etc
+```
+
+(if we use enums, GetAssert() signature needs to be changed)
+
+### Lazy decompression
+to save memory some assets can be decompressed 'at retrieval time' but kept
+compressed in memory until then.
+This means that we need a 'void DropAsset(uint16 asset_id, const uint8* asset)'
+method to handle memory disallocation depending on the asset type.
+
diff --git a/PROJECT_CONTEXT.md b/PROJECT_CONTEXT.md
index b8d0273..2fb533c 100644
--- a/PROJECT_CONTEXT.md
+++ b/PROJECT_CONTEXT.md
@@ -36,6 +36,7 @@ Incoming tasks in no particular order:
- [x] 8. add a #define STRIP_ALL to remove all unnecessary code for the final build
(for instance, command-line args parsing, or unnecessary options, constant
parameters to function calls, etc.)
+- 9. work on the compact in-line and off-line asset system (@ASSET_SYSTEM.md)
## Session Decisions and Current State