Artificial Intelligence In X-Wing

By Astech, in X-Wing

9 minutes ago, BadMotivator said:

Indeed. But i doubt the big AI developers could develop a good RTS AI even if they did try. You'd never make a Deep Blue equivalent for Total War or Starcraft. Not in the near future anyway.

Give it a year

They just released the AI dev tools for SC2 this summer and several big names are throwing their hat into the ring so you'll get to see if you're right.

To this point most of the AI development was concentrated in SC1 and, though extensive, was hobbyist using hand structured stuff. But now that the big boys are piling in and sucking literally millions of games into more modern platforms I expect you'll see a rapid and massive improvement in capabilities. It'll likely still be a while before they can beat top level Koreans but I wouldn't be surprised at all if they're around the high end NA amateur level within 2-3 years.

IMO, based on what I've seen coming out the AI field (They now have AI that can outplay and outbluff the best poker players in the world) the only thing stopping the big tech firms from developing an AI using machine learning is a lack of motivation. Chess, Go, Poker, Jeapordy, Backgammon, those are household games that have a rich history in the public eye as being extremely strategically deep. Conquering these games is a huge notch for these tech companies to put on their bed posts and incorporate into their marketing and shareholder pitches. Magic the Gathering may be close to having the public recognizability to motivate a tech firm to create an AI that can beat professional players. X-Wing is not there yet in terms of public recognition with non-gamers, not even close.

So the question is will we see a smaller tech firm, most likely a tech student, find a way to create an AI that plays X-Wong on the level of the professionals? I sure hope so. The Go players that were commentating on Alpha Go's plays remarked that it was super-human, as if the moves were coming from a divine realm of the game that had been previously inaccessible to humans.

I look forward to the day that some guys smart x-wing AI turns our competitive notions on this game upside down or shows us just how much real strategic depth this game actually has.

The growth of AI always disturbs me. I'm aware there are possible futures which are utopian, but there are others which are deeply dehumanizing, and the chaos and ennui of the transition stage I fear immensely.

There's a quote from the novel Dune that should be famous if it isn't already:

"Once men turned their thinking over to machines in the hope that this would set them free. But that only permitted other men with machines to enslave them."

"'Thou shalt not make a machine in the likeness of a man's mind,'" Paul quoted.

"Right out of the Butlerian Jihad and the Orange Catholic Bible," she said. "But what the O.C. Bible should've said is: 'Thou shalt not make a machine to counterfeit a human mind.' [...] The Great Revolt took away a crutch," she said. "It forced human minds to develop."

Here's my initial outline on ways to go about this idea. I don't work in AI or in Predictive Analytics so I probably get stuff wrong but I've been trying to figure out how to model what to bring to a tournament and what decisions are always optimal for an X-Wing game using data.

