on Apr 10, 2008
This is something I’ve been pondering as well. It’s probably too much to hope that Blizzard will release the Starcraft source someday. That might be a terrible idea anyway, given the fact that the community is still going strong, not to mention the professional-level competition gameplay. Having the source would make certain kinds of cheating possible. You couldn’t get free money or anything like that, but you could make it so that the interface shows you information which should be hidden from you. You’d be able to see (but not attack) fully cloaked units, start with the map explored, see what resources your foe has, and other information along those lines. Basically you couldn’t make a hacked client to let you do anything you couldn’t normally do, but you can make one that would let you know what you shouldn’t.
So, Blizzard releasing the Starcraft source probably isn’t going to happen for us.
Still, the idea of competitive AI programming is really compelling, and moreso if we’re talking about doing it with a game where humans can join in. Sure, you could write your own platform designed to let programs fight it out in some arbitrary manner (and there have been many systems like this in the past) but the whole thing doesn’t really get interesting until it has to face a human being. I think an interesting idea would be for a game designer to devise their own scripting language (probably some C++ flavored thing, but whatever) that allowed anyone to write AI modules and share them with others. Non-programmers could download new AI packs if they want a new challenge. Introduce some sort of global rankings system and we can see which AI packs fare best against the userbase and which ones people enjoy playing against. It would keep the game fresh and new, even for people who stick to the single-player experience. Actually, it would turn vanilla Human vs. AI play into a sort of proxy Human vs. Human. It would be some sort of new form of multiplayer, going against someone else’s AI.
And now, let me construct my fantasy system and how I think it should work:
- To keep it fun for human players, the system ought to be restricted so that the AI can’t know things that a human wouldn’t know. You don’t want to ever worry that the AI you’re playing against is a “cheater”.
- There should also be some sort of limit on how fast the AI can issue commands. It’s not very fun fighting an AI that can control eighteen individual units and have them all doing different things at once. “Selecting” units should be free for the AI, but issuing a command to the group should only be allowed at certain intervals. This will encourage AI programmers to “group” units the way humans do. Sure, you can have half a dozen Ghosts attempt to run in and lock everything down, but you won’t be able to give them those unique orders faster than once every other second, and while you’re doing that you’re ignoring units elsewhere on the map.
- The AI programmer should have to put up with the same unit behavior that humans do. If Battlecruisers tend to drift away, get distracted and end up chasing peon units on their own, then the AI coder will need to tolerate and deal with this as well. This also means that AI coders get to benefit from the built-in unit pathfinding and foe selection without having to write their own.
- The AI programmer should have access to everything a human does. Rally points, formations, unit stances. I would even argue that making these choices should be free. (Not count against the AI limit on commands issued.)
- While the AI must deal with fog of war like any human, I wouldn’t want to restrict them to only “seeing” a single screen of data the way a human does. Sure, it would make it more fair if the AI could only be “looking” in one place at a time the way a human does, but it would also make AI coding a lot more complex.
- You’d need some way to limit the CPU cycles the AI is allowed to suck down. You want to be able to play against several AIs at once without slowing things down, so you want to strongly encourage speedy, efficient code. Even on modern machines it’s pretty easy to slow things down if you start doing heavy-duty a statistical analysis on a battle between dozens of units.
I imagine you’d have functions in your AI script: Things like: new foes coming into view, units being injured, new units coming under your control (produced), units dying, units activating special abilities, and so on. The game would call these events as they took place, and this is how the AI would “see” the world. The default AI that ships with the game would be built using this system, and would be the example program that new coders could use to teach themselves about the system. Ideally, AI scripts would be shared in plain text format, thus enforcing a system of open source.
If someone put out a game like this, within a few months the game would have unparalleled AI. The combined work of many fans, sharing their efforts over time and seeing their attempts pitted against the community at large, will rapidly achieve what no in-house AI coder could hope to do on their own.
Shamus Young is an old-school OpenGL programmer, author, and composer. He runs this site and if anything is broken you should probably blame him.