Some of you may be aware that I’m trying to gut our current item system and replace it entirely.
Basically, this is going to serve as my working reference repository while I do so. Suggestions are appreciated, and hopefully this post will describe the latest form of item_templates (the things actual in game items are built from, and what’s actually defined in this file)
The structure is pretty basic right now, and doesn’t have all (or even most) of the attributes it will need to work with the game yet. I expect that to change in the near future. Also, it’s in JSON, because that is the file format we’ll be using.
[ { "key": "UNIQUE_KEY_VALUE", // This string represents an items unique identifier. Additional definitions with the same key will be ignored. No spaces.
"name": "Item Name", // The name
"description" : "This is a a generic item. It is glorious." // Don't worry about adding newlines for display purposes, I'm going to let my rendering code figure that out."
"weight": 10, // The weight
"volume": 4, // The volume
"variations": [ { // You can swap out a set of values for a different set of values without creating a new item. Right now, just for name and description.
"odds": 200, // The odds, in hundredths of a percent, that this variation will replace the default. This is a 2% chance.
"name": "Alternate Item Name" //The value to be changed if this variation is selected.
},{
"odds": 50, // The odds, in hundredths of a percent, that this variation will replace the default. This is a .5% chance.
"name": "Super-Brand Alternate Item Name" //The value to be changed if this variation is selected.
"description": "This is the best damned generic object you've ever seen."
}
]
I do hope on generalizing the code for handling “alternates”, my current implementation is a wee bit lacking. I think it will do a lot to add flavour to common objects, but far more importantly, it will do a lot to enable completely NEW types of objects: Things like notes or journals, for example.
They could all have the same item key, meaning there’s a chance for any of them to spawn, and you only have to add one entry, but adding additional potential contents for those journals suddenly becomes trivial.