Custom AI API

Discussion in 'Planetary Annihilation General Discussion' started by zeroonezero, May 8, 2013.

  1. zeroonezero

    zeroonezero New Member

    Messages:
    1
    Likes Received:
    3
    Here is a proposition regarding modding capabilities in terms of AI programming:

    There's at least a couple of games for which a custom AI can be created - Starcraft and Unreal Tournament 2004 being two of them. Both of those have spawned AI competitions (see http://eis.ucsc.edu/StarCraftAICompetition and http://botprize.org/) and brought about some interesting results in term of AI development itself - for example the UT2004 bots were capable of fooling judges in a contest into thinking they are human (http://www.newscientist.com/article/dn2 ... -test.html).
    An official AI API together with Planetary Annihilation would also allow for such competitions, maybe even human vs AI matches in the future.

    Making an AI for a game usually involves non-official modifications which can contain a lot of bugs and be awkward to use. Having an official AI API would really be a great treat for the modding community and the development of game AI in general. Generally a higher level language would be better for this purpose (ideally a functional one like). Perhaps the game could also include a special mode in which people can pitch their AIs against each other, or volunteer to play against an AI to test it.
    ledarsi, Quitch and Pendaelose like this.
  2. zaphodx

    zaphodx Post Master General

    Messages:
    2,350
    Likes Received:
    2,409
    Awesome! Although I trust Sorian to do a great job with the AI, this would be ace!
  3. pashadown

    pashadown New Member

    Messages:
    14
    Likes Received:
    0
    Sorian? Great AI? Ha. Ha. Ha. I still remember his Cybran Air where it first and foremost builds 2 transports and then sits them there. :lol:
  4. KNight

    KNight Post Master General

    Messages:
    7,681
    Likes Received:
    3,268
    Yes, because only being able to modify certain aspects of the AI is exactly the same as being able to write it from the ground up......

    Mike
  5. neutrino

    neutrino low mass particle Uber Employee

    Messages:
    3,123
    Likes Received:
    2,687
    I can't wait to try out your AI ;)

    Sorian is a rockstar programmer IMHO.
    lokiCML, tatsujb, ledarsi and 5 others like this.
  6. ooshr32

    ooshr32 Active Member

    Messages:
    749
    Likes Received:
    141
    Against a decent player the SupCom AI remains stupid and above all predictable.
    No two ways about it.

    However, Sorian improved it out of sight from it's original brain-damaged state, and is rightly highly-regarded in the community (and at Uber is seems :)) for his efforts.

    But as Neutrino perhaps implies, writing any AI to play a game like this (so so many options) isn't easy, which is why so many of them resort to cheating.
    The Civ V AI could barely play the game on release and they get to think about their moves in non-real-time!
    Pendaelose likes this.
  7. Blayzeing

    Blayzeing New Member

    Messages:
    2
    Likes Received:
    4
    I too would love an AI API. I can remember having lots of fun with the DEFCON API and learning a lot too.

    Of course for that to work you had to compile the game, which would be ethically questionable with such a new game; especially a competative one. I suppose some kind of scripting could get around that, perhaps maybe lua or some sort (never used it myself, but it strikes me as usable here).

    Just happy to play at the moment though XD
    Pendaelose likes this.
  8. Sorian

    Sorian Official PA

    Messages:
    998
    Likes Received:
    3,844
    Wow, thanks :)
  9. thetrophysystem

    thetrophysystem Post Master General

    Messages:
    7,050
    Likes Received:
    2,874
    Haven't a lot of people seen the AI "orders of operation"? I believe I opened it once, looked like a simple if-else parameters list, albeit if-else really can get anything done. So far it knows exactly how much of anything it needs to make anything else, and arguably spreads faster than any human without cheating. The only downside is it doesn't continue to spread after so big sometimes, and it doesn't pressure enemy eco. Those are programmable to be random events it can focus on once it has so many combat units at a certain time or scouts so many enemies in one place with a lack of defence.

    When it starts actively reacting to attacks by moving it's armies faster, or keeping sorted "fast" and "slow" armies, or early raiding, or even com pressure while retreating behind an army (agressive yet safe use of com), then it will be pretty functional in my opinion. (and navy) Anyway, nobody could complain at that point, I want to mostly play this for largescale singleplayer and I am happy with progress torwards it, but I still feel there are suprises coming, and there already were when AI started combombing, I was legitimately suprised.

    On original topic though, those if-else notepad style parameters should be fairly simply programmable, as well as tweakable (make several of them, some where AI focuses earlier and more heavily on artillery, one where AI focuses on attack orders earlier to aggressively raid, one where AI rushes t2, ect, then insert script that chooses one of those from random for the AI to follow, giving you a random AI that might specialize in anything)
    stormingkiwi and Pendaelose like this.
  10. Pendaelose

    Pendaelose Well-Known Member

    Messages:
    536
    Likes Received:
    407
    There are a few mind sets when it comes to creating a good AI. Personally, I believe that no matter how efficient the AI is, a good game will reward critical thinking and creativity. No conventional AI on the market can compete in that department, yet. However, replacing a human is not the purpose of game AI. The goal is to give the player a healthy challenge. If scripting your AI to cheat results in an experience that is more rewarding than roflstomping a digital retard I say go for it. I certainly did when I scripted the AI for my ZeroHour generals and most players preferred it that way.
  11. stormingkiwi

    stormingkiwi Post Master General

    Messages:
    3,266
    Likes Received:
    1,355
    The AI should only be scripted to cheat if it achieves the same result simply that much more complicated code achieves. I.e.. There isn't an observable difference.


    The AI should be emergent and not scripted.

    An emergent AI is one that does do stuff that you didn't program it to do.
    Pendaelose likes this.
  12. Pendaelose

    Pendaelose Well-Known Member

    Messages:
    536
    Likes Received:
    407
    That's ideal, but not always possible, especially for modders. You can only modify the AI as much as the game engine is designed to accommodate.
  13. thetrophysystem

    thetrophysystem Post Master General

    Messages:
    7,050
    Likes Received:
    2,874
    You can script it to have a variable chance to do one of different things, and the depth of detail is what makes it better each line of code.

    You can make it scout, and when it recognizes you built pelters it can react in a variable way, its reaction could be a probability role between building bombers or build pelters just out of range against the pelters. This gives it the illusion of unpredictability, because it doesn't just react one way but it can roll dice to react one of several ways to everything.

    Also, cheating is something that increases the challenge handicap, for both players and AI (increasing the eco for one player over another for example when otherwise the players are unbalanced in skill). Increasing the challenge handicap is an effective tool, but it doesn't make the AI more or less interesting, just like it doesn't make the player with the handicap play any more tactfully, it just gives the advantage to play poorly but faster. Having an AI that makes some pretty innovative plays is interesting. Cheating with an eco scaler or no fog of war, is just a difficulty increment without changing necesarily how the AI actually plays.
    Pendaelose likes this.
  14. vackillers

    vackillers Well-Known Member

    Messages:
    838
    Likes Received:
    360
    There was some good AI mods for supreme commander but I can see AI API being released at some point for this game but I have to say I'm really looking forward to Sorian's flushed and finished AI because this time around with all of his experience and what I've personally experienced already with the AI in the game, it will no doubt have one of the best AI's in the RTS genre as it is anyway, we might not actually need to add, or tweak or change things by the time it gets fully finished. I do hope we'll be able to set AI behaviors though in the lobby so make those of us who aren't great at games (me) to be able to actually beat the AI, like no rush timer or setting rush/turtle behaviors on/off ect... being able to set no nukes on/off air units on/off stuff like that though thats not specifically part of the AI stuff..
  15. thetrophysystem

    thetrophysystem Post Master General

    Messages:
    7,050
    Likes Received:
    2,874
    An AI API would, if made by a player, pretty much be like Raevn's Mod Manager, where it autoscripts based on a graphic interface.

    Mod manager basically installs mods into the correct folder, and then autoscripts changes to the modlist to load the mods. Using a simple checkbox, it adds or removes the code from the mod listing, which determines if the game reads it. At least it was before the last biggest modding change how the Mod Manager worked.

    The AI file could have the same. You have a simple screen, add tactics to the AI, you list them in order of focus, and you prioritize them beside one another with a precentage of 100. All that automatically plugs script into the file. End result, a scripted AI. Doable by notepad just like mod installation. Done by Graphic Interface instead for user friendliness... just like mod installation.
    Pendaelose likes this.
  16. vackillers

    vackillers Well-Known Member

    Messages:
    838
    Likes Received:
    360
    Well i think Sorian will release the API when its finished I see no reason not to at this stage cept perhaps the ground breaking AI path finding stuff which I believe has never been done before so I dunno if uber will want to protect that sort of coding or not but I think it would be pretty kool to see customized AI though, I'm all up for that stuff...
  17. stormingkiwi

    stormingkiwi Post Master General

    Messages:
    3,266
    Likes Received:
    1,355
    Yeah, which is why the game engine should accommodate some modding.
    Err.. what exactly do you mean by scripting?

    If you mean predictable AI... thats just bad. It means you can exploit it..

    The problem with explicitly programming every option into the AI is that you can't do that, you can not cover each possibility, and it's easy to find the weak points that you can exploit.

    Cheating does not increase the difficulty. It means that you have to find the strategies that work against the AI and exploit them. It makes you a good singleplayer player, not a good multiplayer player. You're just better at exploiting the AI.
  18. thetrophysystem

    thetrophysystem Post Master General

    Messages:
    7,050
    Likes Received:
    2,874
    How is... that is exactly what I am advocating avoiding. If an AI has MULTIPLE ways listed to react to something, then it can't be predictable. That is about the only way to avoid being predictable, otherwise playing against the AI is just playing a numbers game, where you lure them heavily into going anti air or something and then just flip the table on them. And cheating only amplifies how well the computer can do what they are doing, if they have the eco to respond twofold then they still respond predictably then they still aren't interesting in any way at all and they still can be duped by anyone who knows the numbers game against the AI.

    When I am agreeing with you, don't make it sound like I am not lol.

    About Pathfinding: That is all done in flowfields I believe? Besides maybe choice of build locations which is really not groundbreaking. Anyway, flowfields will possibly be editable but I doubt anyone will want to, nothing to gain from it.
  19. Quitch

    Quitch Post Master General

    Messages:
    5,884
    Likes Received:
    6,045
    Have you changed your first name to Sorian yet? It really would simplify things :)
    stormingkiwi likes this.
  20. stormingkiwi

    stormingkiwi Post Master General

    Messages:
    3,266
    Likes Received:
    1,355
    Lol :p

    I understand you agree with the principal, but I don't agree with the execution.

    What I mean is you shouldn't say 'if you find this structure, then you should counter it by A, or else by B, or C, D, E, ...., or ZZ9 Plural Z Alpha or any combination thereof

    Because A) this requires that you think up every situation the AI could encounter, and account for it; B) you have to think of every solution, and C) someone will probably immediately develop an additional solution that the AI can never do, but which is a really good idea and actually creates a problem for the AI.

    You should give the AI the tools it needs to develop all those solutions without you ever explicitly telling it to.

Share This Page