Patch 1.23

Patch 1.23 came out for Supreme Commander 2 last week and brought with it the infinite build queue system. This system allows players to queue up build commands as much as they want, whether they have the resources for it or not. This means players don't have to wait for the resources to be available before placing a building and don't have to check their factories to see if they paused themselves. I think that was worth calling it a "big change", don't you?

Patch 1.23 also included the new AI neural networks. This has given the AI's platoons a much needed boost to their intelligence. So much so that they may have become a little too timid. Previously, the AIs platoons would move back and forth because of a bug in the neural networks that would give them bad data and make them make bad decisions. Now, the neural networks have become smart enough to recognize bad decisions and it makes them not want to take any risks. They always want to have the advantage.

The solution, in my opinion, is the yappy dog approach. You know, that annoying small dog that thinks it is a doberman. We can take a queue from the small yappy dog and make the AIs platoons think they are bigger than they really are. When we get the data for the platoon and enemies for the neural network we can adjust the platoons numbers by a multiplier, say 25%. So, if the platoon had 100 DPS, we would raise that to 125 and send that data to the neural network. That way, the AIs platoons still get valid data back from the neural network and will still run if they are greatly outnumbered. But, if it is close, they will attack. This will give players the sense that the AI is being more aggressive and will push the AI to take more chances. Now, this is no guarantee that this change will make it out in a patch, that isn't up to me.

I spent most of last week integrating all of my recent AI changes over to Kings and Castles in preparation for full production. I can't wait to get started. I will be the Lead AI Engineer on the project so this will truly be my baby and I hope to get the opportunity to really push the limits of RTS AI design.

Lately, I have been trying to become more active in the AI community and hope to utilize AIGameDev.com as a resource to help me take RTS AI to the next level. So far, I think Supreme Commander 2's AI is a great starting point.

Neural nets in more detail

Since so many of you have requested more info on how the neural nets in Supreme Commander 2 work I have decided to make another blog entry to go into the neural nets in more detail. Actually, I am a bit surprised I haven't made a blog entry about them already.

Supreme Commander 2 contains 4 neural networks, each of them consisting of 3 layers of neurons (input, hidden, and output) and learn via backpropagation. There is a neural network for Land, Naval, Fighter, and Bomber/Gunship. The neural networks are used for AI platoon fight or flight mechanics which are used by the bulk of the AIs combat platoons.

When a platoon is formed it contacts the AI's strategic manager and requests a place to attack. The strategic manager looks at the map and chooses a place to attack based on a risk versus reward ratio. It also checks for pathability. Once it has chosen a spot it generates a path using good old A* and returns the path to the platoon. The platoon then sets up a series of move orders to take them to the attack location.

Up until now the neural networks have not even come into play (although, that is one thing I would like to change in KnC). Once the platoon encounters an enemy it gathers information about the enemies in the area and it also gathers information about allies in the area. Note the difference between live and training. In training the platoon only gathers information about itself, in live the platoon gathers information about all allies (including player controlled units) in the area.

It then takes all of that information and feeds it into the input neurons of the neural network and feeds the network forward. It then gathers the outputs from the neural network and evaluates the output. Each output corresponds to an action that the platoon can take such as, attack structure from range or attack highest value target. Each output is going to have a value of between 0.0 and 1.0 with below 0.5 being a bad decision and above 0.5 being a good decision. If there are no good decisions returned by the neural network it means run away. After a small delay the enemy and ally data are gathered up again, feed to the neural network, and a new decision is made.

The neural networks are trained by having the AI fight it out repeatedly and backpropagating the results. At the end of a match the game writes out the new neural networks to a file. The game runs using a few special command lines which do the following:

  • Set the game to run at +/- 50 sim speed.
  • Automatically restart the game when it ends.
  • Enable neural network training.
  • Set which map to play on.
  • Sets up the AIs.
This allows me to run neural network training 24 hours a day on a dedicated machine. For Kings and Castles I want to look at having several computers running training at once and merging the results. The more iterations the neural networks get the better they can be. This is because, during training, the platoons are choosing actions at random and recording the results. It can take a long time to test every action in large set of circumstances.

Hopefully this answers most, if not all, the questions you all had.

Finally!

A couple of weeks ago I made a list of things I wanted to work on to start prototyping things for the Kings and Castles AI. So far, I made it to item number one. The first thing I wanted to work on was the neural net system. I was never really happy with it and, up until today, I was thinking about pulling it out of Kings and Castles. So, I decided I wanted to go into the core of the neural net system and see what might be up.

Up until two weeks ago I had been treating the core neural net system as a black box. I had assumed that the system was working as intended. In hindsight, that may not have been the best idea. Now, I know patch 1.2 says that I improved the neural nets, and I did, sort of. I worked on a layer above the neural nets. I added new inputs and messed with some other stuff, but I never messed with the core neural net code. I also retrained the neural networks by having them play against each other over and over while having the AI platoons choose actions at random and feeding the results back through the neural network.

Before I go much further I should take the time to explain what a neural network is for any of you that may have no idea what it is. A neural network is basically our attempt at mimicking a cluster of neurons in code. The neurons in a brain receive signals from several other neurons and if those signals are above a threshold, the neuron fires off. A neuron in a neural network is much the same. The neurons in the neural networks that Supreme Commander 2 uses are set up as a feed forward network.

