Page 1 of 1

Simple platformer AI test

Posted: Sun Jan 26, 2014 6:09 am
by andrew.207
Hi friends,

I'm trying to make some sort of AI for a basic platformer. Essentially what the AI is trying to do is jump on the player's head.

My code so far is horrifyingly convoluted and ugly, but it works. It will be cleaned up eventually.

I'm just posting it here hoping to get some feedback on how stuff works, what I could do better. At the moment one of my strongest focuses is on efficiency, so the AI (very obviously) only updates pathing when it has moved a significant distance. The terrain is going to be dynamic and changing constantly, and the target is going to be moving constantly.

There is one blatantly obvious bug that I'll thank you not to call me out on -- when you are standing under an enemy who is on a platform above you they'll just hover left and right without jumping off the platform. Feel free however to offer a fix for it. My brain has just melted from coding for too long, so I can't do it now.

See gif here: (NOTE: FORUM CSS MAY CUT PART OF GIF OUT. GO HERE FOR FULL GIF)
Image

See attach for .LOVE.

Buttons:
  • Arrow keys: MOVE
    X: JUMP
    Q: RESET PLAYER LOCATION (won't reset AI)
[/list]

Updates:
Made players and AI different colours
Added head-jumping and made it work
Added scores

thx for looking
pls to doge tip DEZUmeevfRQeZKU2oDgLeNg6ALPjouyT5J

Re: Simple platformer AI test

Posted: Sun Jan 26, 2014 12:25 pm
by Germanunkol
Yay, jump n' bump!! :D

One of the best games ever. Your version looks solid. Are you really going to make it into a jump n bump clone, or is the similarity not intended?

Seems to work well so far, apart from the problem you already mentioned.
I'm not really able to jump on the enemy's head though - if this is goal of the game then you migth need to make it less perfect later on. It's hard to tell though, without hit boxes. Maybe I did hit him after all...

Re: Simple platformer AI test

Posted: Sun Jan 26, 2014 9:37 pm
by andrew.207
Rofl I've never heard of Jump n' Bump, but I suppose it is similar to that game.

It was meant to be more of a Super Mario War clone, but doesn't really matter.

Good to have some constructive feedback. I intend to have players bumping each other from all edges, with a top edge / bottom edge bump (jumping on head) being the kill. Also Mario sprites.

**UPDATED IN OP**

Re: Simple platformer AI test

Posted: Thu Mar 06, 2014 11:24 pm
by Positive07
Just a little error:
change

Code: Select all

love.event.push('kill')
for

Code: Select all

love.event.push('quit')
Its an awesome AI althought it is jumping all the time but I dont think that its a problem so it's great

Re: Simple platformer AI test

Posted: Sun Jan 11, 2015 1:25 am
by Gold_Car
Nice. Avoiding the red box is pretty fun, he reminds me of the Yeti from SkiFree for some reason. Unlike the Yeti, however, he has one weakness.

The Yellow box on the far right has a few boxes next to and above it. If you stand on the middle one, he jumps on the box right above it and just wiggles about, unable to catch you.

However, the Rectangle of Red is a worthy adversary and a formidable combatant. Defeating him is beyond my skillset (partly because I don't understand Jump 'n' Bump).

Also, the game does that bluescreen thing when you press Escape.

I actually quite like this game, and I think it has a lot of potential. I can imagine playing a Sonic clone where you're constantly running from this evil red rectangle, but I suppose that's just my imagination. :)