Save Data Standard Structure (v2 - Enhanced Inventory)
Edit the JSON above carefully. Ensure valid JSON syntax before saving.
{
"currentLevel": "levelX.html",
"player": {
"hp": 100,
"currentWeapon": "p"
},
"inventory": {
"currency": 0,
"weaponsOwned": [
"p"
],
"ammo": {
"pistol_rounds": 50,
"heavy_rounds": 0,
"shells": 0
},
"items": [
{
"id": "example_item",
"name": "Example Item",
"quantity": 1,
"acquiredLevel": "level1.html"
}
]
},
"saveTimestamp": 1678886400000
}
Field Explanations:
- currentLevel (String)
- Filename of the level the player should load into (e.g., "level2.html").
- player (Object)
- Container for player state.
- player.hp (Number)
- Player's current health points.
- player.currentWeapon (String)
- The unique key of the weapon currently equipped (e.g., "p", "b", "sg").
- inventory (Object)
- Container for all player possessions.
- inventory.currency (Number)
- Amount of game currency held.
- inventory.weaponsOwned (Array of Strings)
- List of unique keys for all weapons the player possesses (e.g., ["p", "b", "sg"]).
- inventory.ammo (Object)
- Key-value pairs where the key is the ammo type (String, e.g., "pistol_rounds") and the value is the count (Number).
- inventory.items (Array of Objects)
- List of general items. Each item object has:
- id (String): Unique identifier (e.g., "health_pack", "keycard_alpha").
- name (String): User-friendly display name.
- quantity (Number): How many of this item the player has.
- acquiredLevel (String): Filename of the level where this item ID was first obtained.
- saveTimestamp (Number)
- Timestamp (from Date.now()) indicating when the save occurred.
Note: Old fields like `player.ammo`, `player.hasBigGun`, `player.hasKeycard` are replaced by the more detailed `inventory` structure.