A feed forward network has layers of neurons; an input layer, one or more hidden layers, and an output layer. The input layer takes the inputs, feeds them to the hidden layer which then feeds to the next hidden layer until they finally feed to the output layer. When a neuron receives input from a neuron in a higher layer that input is weighted. These weights are how the neural networks learn. The networks learn which weights are more important for which outputs. They accomplish this via back propagation, which is where I found my first issue with the neural networks in Supreme Commander 2.

Back propagation basically goes back through the neural network and adjusts the input weights so that next time a more correct answer will be chosen. In order to do that you have to take the inputs from when the decision was made using the neural network and put them back into the neural network. You then feed the network forward so that the outputs are the same as when the decision was reached last time. Then the neural network goes back through, from the output layer to the input layer, and adjusts the weights as needed. Unfortunately, the function that was being called forgot the feed forward step, which completely invalidates any learning that was trying to be done.

In order to cope with this, there was code placed that would force the platoon to take an offensive action regardless of what the neural nets said if certain parameters were met. This is why the AI's platoons were seen to go back and forth after patch 1.2, I had forgotten to uncomment those sections of code. Even with that fixed, the neural networks still were not giving me the output I expected, until this afternoon.

I finally found the last piece of the puzzle. When a platoon encounters resistance it gathers up data about it's platoon and any enemies in the area. It then hands this info off to the neural network and gets an answer about what to do. When the platoon dies, kills all the enemies in the area, or hits its re-evaluation timeout, it sends the results to the neural network so that it can learn. It gets the results by doing the same thing it did when making the decision. It gathers the information about the platoon and the enemies in the area. The problem is, by the time it goes to report back to the neural network there could be a lot more enemies in the area. This skews the results.

So, I decided to try something different. When the platoon encounters resistance it gathers information about the platoon and enemies in the area. It also stores all of the enemies in the area. When it goes to report back to the neural network it only reports about the enemies that were in the area when the decision was made. We don't care about the platoon of gunships that just arrived after we killed that mass extractor, we only care that the decision to kill the mass extractor was a good one because it is now dead. We will deal with the gunships when we re-evaluate again. This change has made me a believer in neural nets again. They are performing exactly as I would expect and the hard-coded situations that force the platoons to attack are a thing of the past.

Before I left for the evening I had one more flash of insight. Among the hard-coded situations was one that made the AI's platoons attack an ACU if it saw one. Since I don't want those hard-coded situations anymore I had to come up with a way to still have that behavior, but not make it so two tanks think they can take on an ACU. Now, you would think the neural nets would learn that taking out the ACU is a good thing, and they probably would if it weren't for that fact that the ACU goes nuclear when it dies and kills almost the whole platoon that took it down. So, I made a change where if a platoon was told to attack the ACU during training and killed it, it will be bumped up as a good decision. This will make it so that those two tanks that encounter an ACU will run as expected, but if a Monkeylord finds your ACU, it is toast.

As an aside, I am being interviewed live over the internet by Alex Champandard of AIGameDev.com Sunday October 10th at 1PM PST. It will be available for viewing by Plus and Premium members of the site. So, if you happen to subscribe (Plus membership is like $7 a month), you should drop in.

One year down

August 31st was my 1 year anniversary date with Gas Powered Games. My how the time has flown. This time last year I was working mostly in Lua wiring up the two new characters for Demigod. A couple of weeks after that I was learning C++. Now, a year later, I am spending most of my time in C++. This whole situation still has a dream-like quality to it. I still can't really believe I am here.

Patch 1.20 went out last week, finally. If you haven't seen the patch notes, you can find them here: http://www.supremecommander2.com/na/blog/2010/08/30/supreme-commander-2-patch-notes-v1-20/. A lot of changes went into this patch. I think my favorite change has to be the new AI options menu. Being able to custom tailor an AI like that is awesome and should be a standard feature for any game that features a skirmish mode.

Work still has not stopped on Supreme Commander 2. In fact, there was a video released yesterday that showed off a few things that will be included with the upcoming DLC pack. You can find the video on GameSpot's site here: http://www.gamespot.com/pc/strategy/supremecommander2/video/6275172/supreme-commander-2--strategies-from-team-gpg. In addition we are working on fixing the bugs that have been brought up after the latest patch as well as work on other super secret stuff that I am sure you will all enjoy.

More videos to come, more cool patches on the way, and the epic return of the Monkeylord is drawing nearer. It is a good time to be a SupCom fan.

The one drawback

After working for Gas Powered Games for 11 months I have found only one drawback to this job. While patching Supreme Commander 2, there have been many times when the game is so much better on my dev machine than the version installed at home. This was especially true back before the first AI patch was released. I wanted the patch to be released as much as any of the Supcom 2 fans just so I could have the improved AI on my home machine. The same is true of the upcoming patch. There are so many game improvements that I can't wait to be able to play with at home.

Recently @squareenixdave posted that some new news regarding Supreme Commander 2 should be released soon and I truly can't wait. We have been hard at work doing all sorts of things I wish I could post here. For me, the news can't come fast enough.

Over the past month I have been writing down ideas that I would like to implement for the Kings and Castles AI (assuming I am in charge of it). I have a habit of keeping a notebook nearby and just writing down any wild idea I get. Lately, I have been taking those ideas and trying to form them together into a cohesive plan. I still have a lot of refining to do before I actually put it all into a document.

