Alright. I'm finally getting somewhere with my level code, physics, and... well, I'm still WORKING on my composition stuff, too. But now I'm also starting to work on enemy AI. And here's another spot I'm kind of fresh to.
See, past projects I've worked on include fighting games - which are essentially just really big FSMs, and the AI uses some conditions like player distance or input to determine appropriate responses (some MegaMan bosses do this, too)... and music games, which is really just about lining up targets with precise timing and that's really all there is to it. Making shots doesn't seem any different than making fireballs in SF, either. But making enemy AI for platformer and top-down-adventure games is kind of a different thing; and I could use some guidance - heck, maybe even outright collaboration with.
There's four titles of enemies I'm trying to reasonably replicate here:
200X - a MegaMan knockoff.
Concert of the Damned - something between Zelda II and SotN, maybe a little Shovel Knighty too.
Gentroid - Yet Another Metroid Fangame (there's a good grip of these, it seems - and Cow has the physics/feel to that DOWN! Perhaps I should just step aside...)
...and an as-of-yet-to-be-determined title that's in line with Zelda 1 and/or Gauntlet; maybe a bit Isaacy, but certainly not Isaac. Save for maybe boss influence, we'll see where that goes.
How do some of you do your enemy AI? I know really simple stuff could be handled by my "MakeTarget()" code, but not stuff that depends on terrain contact. "MakeTarget()" is mainly about making basic movement patterns - lateral, vertical, sine-waved values, diagonals, circles or semicircles, that kind of thing.
function maketarget(obj,scr,x,y,xrange or 0,yrange or 0,speed or 0,loop or 0) --x/y position relative to map obj.p.x=((scr\5)*16+x) obj.p.y=((scr/5)*16+y) --set sine motions to control local movex=2*sqrt(xrange)*speed local movey=2*sqrt(yrange)*speed --reverse direction! if (movex=xrange or movex=-xrange or xrange<0) movex*=-1 if (movey=yrange or movey=-yrange or yrange<0) movey*=-1 --diagonals or curves if loop=1 then movex=xrange elseif loop=-1 then movex-=xrange end
So... back at this. Going to go over some of the enemy designs I'm trying to put into this. The bat's a pretty straightforward bat, and there's a few varations of the Metool I'm hoping I can implement - the pop up, pop down kind, the run after the pop up kind, a hop-forward kind, the propeller/flying types (just draw a line on top, really). The Mets can even pilot the mecha suit in the lower left! Anybody who's played 20XX would know how the penguins and beetle things work, although we could also just do a belly-slide penguin as well, and if we do up-and-down pit enemies, I'll probably go with this one. We've got the shield blockers that have become staples since MM4. Off-screen, I have another kind of head and a shield that can be added to the player's body to make drone/humanoid enemies like Sniper Joes.
The wheel/leg enemies you see right by the first head sprites are nice and flexible. There's a lot of cool stuff we can do with those. Octopus Batteries (MM1). A simple spinning wheel that rolls around the level, or traces around platforms like Metroidy things. A stationary or pattern-moving foe that alternates between firing cardinal and diagonal quad shots. Or one that with the same kind of rhythm, can simply shoot straight at the player as the turret does a little spin animation. Then there's also the wall/ground crawler types that can be made by connecting the leg parts next to it.
Finally, towards the lower right, The Fist is a major kind of thing, I think I'm going to focus "final boss" battles, with the different things you can do with it (vertical platform/smash, horizontal platform/smash, moving in circles or semicircles...?). You know, all three of them. Next to that is a saucer-type thing that can be used a number of ways. Flying. Sliding on the ground. Like Big Eye, or with the springboard punch thing above it (looking back at map design, I'm not sure what I was thinking there! Subterranian miniboss that can punch you from below?)... This can also be combined with the leg things by the red wheels, too.
Now... translating these designs to code? Gotta learn to devise a few functions that make this kind of thing easier to manage, and that's where I'm a little lost. Still kind of new to platformer stuff, personally. Apart from the aforementioned head-and-shield, most of "sprite page 2" is made up of weapon sprites, tiles, power-ups, etc., btw.
I figure 200X is the best place to start with this stuff, since this is probably the biggest amount of basic enemy designs in my projects, and in many cases, the simplest ones. Concert of the Damned is gonna be a different beast entirely, and that's going to take something closer to fighting game AI to pull off; but we'll cross that bridge another day.
Those with more experience in this kind of thing: Where do you get the ball rolling on this lower AI stuff?
[Please log in to post a comment]