Game Design, Programming and running a one-man games business…

Initial thoughts on game AI

I’ve thought about the AI for Gratuitous Space Battles a lot. I have a lot of ideas, some of which I’ll sketch out, and some I’m keeping secret for now.

When I say ‘AI’ I’m being pretty nebulous. I don’t use AI in the trad comp-science limited sense of it. I’m talking about the whole matter of computer-controlled opponents. Who they are, how they are selected etc. Because GSB is a ‘hands-off’ battle game (for now), there is an element of determinism about how the battles work. In other words, if you design a fleet, in theory the AI can design one that it is assured of kicking your ass with.

There are many ways it could do this. The most obvious bruet force method is to randomly design fleets and pick the one that beats yours. Another would be to have some initial ‘seed’ fleets and do a genetic mutation – evolution algorithm to deduce the ultimate fleet against yours.

However, while I want a challenge, I don’t want you to be beaten every time. Plus, the ‘problem-space’ is colossal, way beyond chess, because there are maybe 40 hull designs, maybe 100 ship modules, near infinite combinations of ships and modules, and that’s before ship placement or ship-behavior/instructions. It’s not possible for the AI to beat your fleet using deep-blue style iteration of possibilities.

So there is a good chance the final AI will be some mixture of pre-designed (by me) AI fleets, combiend with an element of letting the AI battle several thousand slightly randomly mutated sample player fleets, and improving on my initial design.

I’m sure everyone has lots of ideas of where else to go with this, such as machine learning, copying player fleets etc. Needless to say, I’m mulling over them all :D


7 thoughts on Initial thoughts on game AI

  1. As a player, I approach fleet design with tasks. The last big game I played a lot that allowed me to design my fleets was Master of Orion 2. My fleets would consist of specialized ships. One with missiles that stays far back and out of range. One focused heavily on short range weapons that runs straight at the enemy and hits them hard, and one focused on bombardment whose sole missions is to reach the enemy planet and bomb it into oblivion. All the AI ships tended to be very generic ships with no specialization., resulting in easy victories.

    I would break it down as thus in the design: List all the ship design specializations, weight the equipment and upgrades based on their effectiveness in each specialization, then come up with defaults for all the playable sides to make each race feel different when fighting against them.

    Have the AI analyze the opposing fleet(s) and, by analyzing their equipment and using the weights, determine the specialization of each fleet, and that produces the percentages. With this knowledge, the AI can tweak its own ratios of various specializations to try and counter it. If you can pull it off so that the AI is only able to do this against fleets it knows about, it could make the game more interesting. It would provide a reason to keep fleets hidden and away from anyone’s sight. Station a fleet next to an AI stronghold, and if you don’t attack right away, eventually one will appear that can counter it.

    Another thing that you can do to solve two problems at once, is that with such customizable ship designs, you’ll want to have automated/pre-designed ones for players that can keep up with the tech curve.

  2. I like Reliant’s idea of having the fleet type analyzed based on the types of modules used to make up the ships. If a fleet is found to be very missile heavy, then the AI will know to counter it with x. This works in cerrtian situation, but should not be the core AI fleet generation method.

    When you start to approach AI as an omniscient counter to whatever the human comes up with it starts to lose credibility with the player. Who wants to fight something that will always be geared against you? Is the player supposed to be the one solving puzzles and not the AI?

    I guess it all comes down to how the game is going to be setup. Is this going to be story-driven string of battles against the AI? Or is it going to be a single randomly generated skirmish with high replayability? If its the former, then preset fleets with minor generation tweaks at generation time would be ideal. The player wants to know what they are fighting, they want a villain. These preset fleets could even have a persona associated with them, i.e. an evil general that has become far too dependent on laser based weapons despite what he is up against.

  3. I don’t think the AI should just analyze the players fleet selection and then counter. If you were playing against a human opponent over the net, you couldn’t just analyze and counter. You need to decide what strategy you will pursue in the battle and work around that.

    An intelligence report before the battle could give you a little insight into the enemies fleet. That way, you’re given a partial strategy and the rest is up to the player. The AI could then partially analyze your fleet selection so you would be on even terms.

  4. Michael and Viper’s posts gave me more ideas to toss around.

    An intelligence system. Intelligence reports that estimate the size of the enemy fleet, as well as a list of known ships with their last known location. You could even add inaccuracies based on the quality of intelligence, like listing ships that were destroyed by another AI but isn’t known by the player’s intel. That adds the element of trading intel with other AIs, as well as gaining a significant strategical advantage by getting a spy into an enemy shipyard which can keep track of ship building. The AI could use the same system for building its fleet, making the game fair by having the AI and player having the same level of knowledge.

    Another element that can be added would be secret staging areas. Basically empty areas in the middle of nowhere to assemble fleets without the enemy knowing. Counter-intel strength as well as how much time is spent assembling the fleet could be the determining factors on the AI discovering it

  5. I wish the game was that huge and sprawling but currently there is no planned metagame inbetween battles (although if GSB sells ok I would lvoe to add to it over time).
    I have thought a lot about what intel to give the player about the ships they face in the coming battle.
    Currently you see silhouettes of the enemy ships, but no intel on what weapons they are carrying. This means the first attempt at each mission is basically a fact-finding exercise to see what you are up against.

    I am considering having different difficulty levels with less information on the enemy fleet. Maybe just vague blobs showing their dispersal rather than being sure if that blob is 100 fighters or 3 big cruisers.

  6. Hi Cliffski !

    An interesting point would to be to look at table top war games. The one I play has a number of different races which all have different traits – Some are defensive (High armour, high range attack but slow and expensive) whereas some are more fleet ( low armour, mostly hand to hand, high speed & some interesting add-ons to help them get a cross the battelfield before they got shot!) whereas others are simply cannon fodder for the big boys to get into hand to hand.

    I suppose what I am saying is that each to their own – you don’t want to create a series of clones = Race 1 – Big Ship A is the same as Race 2 – Big Ship A but also when I know what my oppenent is likely to play both by race (If its Marines I know I will face a few troops but they will be heavily armed and strong weapons) – So I put in power weapons to cut through that armour
    (Expensive so I can only pick a few but I am safe as he can’t pick anything else.) , game style – If I face Opp A then he is always going to put in loads of foot soliders even though he can pick tanks, war machines or support batteries and finally Mission type – If its a Take and hold – It’s gonna be tough and bloody so lots of heavy armed hand to hand troops rather than faster lighter armed strike troops or single tanks that could be killed in one shot (either lucky or sustained fire)

    All of these choices are, however, balanced out by cost, ability points, number of that slot (you can’t just field an army of tanks – some must be troops and HQ) and good old Lady Luck of the dice !

    So couldn’t do a weighted matrix of each race / mission winning conditions / game style and then add some random multiplers?

    Love the Fog of War idea – Would love to see things like you could spend some on pre-set up scouts / spies or even to pay something extra to seed mis-information.

    Would love random things like nebulas / “weather effects” – Big plasma guns can’t fire if Sun is showing solar flares as they might set space on fire due to proton clouds !!!!!

  7. Yes I plan to have some scenario modifiers. The code is already done, so some battles will be in dust clouds that reduce ship shpeed, some will be in planetary atmospheres where lasers do more or less damage etc etc.
    There is plenty of scope for different scenarios to keep up big variety :D

Comments are currently closed.