🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

An idea on RTS Game AI

Started by
11 comments, last by techpage 22 years, 5 months ago
Parralel State Machine? Is that a new concept? I don''t have much real world experience coding AI, and that idea is new to me. I like it =).

So yea lets see.

Economics Engine
Production Engine
Tactics Engine
Military Engine
Recon Engine

could those be 5 Engines that run in parralel?

The recon engine is constantly asking for papers to gather recon on places suggested by the Tactics Engine.
The tactics engine helps the military engine, by figuring out troop placement.. IE, it finds cliffs, and other cover. Military engine sends best units there (you wouldn''t want your melee rock men gaurding a cliff would you?)
The military engine is constantly asking the production engine for more units. And the production engine and Economics engine are exchanging data about how many harvesting plants to build.

so to sum up:
--Economics Engine--
A) Build another harvest station
B) Not Build another harvest station
Uses some basic math to figure out what to do.
Its asking the tactics engine if the new location is defendable or aquirable. The Tactics engine is asking the military engine if we''ve got forces to take/defend a location.

--Production Engine--
A) Queue x Sissors (is Queue spelled right?)
B) Queue x Rocks
C) Queue x Papers
D) Do not construct any new units.
And its asking the military which it needs and the recon if it needs any. Recon asks tactics if theres any places to explore.

--Tactics Engine--
A) Look for unexplored regions
B) Look for advantage regions (cliffs)
C) Look for resources.
The tactics engine contacts production and resources to see which of these it should be doing. If resources are required it will put more prioty on looking for resources.
The difference between this and Recon, is recon mainly deals with exploring out of sight areas, while Tactics deals with exploring known areas.
The reason tactics has no ''Do nothing'' is because scanning your area is a free action. It costs nothing to look around.

--Military Engine--
A) Organize troops
B) Scatter Troops (to defend multiple areas)
C) Attack
D) Do nothing
The military engine relies heavily on recon and tactics to decide what to do.
The reason military has a ''do nothing'' is beacause organizing and moving troops costs time. And there is the chance that units may be stuck marching to another location when they would have been better of had they not moved.
Military also would have a sub system that deals with unit deployment (aka, putting the damage dealing melee ''rocks'' in front behind the papers, and the sissors at a range out of the firefight or on cliffs.)

--Recon Engine--
A) Look for potential Important areas.
B) Do Nothing
The recon engine requests papers to explore with.
It uses a bit of math to find out where to explore
for example, most mappers put miltary start locations as far away as possible, so its a good idea to explore opposite map corners, the center, and half-way points first. Later its important to explore near the enemy base, and near resource points for enemy build up. Later on its important to explore the rest of the black spots, to make sure you haven''t missed any.)
The do nothing is provided, so that during the middle of a firefight, the Recon engine won''t be tieing up the production centers, nor stealing units from the defending military.

I think I may have messed up the idea of Parralel State Machines a little bit... but I think this may work better, and be easier to code.

What do you think?
Advertisement
"Pants" is british slang for lame/crap I think (don''t ask me why).

I''m not sure why RTS AI opponents are so terrible, but I''ll wager it has something to do with AI being so reliant on the rest of the game while having to be completed on schedule at the same time as the game. So the AI programmer has to work his/her ''magic'' on the basis of a half-completed project, while the distributed mass of human ''player'' is working overtime on the finished game.

However if one was able to produce a decent AI, I''d definitely be doing what techpage suggests - limiting the AI''s ''inhumanness''. If you predefine micromanagement strategies, don''t let the computer use them all at the same time. Anyone tried to run over a minigunner with a tank in the C&C series of games ? Maybe allow it only in one area/battle at a time. No need to delay anything.

Most AI programmers probably have the theoretical concepts down fairly well - it''s just that individual games can have some features which are difficult to control intelligently. For instance, the ability to teleport other units would be a nightmare to try to get working as effectively as a human player might use it.
Pants = crap, don''t know why, just is. In the US, pants means trousers, here it means underwear, smaybe that is why?

Parrallel State Machine is a term I made up, because FSM''s as far as I know only allow you to be in one state at a time, so there probably is a better name for it than that, and it''s almost definately a system that''s being used. We want our AI to perform certain strategies at different points in the map.

@Ferretman: With the data gathering technique, I was talking some simple data, so where information is stored on the map about things such as terrain gradient (most RTS games only use up to 3-4 different terrain heights, unless they are fully 3D, I think). So one way we can code this is to have all of that information there already, in a data structure. As we uncover areas of the map, this data becomes available to the AI, so therefore, the AI doesn''t have to calculate the gradients of the whole map as it uncovers it. If we wanted to have the computer cheat a little to improve it, we could have two maps. One has all the data, pre-embedded into it, the AI starts off with a simple map, with things such as water, resources etc already known, then we add more data from the hard copy to the AI copy as it performs reconaisance.

So imagine you have a map, with lots of data, and yo7u put a piece of paper over it, so you can''t see any of it. As you move about the map, squares are cut out from the top piece of paper to reveal the data underneath. And of course, once the AI has been to a particular spot, that data is permanently in his own map, so in effect, we are modelling a simple form of memory too! Except, if the AI finds a good spot, then returns to his base, he''ll remeber it''s there, and when he goes back, it may have some of the humans players on it, there''s no way he could have known that, just like we don''t, because of the fog of war. BUT, if u want to allow the AI to cheat, you can give him superior knowledge on his opponents positions. I don''t know how much data, because of course we would have to ''tune'' the system to make it look reallistic.

Cheers

This topic is closed to new replies.

Advertisement