Hi I am looking for a way to put AI in my 2d platforming game. It is mostly going to be used as a survival horror were things chase you on a flat 2d plane like mario. The thing is, I have found one http://www.arongranberg.com/ which uses the A* pathfinding, but I feel that, since I am sort of new to learning this, to complicated. I have made some progress where I can get enemies to run at you but falling down to the ground below and standing right under them they just walk back and forth.
So I would like to know is there any other path finding ai that might be simpler or easier to learn?
Often A* isn’t really the answer to AI in a 2D platformer because you need to define when a path node is going up or down (jump / jump down from a platform). But you could create a waypoint based A* where it is possible to define each waypoint.
A more simple approach could be to tell the AI to go towards a direction and then have collision triggers around your level telling it what to do based on its destination.
when we think about 2D platform games the 2 biggest examples that comes to mind (for me anyway) is mario and maplestory
in mario the enemies move left/right/ hop/left/right and changes direction if hit something
then theres one that throws stuff at you so far nothing really requires much of AI
while in maplestory they just run around randomly. and if you aggroo them they run at you/ run close to you and use an attack within attack range. which still doesnt really have much of an AI. think about what exactly you want your enemy/creature/things want to do and then decide if you REALLY need the AI. or just some simple instructions?
so… if zombies see you. they’re pissed off: run at you/wants to kill you (in sight)
and when you drop down a platform for example they lose the aggro(out of sight) and just wonders back and forth on the current platform/area?or do they go back to where they started?
kinda reminds me of how enemies respond in Mark of the ninja.
Well all I did was put in the A* pathfinding assets and didn’t change it at all, so their is nothing about sights. It’s just that when I go under the object it seems to be updating to find the shortest path to the player. It does make a path that goes to the player but it seems as if it doesn’t follow through and as it updates it finds a different path which makes the moving back and forth movement.
in that case i thnk BFGame’s approach sounds good cause its pretty simple. having collision triggers in the levels so if a player gets away by jumping down a ledge, the zombies would touch the trigger and jump down after him. (assuming this is what you wanted)