Well now that I'm moved into my new apartment and have begun working again on the Xenoforce Reborn mod I thought I should tackle that one thing that everyone wants to see. God did I not know what I was getting myself into. You see, I have been messing with CNC3's AI for the better part of 2 years now. Not seriously mind you, and not in the way that I'm now working on it, but just looking at it and reading online what others say can and can't be done with it.
I have recently started doing serious moding on the AI within the last 2 releases of the mod, more spicificly I've been working on making the GDI/NOD/Scrin AI more of a challenge. In some cases I would say I was sucsessful, in others not so much. But it has been a good learning process and I have made good progress.
So the next logical step would be to add that infamous AI to the Earth Federation faction. As the Earth Federation will be the most complicated army out of the 4 we are adding in they are the ones we wanted to start with. Now for a bit of information that you guys may not know about editing the games AI. If you edit the AI and make even the tinyest mistake, the game will crash. However, it will not crash the compiling of the MOD, it only does it once you try and load up a map with the new AI active. Also, for the AI to work the map must be edited so that it will apply AI Scripts to the new faction! This isn't nessicary on maps for new AI's based on the original 3 armies as all the maps have already been set up for GDI/NOD/Scrin players but this leads to a unique issue for a new faction. Is it a problem with the map that's causing the crash or the AI scripting that's doing it?
And of course when the game crash's it doesn't tell you why, just that it's sorry and it needed to close. So I have been working on a seperate mod simply called XenoforceAI which is just a new faction (Clone of GDI) with only one AI choice (xenoforce) with a single opening move set. Why did I do this? A few reasons actually, the first being that as long as I'm using an existing force's models and playset I can take my own units out of the equation as to why the game is crashing. Also by trying to make it as simple as possible and with as few changes a possible I take a mod that takes 15+ minutes to compile and do it in less than 5 seconds. This means I spend more time trying different things than sitting around doing nothing.
So that's where we stand now. I've been doing slight modifications to the game trying to get the AI to work in some form (heck I would settle on it just not crashing when starting at this point). I will know within the next few days weither this will be a plausible choice of if I should start looking at other ways of getting the AI into the game.
Now I know what your thinking. "Wait, he knows of another way to get the AI into the game and isn't just doing that?" Correct, I do. On top of that if I choose this path I would be garunteed a working (if not fully functional) AI. However I do not want to do this as for all of its advantages the major drawback is a big one to me.
What I would have to do is add the EF force into GDI.
I'll let that sink in a bit. All done? Good. I already know how to manipulate the exsisting AI, it's really not all that difficult honestly. What I would have to do is modify the exsisting GDI AI's opening moves and change the starting building for GDI. The new start building would simply be a building with 2 upgrade choices, GDI or EF.
You would select which side you want and the starting building would transform into that factions starting building. On the AI side the Opening Moves would have to have what "side" the player wanted as the first option to do, then everything would move on from there. In theory this would work fine. Another advantage to this idea is that the AI would work on all maps with no modifications needed by us. That makes things all the better for people who have a favorite map that they want to play on.
My issue with this solution should be fairly obvious. It's a serious pain in the butt to go back through and make the changes for this to work, and on top of that it's a fairly "blunt force" way of getting a working AI for EF into the game. I mean honestly, making a player jump through that many hoops just to get to play as UC for example, it's a bit more complicated than it should be. First you have to pick GDI, then EF, then build the required buildings to pick UC. Not that it's that big of a deal, it's just thats one step too many for my tastes.
Another thing that's come up about the AI recently is getting a unit to use it's special powers. We were sucsessful in getting the AI to use the upgrades that are located on the Devistator Warship (Scrin) and Avatar (NOD) recently, but only slightly. The Devistator works all the time just fine, so no problems there. The issue comes up with the Avatar using it's ability to upgrade itself. If you play the game on medium the AI will only use the Avatars ability to upgrade just before it's about to be killed. On Hard it does it after it's taken half damage, which is fine to me, but on medium it upgrades and dies almost at the same time. I'm trying to find the bit of code that controls this but so far have had no luck.
But this brings me to my last point on this topic today. The different difficulty settings. The game currently has 4, Easy - Medium - Hard - Brutal. The honest to goodness truth is that there are not a lot of differences between these settings. Easy has all of it's timerates turned to high so it takes forever for the AI to go from one build list to the next. Medium has all of it's times turned to low, so it only takes 3 to 5 seconds inbetween the AI switching to another build list. I suppose this could be seen as a normal player taking a few moments to decide what to do next. Also the Medium difficulty has a 25% chance to deviate from it's build order. So it has a chance that while it's supposed to build say an Orca it will randomy pick a different air unit (Orca Stormshell or Firehawk) for that team. This gives the AI a bit of random personality that I like.
The Hard AI is the exact same as the medium except they took out the time delay inbetween build orders and removed the chance to deviate from it's plan. The way I see it the Hard AI has a plan and it simply sticks to this plan, the consiquences be damned. A good thing and a bad thing at the same time. Finally the Brutal AI is the same as the Hard AI except that the game cheats on Brutal with all units costing half of what they normally cost and building twice as fast as normal. Not a good thing.
To me you have 2 choices. You can either make an AI smarter or make it unpredictable. If you have to have the AI cheat to win then you fail as a programmer. So with saying that I plan on making the following changes to the AI.
Easy will stay the same. Medium will have the same time delays as normal, but with only 2 different starting build orders and with a 20% chance of a build deviance. Hard with have 4 different build orders but will have a 0% chance of a build deviance. Finally Brutal will have 5 different build orders with a 40% chance of a build order deviance.
Thats right, Brutal AI will be the most random AI I can make it so that you will never know what to expect from it.
It will NOT have a cheat bonus. I will also be modifiying the "Kill Teams" that the Ai will choose to build, a good example of this would be our current NOD AI. It has the ability to build Scarab teams to seige the enemy instead of Beam Tanks, and it will do this 66% of the time if NOD gets into the position that it needs to lay seige to an enemy base. A good idea here would be to add in something unexpected for a seige attack on Brutal. Say, a kill team made up of 1 Scarab, 3 Avatars, and 8 Stealth Tanks. The Avatars and Scarab would be a good distraction (because they are visible the enemy will see them first and attack them) while the stealth tanks can get way up close and do what they do best (be evil).
So those are my thoughts on CNC3's AI, what we're trying to do, and possible solutions to exsisting problems with the AI. If you have any thoughts yourself, feel free to post them. Have a good Sunday everyone.