More work on defining the data system

This commit is contained in:
2026-07-31 22:51:12 -05:00
parent 08211e4d0f
commit 567b1a9c68

171
szds.md
View File

@@ -25,8 +25,9 @@ The flow goes as such:
```text
author.system_name/
- system.sz (A TOML file with metadata)
- character_template.szt (sessionzero template file)
- system.sz
- icon.png
- character_template.szt
- templates/
- template_name.szt
```
@@ -36,6 +37,7 @@ Example `system.sz` file
id = "szcore"
display_name = "SZ Core System"
version = "1.0"
author = "sz"
description = """
A simple core system to base others off of
"""
@@ -44,9 +46,156 @@ description = """
Example `character_template.szt` file
```toml
template_type = "character"
author = "sz"
[fields.name]
type = "text"
required = true
default_value = "Character 1"
[fields.player_name]
type = "text"
required = false
[fields.level]
type = "number"
required = true
default_value = 1
[fields.race]
type = "option"
required = true
option_type = "data"
data_source = ["races"]
[fields.class]
type = "option"
option_type = "text"
data_source = ["ranger", "fighter", "wizard"]
required = true
[fields.status.is_dead]
type = "boolean"
required = true
default_value = false
[fields.stats.str]
type = "number"
required = true
default_value = 0
[fields.stats.modifiers.str]
type = "formula"
formula = '(stats.str - 10) / 2'
[fields.inventory]
type = "list" #
list_type = "data" # If a list type is `data` then the list_data_source becomes a list of data sources in which the list can pull from, otherwise you can use `number` or `text` for literal values
data_source = ["items", "weapons"]
[fields.spells]
type = "list"
list_type = "text"
data_source = ["fireball", "mage_hand"]
[fields.equipped_weapon]
type = "option"
option_type = "data"
data_source = ["weapons"]
[fields.stats.damage]
type = "formula"
formula = 'equipped_weapon.calculated_damage'
```
Example data template file `weapon.szt`:
```toml
# The data type eg. "item" is pulled from the file name, and can be anything
template_type = "data"
author = "sz"
[fields.id]
type = "text"
required = true
[fields.display_name]
type = "text"
required = true
[fields.value]
type = "number"
required = true
default_value = 1.0
[fields.base_damage]
type = "number"
required = true
default_value = 1.0
[fields.skill]
type = "text"
required = true
default_value = "str"
[fields.calculated_damage]
type = "formula"
formula = 'base_damage + $PLAYER.stats.modifiers.{skill}'
# TODO: Need to figure out the syntax for this;
# $PLAYER should be a special variable that gets the current character of the owning player within a session,
# and the local `skill` variable needs to be evaluated as a string value (so it will look for `$PLAYER.stats.modifiers.str` as a number).
# Not sure about the {} as the syntax though, maybe I should rework the formula type entirely
```
### Datasets:
- Reference to a System and its templates
- Data Instance
Directory structure
```text
author.dataset_name/
- dataset.sz
- icons/
- dataset.png
- weapons/
- sword.png
- data/
- weapons/
- sword.szo
```
Example `dataset.sz` file
```toml
id = "szcore_data"
system_id = "szcore"
author = "sz"
```
Example data instance file `sword.szo` (this would use the `szcore.weapon` template from the system defined in the dataset)
```toml
author = "sz"
[fields.id]
value = "sword"
[fields.display_name]
value = "Sword"
[fields.value]
value = "100"
[fields.base_damage]
value = 10
[fields.skill]
value = "str"
```
### Games:
The Game type glues everything together
- System
- Plugins
- Datasets
@@ -54,7 +203,17 @@ template_type = "character"
- Character Instances
- Gamestate/Data
### Datasets:
- Reference to a System and its templates
- Data Instance
```text
game_name/
- game.sz
- plugins/
- (plugins will be defined in the future)
- datasets/
- player_data/
- player_name/
- player.sz
- characters/
- character1.szo // An actual Character instance using the System's template
- game_data/
- (various game related data...)
```