goldensun_html5 icon indicating copy to clipboard operation
goldensun_html5 copied to clipboard

Build Enemy AI in battle.

Open jjppof opened this issue 4 years ago • 4 comments

jjppof avatar Oct 27 '20 02:10 jjppof

Some monsters have their own AIs; how are users of the GSHTML5 engine to create custom AIs without coding? And how is the engine to incorporate their scripts?

MilesBHuff avatar Apr 14 '22 03:04 MilesBHuff

There's no spec for this. Everything needs to be thought. And yeah, I reeeeally want to avoid users writing code, need to think of a system that allows having different behavior for enemies without coding.

jjppof avatar Apr 14 '22 12:04 jjppof

Maybe pretend it's Pokémon? Allow users to select 4 moves for each monster. In the code, each move can be classified into damage vs status vs healing. The AI can cleverly attempt to use moves that are strong against an enemy's resistances ("type", in Pokémon terms), and AI will prioritize using status effect moves when no enemy has that move's status. Whenever an AI's party member is at or below 1/3 health, they will prioritize healing that party member with their best-available heal. Enemies with a healing Psynergy will not use damage or status Psynergies if doing so would lower their PP by enough to prevent the use of their healing Psynergy; they will instead use physical attacks. AIs in a team that has a healer will guard when low on health, in hopes that a teammate will heal them. As for target selection, the AI could either select at random (and then pick the best Psynergy to use on that target), or the AI could select a move at random (and then pick the target that is the best pick for that move). Another option, is to choose the target with the lowest HP for damage Psynergies. In any of these cases, we could make it so that the AI doesn't choose the same move twice in a row unless they have to; just for the sake of variety -- although this has drawbacks.

MilesBHuff avatar Apr 14 '22 14:04 MilesBHuff

Yeah, those are all valid points. Whenever someone starts doing this, we can precisely define what we want initially based on your comment.

jjppof avatar Apr 14 '22 14:04 jjppof