{"id":1599,"date":"2008-04-10T11:56:15","date_gmt":"2008-04-10T16:56:15","guid":{"rendered":"http:\/\/www.shamusyoung.com\/twentysidedtale\/?p=1599"},"modified":"2008-08-16T10:27:26","modified_gmt":"2008-08-16T15:27:26","slug":"user-made-ai","status":"publish","type":"post","link":"https:\/\/www.shamusyoung.com\/twentysidedtale\/?p=1599","title":{"rendered":"User-made AI"},"content":{"rendered":"<p>In <a href=\"?p=1597\">yesterday&#8217;s post on Startcraft AI<\/a>, SolkaTruesilver mentioned <a href=\"http:\/\/www.shamusyoung.com\/twentysidedtale\/?p=1597#comment-91529\">here<\/a> that it would be nice to have a way to make custom AIs for the game and pit them against each other.<\/p>\n<p>This is something I&#8217;ve been pondering as well. It&#8217;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&#8217;t get free money or anything like that, but you <i>could<\/i> make it so that the interface shows you information which should be hidden from you.  You&#8217;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&#8217;t make a hacked client to let you <strong>do<\/strong> anything you couldn&#8217;t normally do, but you can make one that would let you <strong>know<\/strong> what you shouldn&#8217;t.  <\/p>\n<p>So, Blizzard releasing the Starcraft source probably isn&#8217;t going to happen for us.  <\/p>\n<p>Still, the idea of competitive AI programming is really compelling, and moreso if we&#8217;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&#8217;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&#8217;s AI.<\/p>\n<p>And now, let me construct my fantasy system and how I think it should work:<!--more--><\/p>\n<ul>\n<li>To keep it fun for human players, the system ought to be restricted so that the AI <b>can&#8217;t<\/b> know things that a human wouldn&#8217;t know.  You don&#8217;t want to ever worry that the AI you&#8217;re playing against is a &#8220;cheater&#8221;.\n<\/li>\n<li>There should also be some sort of limit on how fast the AI can issue commands. It&#8217;s not very fun fighting an AI that can control eighteen individual units and have them all doing different things at once.   &#8220;Selecting&#8221; 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 &#8220;group&#8221; units the way humans do.  Sure, you can have half a dozen Ghosts attempt to run in and lock everything down, but you won&#8217;t be able to give them those unique orders faster than once every other second, and while you&#8217;re doing that you&#8217;re ignoring units elsewhere on the map.\n<\/li>\n<li>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.\n<\/li>\n<li>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.)\n<\/li>\n<li>While the AI must deal with fog of war like any human, I wouldn&#8217;t want to restrict them to only &#8220;seeing&#8221; a single screen of data the way a human does.  Sure, it would make it more fair if the AI could only be &#8220;looking&#8221; in one place at a time the way a human does, but it would also make AI coding a lot more complex.\n<\/li>\n<li>You&#8217;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&#8217;s pretty easy to slow things down if you start doing heavy-duty a statistical analysis on a battle between dozens of units.\n<\/li>\n<\/ul>\n<p>I imagine you&#8217;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 &#8220;see&#8221; 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.  <\/p>\n<p>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.  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>In yesterday&#8217;s post on Startcraft AI, SolkaTruesilver mentioned here that it would be nice to have a way to make custom AIs for the game and pit them against each other. This is something I&#8217;ve been pondering as well. It&#8217;s probably too much to hope that Blizzard will release the Starcraft source someday. That might [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[55],"tags":[],"class_list":["post-1599","post","type-post","status-publish","format-standard","hentry","category-game-design"],"_links":{"self":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts\/1599","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1599"}],"version-history":[{"count":0,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts\/1599\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1599"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1599"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1599"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}