#AI Commanding woes

1 messages · Page 1 of 1 (latest)

umbral crown
#

Hey frens I wonder if someone could take a look at some.. interesting hacks and workarounds I had to do in order to get AI Commanding working in Overthrow (essentially recruiting civilian AI off the street into the player's group)

Maybe I'm missing something or have done it all completely wrong but here are the highlights:

https://github.com/ArmaOverthrow/Overthrow.Arma4/commit/a8512d3a40aa538ddd7b9b59f1b64ad43d1a023d#r161594109

It seems that even if I use SCR_PlayerFactionAffiliationComponent.RequestFaction in order to put the player in the CIV faction the client never updates the Player <-> Faction mapping in the faction manager (m_MappedPlayerFactionInfo), which is what the entire AI commanding UI relies on to even display, otherwise ~ just fails silently due to the player not being in the same faction as the AI. So I had to add an RPC call to the faction manager to force this to occur.

I then go about creating a playable group for the player automatically, making them leader, respawning any AI recruits they have saved in EPF and adding them to the group (also enabling their AI of course). This whole process, however, seems rife with race conditions unless I'm just doing it wrong.

its basically the majority of this file: https://github.com/ArmaOverthrow/Overthrow.Arma4/blob/v1.3.0/Scripts/Game/GameMode/Managers/OVT_RespawnSystemComponent.c

You can see me using CallLater a bunch of times in order to make sure the changes I'm doing are replicating to the client before doing the next thing. If I dont do this, I find that the AI just won't respond to commands. They are in the same group, the same faction, the player is leader, and the commands are definitely executed but they just stand there. Even adding brand new recruits to the group can be in this state.

As it stands now, with the code you can see on github in the v1.3.0 branch it works.. 98% of the time. I could maybe get it to 100% or close to that if I extend the delay times out even further, but I thought I'd get in touch to see if there are better options.

Thanking you kindly in advance for any guidance you can provide

GitHub

A dynamic and persistent revolution platform for Arma Reforger (and eventually Arma 4) - ArmaOverthrow/Overthrow.Arma4

#

Oh and somewhat related questions:

Is it at all possible to get the AI to slow down when driving? Im using a Patrol/Relaxed Move waypoint but I can't find any way to set speed limits and they are really heavy on the gas pedal. Patrolling a town full of resistance fighters mixed in with civilians I would think they would slow down, is all.

And is there any handling currently for convoys? Will just putting multiple vehicles in the same group suffice and be effective?

wind vector
#

I would search scripts for cruise, should come up

umbral crown
#

found it, thanks

wind vector
#

Nice! Yeah they don't know how to slow down for turns either, that's why I had to limit their speed. Otherwise they would flip their vehicle at the first sharp turn. 🤣

umbral crown
#

...

umbral crown
true geyser
# umbral crown https://feedback.bistudio.com/T193354

well this should work.
not sure what those mods are doing but vanilla is just fine.

You can see what I do on video. First set speed a bit lower and it react precisely to that value. As I setup 80 it's there for a moment and than it goes lower to be sure it is able to pass the turn on path (marked by cyan 'limit' point on path). When it passes this section it goes to those seted up 80.

#

About groups - I'm unable to check it now if there is something wrong. Maybe @modern hare could help here.

umbral crown
#

unless its getting a weird value from the attribute

#

ill step through and see if I can find out more

umbral crown
#

driving a UAZ469_PKM

#

in general they seem to either have their foot to the floor or completely off the pedal

#

and even with default BTRlike navmesh they will often drive full throttle into walls they don't seem to know exist

#

the only reliable way to use them is point to point on the road network

#

.. but then they will often lose control on sharp corners

wind vector
#

I had the same issue with the armed uaz. AI was always going too fast around corners causing them to flip and abandon the vehicle.

umbral crown
#

@true geyser @modern hare any help here with the group issues? Sometimes the AI wont shoot at enemies with a "fire at will" order and equipped weapon either, could be related

umbral crown
#

I may have worked out the issue with not shooting, as the AIs are in the "CIV" faction so wouldnt be seeing anyone as enemy, but still interested in any guidance about the group and group leader issues were having as they still happen sometimes

modern hare
#

Heyo, sorry for coming in late, can you give me a tldr of what was the original group/group leader issue?

umbral crown
#

It could not be any more succinct than that tbh

#

Basically there are race conditions when trying to set up a player in a group so they can command AI, hacks that I needed to do for it to even be possible to command AI, and sometimes even after all that the AI refuses orders

umbral crown
#

Hey @true geyser do you know of a debug view in game already that would show what group characters/AI are in?

#

maybe like the danger debug view

#

if not I can try make one

true geyser
#

AI->Group members should visualize it