In Supreme Commander 2 the addition of neural nets gave the AI some tactical thinking capability. It could decide if a single platoon should run or engage and, if it chose to engage, which target to focus fire on first. For Kings and Castles I not only want to improve upon that, I want to focus on the AI's strategy game. I don't want the AI to decide it has enough troops to send out and then send them somewhere solely based on threat values. I want the AI to keep track of enemy threats on the map and when it finds one that is a high priority I want the AI to grab nearby platoons, already in the field, and send them to take the threat out.

Having the AI oversee its platoons, rather than having the platoons basically doing their own thing as they are now, would allow the AI to react faster to high threats. If the AI found an group of enemy long range artillery in range of it's main base it could find all of its nearby platoons that are on lower priority missions and redirect them to this new threat. If the AI sent out a platoon on a low priority mission and suddenly found a large group of incoming enemy units, it could immediately bring that large platoon back to take up a defensive position.

I also don't want to the AI to see threats as single places on the map. I want to improve the AI's threat map by giving units a threat range. That way, those long range artillery (using SupCom 2 as an example) can not only be seen as a large static threat, but as a threat with a long range. Using the threat map for this purpose could give the AI a much better sense of safe and dangerous areas, threats that are very dangerous, and a better sense of who has the better map control. Best of all, it would be cheap to implement performance wise.

Next on my list is to give the AI the concept of front lines. This would also help give the AI a sense of map control as well as allow the AI to post units near the front lines in an attempt to hold them. I want to move away from the AI hording units in its base before sending them out onto the battlefield and instead have the AI build units, send them to forward position near the front line, and send attack waves from there. That way, the AI is not constantly fighting to retake land it had under its control just a minute ago. It would also allow the AI to easily implement advanced tactics such as PD or TML creeps (again, using SupCom 2 as an example) without having to code anything specific to handle it. Just defend the front line.

My goal is to make people say "Wow, I can't believe an AI just did that." I don't necessarily want the AI to wipe the floor with average joe player by default, that isn't any fun. But, I do want the option to make the AI very hard to be there for the hardcore players. It would make my month if Mike Swanson walked into my office and said that they need to give the normal AI a handicap to make it accessible by average joe player. Hell, it would probably make my year.

This is just a small sample of the ideas rattling around in my head. I hope to, over the next few months, refine more ideas and get a battle plan together for truly improving the AI system. Chris seems to be on board with it so far. I can't wait to see some of these ideas in action.

Week off

I never thought I would see my face in an issue of PC Gamer magazine, but its happened. The latest issue of PC Gamer UK features an article about the recent improvements to the Supreme Commander 2 AI and the amount of praise it received is astonishing. However, I can't take all the credit. If it weren't for Dru the AI wouldn't have existed in the first place. He was hard at work on the AI before I even started at GPG. The way Dru set up the core of the AI made it easy for me to make the necessary changes to take the AI to the next level. Dru truly deserves as much credit for the current state of the AI as I do.

I am currently on a well deserved, in my opinion, week off. My parents and 2 sisters are in town visiting for a couple of week and it has been a blast so far. This is the first time I have lived so far from the rest of my family, so getting a chance to see them has been great.

I will be back to work next week finishing up some stuff for Supreme Commander 2 and then going back to the un-announced project. Busy, busy, busy.

Human pinball

Things have been hectic over the past month. I have gone from SupCom 2, to Demigod, back to SupCom 2, to Kings and Castles, and now I am back on SupCom 2 and an un-announced project at the same time. Very, very busy. It is nice to have a variety of things to do, but being on 2 projects at one time is crazy. I end up getting questions from both projects (and KnC) throughout the day and my brain has to lurch from one project to another to find the answer.

After working for GPG for nine and a half months, I have discovered that no matter how hard the assignment is, I love this job. Actually, I like the harder assignments (like getting ships to sink and leave wreckage) because it feels awesome when I finally finish and have it working.

Variety is also nice. I can sit and work on AI for months at a time, but bug fixing is draining. It is nice to get a break from tracking and fixing bugs to do something else. On the un-announced project I am focusing on UI work which is quite interesting. Most of my work so far has been prototype stuff, but now I am going to start focusing on building out organized systems for all of the UI features.

The time leading up to E3 was crazy. The frantic pace reminded me of milestone dates during the production of SupCom 2. If you haven't seen our E3 demo video, you can find it here: http://www.youtube.com/watch?v=AB-Xdee1nN8&hd=1. Not bad for 4 and a half months of production. I can't wait until we get more assets in place and I get to start working on the AI. Big plans, oh yes.

On the SupCom 2 front, patch 1.15 was released a little while back. After a lot of effort, skirmish save/load was finally put in place. Thankfully, this means putting skirmish save/load into KnC should be quite simple. We also got a couple of my pet issues fixed as well. 1) Replays stopping when a player leaves the game and 2) no version information in the replay file. There were also some minor AI changes. I wish I could give you some information about the upcoming changes, but alas, I cannot. You will just have to wait and see.

How the AI got to where it is now

I have been getting a lot of questions about what I did to the Supreme Commander 2 AI and why. I certainly have no trouble talking about the AI (ask my family or anyone I work with) so hopefully I can shed some light on what changed and maybe even what didn't make it...yet.

Back in March I got received a list of bugs that were reported about the AI and was asked to give a time estimate on how long I thought it would take to fix them all. I was also asked to provide a list of things I would personally like to see fixed. It was a fairly long list with some of the issues being very broad ( like: "AI does not adapt to player strategy.") which I was very happy to see. Broad bugs can mean broad solutions. My reply was that I would need a month to go through and fix all of the issues. Now, I believe in the Scotty theory. When your boss asks you how long something will take, always add extra to your estimate.

The day I was supposed to transition to working on the Supreme Commander 2 AI I was pulled aside by Chad (SupCom 2 engineering lead at the time) and he said the most beautiful words to me. He said I would have autonomy with regards to the AI. I don't remember if I giggled after he said that, but it would not surprise me if I had. Basically, I could do whatever I wanted with the AI as long as the bugs got fixed, there was an overall improvement in the AI, and I didn't kill perf or introduce any more bugs.

Starting out, a lot of my time was spent fixing the various bugs. There were issues with the AI getting stuck in its starting build order and then not doing anything else. There was a bug that was preventing the threat build conditions from working at all (threat build conditions allow the AI to change behavior based on enemy threat). The AI had trouble with exclusions, factory upgrades, build queues, even just picking somewhere to attack. I probably spent a good solid week just working on some of the simpler bugs.

Some of the bugs, however, were not so simple. You would think getting the AI to build an anti-nuke when it gets nuked would be simple, but you would be wrong. I had to write support for an OnDamaged event for the Event Manager (AI manager that controls what happens when certain events get triggered, such as when experimental research is obtained) that would get checked whenever an AI controlled unit took damage. This was something I could only dream of in SC/FA. This is the kind of change I really like.

Reaction. Such a simple concept, but something that I think is underutilized by RTS AI. Simply making an AI react to things that the player does adds so much more immersion, especially if you do it right. Making the AI build shields when it sees an artillery being built or starts taking artillery fire. Making the AI build AA when it sees a lot of enemy air units. Making the AI send bigger and bigger waves as the game progresses. I am a huge fan of making an AI react, and react intelligently and I think some of the biggest gains in the AI came from this concept.

The other system that gave the AI huge gains was the economy system. I discussed one of the changes in a previous blog post (the AI constantly taking from the same resource bucket over and over). There are two more changes that had significant impact. One change affects the AI late game. I noticed that the AI would end up having a huge amount of resources in its slush bucket, but was unable to build because its other buckets were empty. Now, every so often, the AI will check to see if it has more resources in its slush bucket than it has missing from its other buckets. If so, it will pull those resources from slush and distribute them into the other buckets. Now when you watch the AIs resource buckets late game they are almost always full.

The other big econ change was to the reservation system. The reservation system is used by engineers to reserve resources for build orders. This prevents the situation where an engineer is given a build order, but the resources get used before the engineer can get into position. The problem is that these reservations were not always being removed when the engineer died. To prevent that, the resource manager now goes over all of its reservations every so often to make sure the unit that owns the reservation is still alive. So, the AI no longer ends up in the late game with 3000 mass worth of reservations for dead units.

I think my favorite change, however, is the recent AI Overlord system. Playing against teamed AIs and seeing a massive group of units comprised of units from more than one AI just brings a smile to my face. This is another one of those changes I could only dream of in SC/FA and I am so glad it is finally here. The AI Overlord system is a manager that controls how the AI acts as a team. It ensures that all AIs on a team are attacking the same target, it allows the team members to group units together, it provides a system for a team member to call for help, and also has a system for team members to warn other team members when one of their OnDamaged events gets fired off (so if you start hitting one AI with artillery, the others on the team will know it and build shields in response).

Of course, people want to know what things got cut from the AI. What did I want to do, but was not able. Honestly, that is a difficult question to answer. I never believe an AI is done, because there is always something else my twisted mind will come up with. I keep a word document scratch pad of sorts that I can access from home and the office. Whenever I get an idea, it goes on the scratch pad. There quite a few ideas on there both from before and after the latest AI updates went out. Anything that does not make it into Supreme Commander 2 you will surely find in Kings and Castles. Hopefully Square Enix will be willing to put some more time into the AI. Who knows what I could do with another month.

Patch 1.14 is live

Patch 1.14 is live and in the wild. The patch debuts the AI Team Manager, a system that allows the AI to work together when on the same team. I am very excited to see this finally out in retail. I was able to do things that I could only dream of doing in SC/FA, like having the AIs group units from multiple AIs into one platoon to be controlled by one AI. They also pass the word along if they start taking Nuke or Artillery damage. I hope this makes the AI more fun to play against.

Patch notes for 1.14: http://store.steampowered.com/news/?feed=steam_updates&appids=40100

I spent a couple of days last week working in VB Script, something I haven't touched since High School, and hope to not have to do again for a while. It is kind of rewarding getting some features into an internal tool that have been wanted for quite a while, especially when they said it couldn't be done. I also had to work with 3dsMax scripts for the first time. It is always interesting trying to fix bugs in a language you have never used before, but it had to get done. I needed the exporters to work for....wait, I can't talk about that yet. Ha ha.

I have also spent a good chunk of this week working on Demigod fixes. Apparently Stardock has sent us a list of bugs they would like to see fixed, and I am happy to oblige. It gives me a reason to kick some AI butt with Demon Assassin on work hours. I did manage to fix a bug that has been bothering me since the last patch, which is nice. As per usual, I don't have a time frame. I am hoping a build gets put together tomorrow and then it will have to go through Stardock QA.

Patch 1.12 is live

Finally, I think the AI will look the same on your machine as it does on mine. The bug that was causing the AI to repeatedly build things from factories was just a stupid little thing that was hard to track down, mainly because it would only happen in retail.

