This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-04-21 20:33:06

THAWKK
New Scratcher
Registered: 2012-02-27
Posts: 37

How to program AI for real time strategy game

I need help with programming an AI for a strategy game I'm making.  Not a perfect AI, but at least a CPU that can analyze situations and adapt.  The game revolves around the creation of military units to conquer the CPU.  If any of you guys know how to do this, please help me.

Offline

 

#2 2012-04-21 20:46:06

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: How to program AI for real time strategy game

We/you need to have a much more concrete understanding of the game before you can begin to make AI for it.  Real-time strategy in Scratch is severely limited (due to speed mostly, but also script complexity) and truly adaptable AI is pretty much impossible no matter what programming language you use.


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#3 2012-04-21 20:50:34

THAWKK
New Scratcher
Registered: 2012-02-27
Posts: 37

Re: How to program AI for real time strategy game

Well, I don't mean a perfectly adaptable AI, just one that can grasp basic situations and decide actions to choose from based on a number of advantages/disadvantages

Offline

 

#4 2012-04-22 04:19:36

JSO
Community Moderator
Registered: 2007-06-23
Posts: 1000+

Re: How to program AI for real time strategy game

What your AI will look like, will heavily depend on the way your game works. You'll have to tell us some more before we can help  smile


http://oi48.tinypic.com/2v1q0e9.jpg

Offline

 

#5 2012-04-22 09:05:28

jasper2428
New Scratcher
Registered: 2012-04-21
Posts: 4

Re: How to program AI for real time strategy game

I suggest you use a bottom up appproach to creating an AI.
Imagine a simple arena that is a tight hallway (so tight you can only move forward and backward) , and there are two *hostile* robots facing each other. The simplest you can do is to let it shoot on sight.

Then imagine a more complex arena, where there are two degrees of freedom, moving left,right, up and down. You could program it to move randomly, and then shoot on sight.

For economy that depends on what kind it is.

Offline

 

#6 2012-04-23 16:30:29

THAWKK
New Scratcher
Registered: 2012-02-27
Posts: 37

Re: How to program AI for real time strategy game

Well my game is based off real time war strategy games.  I need my AI to react to the player's actions.  For instance: the player attacks a CPU controlled territory.  The AI reacts by either fortifying its defenses, or initiating a counter attack.

Offline

 

Board footer