#26 22.05.2005 16:58:43

Registriert: 01.05.2005
Beiträge: 94

Re: Einheiten-KI im Strategiespiel

Mach verschiedene Schwierigkeitsgrade!

Leicht: Analysiert nicht viel und macht einige Fehler (z.B. Turm feuert einfach auf irgendwen, nicht auf stärkste oder so)

Mittel: Versucht, so stark wie der Spieler zu sein

Schwer: Will auf jeden Fall gewinnen



#27 22.05.2005 17:04:49

Ort: Erlangen, Bay
Registriert: 24.01.2005
Beiträge: 694

Re: Einheiten-KI im Strategiespiel

hier noch was schönes:

There are three important things for an AI to know in an RTS game.
How many units does my opponent have? How much units will my opponent have? And where are they right now?

Army strenght is indeed the sum of all units but the strength of an individual unit varies over time. A unit all by itself is much weaker then a unit in a group of units even if it's the same unit!
So a group is stronger then the sum of it's units and an army is stronger then the sum of its groups.

You can reflect this in an heuristic algorithm by adding an extra value on top of the base unit strength. This value will be the total sum of the inverted distances this unit has to any friendly units within a fixed radius.

So: Army strength = E(base unit strength + E(1/distance to friendly))

Note that this is still simplified as most RTS games usually have a paper, rock, sissor system which modifies a units potential strength even more.

Up next is the location of enemy units itself. Basically what you need to do is identify locations that are critical towards the desired win/lose condition. And then calculate how close by enemy units are (with once again the value shift for groups taken into account).
So: Location dominance = E(1/unit distance to critical location + E(1/distance to friendly)

Last we have the potential (not existing yet) army which can be extrapolated from info regarding resources. If the AI knows its opponent controls two resource patches and spotted the amount of harvesters it can determine how much resources the opponent has stored in the bank so to say. Resources that aren't harvested yet are controlled and not owned.
Resources Owned = Income per second*Elapsed Time (in seconds) - observed enemy army cost.

Note that this assumes exact knowledge of resource costs for enemy units.

So the total sum is: Army Strenght + Location Dominance + Resources Owned

Army strength: More units is better, especially when close to each other.
Location Dominance: Having units near important locations is better.
Resources Owned: Having more resources available for spending is better.

Note that Army strength and Location Dominace are related with a negative correlation. If an AI groups all it's units into a single group it has high army strength but low location dominance if there are several critical locations. If only one critical location remains this algorithm will still display the proper behavior (massing all units for the final strike).

klingt ganz vernünftig. Ich denke ich werde das Lernen auslassen wink
Wie kann ich auf der Basis dieses Artikels jetzt eine KI schreiben?

(außerdem habe ich meinen A* so modifiziert, dass er Nebel des Krieges erkennt. Wens interessiert wie meldet sich.

mfg Chris

Nimm meinen Rat an - ich brauch ihn sowieso nicht



#28 22.05.2005 17:32:31

Registriert: 01.05.2005
Beiträge: 94

Re: Einheiten-KI im Strategiespiel

Also, ich würde das Schere/Stein/Papier-Prinzip weglassen, das sorgt imho nur für Verwirrung. Mehr kann ich dazu leider auch nicht sagen.



Brett Fußzeile

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson