|
|
| 24.02.2008 | Artificial Intelligence | | The last weeks I've been working on a very exciting part of the game - the Artificial Intelligence. Does not mean the pathfinding for soldiers, which has been threatened in the last news, but the CPU players. A proper CPU enemy is very hard to code, since a computer has no intuition, no feeling what's a dangerous situation and what isn't, he just has the pure values (crossing 1: 2 soldiers, crossing 2: 3 soldiers, crossing 3: empty, building 1: powerplant, building 2: farm, building 3: empty field), and does not know the rules of the game. So how to make the CPU play? Without going too much in detail, the concept was very hard to create, since the computer has no goals or needs, and especially it has no overview (example: Why should the AI move a soldier at the start of the game? After copying the human patterns, the AI might think: "There is nothing under attack, there is no need for money, since I still have my start money, there is no need for energy, since I have no energy consuming buildings, and my opponent does not own more of the map than me". So you obviously need to give the AI reasons to expand-)
I splitted my AI think procedure into several blocks, which are destined for several interpretation phases on the field. This allows the AI to flexibly react on what happens on the field. No energy? Build a new powerplant or upgrade an existing one. No field to build on? Expand. Soldier limit reached? Try to conquer a fertile field or conquer enemies farms... etc. And if there's nothing to react, I gave the AI a natural pressure to expand. The defense part of the AI makes sure, that there are enough soldiers in the possessed areas, which can be used for that by the offence AI. But that's just the "thinking", how to solve that technically? The AI creates priority lists of crossroads and fields, which are the best ones to do what. To give you a rough estimation, how complex it is (especially in realtime), I appended a little diagram, which roughly presents the structure of the AI which I made for this game. Just to compare the AI to the one from CS4 (which was roundbased): The CS4 AI was based on two priority lists, one thread, and one heuristic. The CS5 AI is based on 14 lists, 10 threads, and 5-6 heuristics based on the difficulty level of the AI (like performing a rush, etc).
Another new thing we integrated, is the build time. When you create a building, it's a construction site for a while, before turning into the real building, which seems quite natural. On the 2nd screenshot appended you see the construction site. The black buildings are buildings, which lack energy. If you're out of energy and have not enough powerplants to compensate, the energy consuming buildings turn black and lose all their functionality. You can see that better on the 3rd appended building. On the 2nd picture you can also see the AI acting in the background. It expanded very fast and built the needed buildings to survive.
Other new things are just minor and not worth showing here, like bugfixes, overworked build menus, etc.
| |
|
|
|
Statistics
|
| Users Online: | 0 | | Games Open: | 0 |
|
|
|
Latest Updates
|
City Skirmish Test File #3 (13.01.2008) Download - 0.1 MBCity Skirmish Test File #2 (12.01.2008) Download - 0.1 MBCity Skirmish Test File #1 (11.01.2008) Download - 0.1 MB
|
|