Post feature Report RSS 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 on

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 - - 3,554 comments

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.

Reply Good karma Bad karma+3 votes
Nyerguds Author
Nyerguds - - 360 comments

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 :)

Reply Good karma+2 votes
stalkerforever
stalkerforever - - 683 comments

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?

Reply Good karma Bad karma+1 vote
Nyerguds Author
Nyerguds - - 360 comments

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

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

Reply Good karma+1 vote
stalkerforever
stalkerforever - - 683 comments

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

Reply Good karma Bad karma0 votes
Nyerguds Author
Nyerguds - - 360 comments

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.

Reply Good karma+1 vote
Guest
Guest - - 689,468 comments

Yes but can you make C&C 95 AI build bases? :) lol

Reply Good karma Bad karma+1 vote
OrangeNero
OrangeNero - - 6,594 comments

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.

Reply Good karma Bad karma+4 votes
Nyerguds Author
Nyerguds - - 360 comments

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

Reply Good karma+3 votes
OrangeNero
OrangeNero - - 6,594 comments

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.

Reply Good karma Bad karma+2 votes
Nyerguds Author
Nyerguds - - 360 comments

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

Reply Good karma+3 votes
chr1sto
chr1sto - - 55 comments

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

Reply Good karma Bad karma+2 votes
Valherran
Valherran - - 2,443 comments

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.

Reply Good karma Bad karma+2 votes
Nyerguds Author
Nyerguds - - 360 comments

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.

Reply Good karma+2 votes
Trailhog250
Trailhog250 - - 714 comments

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'.

Reply Good karma Bad karma+2 votes
Nyerguds Author
Nyerguds - - 360 comments

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 :)

Reply Good karma+3 votes
akhero47
akhero47 - - 2 comments

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..

Reply Good karma Bad karma0 votes
Nyerguds Author
Nyerguds - - 360 comments

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

Reply Good karma+1 vote
Milanium
Milanium - - 453 comments

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

Reply Good karma Bad karma0 votes
Nyerguds Author
Nyerguds - - 360 comments

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.

Reply Good karma+1 vote
chr1sto
chr1sto - - 55 comments

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.

Reply Good karma Bad karma+2 votes
stalkerforever
stalkerforever - - 683 comments

can we play skirmish in this patch?

Reply Good karma Bad karma+1 vote
Nyerguds Author
Nyerguds - - 360 comments

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.

Reply Good karma+1 vote
chr1sto
chr1sto - - 55 comments

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:

Reply Good karma Bad karma+1 vote
Nyerguds Author
Nyerguds - - 360 comments

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

Reply Good karma+1 vote
PinchySkree
PinchySkree - - 11 comments

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.

Reply Good karma Bad karma+1 vote
Nyerguds Author
Nyerguds - - 360 comments

"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

Reply Good karma+1 vote
CannerZ45
CannerZ45 - - 134 comments

Love this article, great read. :)

Reply Good karma Bad karma+1 vote
Nyerguds Author
Nyerguds - - 360 comments

Thanks :)

Reply Good karma+1 vote
Guest
Guest - - 689,468 comments

I am soooooo sorry for asking all these questions to you in the forums years ago. I feel really bad! Oops LOL!

I remembered stores in the 90's having unofficial add-on CD discs for C&C with
solo (or was it co-op for LAN?) multiplayer maps that had AI with bases that made it look like they knew how to build bases, but I guess they could only re-build already existing bases.

Reply Good karma Bad karma+1 vote
Nyerguds Author
Nyerguds - - 360 comments

Well, as I said, there's no real difference between building and rebuilding. It's just the small detail of whether the building is placed on the map from the start or not. The AI still acts the same; it checks whether the building is there, and has the AI as owner, and if not, it tries to build it there.

Reply Good karma+1 vote
thel_vadam0
thel_vadam0 - - 1 comments

Drive.google.com here its a singleplayer map with Working AI that simulates a 3v1 skirmish game

to use it put the files in the C&C 95 folder then on the mainmenu go to new missions and look for GDI: Sherwood Skirmish

Reply Good karma Bad karma+1 vote
Jedininja28
Jedininja28 - - 14 comments

Id like to direct all your attention to Open RA - Openra.net

I have searched around a lot over the years attempting to bring the time crushing awesomeness of RA95 Skirmish play to C&C95;, but alas, "It Can't Be Done", The very attempt lead to Ra95's Game engine!

But,

What can be done is bringing the awesomeness of C&C95; to RA95's Game engine, Which is what Open RA did, and they did it really well, also including Dune 2000's Architecture!

But, Wait... there's more

after a lot of digging around i found this gem of a game mod, "The Red Alert" Moddb.com

"The Red Alert" uses C&C-RA-3's game engine to recreate the awesome of RA95 in the modern day. (These conversations come up so so often)
But the modders in this case have, at least in my eyes ended this 25 year old question. lol Maby EA will wonder apon them and realize the error of their way! :P

Last Note:
I discovered these mods using a mod engine called "Desura" which, was pure amazing, but has since been crushed by some unknown foe (of doom). but i happen to have the source code for the Desura mod engine so if anyone can and is willing to put it all back together (@OP),

And Lastly i bring your attention to Tunngle: Tunngle.software

For all your "pre-micro-transaction-facebook-garbage-nonsence" multiplayer experience! Its an IPX protacal Emulator, which has really great support for all the old ipx/tcpip games of the 90's!

You all welcome!~

Reply Good karma Bad karma0 votes
Nyerguds Author
Nyerguds - - 360 comments

OpenRA is a game that uses the game's assets to make itself look like a C&C game. I'm not sure how it is even relevant in this, to be honest...

Reply Good karma+1 vote
Guest
Guest - - 689,468 comments

ive noticed that in multiplayer if a player leaves the game, the AI takes "control" and I am not sure but I think it also sent its units to hunt. So could it be possible to make the AI that takes control to train random units and sent them to hunt the moment they are out of the production building??

So if that is possible, players can start games then leave them and have the AI play. In my case this could be useful because I want to play with my nephews in a team vs AI.

Reply Good karma Bad karma+1 vote
Nyerguds Author
Nyerguds - - 360 comments

I think that through hacking alone, it'll be really, really difficult to do anything like that, since all production relies on scripting inside the mission file, and most of that doesn't even work in multiplayer.

But now we got the source code, who knows. Probably won't happen through hacking anymore though. More likely people will just manage to build new versions from the code.

Reply Good karma+1 vote
Guest
Guest - - 689,468 comments

Funny how you say it can't be done, yet they did it perfectly well in KKND, both of which are PS1 generation games.

Reply Good karma Bad karma+1 vote
Nyerguds Author
Nyerguds - - 360 comments

Not sure what you're referring to there. Who are "they"? Did KKND ever receive unofficial patches?

If you mean the OpenRA mod, that's not a patch at all, that's a remake.

Reply Good karma+1 vote
Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: