Notice: If the game stops working after an update, it might be a savegame incompatibility. Remove your savegame folder and try again before posting about it.
Registration has an extra hurdle now: There have been advertisement bots, so I added a security keyword to registration. Deal with it.
  0 users browsing Suggestion Box. | 1 bot  
Main » Suggestion Box » Loot Tables
Pages: 1
Posted on 02-13-13, 07:35 pm (revision 3)

 

Posts: 59/105
Since: 12-06-12

Last post: 4022 days
Last view: 4004 days
So I had an idea. What if rather than using hardcoded loot sets to fill things like chests and arm wild NPCs, we used a loot table to populate their inventories? I know this is already done to some extent with the costumes, so I'm sure it's something you've at least considered, but I wanted to come up with a system that we could use to cover all items and objects in the game rather than just clothing on characters.


Here's a small mock-up of what I was thinking:

<lootset target="container" type="chest">
   <oneof> whip, knife, dagger </oneof>
   <someof min="2" max="5"> bagel, apple, bread_loaf, bacon, sweetroll, croissant </someof>
   <allof> water_flask, water_flask </allof>
</lootset>

Alternatively this could also be done with tokenization like the costumes are, so I guess it's just a matter of preference or ease.

Another advantage of using a system that's a little more generic is that we could create separate loot sets for wild and town based NPCs that are indifferent to body type.


<lootset target="NPC" type="town">
   <oneof> club, pitchfork, shovel </oneof>
</lootset>

<lootset target="NPC" type="wild">
   <oneof> dagger, short_sword, whip </oneof>
</lootset>


One last way that loot tables can really add some interesting diversity is through the use of filters. For instance, you could filter based on the possession of certain flag tokens, or just by gender, race or culture. Alternatively, you could also filter by region:


<lootset target="container" type="wardrobe">
   <filter type="location" name="biome" value="Tundra" />
   <someof min="1" max="3"> parka, wool_scarf, wool_mittens </someof>
</lootset>

<lootset target="container" type="wardrobe">
   <filter type="location" name="biome" value="Desert" />
   <someof min="1" max="3"> silk_scarf, cotton_blouse, sandals </someof>
</lootset>

Anyway, these are just some ideas. I'm sure you could come up with some better syntax, but I wanted to give you some idea of what we could do with a system like this. Let me know what you think!


Lead writer on Noxico (and sometimes programmer or designer) <br>
Posted on 02-13-13, 07:43 pm
<i>Prophet of Celestia</i><br>Baka on the streets, senpai in the sheets

Posts: 163/344
Since: 06-08-12

Last post: 1692 days
Last view: 1232 days
Saving this page for later study.

I don't just program Noxico...
Posted on 03-07-13, 06:18 pm
<i>Prophet of Celestia</i><br>Baka on the streets, senpai in the sheets

Posts: 176/344
Since: 06-08-12

Last post: 1692 days
Last view: 1232 days
This is now a thing.

Calling WorldGen.GetLoot(string target, string type) returns a list of tokens that can be directly added to a container or a character's inventory, like the now obsoleted InventoryItem.RollContainer(Character owner, string type) does, using the following data:
<pre>
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE loot [
<!ELEMENT loot (lootset+)>
<!ELEMENT lootset (filter|oneof|someof)+>
<!ELEMENT filter EMPTY>
<!ELEMENT oneof (#PCDATA)>
<!ELEMENT someof (#PCDATA)>
<!ATTLIST lootset
target CDATA #REQUIRED
type CDATA #REQUIRED
>
<!ATTLIST filter
key CDATA #REQUIRED
value CDATA #REQUIRED
>
<!ATTLIST someof
min CDATA #REQUIRED
max CDATA #REQUIRED
>
]>
<!--
for sets:
* "directitem" -> item with that ID
* "@token" -> any random item with that token
* "@tokenA+tokenB" -> any random item with those tokens
* "@tokenA-tokenB" -> any random item with tokenA but NOT tokenB
* "@tokenA+tokenB-tokenC" -> any random item with tokenA and B but not C
* "@-token" -> any random item AT ALL that does not have that token
separate with "," result is trimmed.
-->
<loot>
<lootset target="container" type="dungeon_chest">
<!-- Contains: ONE small weapon, large weapon, or rare weapon, TWO to FIVE food items, and ONE to THREE potions, all random. -->
<oneof>@smallweapon, @largeweapon, @rareweapon</oneof>
<someof min="2" max="5">@food</someof>
<someof min="1" max="3">@potion</someof>
</lootset>
<lootset target="vendor" type="baker">
<someof min="10" max="10">@baked</someof>
</lootset>
<lootset target="vendor" type="greengrocer">
<someof min="10" max="10">@fruit</someof>
</lootset>
<lootset target="npc" type="arms">
<filter key="board" value="wild" />
<filter key="culture" value="seradevar" />
<!-- either a small or large blade. -->
<oneof>@smallweapon+blade, @largeweapon+blade</oneof>
</lootset>
</loot>
</pre>
Many but not all items have been marked to allow this.

I don't just program Noxico...
Posted on 03-07-13, 06:53 pm

 

Posts: 70/105
Since: 12-06-12

Last post: 4022 days
Last view: 4004 days
Looks nice! Definitely going to have some fun playing around with this. :awsum:

Lead writer on Noxico (and sometimes programmer or designer) <br>
Posted on 03-08-13, 07:03 pm
<i>Prophet of Celestia</i><br>Baka on the streets, senpai in the sheets

Posts: 178/344
Since: 06-08-12

Last post: 1692 days
Last view: 1232 days
Considering the following: split up GetLoot into GetRandomLoot and GetLoots. One returns all lootsets that match the type, target, and filters, and the other picks one at random.

Then, to create a villager and their personal containers, call GetLoots. Pick one out from the results and give that to the NPC, then put some of the rest in their wardrobe and such.

Also, keep separate lootsets for clothing, tools, and weapons. If a villager has a wardrobe, get multiple clothing sets as above. If not, get only one. Same deal with chests and weapon racks or whatnot. That way, for a house with two inhabitants, two beds, two wardrobes, and one chest, there'd be two clothing lootsets worn, N clothing sets stored in their respective wardrobes, two tool sets carried, and N tool and other item sets in the chest.

Sound good?

I don't just program Noxico...
Posted on 03-08-13, 08:03 pm

 

Posts: 72/105
Since: 12-06-12

Last post: 4022 days
Last view: 4004 days
Yeah, that sounds like it should work just fine. I had always intended that multliple loot sets could be combined and given to an entity, so this looks like the start of a good system for that. I guess we just need a standard way to differentiate the different types of sets so that they end up in the right places.

Lead writer on Noxico (and sometimes programmer or designer) <br>
Posted on 03-08-13, 08:10 pm
<i>Prophet of Celestia</i><br>Baka on the streets, senpai in the sheets

Posts: 179/344
Since: 06-08-12

Last post: 1692 days
Last view: 1232 days
I was thinking of taking the <code>type="baker"</code> part and replacing that with a <code><filter></code> element. That way, we can query for all <i>NPC Clothing</i> -- GetLoots'll then return a baker's costume <i>and</i> any other clothing sets, which can then be distributed.

If we sort the more specific stuff such as a baker's costume at the top of the file and the less specific stuff such as typical mens clothing further down, like with the scene data, GetLoot's returned list will have the costume as [0], for trivial distribution.

I don't just program Noxico...
Posted on 03-11-13, 01:36 pm
<i>Prophet of Celestia</i><br>Baka on the streets, senpai in the sheets

Posts: 181/344
Since: 06-08-12

Last post: 1692 days
Last view: 1232 days
GetLoot split up, Character.ApplyCostume redone to use the results. Much shorter now. Short is good.

I don't just program Noxico...
Posted on 03-11-13, 07:02 pm

 

Posts: 73/105
Since: 12-06-12

Last post: 4022 days
Last view: 4004 days
Much shorter and much cleaner. I'm definitely liking how this is coming together. ;)

Lead writer on Noxico (and sometimes programmer or designer) <br>
Posted on 03-11-13, 07:42 pm
<i>Prophet of Celestia</i><br>Baka on the streets, senpai in the sheets

Posts: 182/344
Since: 06-08-12

Last post: 1692 days
Last view: 1232 days
All it really needs now is a way to set colors on items that support them.

I don't just program Noxico...
Pages: 1
Main » Suggestion Box » Loot Tables