Everyone keeps asking me about skirmish AI that builds bases, despite me saying it can't be done. So let me explain, once and for all, and in great detail, why it can't be done.
First of all, we'll look at how it is done in the campaign. As you probably know, the AI builds, or at least rebuilds, buildings in the campaign. However, let me go right ahead and crush any illusion that this would imply that the C&C95 AI knows, in any way at all, how to build bases.
This is what the base building AI in C&C looks like. This piece of text is taken from GDI mission 3. Now, it's not immediately clear from these values, but, once converted to hexadecimal, you can see they're just X and Y coordinates of the locations where the buildings should be built. If we decipher that block of ini code to readable language, we get this:
Priority of (re)building structures:
1: Tiberium Refinery at X=31, Y=28
2: Tiberium Silo at X=31, Y=26
3: Tiberium Silo at X=33, Y=26
4: Hand of Nod at X=24, Y=26
5: Power Plant at X=29, Y=26
I say "(re)building", because this system can also be used to build new ones. As long as the structure isn't there, it'll try to build it.
Now, let's take an actual screenshot of the base, and see which buildings that are.
It should now be clear that the C&C1 AI, even in missions, can't do anything but build buildings which are already listed for it. The only actual 'intelligence' involved in this process is that they don't attempt to build the building if they already have it standing there.
On to the original point: Skirmish.
As you see, the C&C95 AI has no base planning logics whatsoever, which means that the only plausible way building bases in skirmish can work, is by editing multiplayer maps, adding such a [BASE] section, and giving the AIs construction yards to build from.
But then, of course, you're heading into mission making territory. You can't go adding structures and mission scripting to a multiplayer map, and expect them to magically disappear just because you didn't tick the "AI players" option. If you play normal LAN games on the same map, those construction yards will still be there, and so will the scripting that lets the AI build stuff.
Now, with the hacking I can do, I might be able to make the AIs spawn MCVs in multiplayer games, just like all other players, and I might even be able to give them a Deploy command, but it definitely won't be smart enough to move that MCV to a place where it actually has enough space to deploy, or even to move its units out of the way to give it enough space.
Bear with me though. Even if none of that would be a problem, imagine playing a game against two AIs that build bases. Their buildings are all programmed into the map with a [BASE] section. So, logically, that would mean they can build everything just fine, right?
Wrong. You might have noticed, the BASE section is missing something. One small detail that is crucial to allowing multiple AI players to use it.
The buildings in the list have no owners.
The results of this get rather bizarre. I told you that AIs don't attempt to build the building if it's already there. This ONLY applies if the building that's already there is their own building, of course. Capture one, and AI units will rush in to destroy the obstruction so they can rebuild it.
Now imagine, if you will, a [BASE] list with the complete layouts of two AI bases. Say the AI players ingame are green and gray. The list has power plants, refineries, silos, troop production, everything needed for both bases.
Then you look at how it works in reality, and you see that both bases have a mix of green and gray buildings. In fact, the gray one is building Obelisks while it doesn't have enough power to make them work, because the green one has claimed some of its Advanced Power Plants from the [BASE] list. The green player, after building those power plants, seems to have stopped building completely, because Gray has meanwhile built the refineries for both bases, meaning Green has no money left.
What you'd get, when looking at one of the bases, would be something like this:
If they are enemies, they'll also be busy trying to destroy as many buildings as possible from the other AI because they obstruct their building plan. And no matter whether they are allies or enemies, you can expect to destroy a gray building and immediately see a green one pop up in its place.
So, let's sum up what we got here, all right?
- The base building AI in C&C is 100% scripted. There is no logic anywhere in the game for intelligent planning of a base.
- Maps with skirmish scripting and AI construction yards would keep those things when playing normal multiplayer games, meaning you can't disable the AI players on these maps.
- Even though the rebuilding logic can be used to make an AI build new buildings, and thus, entire bases, it fails spectacularly once the mission has multiple AIs that own a construction yard.
I'll add another one to that. I'm programming in bytes. In bare CPU commands. What I use can barely be called a programming language; it's just checks, jumps and byte manipulation.
In other words, it is not the kind of programming environment that would allow me to program, say, a base planning AI. And even if it was, we'd be talking about such a complex piece of programming that it'd take me years to do. That 'little feature' people keep requesting from me happens to be the one major difference between the C&C1 and the RA1 game engine. The Red Alert base AI was rewritten from the ground up; I can't just 'patch' that in.
Another grave misconception is that I could just 'copy it from Red Alert'. It doesn't work that way. I remember, back in the early days of this hacking-to-upgrade stuff, it took the RockPatch team about three months to successfully copy a superweapon from Tiberian Sun to Yuri's Revenge. Now, in our case, we're not talking about a single superweapon. We're talking about a core mechanic of the game, with dozens of functions all tightly linked to each other, and all optimized towards Red Alert's internal workings. It'd be madness to even try that.
So there you have it, folks. I hope this clears up why I get frustrated every time someone asks this question, and why the answer is not a simple satisfying one-liner I could put in the FAQ. But for the record, let me sum this entire article up for you in four little words:
It Can't Be Done :)