Simple platformer AI test

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
andrew.207
Prole
Posts: 19
Joined: Sat Jun 08, 2013 7:27 am
Location: Melbourne, Australia

Simple platformer AI test

Post 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
Attachments
AI_TEST_1.2.love
(35.72 KiB) Downloaded 346 times
Last edited by andrew.207 on Sun Jan 26, 2014 10:21 pm, edited 4 times in total.
http://www.atunnecliffe.com/
Bitcoins? 1LHn9yaErCakYD2iGwCyLungiC7ACxRUW8
Germanunkol
Party member
Posts: 712
Joined: Fri Jun 22, 2012 4:54 pm
Contact:

Re: Simple platformer AI test

Post 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...
trAInsported - Write AI to control your trains
Bandana (Dev blog) - Platformer featuring an awesome little ninja by Micha and me
GridCars - Our jam entry for LD31
Germanunkol.de
andrew.207
Prole
Posts: 19
Joined: Sat Jun 08, 2013 7:27 am
Location: Melbourne, Australia

Re: Simple platformer AI test

Post 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**
http://www.atunnecliffe.com/
Bitcoins? 1LHn9yaErCakYD2iGwCyLungiC7ACxRUW8
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: Simple platformer AI test

Post 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
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
User avatar
Gold_Car
Prole
Posts: 27
Joined: Thu Jan 01, 2015 2:07 am

Re: Simple platformer AI test

Post 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. :)
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 2 guests