That depends on what your AI should do. I have a class "enemy behaviour" and each enemy has a list of enemy behaviours (usually: With one entry, but sometimes more than one if I want something more dynamic) and upon creation of the enemy I add the bahviours I want them to have to the character. Regarding enemy hierarchie, I have a class "character" with sublass "AI character" and "Player character", the distinction between different enemies is made via variables, so their looks are stored in a dictionary of tiles and their behaviour as I said is stored in a list of enemy behaviour-objects.
However, if you want to make your AI really dynamic and to be different from level to level, then yes, you'll probably need to build an AI for each level. Typically, in SPRGs, the AIs are not that flexible though. They basically have ~3 different attack patterns and 0-1 defensive pattern depending on the SRPG you look at.
I guess it depends. I mean, a Bandit will act like other Bandits. So I suppose I want the same AI for the same enemy but different AI for different enemies. Like a Knight and Healer enemy won't act the same, neither will a Ranger. But I can't deny that other Ranger variants will probably act very similar to the original Ranger.
Bosses would all have unique AI but that's kind of a given.
I think when I mean't by a "unqiue AI" for each level was that in Game Maker, I'm not sure I would want ObjEnemy to be the parent of ALL enemies in the game.
So like for the tutorial it's just 2 bandits, so maybe I have ObjEnemyTut that just is the parent for the two Bandits. But say I have another level with 3 or 4 bandits, shouldn't I have ObjEnemyLv2? But when I have 3 or 4 bandits, do I make 4 unique Bandit objects that I place in the level? Otherwise if I just place the same Bandit object 3 or 4 times, how does it know which one to select as they're all named the same thing.
Currently I have...
Code:
-ObjEnemy
-ObjBandit
-ObjBandit1
-ObjBandit2
So I assume for this, Bandit1 and Bandit2 would hold... HP, Mana, Lv, Atk, Def, skills, and maybe the actual range of movement.
And ObjBandit would have the actual behaviors of said Bandits.
And ObjEnemy would have the "heirarchy" AI that determines who goes first and such.
Or for levels that have a different objective like the enemies need to attack something specific alongside attacking players.
I guess I'm wondering if that is what I should do.
Yet while this is helpful to decide, I still think my biggest issue is that I have no clear understanding of how to actually write any of this.
Like how does a player move? Well a player spawns objects called: "Ground" (or in simple terms, the blue tiles you select in any SRPG), and then when you select a ground tile, the character moves to it.
The thing is though, is that the "selector" object you control, has no functions when not selecting ground. So already for it, there's that natural "boundry" created.
But how do I make the enemy AI know this? How does the enemy spawn "Ground" tiles and know that it can only move in that range. How do I make it so it doesn't do it instantly? Because code is instant, if I manage to create all of this, how do I make sure the enemy turn isn't instant because it will run through all the code in a second?