My project is maybe slightly out of the scope of Construct 3, but I'm wondering if anyone else has attempted this or something like it with success.
Basically I have a state machine that worked well when I had all the enemies targeting the same thing (the Player object). My previous state Machine looked like this:
EnemyMob 'EnemyType' var =Goblin
EnemyType 'State' = Idle
Do this stuff
EnemyType 'State' var = Wander
Do this
etc.
This seemed to work okay but recently I have been trying to expand it a bit and make it capable of not just attacking any nearby target in the "Ally" family.
My main issue however is that now that I'm attaching a 'TargetUID' var to the Enemies and making them target a 'MobAlly' with a specified UID, they kind of run each others code a lot of the time. It works fine when there is only 1 enemy I am testing but be the more I add the buggier it gets and the more they stutter around, switching from their target to another Enemy's target.
I'm looking for a way to make these enemies trigger their own events, but I know construct can be a bit limited in the way that it is set up.
Things I've tried:
- Making everything timer based, random(.05,.3) so that the mobs triggered their events somewhat staggered { this helped somewhat but there will still stutters the more enemies were added }
- Making the enemies call Functions that run the code and sending over the UID fingerprints of the Enemy running the code and their 'TargetUID' var {the limitation with this being (as I am understand) you can only run a function once at a time.}
- I've tried some stuff with "For Each" loops but it seemed to make things stutter more often.
Any ideas would be welcome, I have been trying to get a solid foundation for AI in my game leaving it open ended for me to create any allies/enemies, but I've been at a bit of a roadblock for the last 2 days.