whistlerat, you are such an inspiration to me, seriously. Thank you so much ❤️
This is another design post, on some of the foundations of Menagerie's behavior system. It, uh, came out a bit longer than I anticipated.
---
Recently I've been reading the fantastic
Wobbledogs devlog, and it really struck me how opposite my process is from ActualDog's. I'm an
obsessive planner, which has been to my detriment more often than not. Partially, this is lack of experience, and I expect it'll get better with time. But I think it's also a natural tendency -- something I'll have to work on.
Menagerie's behavior system is so complex that it will both take forever to plan thoroughly
and be highly dependent on iterative development anyway. And that makes the prospect of actually implementing it totally paralyzing to me. As a result, I've spent a ton of time goofing around with way less critical stuff like data loading and worldbuilding. It's high time to get back on track!
So I've been working on breaking behavior down to the simplest possible functionality. To start with:
when a monster is dropped into a totally empty void of existential dread, what does it do?Normally, monsters will check their surroundings for Entities (that is, Objects, Items, and Monsters) that they can interact with, generate a list of possible Actions they can perform with each one, then evaluate all those Actions based on a utility calculation. (Or at least, that's the idea.)
This is basically a freakish hybrid of a general
utility-based system, where each Action has its own predefined utility formula based on the agent's
current state, and a Sims-esque
needs-based system, where Entities advertise the
effects they might have on an agent's state and then the agent chooses the most lucrative result. (There's an important dichotomy here: present versus future. I think we will need aspects of both.) On top of that, Actions themselves should work like little behavior trees -- most of them are composed of other, simpler Actions, and complex ones like "play tag with <target>" might have a lot of logic inside.
(Then there's interrupt handling, which is super duper important for realistic creatures. I've got a plan for this, but I'm sure there will be a bunch of obnoxious cases I haven't thought of, so we'll have to see if it will actually hold up.)
Anyway, back to the void. There are always a few actions we can take that don't depend on other Entities. For now I've identified three: SLEEP, WANDER, and IDLE. (There is potentially a fourth, REST, though I might be able to finagle it as a subset of IDLE. Similarly, we should be able to WANDER at a run instead of a walk, but that also applies to the general case of movement.)
So, we're a monster in an empty void. How do we decide whether to SLEEP, WANDER, or IDLE?
...
(Here's where I fill another 7 pages of notes trying to answer that basic question.)
The important thing is that
even in an empty void, a monster's personality should
noticeably affect the way it behaves. In other words,
the choice between SLEEP, WANDER, and IDLE must be nontrivially influenced by our traits.
I floated a bunch of stuff, like a BOREDOM drive and/or a CURIOSITY trait that affects how quickly the pet gets bored, and based on that how likely it is to WANDER around looking for stuff to do versus IDLE vacantly. But I think this might be overkill, at least for this situation. After all, in an empty void, just about any intelligent creature should trend toward maximum boredom.
What it comes down to, I think, is really just
ENERGY. Some monsters (read: pets) will prefer to move about often, and others will prefer to sit there and stare out the window, or sleep for 20 hours a day. There really isn't much else you can do in a void.
I mentioned that traits affect drives. The
EXTRAVERSION trait is a good example: in my notes, I wrote that it should affect the pet's desire to socialize
and also the "amount" of socializing necessary to meet that desire. So you can have a pet that's oversocialized, which will make it unhappy, and this will happen more often for introverted pets.
Esseintally, here are two different kinds of effects on the SOCIAL drive: one, an ideal threshold, more than which is "too much" -- I call this the
equilibrium. And two, the rate at which the drive changes. A drive is a meter that can be anywhere between full and empty; the more extraverted the monster, the faster its SOCIAL meter will decay, and the more socializing it will take to fill it again.
Most drives decay naturally with time -- monsters get hungrier, lonelier, and less happy. ENERGY is a little more complicated, since its rate and direction of "decay" depend on what the monster is doing. Its ENERGY should
decrease slowly while it's walking and quickly while it's running; it should
increase slowly while it's idling (or resting), and quickly while it's sleeping.
I had already planned for the "decay" rate of ENERGY to be modified by the monster's
VIGOR trait, on top of the effect of whatever it's doing. High VIGOR makes a monster lose ENERGY slower
and regain it faster. (Realistically, the fullness of a pet's BELLY should affect the decay rate too -- and all of these multipliers need to play nice together...
)
But I didn't have anything affecting
equilibrium of ENERGY -- it didn't occur to me, because I hadn't really thought about equilibrium that way yet. So I added
PEP, a trait that determines how active your monster is, by affecting its ENERGY equilibrium. And suddenly a whole range of personality opens up, based around PEP and VIGOR:
A monster with low PEP will have a
high ENERGY equilibrium, which means it's happiest when it has lots of energy to spare. If its VIGOR is high, it'll be somewhat active, since it can gain back whatever ENERGY it spends relatively quickly. But the lower its VIGOR, the harder it is to maintain that high equilibrium, and the lazier it will be.
A monster with high PEP needs to maintain a low level of ENERGY to be happy, so it will regularly be motivated to exercise. If its VIGOR and PEP are both high, it'll constantly be active -- it won't even need much sleep. If its VIGOR is low, it won't have to exercise
often, but it will still have to do so
consistently.
So why use two separate traits, you ask, when one is enough for SOCIAL?
Because even though all traits are supposed to be malleable, some should be more so than others. The human equivalent of VIGOR would be physical health, while the equivalent of PEP would be a
preference for activity. One is way easier to change than the other, in the game as in real life -- VIGOR is naturally increased by
doing cardio expending ENERGY. (This also means that a high PEP monster should naturally trend toward high VIGOR over time, which I think is pretty neat.)
"Vigor" is also more
quantifiably useful than "pep", and that matters too. As a gameplay incentive for all the discipline stuff you can do, Menagerie has a framework for evaluating monsters:
attributes, which are
visible indicators of related groups of traits. VIGOR in particular contributes strongly to the attribute of
VITALITY, along with the traits STRENGTH (improved through
deadlifting certain activities) and SIZE (improved through good feeding). In fact, some traits
mostly exist for the sake of attributes.
Attributes have their own relevance, of course, but that's a different topic...
(Edit: Oh, and by "visible" I mean, like, there's a section for attributes in the "monster details" menu, where you can check its birthday and preferences, edit its name, stuff like that. Not that its sprite grows huge muscles if its VITALITY is really high or something, although that would be rad.)