The Past Ain't What It Used To Be... The first Command & Conquer received its last official update on the 21st of June, 1996. Since then, the game has been ported to Windows (as "Gold" version), and re-released in the big "The First Decade" collection pack, but has never received any more bug fixes. The C&C Gold Patch 1.06 project aims at bringing this classic into the new millennium, by fixing the old bugs, supporting higher resolutions, and adding new modding and mapping possibilities. It also contains an addon-based language system, allowing anyone to create translation packs for the game.

Report article RSS Feed Base building in C&C95 Skirmish

A study of the plausibility of implementing base building skirmish AI into C&C95. (hint: It Can't Be Done)

Posted by Nyerguds on Apr 12th, 2012
Article

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.

Exhibit A:
[Base]
004=NUKE,436215040
003=HAND,436213760
002=SILO,436216064
001=SILO,436215552
000=PROC,469769984
Count=5

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.

Base

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:

Mixed base

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?

  1. The base building AI in C&C is 100% scripted. There is no logic anywhere in the game for intelligent planning of a base.
  2. 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.
  3. 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 :)

Post comment Comments
23-down
23-down Apr 12 2012, 10:56pm says:

Well then it's time for you to enhance the game engine code itself Nyerguds. :P

Nah it's ok Hihi.... for ai games people also always download some other TD mods for red alert1 Tiberian Sun etc.. So it shouldn't be that bad. Eventually you should list such mods on your website.

Wanna have TD skirmish games?
Then go ahead and download this & that etc for following C&C games.

+3 votes     reply to comment
Nyerguds Author
Nyerguds Apr 13 2012, 7:17am replied:

Yeah... there are two excellent C&C1 mods for Tiberian Sun, <strong>Return of the Dawn</strong> and <strong>Dawn of the Tiberium Age</strong> (both of which I contributed to) which copy C&C1's gameplay very well. I've had tons of fun in skirmish and online play on those :)

+2 votes   reply to comment
stalkerforever
stalkerforever Dec 19 2012, 1:00pm replied:

can i play this 1.06 with those that dont have it? and if i want infantry to be oversized (vanilla) do i reinstall the patch?

+1 vote     reply to comment
Nyerguds Author
Nyerguds Jan 20 2013, 9:09am replied:

You're thinking of Red Alert. C&C95 never had that oversized infantry.

And the entire online community on CnCNet uses the patch anyway.

+1 vote   reply to comment
stalkerforever
stalkerforever Dec 19 2012, 1:16pm replied:

btw, can u make the migs shoot air and do more damage to ground? cause now theyre pretty useless just like the scouts in starcraft

0 votes     reply to comment
Nyerguds Author
Nyerguds Jan 20 2013, 9:10am replied:

Again, you're thinking of the wrong game. This patch isn't for Red Alert 1. I don't work on RA1, and RA1 has perfectly working skirmish anyway, so this article definitely isn't about RA1.

+1 vote   reply to comment
OrangeNero
OrangeNero Apr 13 2012, 12:45am says:

I hated the AI base building in missions. Out of nowhere it would rebuild its obelisk in an entirely destroyed base. I had to block the spots with silos or walls. Thinking of it C&C always had a poor and cheating AI.

I wouldn't see the point in working at this anyway, seeing there are total conversion mods for this game on Tiberian sun with a working skirmish AI, even standalone.

+4 votes     reply to comment
Nyerguds Author
Nyerguds Apr 13 2012, 6:46am replied:

Well, it's not really cheating, but more 'compensating for a severe handicap'. The rebuilding system made the AI's base building behaviour horribly predictable, and you usually only have to block one building spot to prevent it from rebuilding anything, since it still has that building ready and is attempting to place it on that blocked spot. The only exception to that behaviour seems to be if another building spot of the same building type is also free, allowing the AI to place it there. It'll never cancel a building and try to rebuild something else, though. That rebuilding priority list is followed really strictly.

In fact, in some missions, like one of the three varieties of GDI #15, Nod builds an outpost close to your base with this system, in an attempt to harass you. In reality, you'll obviously be forced to destroy or capture the thing and block it, thereby blocking the base rebuilding system for the entire rest of the mission.
Nyerguds.arsaneus-design.com
(the cyan buildings, bottom middle, are the unbuilt ones on the rebuilding list)

Another one like that is the Covert Ops mission 'Infiltrated', where blocking off the one turret popping up in your base (I typically build a repair bay over te spot) has the same effect.
Nyerguds.arsaneus-design.com

+3 votes   reply to comment
OrangeNero
OrangeNero Apr 13 2012, 10:49am replied:

it was that mission which drove me nuts. As I remind it I had to capture all the buildings in the middle base and block the spots of the defenses.

+2 votes     reply to comment
Nyerguds Author
Nyerguds Apr 13 2012, 1:33pm replied:

Admitted, the 2 CYs in that mission made it quite a bit harder... and IIRC they even rebuilt the CYs. Can't call that anything else than cheating, yes :p

+3 votes   reply to comment
chr1sto
chr1sto Jul 26 2013, 10:01am replied:

I used this tac in the last gdi mission with the first gun turret.
Youtube.com

+2 votes     reply to comment
Valherran
Valherran Apr 13 2012, 1:53am says:

Actualy, someone did manage to code the AI to build bases back in 1998. Problem was though, it was an addon file and to play with other people against that AI, they could only do it via LAN. This also happens to be the same guy who managed to make a trainer that had code option that weren't in the other, namely that regeneration option that we talked about a few months back.

+2 votes     reply to comment
Nyerguds Author
Nyerguds Apr 13 2012, 6:38am replied:

That 'addon file' was just a co-op map, then. As I said, a multiplayer map with base building AI programmed into it is perfectly possible, as long as it has a pre-placed construction yard (or heck, an entire pre-placed base), and there's only one AI with a base. The thing about multiple base-building AIs screwing up applies to normal single player missions too anyway.

And yes, playing multiplayer maps without other players wasn't possible before my patch. And even with my patch it's only possible if AI players are enabled, which is probably not ideal if there's an AI with a base in there already, since it spawns extra AI units.

+2 votes   reply to comment
Trailhog250
Trailhog250 Apr 13 2012, 3:37pm says:

I would actually find it quite entertaining and amusing to play against 6 AI's all 'building over' each other. But it would be pointless, they would not even be able to build a proper base much less coordinate an attack.

Thankfully, making a mission is quite easy. You can export a map from the campaign and erase all the units, buildings, triggers, etc. add some more Tiberium and easily make a 'skirmish game'. All that could be done in under about 30 minutes properly. Might not be incredibly challenging, but it'll be a skirmish of sorts.

You could even make 'survival' maps rather easy by giving the AI ridiculous amounts of refineries, harvesters, and Tiberium. Any one still playing C&C 95 today shouldn't have too much trouble learning how to make a map and program a quick 'skirmish' game. Nyerguds even has a comprehensive guide he compiled some time ago about creating a 'mission'.

+2 votes     reply to comment
Nyerguds Author
Nyerguds Apr 13 2012, 5:34pm replied:

Well, for the closest approximation of Skirmish, you can also just take any multiplayer map, put an AI base and some attack teams in it, and a player-owned MCV with some units, and put it in the New Missions list as new addon mission.

But as I said in the article, then you're simply in mission making territory, and that's not what this article was about.

Though if anyone wants to make such a Skirmish Missions Pack, they're more than welcome to do that :)

+3 votes   reply to comment
akhero47
akhero47 Apr 28 2012, 6:42am says:

I've always wondered though, would it be possible to completely wipe the C&C95 AI and rewrite it based off of the RA AI? I would fail miserably at such an attempt, but I have always wondered if it would be possible..

0 votes     reply to comment
Nyerguds Author
Nyerguds Jun 25 2012, 5:27am replied:

I addressed that issue in the article. It's the line saying "I'm programming in bytes" -_-

+1 vote   reply to comment
Milanium
Milanium Oct 7 2012, 3:26pm says:

So finally you must admit that the Open-RA.org project is superior to a patched C&C95 :) By the way a new BetaAI is work-in-progress at Github.com discussed at Sleipnirstuff.com

0 votes     reply to comment
Nyerguds Author
Nyerguds Nov 30 2012, 4:17am replied:

I'll do no such thing, for the simple reason the C&C95 mod of OpenRA simply -isn't C&C95- :p

In fact, besides the graphics, it doesn't even seem interested in keeping it close to the original game feel (even for RA1). To the point someone who got tired of that is making a specific 'classic feel' mod for it now.

+1 vote   reply to comment
chr1sto
chr1sto Jul 26 2013, 10:19am replied:

OpenRA has quite different game mechanics. As I said before, it might be more similar to starcraft than c&c95 if we consider the game mechanics. I guess, the Dune mod in OpenRA is the most similar to the original Dune2000 (comparing with the similarity between the OpenRA c&c games, and the original c&c games).
I dont say that OperRA is out of my interests, but it is not an excitement compared to the original c&c games. However, I like the linux support in it.

+1 vote     reply to comment
stalkerforever
stalkerforever Nov 1 2012, 11:22pm says:

can we play skirmish in this patch?

+1 vote     reply to comment
Nyerguds Author
Nyerguds Nov 30 2012, 4:16am replied:

Yes, by starting a LAN game without additional players, but with the AI players option enabled. As the article shows, though, the AI can't build bases.

+1 vote   reply to comment
chr1sto
chr1sto Jul 26 2013, 9:45am says:

In this mission, AI doesnt have advanced guard towers in the beginning, but he will build it after a while.
As you can see on this map, the AI has some agts:
Pnmedia.gamespy.com
But in my speedrun, I dont let him to build them up:
Youtube.com

+1 vote     reply to comment
Nyerguds Author
Nyerguds Jun 4 2014, 4:02am replied:

Yes, as you can see on the same mission pic at my site, I changed these unbuilt buildings to teal colour to show that:
Nyerguds.arsaneus-design.com

+1 vote   reply to comment
PinchySkree
PinchySkree Sep 19 2013, 3:04pm says:

So why don't you just modify Red Alert and change the building graphics, audio and unit AI for the C&C95 versions?

That has working skirmish AI.

+1 vote     reply to comment
Nyerguds Author
Nyerguds Dec 16 2013, 9:59am replied:

"just" copying a unit AI? Right. you act as if "unit AI" is one neat little block of the game's code, and not spread out in hundreds of little functions. Not to mention, RA has no separate war factories, no airplane deliveries, a different stealth logic (the submarine one), no ion cannon logic, no tiberium damage, a nuke launching building with a completely different building footprint... oh hey, while we're at it, it has completely different building footprints in general, and those can't be changed in the rules file.

I think you're oversimplifying things just a tiny bit :p

+1 vote   reply to comment
Post a Comment
click to sign in

You are not logged in, your comment will be anonymous unless you join the community today (totally free - or sign in with your social account on the right) which we encourage all contributors to do.

2000 characters limit; HTML formatting and smileys are not supported - text only

Icon
Command & Conquer Icon
Platform
Windows
Developed By
Nyerguds
Contact
Send Message
Release Date
Released Sep 19, 2008
Mod Watch
Track this mod
Feature
Browse
Features
Report Abuse
Report article
Related Mods
Command & Conquer Unofficial Patch 1.06 (Command & Conquer)
Command & Conquer Unofficial Patch 1.06 Command & Conquer - Single & Multiplayer Real Time Strategy
Related Games
Command & Conquer
Command & Conquer Single & Multiplayer Real Time Strategy