For those of you who do not know, there are 3 possible builds of the game. If we want to be able to break into the code as it is running and see things like variable values and such, we make a Debug build. For most everything else we make a Release build. Release builds still have some debug info and also allow us to insert assertions for really strange behavior to let someone know that something that should never happen in the game just happened. Retail builds are what actually ships. These builds take a lot longer to make, which is the main reason devs use Release builds.

So, when I went to test the reported issue of AIs building massive amounts of transports, I, of course, tested on a Release build. That is why I couldn't reproduce the bug. It wasn't until I played a game with my brother-in-law that I saw the bug for the first time. This is what led me to believe it was a Retail only issue. Now, thanks to patch 1.12, it should finally be fixed. It even gave me an opportunity to fix some other issues as well.

Is the AI done? The AI is never done! I still have a list of things I would like to work on, if given the opportunity. We'll see what happens.

Patch notes for 1.12:

New Features:

  • Added a warning dialog when a player accesses multiplayer with modified data
  • Adjusted exploit handling for research during game initialization
  • Adjusted exploit handling for hotkey-triggered commands
  • Land AI will default to Air factories faster on non land maps
  • AI will build units from factories that are outside its primary base radius
  • AI platoons will loiter less and instead attempt to move to the best possible place to do damage
  • The starting base locations will now generate less econ threat to the AI causing the AI to more aggressively target buildings outside the starting base locations
  • The AI will more quickly respond to attrition, and retreat appropriately

Fixes:

  • Fixed a potential crash encountered when entering the game summary screen with an AI present
  • Fixed an issue where the AI could repeatedly queue the same unit (especially transports)
  • Cybran AI will now properly research naval walking

Video blog #9 is up

Kings and Castles video blog #9 is up for viewing. It has some nice video of the dragon in action and some beautiful landscape shots. Check it out here: http://gaspowered.com/kingsandcastles/video-blog-9/

Ranked patch is live, AI delayed

The ranked patch for Supreme Commander 2 went live about an hour ago. The AI didn't get enough testing to go into this patch, but I am hopeful for the next one. This is by no means a guarantee, just a hope from someone who is looking forward to a good old comp stomp.

Ranked isn't the the only thing that made it into this patch (which should give you an idea why the AI was delayed). From http://store.steampowered.com/news/3685/

New Features

  • Ranked 1v1 System!
  • Ranked Challenge System
  • Unranked Quickmatch
  • Map Pings - Added three different kinds of map pings for team play. F5 issues a generic alert to your teammate at a specific location, and it appears as a yellow arrow when zoomed in and a yellow animated ping indicator in strategic mode. F6 is a Move ping, and it uses a blue indicator. F7 is Attack ping, and it uses a red indicator. Color coded arrows will appear on each edge of the screen where your teammate has placed one of these for you to view
  • Multi-player lobby ready-up checkboxes will now "uncheck" any time a host changes the settings
  • Changes to multi-player lobby exclusions, game-type, etc. will show up in the multi-player lobby chat box when the host makes changes
  • Voice icons display next to each player in the multi-player lobby allowing the user to mute individual players
  • Menu version number รข€“ The game now displays a version number on the Main Menu. The versioning has been adjusted at this update to 1.10 to accommodate future updates
  • AI now starts as a random faction

Fixes
  • Cheating fix: Closed a loophole in the code that allowed some players to enable limited cheats
  • Fixed rare crash if player gets kicked out of the lobby and submits chat text
  • Fixed rare crash when player hits the enter key in the Skirmish menu
  • Fixed replacing ready kicked player with AI causes the AI options to be locked
  • Fixed inability to join DLC map games if you don't have the pack as a client

Tuning and Balance
  • UEF Assault Bot Research cost decreased from 4 to 3.
  • Cybran Battleship Range reduced from 128 to 115.
  • Cybran Destroyer Energy cost increased from 500 to 650.
  • ACU Training bonus reduced to +25% per level.
  • Soul Ripper II Anti-Air Damage reduced by 50%.
  • King Kripter, Colossus and Cybranasaurus-Rex Health and Damage increased by 35%.
  • Cybranasaurus-Rex Range increased from 22 to 32.
  • Wilfindja Speed increased from 3.6 to 4.6.
  • Gantry build time reduced from 120 to 100 seconds.
  • Pulinsmash weapon range increased from 50 to 100.
  • Darkenoid Health increased from 20,000 to 27,500.
  • AC-1000 primary weapon damage blast radius increased from 1.5 to 3.
  • Cybran Air Rate of Fire boost Research cost increased from 3 to 5.
  • Bodaboom Health boost increased from +20% to +30%. Aura radius increased from 20 to 30. Added a +200% regeneration bonus.
  • ACUs are now repaired 150% slower.
  • Increasing ACU storage size to 15.
  • UEF Submarine weapon range increased by 50%. Movement speed reduced from 6 to 5.25.
  • Structure bubble shields now take twice as long to come back online.
  • Anti-Air Tower damage increased by 25%.
  • ACUs and Engineers now get a Sonar range equivalent to their Radar range.
  • ACU/Escape Pod Experience value increased to 7500.
  • Gantry Experience value decreased to 1250.
  • UEF/Illuminate Mass Convertor Experience value increased to 750.
  • UEF/Illuminate Mobile Anti-Air Experience value decreased to 100.
  • Fighter/Bomber Experience value decreased to 250.
  • Transport Experience value increased to 750.
  • UEF Fighter & Bomber Experience value decreased to 200.
  • UEF/Cybran Battleship Experience value increased to 1500.
  • Cybran Destroyer Experience value increased to 750.
  • UEF Submarine Experience value decreased to 150.
  • King Kriptor, Universal Colossus, Cybranasaurus Rex and Pulinsmash Experience value reduced to 3000.
  • Cybran Intel Add-on Vision radius is now correctly set to 75.
  • Fixed an issue with Cybran tactical missiles that prevented them from hitting a target if it was really far away.
  • Illuminate ACU Teleport time reduced from 10 to 6 seconds

