Borut Profile picture
28 Dec, 36 tweets, 7 min read
A little post holiday down time means it's time for a sequel to this thread (because everyone likes sequels right?), on using tagging for better gameplay implementation:
In the first thread I glossed over a few of the ingredients in the "secret recipe" of making tagging work to really transform your workflow to build stuff more easily.
The first, which I kind of implied in the sound example, is how tags stack. It starts from the object which relevant to the event - like the character speaking, if it's an NPC firing a bark.
That object will then get the tags applied from the volume it is in. If it's in the saloon, which has its own building volume, it has the "Saloon" tag applied. If it's in the barkeep's back room, it's also got the "BackRoom" tag applied.
You can filter "BackRoom" to specify a dialogue line only to play while in one of these back rooms ("Get out of here!"), as opposed to say "DoctorsOffice Backroom" which would only fire in the doctor's back room ("If you need bandages you can buy them from me, or get out!)"
Then we add on the location's tags - the location type (eg "Town"), and other features, like the terrain (ie "Terrain:Desert") and other state info like "Abandoned" if it's been abandoned by its main population.
Then we add the world tags, which includes global game system info like the time of day (eg "TimeOfDay:Night"), and main quest story state (how far you've advanced or what you've accomplished). Now that we've collected all these tags....
The second important thing is how you actually prioritize the filtered results. Taking this whole architecture from end to end on Weird West (unlike prototyping on LMNO) definitely helped narrow down for me What Things Work and What Things Don't Work in this area.
One of the early things I tried in the dialogue was to weight results by the # of tags. The more specific the condition, in theory the better the result would be. Because the context would be more specific, which is partly the goal of the tag system (easy contextual overrides).
However I ran into issues quickly where a condition caught by fewer tags might contextually be more appropriate. Seeing a dead body takes one tag for that event, "Dead", and seeing a character pick up a burning barrel takes two - "Burning, Barrel"
But you really want the character to react to the dead character, because that's the thing that is more important to them. Not the burning barrel - if they see both of them at the same. Which is definitely the sort of thing that happens in our game 😆🔥🪵☠️
So instead I added a weight which was an explicit priority. the system would take all the results at the same highest priority/weight, and randomly selects among those at the top value (avoiding repeats as much as possible). But that's just for dialogue.
Ooh, before I forget, here's one of my favorite examples of the dialogue getting very specific from @elfirestine:
(Maybe a slight aside but now I'd swap that for an abstract priority - assign a line a category like "Quest Non combat Barks" that has a number assigned to it, and you can adjust those numbers w/o changing categories, to reduce the tweakiness the writers ran into sometimes).
But when we were starting out I didn't really have any sense of what the categories might be, so I stuck with the #, which @elfirestine @lucasloredo did graciously tweak accordingly❤️. But some external piece of authored data that said "how important is this line" was def needed
Prioritization by # of tags works well for sound though, like the Thief arrow example I mentioned from the previous thread:

The more tags something matches, the more specific it really is.
Animation tho, relies more on random weighting. You might weight 3 anims that could fire, at weight of 1, 3, and 1, respectively. The middle anim would be picked 3 out of 5 times. It would also bias the random weights based on how long ago it was played, for visual variety.
So basically the algorithm you use to prioritize the search results varies a fair bit amongst different types of content. But they all have some shared features:
* How much to increase the search score by the matched tag count
* How to factor in the score by the weight provided by that data asset
* How much to adjust the score by the number of uses
* How much to adjust the score by the last use time (given a window of time for this kind of asset, which can vary - for an anim it might weight according to the last 5 minutes).
* Or just order the list of selections in the priority they should be evaluated
Let's look at another tagging example - loot.

Typically loot is implemented by taking a container in a level and setting a property on that defines which loot table to look up items for it.

The loot table is just a list of stuff with some info on how much to randomly put in.
Now loot can be stuff the player needs, ammo, powerups, etc, but there's also a certain amount of storytelling involved - a container should have things that are appropriate for the place it's in. That is a way of reinforcing where you are, like set dressing.
Place a barrel in a mine, assign the mine_underground_loot_containers list to it. Put it in a barn and you might assign the farm_loot_containers list to it, or maybe a specific one for barns.
W/tags, fundamentally it's not too different, it's just more flexible to change and customize. Barrels ofc have the "Barrel" tag & when searching for a matching loot table it includes tags for the building it's in (ie "Barn"), and the location (eg "Farm", "Mine").
Now you assign the loot tables each a set of filter tags, and the game will automatically look up the right table according to the container's tags.
So let's say you start with just one list for all barrels, barrel_loot_list, & later on you decide you want to flavor the loot differently per location. In mines you might have an occasional pickaxe, rocks, even maybe a gold nugget, & farms they might have food like apples.
Instead of having to go to *every* single barrel in *every* farm and *every* mine and set their new list, all you have to do is make the two new lists, set their filter tags correctly, and never have to touch a single barrel.
It can easily get more specific - let's say you have barrels in a story specific location, like the starting level of Weird West, which is the player character's farm.
Now you can add custom items that help tell the story of who the player is & where they came from using this same mechanism, trivially.
Other fun examples (I may delve into more in each of their own threads are fav any you want to see next): our building/location construction system...
You can request location with a field with any kind of crop. or a corn/strawberry/etc field, a small/large/etc field, or be specific and say you need a small cornfield, but that's all really more for another thread on how our world is built for procgen story stuff.
The game can also assign random scenarios to abandoned locations, to help add challenge for the player and give folks trodding off the beaten path something to do (and maybe some loot, accordingly)...
The types of monsters spawned can be varied by location type, world or story state, as well as overrides for specific locations - for story reasons certain monsters may not make sense in a specific town or what have you, while they might be totally fine in other towns.
There's also the distraction system - distractions are basically smart objects NPCs and the player can use, do an animation at, and/or perform some gameplay function.
Tags help filter when NPCs care about different behaviors. They won't sleep in beds during daytime, only nightime, and shopkeepers aren't going to be cleaning their counters in the middle of the night. My favorite is probably how they puke outside the bar only when they're drunk.
Whelp that's it for now, let me plug my soundcloud etc etc store.steampowered.com/app/1097350/We…

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Borut

Borut Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @plushapo

14 Dec
Now that Weird West dev is slowly but surely calming down a bit I'd thought I'd start some design/tech threads...
The first is about how we can better build game worlds for storytelling - embodied games, where you're a person or thing running around a world (3D mostly but some of this applies to a 2D too). Not all games certainly, but a lot.
"Modern" game engines have not really changed how we build these games in the last 15 years. We can put more stuff in them, and that stuff looks way nicer, but in terms of how the player experience in the world is built, it's pretty much the same.
Read 44 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(