I have two state machines. They are pretty much the same. I have two AI players. One state machine for each player. The state machines are for base building.
I have three maps. One map for AI player 1 and one map for AI player 2.
Because the state machines are identical the base building takes place the same for both players. They evolve the same at the same time.
On the third map I have a third player.
Player 1 has advanced AI or emergent AI. Player 2 is scripted.
Player 3 doesn't see what the other two players are doing. It has a limited base building state machine. Player 3 is a limited sincronization with Player 2. Player 3 is what player 1 is seeing that player 2 is doing. When the player 1 sees player 2 units the units that are spotted are sincronized on the third map everything else on the third map is run by the third limited state machine.
Map 1 and map 2 is the same map. They`re more like viewports. Map 1 is for displaying what player 1 is doing and map 2 for displaying what player 2 is doing. Map 3 is the same map with map 1 and 2 but it doesn't have players 1 and 2 it has player three which is a partial sincronization with player 2. Map 3 helps player 1 understand what player 2 is doing.
Here`s an example. The game begins. Player 1 workers begin mining minerals, they are visible only in Viewport 1 or Map 1. Player 2 workers are also on Map 1 but they are not visible. Player 2 workers begin mining minerals too, they are visible only in Viewport 2 or Map 2 . Map 2 has also Player 1 workers but they are not visible. Player 3 workers begin mining minerals they are present only on Map 3. Map 3 doesn't have Player 1 or 2 units. Ok. All 3 players are mining minerals. Player 2 workers cease to mine minerals and move to the side. Player 1 and 3 keep mining minerals.
Player 1 sends a worker to scout the map. Player 1 discovers Player 2 base. Player 2 base becomes visible in Viewport 1. Player 1 scout worker observes that Player 2 workers are missing from the resource extraction site. Player 3 workers cease to extract minerals. If Player 1 scout worker notices where Player 2 workers have moved Player 3 workers are placed there, if not player 3 workers are placed at a random location on map 3 where Player 1 scout hasn't been yet ( it's not really a random location, you can apply some common sense rules: the workers are not scattered all over the map but rather located somewhere as one compact group )
When Player 1 attacks Player 2 with he will use as a reference Player 3 units. Player 3 units are visible to player 1 at all time. For “play with fog of war disabled” scenario it's easy to create an AI player that behaves like a human player, all the AI player has to do is avoid the enemy defenses and attack the workers/weak spots. In this blog entry I'm trying to explain what can be done when fog of war is enabled. If workers are missing from where you think they are you place them somewhere else in your mind until you know better. Same thinking applies to combat units if they are not where you think they are you place them in your mind somewhere else ( in this entry the mind is Player 3 ).
When the game starts the enemy combat units (Player 3) are produced and remain in Player 3 base. That is if you haven't explored the map yet. When you have discovered the enemy (Player 2) base and spotted some enemy combat units. If the number of spotted enemy combat units matches the predicted number of combat units produced ( Player 3 produces workers and combat units based on a script regardless if you visit his base or not, what Player 3 does is the “prediction”) all enemy combat units are sincronyzed. If what is spotted in Player 2 base is less than what Player 3 has produced (I mean combat units here) the extra Player 3 units are placed somewhere else out of sight. If what is spotted is more the evolution of player 3 hasn't been accurate and he needs to be restarted and run again (on fast forward) keeping count of new data available. This was combat units. If less workers are discovered than what was predicted Player 3 needs to be restarted and produce less workers.
When the number of combat units is less than predicted it means that the enemy is building an expansion (by default Player 3 evolves without an early expansion ). In this case the message is “attack now or build an expansion too”(it also means you should scout further the rest of the map to discover if the “enemy is building an expansion” assumption is correct). You don't need to run Player 3 “into the future” (faster than real time) to see what the current state of Player 2 means. Less combat units than predicted might be caused by the fact that Player 2 is not playing too good but you're preparing for the worst scenario.
Hey fren…I'm following your progress. Keep up the good work.
BTW, you probably don't want to click that. Just saying.