For the below, use the time interval of data since the last FAQ or release, whichever was most recent (FAQ as of today). Note this also assumes the following:

  • AI Cheats by measuring distance (i.e. from camera and anchor points)
  • AI can see the board (i.e. mobile app running on phone using the camera is the AI's form factor).
  • Actively using tournament videos, list juggler and the existing game in front of the AI as data sources

LIST BUILDING

1 - perform a multivariate analysis with list juggler data to identify the most impactful group of ships and upgrades based on tournament data where positive correlation of a given card (upgrade or ship) to a "win" becomes the weighting (to some extent already done on the meta analysis site but you need the specific card correlations to a win). Start with ships to pick the best 5 ships in rank order. Pick the faction that has the most representation in that "5 ship ranking" and then rerun the analysis for only those ships in that faction. Then do the same analysis on upgrades for those ships.

2 - pick a minimum bid to be competitive at PS if the "winning" ships have: PS8+VI, PS9+Adapt or VI (or if all "winning" ships are base PS less than 8, set bid to 100)

3 - run a "market basket optimization model" to select the best upgrade and ship combination at the bid level you defined where 100-(bid) is your "basket size" and the correlation is strength of weighting at the ship level - for example when Advanced Prototype Vader is the "best" ship, look only at the correlations for each upgrade Vader can take in the slot, if Harpoon has a higher positive correlation value to a win than Cruise Missile for the missile slot, you select Harpoon. If all correlations are negative or only weakly correlated, then leave the slot empty (i.e. missile slot on Ryad might only have weak correlations). This will likely leave you with only 2 or 3 ship builds where Rebel has Fenn as the primary ship (given its use with both Ghost and ARC-170), Empire has Quickdraw as the primary ship, and Scum has Asajj as the primary ship. Optimize for each ship, last ship is probably sub-optimal if there is a lot of variation from list to list, more likely for Rebel in a 3-ship list in the current meta. I think Mynocks alluded to this on a recent podcast (just toss 3 named "aristocracy" rebel pilots on the table)

SETUP

4 - calculate the starting ship and asteroid type and positions from online videos of similar ships where the list won, look for % variance from the winning videos as opposed to absolutes since you have to respond to the competitor's decisions OR go with an archetype like Swarm, Aces, 2-ship large bases where you can set specific go-tos such as "as big a cluster in the middle" or "push to the corners" and use distance calculations from rocks to decide

DIAL SELECTION

5 - for each ship selected for the "winning list", look at the movements on online videos of these ships by winning players and see what decisions the players made, look for patterns where the player either:

  1. never made a certain dial decision (flag as "i" = impossible --> AI never makes that decision [i.e. fly straight 4 when the board edge is distance <= speed 4]);
  2. sometimes made a certain dial decision (flag as "p" = possible --> AI may or may not make that decision [i.e. fly over a rock]);
  3. always made a dial decision (flag as "n" = necessary --> AI will always make that decision (i.e. hard turn when near the board edge at 45 degree angle within speed 3]);
  4. account for position of arc (all geometry) and nature of the opposing ships (turret, multiple arcs, bombs) in the calculation of when a decision is "n", "p" or "i". Set "n" to always do in a given situation and "i" to never do in a given situation. "p" is more complicated. you will spend most of your time on "p"
  5. for each "p" determine what causes a player to decide one way or another at any given situation and try to redefine that decision as a new "n" or "i" scenario. For example, if a ship is within a given distance of the board edge and certain dial selections would cause it go off the board in the following round regardless of dial selection you would call that decision an "i". For simplicity, if you can't tease out why a given decision was made, look at the % of time the player picks one maneuver or another in the same situation and use a (1-100) random number generator to decide OR do a weighted calculation for likely decisions over next 2-3 rounds and compound the % until you reach a number close enough to 100% that you can set the decision combinations to "n". Usually a good way to know the correct scenario for "p" is when the commentator says, " why would you do that??" and it costs the player more than they gain (i.e. lose shields or hull but deal no damage in return). Change the "p" scenario in this case to "i" and have the AI not make that decision in the future.

SHOOTING

7 - to the OP's point, probably easiest - solve as follows:

  1. focus fire - given the total attack dice and arcs on any given target, is it plausible to completely destroy a ship, if so does that ship have a positive correlation to a win (as per "List Building" section above #1-#3)? If yes, then attacking that ship is a "n" decision.
  2. if the above is not true, what combination of attack decisions is likely to cause the most damage and mitigate the most return damage using Red Dice + Modifier vs. Green Dice + Modifier tables that already exist, Most favorable outcome is the decision for the AI to make

An X-Wing AI is a fascinating idea. Training it via VASSAL to get in the games required fast enough and independant of human input would be mandatory, but for 'shock' value it would also need to be able to operate IRL. So it would need an I/O format flexible for both and some major framework work to get going. That is already quite the task without getting into AI know-how!

An AI like this could be an invaluable tool, from watching it play your list to pick up some subtleties to using it as a sparring partner. I'd love to have it, but my knowledge on machine learning is very basic (used some basic models for categorisation a while back) and the amount of time you'd need to put in is something I can't spare right now.

I'll still learn some basics, just in case.

If any of interested is a developer and would like to try to make it happen, then pm me please :)

3 hours ago, Admiral Deathrain said:

Training it via VASSAL to get in the games required fast enough and independant of human input would be mandatory, but for 'shock' value it would also need to be able to operate IRL. So it would need an I/O format flexible for both and some major framework work to get going

I think you completely separate and abstract the 2 things. The AI is the AI and it has an input contract for board state, whether that's coming from Vassal or from an API that converts camera images of the board into positional data it doesn't particularly care. For the camera data you'd also need someone entering non-positional data like shields, hull, ordnance or palp usage, etc. so it could be passed in as well.

Though that does raise the question of whether when playing in meat space you'd want some sort of variable noise in the predicted movements to represent people bumping ships, imprecise overlaps, and template wiggle. You'd get some of that naturally since any image rec will likely be at least slightly off but it would be off in one direction based on distortion as opposed to random. And since it will know exactly where something was would be funny to have the computer start screaming "Judge!" in a monotone Stephen Hawking voice if you bump something until you put it back where its supposed to be.