Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: MAX_WAIT_TIME and other fine-tuning for interactions  (Read 608 times)

IndigoFenix

  • Bay Watcher
  • All things die, but nothing dies forever.
    • View Profile
    • Boundworlds: A Browser-Based Multiverse Creation and Exploration Game
MAX_WAIT_TIME and other fine-tuning for interactions
« on: February 10, 2020, 06:21:59 am »

Back when interactions were first introduced, the AI would use them quite frequently, whenever it had a valid target.  Later, this was changed so the AI would use them infrequently, except when in combat, when it would spam them whenever possible.

The original way interactions worked could be annoying, but opened up the possibility of creating extremely elaborate behaviors, even entire AI systems, using interactions interacting with each other.  It also made tricks like using a boiling stone as a reaction product to give a unit an interaction more reliable.  (Though allowing reactions to trigger interactions directly so that such awkward workarounds were unnecessary would be a well-received addition.)

Allowing interaction behaviors to be more moddable would exponentially increase the possibility of interesting mods, both for normal spells, and the aforementioned elaborate systems that push the game's potential to its limits.

The changes I'd have in mind are:

Add a MAX_WAIT_TIME to interactions.  It seems that when an interaction is used - or fails to be used - by an AI-controlled unit, the AI sets a random timer on that interaction for when it should try checking for valid targets again.  The timer's min and max values are hard-coded, and can change between versions.  With a MAX_WAIT_TIME tag, the frequency of an interaction's use can be controlled; the random wait time would be set to a value between WAIT TIME and MAX_WAIT_TIME.  Since USAGE_HINTS like ATTACK, DEFEND, and FLEEING separate combat interactions from non-combat ones now, it is not really important to change behaviors in and out of combat; combat abilities can just have lower MAX_WAIT_TIMEs.  (Though a MAX_WAIT_TIME_COMBAT wouldn't be out of place.)

DEFEND and FLEEING both force the interaction to target the user, and GREETING no longer works in combat at all, making combat assist interactions impossible.  Since SELF_ONLY is a tag, this isn't really necessary; DEFEND and FLEEING should target allies in combat as well if SELF_ONLY is not specified.  (A better option would be to make each individual target specified as an ALLY or ENEMY in addition to SELF_ONLY.)

ADV_AUTO would take the use of the interaction out of the hands of the player, causing it to be used automatically as if the player was controlled by the AI.  I'd like this mainly for creating interesting AI systems, but it could also be used in the base game for things like curses or blessings that periodically inflict syndromes, contagious diseases, and all kinds of interesting !!fun!!.

Strik3r

  • Bay Watcher
  • Persistently work-in-progress.
    • View Profile
Re: MAX_WAIT_TIME and other fine-tuning for interactions
« Reply #1 on: February 10, 2020, 07:48:01 am »

DEFEND and FLEEING both force the interaction to target the user, and GREETING no longer works in combat at all, making combat assist interactions impossible.
Actually, that might not be the case. An interesting behaviour cropped up during the development of my mod (HoD), where a Caustic Burrower would target its own mine with an projectile attack.
I used the nearby summon interaction as its template, but i accidentaly forgot to change the targeting hints, leaving it as DEFEND. I fixed it, of course.

Also, i think that this
It seems that when an interaction is used - or fails to be used - by an AI-controlled unit, the AI sets a random timer on that interaction for when it should try checking for valid targets again.  The timer's min and max values are hard-coded
may be the cause for another bug in my mod. (immobile creatures not using their interactions as often as they should in fortress mode)

But, other than that, i like the ideas you've got going on. They'd certanly be useful for modding better interactions.
Logged
NOTICE: If you can't update your profile/signature, stop using a Imgur URL for your profile picture.
Upload it to somewhere else.

IndigoFenix

  • Bay Watcher
  • All things die, but nothing dies forever.
    • View Profile
    • Boundworlds: A Browser-Based Multiverse Creation and Exploration Game
Re: MAX_WAIT_TIME and other fine-tuning for interactions
« Reply #2 on: February 13, 2020, 01:34:27 am »

DEFEND and FLEEING both force the interaction to target the user, and GREETING no longer works in combat at all, making combat assist interactions impossible.
Actually, that might not be the case. An interesting behaviour cropped up during the development of my mod (HoD), where a Caustic Burrower would target its own mine with an projectile attack.
I used the nearby summon interaction as its template, but i accidentaly forgot to change the targeting hints, leaving it as DEFEND. I fixed it, of course.

Sorry, I actually meant that DEFEND would target anyone, including enemies. There is no way to make a combat spell that is only used on allies.

(Well, you can make an ATTACK interaction that makes the target immune to the buff, but this is awkward, unreliable, and doesn't work when there are buffers on both sides.)