More good things to come.

On to Kings and Castles

Work on AI updates for Supreme Commander 2 has officially stopped, unless something breaks. I have now been moved to Kings and Castles to do the work on the AI for that game. I am really excited. I am like a kid in a candy store that has been told I can have anything I want, and as much as I want, for no charge. This AI isn't exactly a blank canvas, but it is blank enough. Besides, the parts that aren't blank are the basic systems that I probably wouldn't change much about anyway.

I was able to make quite a few more improvements to the SupCom 2 AI before work halted on it. So far, the feedback from the people who have tested it is the Hard AI is challenging and fun. Hopefully the majority of players agree. It will absolutely destroy the AI mods that exists, which is unfortunate, but I also added some more stuff for the modders to play with, so hopefully it evens out.

I still have a nice long list of things I want to add to the SupCom 2 AI (my whiteboard is almost full) and I hope I get an opportunity to implement at least of few of the major ones. If not, you will definitely get to see them in Kings and Castles. The beauty of doing the Kings and Castles AI is the framework is already there. I will (and have already started) have to update a few things to work with the new game, but the majority of the framework can remain unchanged. This will, theoretically, give me more time to do other cool stuff with the AI.


The AI patch for SupCom 2 is tentatively scheduled for later this week (according to the post here: http://forums.steampowered.com/forums/showthread.php?t=1211680). Now, that is by no means definite, but I am hopeful. I have comp stomps waiting.

Sneak peek at the AI changes

I didn’t realize how much I missed working on AI until I started working on it again. So far I think I have been able to make a vast improvement in how the AI plays. I want to thank everyone that posted feedback, it was very helpful. I will have to check the list again, but I am fairly certain I have fixed or at least improved upon all of the relevant issues. The change list for the AI so far is longer than any version of the AI I released for SupCom 1 or FA. Before I post highlights there are some things you need to know.

First, you need to realize that some of these fixes may not make it in right away, if at all. They still have to be tested to make sure I am not epically breaking anything. Second, I still do not know when these fixes are going to be patched it, so don’t get upset if they aren’t in the next patch, or even the one after that. There are a lot of fixes spanning many files, so in the interest of keeping patch sizes down it may be delayed until we can include it without killing everyone’s bandwidth.

Probably the biggest bug was the fact that threat conditions were not being used properly. Threat conditions are what we use to tell the AI to do something in reaction to a threat, such as building AA when an enemy has air units. Not only is this fixed, but the AI is using the threat value of its currently targeted enemy to determine how big of a platoon to send and how many experimentals it needs to have built before sending them out.

The AI also takes into account build restrictions when choosing which archetype to use. It also recognizes when it has all research, so it won’t waste mass on research stations when it does not have to. Also, the AI should no longer get stuck if you rush it and destroy something while it was in the middle of its starting build. If you restrict a unit type in the game the AI now acts like that unit doesn’t even exist in the game. Don’t want nukes in the game? The AI won’t even have the option of giving one of its engineers the order to build one.

Most of Thursday, Friday, and Monday the 22nd was spent fixing little bugs like the above. Tuesday and Wednesday were spent balancing and getting the AI focused. The biggest challenge was the AI’s economy.

The AI uses a bucket system for its economy. When the AI gets resources it puts a set percentage in each of its buckets (defense, expansion, experimentals, land units, etc) and it puts any excess resources in a slush bucket. When the AI wants to build something, it checks the appropriate bucket to see if the resources are available. For immediate items (like emergency shields or economy related stuff) we tell the AI to use from all the buckets. The problem with that is the AI ends up taking from the same buckets over and over. Later in the game, when expansion is harder, the expansion buckets ends up getting filled and never used, so the AI ends up in a situation where it has a lot of mass, but can’t build.

My solution was to make the AI take resources from the slush bucket first when taking from all buckets. Then, I sort the buckets from fullest to emptiest and take an amount from each bucket based on how full it is until we have enough or run out of buckets. If the first pass doesn’t get enough we re-sort and take all the resources from each bucket until we have enough. This way, full buckets that aren’t being used much are the first to get resources taken away and the AI has a much smoother economy.

I also worked to get the AI to focus a lot more. The AI would constantly send units, that were doing hefty amounts of damage to an enemy base, across the map to kill and few units that had the audacity to get near of its expansion bases. It also didn’t focus its attacks on its targeted enemy very well either. It took a lot of trial and error, but I think I have it dialed in a lot better.

Another nice upgrade is that the AI will now use the Mass Convertor. Prior to this the AI would never build one. Now, the AI will build one (it only needs one) or, in the case of Cybran, use the ability of one of its power generators.

I am still working out the cheating situation. Some people complain that the Hard AI cheats too much and the Cheating AI cheats way too much. Currently, I have asked a few people in the office of different skill levels to try out the new changes and see what they think.

Now, as with the last post, I have a request. I would like some ideas on research paths. I plan on going over them again and trying to optimize them and wanted ideas on what paths players use. I don’t need an exact path, per se, because I have a function I use in the AI that finds the cheapest path to get to a particular research. What I need is what research item you go for first, second, third, etc. If you are going air, do you get gunships first? Shields? Or, do you go for the experimentals? Let me know.

For those of you who want a tl;dr list of the AI fixes, here you go. Bear in mind, this list is not exhaustive, so don’t get upset if you pet fix is not listed. This is also not a guarantee that they will show up in any patch, let alone a patch that is released soon.

  • Fixed a bug where threat build conditions were not being used.
  • The AI will hold back units until it thinks it has enough to make a push.
  • Fixed an issue where the AI would constantly pull units back to attack an expansion base instead of pushing forward.
  • Added AI response to make a land AI get land unit AA upgrades if the enemy has air units.
  • The AI will no longer get stuck in its startup build sequence if rushed or if there are build restrictions in place.
  • The AI will no longer give every structure blip AA and Land threat; instead it will wait until it has seen the unit first.
  • The AI will no longer give blips on the water Naval threat, it will wait until it sees an actual ship.
  • If Research is disabled the AI will not build research facilities.
  • If a unit type is restricted the AI will act as though the unit does not exist in the game.
  • Platoons will try to only attack areas where they think they can do enough damage before dying.
  • The AI should no longer attempt to send attack platoons to unpathable areas.
  • The AI will choose an appropriate archetype based on unit restrictions.
  • Re-balanced the way the AI chooses an archetype.
  • The AI will react to enemy TML, artillery, or Experimentals by building more shields and placing them closer together.
  • Enemy shields are now given AntiLand and AntiAir threat.
  • AI will build and use Mass Convertors.
  • If the closest enemy to the AI is a lot weaker than the other enemies the AI will focus on the weak enemy.
  • You can now select which AI type you would like to play against from the dropdown in the game lobby (random is still an option).
  • AI will build factory shield upgrades more often, not just when the enemy has air.
  • Factory upgrades now have a threat value.
  • AI will not build research stations if it already has everything researched.
  • AI will now group units based on their target enemy's threat.
  • AI will now group experimentals based on their target enemy's threat. 
Edit:
The last few changes are in for this round, unless something pops up in testing.
  • The AI is now aware of the victory condition and will focus attacks on the ACU more in assassination mode.
  • When an AI unit dies it will add threat to the instigator's location to warn other units.
  • AI will respond when an enemy turtles.
  • AI will now recognize when it is being attacked by nukes or artillery and respond.

      I'm back, baby!

      I have been pulled off my current project, at least for now, to work on SupCom 2 again. Yay! I will be working on fixing the bugs in the AI (found a huge one today) and generally improving the way the AI plays. For the most part, the AI does fairly well. Once I get the bugs ironed out and tweak some things you should see a pretty decent improvement. Unfortunately, I do not know when these fixes will actually make it into a patch, but I hope it is soon. We need to test these changes as much as possible before releasing them and finding out later that we made things worse.

      The other great thing about being back on SupCom 2 is I get to be brought up to speed on the other things we have planned. The next few patches are going to be cool. Some nice changes, some cool new features, and of course, ranked 1v1. Of course, this will give me more to blog about as well. I also got to sit down with Chris and go over some other things I would like to see changed. The outlook for future patches looks good.

      So far, I think I have found the main cause of the complaint about the AI not reacting to things the enemy does, as well as the AI getting stuck when you rush it early. I also have done some preliminary balance changes, and also changed some weights for how the AI chooses which archetype get used. This is just a small part of the list I have been given to work through. Any of you readers have any other complaints about the AI? Feel free to reply and let me know what you would like to see. I know I have my own list, but I want to hear from you. Please be as detailed as possible.

      The next few weeks should be exciting.

      ( btw, Bender quote ftw :) )

      Video blog #5 is up

      Video blog #5 is up at kingsandcastles.com. If you haven't been following the vblogs, now is the time to start. This time around Chris interviews Gautam Vasudevan (Lead Engineer - Kings and Castles) and barges in on an engineering meeting and interviews Chad Queen (VP of Engineering). Of course, there is also some craziness, this time involving trees.

      Supreme Commander 2 has been out for about a week and half, and, at last count, it has been patched twice already, which is awesome. GameReplays.org is even getting ready to host its second tournament. It is nice to finally get to see the game out in the wild and being enjoyed. Now, if I could just get an opportunity to get in there and tweak the AI a bit...

      I think I have about 3 more weeks on my current project (as I said, it was short term). I am looking forward to getting to take a crack at Kings and Castles and being on a project I can actually talk about. Hopefully, I get to dig into the AI more. On Supreme Commander 2 I only got to work on the AI for about a month. This time around I am hoping to work on the AI from start to finish. The base of the Supreme Commander 2 AI could definitely be used for Kings and Castles, which would give me more time to add in other cool and interesting ideas that pop into my head.

      GDC 2010 ends tomorrow. Wish I could have made it this year, but oh well. I am definitely going to try to go next year.

      SC2 demo now available.

      Finally, the demo for Supreme Commander 2 is now available on Steam: http://store.steampowered.com/app/40140/

      I can't believe the game is almost here. 6 days until it hits store shelves (where I am, at least). I am really excited to see he demo online after waiting so long. I can't wait to see the feedback. I know it is only 2 campaign levels, but what do you expect from a demo.

      I have had a chance to see some of the initial feedback since I could not keep my eyes off the forums today. Someone mentioned that he lua files were all garbled. If I recall, there are 2 scd files that contain the lua. One contains the compiled versions and one contains the uncompiled versions. Not sure if the uncompiled ones are included in the demo version since I have not installed it.

      The project I am currently on has been quite interesting. I have even gotten a chance to work on some ui code, which is a big change. This project is short term, so I am hoping I get a chance to move over to Kings and Castles after this is finished. That project looks like it is going to be fun. If you missed it, Chris posted his second video blog Sunday (see http://www.kingsandcastles.com). There is already a thread on the GPG forums trying to decipher what was written on the whiteboard and what it all means. Also, don't think for a second that Chris is acting, he really is that nuts on a regular basis.

      I hope those of you that downloaded the demo enjoyed it. To those of you that have purchased he game or plan on purchasing it, I would like to say thank you and I look forward to seeing you online.

      New game announced

      Kings and Castles, the next big thing from Gas Powered Games, has officially been announced. Check out www.kingsandcastles.com and see the new blog. Apparently, Chris has decided for a more open and informative approach this time around. I wonder where they got the idea to have a blog.

      Unfortunately, this is not the project I am on at the moment, but hope to be in the next couple of months. The project I am on is an external short term project that I, unfortunately, cannot talk about. I was able to see a short demo of the new game last week and it looks interesting. I don't have a whole lot of information about it yet since I am not on that project, but since Chris has already thrown in a blog maybe they will let me talk more deeply and in more detail about the game during the design process this time around.

      Hopefully I also get to be even more involved in the AI design process.

      For the full press release see here: http://gaspowered.com/kingsandcastles/press-release/

      Interesting changes

      It is interesting how changes in a persons life can alter so many things. I spent 2 1/2 years of my life working on an AI mod. A mod that, when I started it, I never expected to grow into what it became. Now I have a job where I am on the inside and can affect change before the game even ships. It still boggles my mind, and it is still impacting my life in ways I never imagined.

      Now that I am getting my programming fix at the office my hobby interest has taken strange turn. I have now become more interested in cooking and baking. It is definitely something I have always been interested in, but has taken a back seat to programming, until now. Funny how that works.

      Work still continues on SupCom 2. It is amazing how much polish is going into the game. It is nice that we have some time for it. Even the effects are getting another iteraton. The game is looking really nice. I can't wait to see how it performs when my new video card gets here. I can't wait for this game to be released.

      Tomorrow I transfer to a different project, so there won't be as much SupCom 2 news for me to post. Wish me luck.



      Make it run faster

      The word for this week for me has been optimization. Most of my time so far this week has been spent digging through Lua files trying to find where we can safely move things into code, restructure things to be faster, or things we can outright remove because we don't use them anymore.. The biggest example (from my plate) so far has been unit damage. The old unit damage stuff was calculated in Lua and made several calls into code to get the information it needed to make the calculations. Now, we call a function in Lua (where we can hook callbacks, or modders can override it) which checks if the unit can be damaged and then goes back into code to do all the calculations. Much faster.

      After seeing the system requirements for the game I was curious just how accurate they are. So, I built a retail build on my machine to try it out. It ran at +10 sim speed from start to finish, but I have a Core i7 machine with 6 GB of ram, so it wasn't really a accurate test and Gordon called me on it. So, he took his FA dev machine, synced up to the latest build, and ran a 1v1 on Seton's Clutch. As expected, the performance was awful. So, we synced up SC2 (which does not have his or my optimization changes yet) and ran a 1v1 on a similar map. Smooth as glass. We even turned the graphics up to high, which did cause some graphics lag because of his old video card, but sim speed was full on the whole time.

      Having the Digipen people (and there are more of them showing up now) around has been awesome. It is like having a mini beta test in the office and I think their presence has been a great thing for this game. The XBox 360 version has been very popular, which comes as a surprise to me. I am a PC gamer myself, so maybe I just don't get it.

      [Edit]
      Gordon's FA dev PC specs:
      Windows XP
      Pentium D 3.2 GHz
      2GB RAM
      ATI X1900

      Workin' weeekends

      It has been a very busy week so far. Sunday we had some people from Digipen (https://www.digipen.edu/) in our office to test out the game. Apparently they liked it because they came back Monday and Tuesday to play more. Monday and Tuesday we had press in the office conducting interviews and checking out the game. Hopefully this means there will be a lot more information available about the game here soon. I can't wait to read the previews.

      We have had a multiplayer area set up in the office since Sunday and there have been some epic matches. I even got to see Chris lose to the AI. It was awesome. The game is really coming together. Bug counts are dropping quickly as most of us get to the smaller bugs on our lists. Some of these bugs really make you wonder how in the world someone managed to find them.

      I am getting really excited to this this game completed. I spent two and a half years trying to get this job and soon I will have my name on my first shipped game. I can hardly believe it.

      Back to work




      Well, I am back to work this week. I had a nice vacation. It was the longest vacation I have had in the last 5 years.

      I am still on gameplay bug fixing duty and will continue to be probably until the end of the project. Our overall bug count is going down quickly. I have high hopes of having a nicely polished game at release. Let's hope I am right.

      I made it past the 4 month mark. The amount of progress that has been made over the last 4 months is amazing. 4 months ago the skirmish AI didn't really exist yet. Now, the game has a skirmish AI to play against.

      I have also learned what it is like to have something you worked on for a while cut from the game. If you have been following this blog for a while you may remember when I mentioned that I created a cool weapon for a unit and even influenced the effects for it. Well, it got cut and replaced a while back. I was not happy about it, but it happens. I have added other, cooler in my opinion, things to the game.