Jump to content
  • Advertisement
Sign in to follow this  
twh8237

Arcade game opponent logic / AI

This topic is 435 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi there,

I'm a retro gamer and hobby-programmer. Currently I'm programming a simple Atari game. The programming language is plain C (Ansi-C / C89) . I'm using the CC65-crosscompiler package, but I don't think the platform/language is of big importance to my question.

I'm facing the challenge to program a real arcade game. But I have some difficulties to start on implementing the logic of my opponent "gopher". It's getting more and more complicated and I would like to ask here to get some introduction/best practice from you.

[attachment=35844:reference_320.png]

A little introduction to my game: It's a about a gopher (AI/opponent) who lives in the cave. It's digging in 6 pre-defined slots up to the surface where the the farmer (player) watches his carrots. The gopher wants to steal the carrots. The farmer has a shovel and can hit the gopher while it is on the surface. If the gopher got all carrots, the game is over. If the farmer catches the gopher he get points. The farmer also can close the slots by using his shovel.

So the game itself is pretty basic. But I don't know where to start and how I should construct / define the behavior and map that to actions like left, right, up, down.

Of course the Atari is not a particular AI/algorithm platform, so there must be some basic principles. I just wonder how it could be done using some simple C-control / switch statements.

thanks for any help,
Thomas

Share this post


Link to post
Share on other sites
Advertisement

For example you can have a variable 'target' which denotes the slot which the ghpher currently wants to steal. This value will be randomized each 5 seconds (once per 300 frames on 60 fps). Then each frame when you want to move the gopher, if target slot is right from gopher, move 1 pixel to right, if target slot is left from gopher, then move 1 pixel to left, if the gopher is under the target, then move 1 pixel up. Time to re-randomize target and the gopher speed can be tuned so that the gopher sometimes unexpectedly changes target but is still able to reach some targets. You also want to somehow handle the possible situation, that the random generator selects empty slot.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!