I am continuing to create my 5-scene, isometric, sci fi rpg, and now have all of the playable characters properly animated, and the character selection working fine. I have kept the environment simple for the moment, with just a few areas where the characters can’t walk. Raised surfaces, etc., still need to be done. So now it is time to add the 3 enemy AI, one each in scenes 1,2, and 3, the one in scene 3 being the “boss”. I need the playable characters to shoot at the AI, and vice versa. When the AI in scene 1 or 2 is killed, the next scene will need to open. When the “boss” in scene 3 is killed, it will be “game over”, and the “credits” video will play. Not sure whether the “game over” text and credits video should just be done in scene 3, or in a separate scene. But the main thing I need help with right now is the animation for the AI. All 4 of the playable characters have idle and 8 directions. Unfortunately, the only tut I could find for adding AI involves a very basic, top-down (not isometric) scenario, and the AI has only an “idle” animation. Full Tutorial How to setup top down enemy ai gdevelop 5 tutorial - YouTube So, for the moment, my questions are, which animations should be on the AI when I bring them in, and what info from the tut do I need to change to account for the isometric view and more animations on the AI? Also, I should use pathfinding for the AI, correct?
Well, on the animation/graphical side, player or AI doesn’t change a thing, right?
For the events, I don’t think iso should change much, either. The view is different, but it’s still up/down/left/right.
Pathfinding is the easy way to have an AI, yes. But it depends on the behavior you expect. For a patrol going back and forth, it may not be the best.
As I often write: Give it a go, and tell us if/where you get stuck.
Thanks, that makes sense! So I gave it a go, as you recommended, following this tut, which, unfortunately, involves a simpler game than the one I’m making, and is straight top-down, not isometric. Tut I’ve just applied the tut to Scene 1 so far, and I also still have work to do on all the character animations. The blue character, “Angie”, is the enemy AI.
So here’s the result. When you play the game from the beginning, you click on the initial graphic, which opens up a series of cut scenes, then the character selection, all of which works fine. When Scene 1 opens, the chosen playable character is there, basically animated OK. The enemy pathfinding character is also there. Firstly, what is right with her. She does spawn where she is supposed to, and when the playable character approaches her, she goes right to the playable character. Now what’s not right. The enemy is very shaky for some reason, but maybe that’s because she has a walking animation for her idle? Probably related, her walking animation doesn’t move her anywhere… Mind you, I followed the tut exactly, and put only a right direction walking animation on her, in the “0” slot. Her only actual traversing is to move toward the playable character, when it gets close to her, which brings me to the last problem. Once she has moved to the playable character, she stays permanently attached to it. So that’s about it, at this point. Suggestions?
Looking great so far.
But regarding your problem, what should happen when the enemy reaches the player?
Each problem has an expected result and an actual result. You provided the actual result, but you didn’t state the expected result.
The shakiness is due (I assume) to the fact that the pathfinding goes Left-Down-Left-Down-Left-Down instead of the diagonal Left+Down.
In the tut, the enemy character patrols back and forth, then (when the playable character gets within a certain distance) approaches the playable character while shooting at her. If the playable character then backs off (she is faster than the enemy), the enemy AI ceases approaching her and shooting. I would like it to be similar in my game, except that the playable character could shoot back, which isn’t in the tut. I haven’t put in the last few events from the tut yet, because they involve the enemy shooting, and I thought I should get her animation correct first. When the enemy character is killed, Scene 1 will change to Scene 2. How many, and which, animations should I have on the enemy pathfinder character, bearing in mind that she has only a walk right motion at this time, in the “0” slot? Regarding what you said about the shakiness, she currently has no left, down, or left-down animations. I’m assuming I’ll have to include a shooting animation for both characters. How do I get the enemy character to let go, when the playable character moves away? At this time, once the enemy has approached the playable character, she just stays with her.
Well, you need another event with the contrary.
if distance > 200, set variable to 0.
(For that, you can right-click and invert the distance condition.)
How many animations do you need?
That depends on what she does, right?
For movement, four or eight angles is usually the way to proceed, if that’s what you meant to ask. The more, the better it looks, of course, it’s a compromise for size.
OK, thanks! In the tut, for some reason, the enemy just has a walk right animation, and it is in the “0” slot, which I copied exactly. So, from what you are saying, I’ll go ahead and give the enemy AI the same animations as the playable characters, meaning idle in the “0” slot, and 8 directions in slots “1” through “8”.
This is in the example project called Isometric Game.
Yes, this is what I mean when I say my game is more complicated than the ones in the tuts. My idle has 250 frames, and my directional movements each have 85 frames. Do people generally use very basic, pixelated objects with this engine? Anyway, what you said about a trade off in number of animations vs. game size is definitely coming into play. Even though I’ve been optimizing everything, 9 animations for each character, plus the cut scenes & audio is really adding up, so I probably shouldn’t put 9 animations on the enemy pathfinder characters. In this case, I’ll resort to something I’ve used in other creative areas like music & art, and just incorporate the “problems” into the game, which, at any rate, makes it more unique! Thus, instead of shooting as in the tut, I’m going to give this enemy a whip as a weapon. When she comes at the player, the player has to shoot her before she makes contact, or the player dies. This will reset Scene 1. As for the animations, the player will be constrained by obstacles to moving up and right. That means the enemy should only need left and left-down, plus right so that she can “patrol” back and forth. She’ll have no idle. So the only remaining problem is setting up the “patrol”. I made a prior GDevelop game, a first person, “shooting gallery” game, in which the enemy AI runs back and forth, between two columns, as the “moving target”. The only difference is that the AI from the earlier game is a platformer object, not a pathfinder object. Can I use the events from this to set up the “patrol” (basically her idle) back and forth from right to left?
That’s a lot of frames
The games don’t have to be “pixelated”, but they need to be optimized.
Usually, about 12 frames per second should be enough for smooth, but if you want higher res, try 25, that’s the old TV frame rate.
For your patrol, know that you can mix behaviors as you want, but for position behaviors, you should enable only one at a time to avoid conflicts.
I’ve been exporting the idle animations from iClone at 51 fps and the movement animations at 60 fps. For the 3 enemy AI, I’ll try 25 fps, and see how it works out. I’ve attached the events I used in the prior game for the platformer enemy’s repeat back and forth motion. Can I do the same thing for this game’s pathfinder enemy’s “patrolling” motion, but set it between two coordinates instead of between the two objects (columns)?
You can use coordinates or you can use invisible objects, but please try first, and ask next.
That’s how my game ended up full of 200+ frame idles! LOL
This is what I currently have in the events (see attached). The enemy AI, Angie, has pathfinding behavior. She has idle animation in the “0” slot, which is of her cracking a whip. She has walk left, walk right, and walk down left in the “1”, “2”, and “3” slots.
What currently happens, when I hit play, is the first graphic then the character selection both work fine. When scene 1 opens, the selected playable character and enemy Angie are there, both idling (cracking a whip in Angie’s case). When the playable character approaches enemy Angie, she slides to the playable character always in her idle animation, and then stays permanently with the playable character. The last event I put in did not affect that. The playable character does all her animations fine. Regarding the “hoped for” results, I would really be happy with any solution that functions correctly. Angie cracking her whip as her idle, then walking toward the character using her motions, would be fine, so long as the playable character can run away from her (which she can’t at this point), and will be able to shoot at her (once I add that animation and event). Alternatively, enemy Angie “patrolling” left and right with her walk animations, basically as her idle, then flying at the playable character with her whip cracking motion would also be OK. Suggestions?
I don’t see where do you set the walk animation of Angie. Is she in Characters?
The problem is that once pathfinding starts, player doesn’t escape fast enough to get a distance > 300? So you have to adjust speed of one of the two characters, no?
Sorry, my first time doing a character with pathfinding behavior! As you can see, for the playable (top down behavior) characters, I did the events with keypresses for the different directions. There are no keypresses for the pathfinding character, right? So how do I set her animations in the events? I can adjust the speed of one of the characters OK.
I showed you that earlier, see the screenshots and the isometric example project.
Thanks. I saw that little “change animation” blurb now, and did that, though I didn’t add the “+round(Minda.Angle()/45)”, because I don’t know what that is, or how 45 degrees would apply to my situation. At this time, Angie starts out in her walk left animation, but doesn’t traverse at all, except to go to the playable character when it approaches her. As you can see, I tried to have Angie walking back and forth between two objects, as sort of her idle, but it doesn’t happen. When the scene opens, Angie is just idling in her walk left animation, though when she approaches Kristi, if Angie touches the “GoRight” object, she then changes to her walk right animation. From your statement above, I’m not even sure if I should have Angie with pathfinding behavior, as opposed to top down. I changed Kristi’s speed to 200, and Angie’s to 100, as you basically suggested, so now Kristi can escape from Angie, which is correct. If it would be easier than all this going back and forth, I could just post the project on my Google Drive for you to take a look at. It would also give you an opportunity to advise me on saving space, as the project already has very long loading times, and I still have to add the animations to Scenes 2 & 3! I am an artist/animator, very right-brained, will probably never be a competent game developer, and really not looking to do anything beyond creating one playable version of my game concept. Struggle that it is, the game is already more advanced than anything I was able to create in Unreal or Unity. You guys in the forums are very knowledgeable and helpful, but the Youtube tuts are somewhat limited.
You can’t just skip parts like that and expect things to work out by themselves.
You have to open the example projects and mess with them until you understand how they’re built, so you can reproduce them in your own game.
Minda is the character’s name in that example. .Angle() is a function that returns an object current angle, and round() is a math function that rounds numbers.
Now, put the bricks together.
Regarding your left/right problem, you put your Move actions as sub-events of the GoRight collision, so they can only happen at that time, you need to be careful.
Also, the default values of number variables (like your Left) is always 0. You should take that into account.
Have you looked into the extensions library? I made one called “Timed back and forth” or something like that. You choose the time and/or distance the object should travel. Maybe it’s a good fit for your game, maybe not.
To be honest, I’d really just like to be following a tut on making an isometric, multi-level game, with character selection and enemy AI, but it doesn’t exist! So anyway, when Scene 1 opens, my enemy AI (the blue girl) Angie just stays in place, doing her left (walk) motion. I NEED HER TO BE TRAVERSING BACK AND FORTH. That’s all I’m trying to fix at this point. She actually approaches the player (silver girl) character, when the playable character gets close to her. Angie actually switches to her right (walk) animation, if she collides with the GoRight obstacle while approaching the playable character. So, eventually, I want to have enemy Angie patrolling back and forth, then, when the playable character approaches, Angie should go towards her. By the way, Angie has an idle and 3 directional animations.