Introduction
I am working on a space 4x board game. I already have made a few posts on it. For a brief context of ideas I have for the game, please see these links:
http://www.bgdf.com/forum/game-creation/new-game-ideas/semi-cooperative-...
http://www.bgdf.com/forum/game-creation/mechanics/space-4x-world-develop...
In my game, I thought it would be neat to have non-controlled player alien races on planets, play as if they were players. It would make the universe more alive and exciting than just having alien races on planets just sit there waiting to be taken over.
I thought about it a bit and it seems to me that actions can be largely based on our particular view of the world, our ideological mind set or values. In short:
ideologies -> actions
So for example, a war like alien race who relishes a fight will typically try to conquer others. An alien race that greatly values knowledge and technology for its own sake will spend lots of resources on technology and so on.
Main Idea
In my game, I am envisioning that each alien race has a set of ideological propensities of certain strengths listed in order of priority of importance.
The ideological set can be boiled down to actions one can do in the game.
For example, an alien race whose society is built around militaristic expansion with a impetus to explore while eschewing trade could have a list of four icons with a number below it to indicate the strength (higher positive number more inclined with a negative number more averse to the action) in committing such an action. In this particular case you can have:
Attack 2, Colonize 1, Explore 1, Trade -1
Now, this is all fine and good, but the essence of an AI is to respond appropriately to conditions around it.
So building on what I have so far, the more likely a specific action will be executed is dependent on how likely that input will generate a response. For example, an alien race who is really keen on colonizing will more likely colonize an available planet than an alien race that is more keen on trading when an excellent trade exists even though a planet is sitting there waiting to be colonized.
To reflect this, the input for a particular action will be used as a modifier to the appropriate alien stat of that same action. Once all inputs are added for all actions to an aliens stat profile, the highest value calculated for an action is the one that is executed. In a case of a tie, the left most stat will be picked in favour of the other ones.
Concrete Example
As a concrete example, let's use the alien profile mentioned above. There are a couple of unexplored sectors adjacent to it and no known planets to attack or colonize.
Each of the unexplored sector cards/tiles next to the alien's home world have an explore icon that matches the explore icon on the alien's stat card along with a number. So one of the unexplored sector cards has a, Explore +1, and the other one an Explore +2.
Now determining the action of the alien race, we begin with the leftmost icon and see if there is any object for that action. If not, we skip that action and go on to the next action listed from left to right.
In this case, as there is no planet to attack (object of the first attack action), this action is skipped and we go to the next "colonize" action. As there is no planets to colonize (just unexplored space), we go to the next action which is an "explore" action.
As there are two objects that can be explored we can add each of the modifiers of each object to the explore stat. Adding +1 Explore to the explore stat for one of the unexplored sectors yields a value of 2, and the other unexplored sector, a value of 3. We note these numbers and move on to the trade action which is ignored as there is no one to trade with.
So we have two potential explore actions with values 3 and 2. We select the highest, and so execute the explore action on the unexplored section with a +2 object modifier.
The explore action results in the card/tile being turned over and yields an uninhabited planet that has a colonize icon with a +1.
On the next turn, we follow the same procedure as before. The attack action is skipped as there is nothing to attack. The next action is colonize and as there is a colonize object (planet) the +1 from the planet card is added to the explore stat to yield a value of 2. We move onto the next action which is an explore, and as there is one unexplored sector left there is an explore object (has +1) which is added to the explore stat to yield a value of 2. There is nothing to trade, so that action is skipped.
In this case have a colonize action with a strength value of 2 and an explore action with a strength value of 2 as well. As there is a tie, the leftmost tied action, in this case the colonize action, listed on the alien card is executed.
Thus a colonize action is performed.
On the next turn, as there is no longer any planet to colonize nor attack, the explore action will be executed.
Refinements
This is still a work in progress and here are some things I need to refine:
- Currently, the AI is totally deterministic. Some ideas to add some randomness is to roll a die where each face specifies an action. If that face comes up, then add +1 to the action strength. To make some races more volatile, one can roll multiple dice. Any other ideas?
- In the case where there is tie in value for multiple objects of an action, for example, two equally valued sectors to explore, I am thinking that maybe a number is on each object and the lowest one is picked. Any other ideas?
Dealing with Build Actions
For sake of simplification, I have tried to make the action strength as simple as possible by assuming that an action can always carried out and if there is no object to carry out the action then skip it.
But that may not be the case if we want to attack and have no space ship to attack with yet can build one to attack. Similarly, even if there is no planet to attack, we may want to build ships anyway (instead of passing on that action) which function as a secondary supportive action.
As such, I am considering a slight variation to the modifier that is added to the alien stat which is:
Modifier = [object to act on] + [tool to do it]
So to go with the example of exploring above, an unexplored region exists with a +1 for explore (object of action). It turns out that a probe is available (tool to do the action) which adds a +2 to the modifier for a total action strength value of 4 (1 for stat, 1 for object and 2 for tool). Besides the probe which functions as a took, an *indirect* tool can be also considered in the form of a probe factory (builds the actual tool). This probe factory can have an Explore modifier of +1 on it which would yield a strength value of 3 (1 for the stat, 1 for the object and 1 for the indirect tool). In this case the probe would be used to explore as its total of 4 is greater than the secondary build action which has a strength of 3.
Now this is the key point: if the probe was missing, then you would only be left with the indirect tool of the probe factory which would yield a action strength of 3. Instead of skipping the explore action (no probe, no explore), the secondary action of building a probe (assuming its overall action strength is greater than the other actions strengths) would be executed.
Even if there is no object to commit an action, instead of skipping an action one can still possibly execute a supportive indirect action (build ships for a future attack action that has an object). Idea being that by doing so, an alien race expects an object of that action to eventually arise.
An alternative to integrating the secondary build actions is try to have a separate build action stat which functions just like other stats except that what will be built is guided by the priority of the other actions; militaristic aliens will build ships, money grubbing aliens will build banks and so on.
Sorry if this gets a bit too complicated. If it is, I can show some more concrete examples which illustrates these thoughts.
Summary
In summary, I think the overall mechanism is fairly simple and straight forward and can yield interesting results. It is reactive to outside conditions and seems to play the game.
I want to emphasize, that these alien races do not need to be the ultimate opponent to the players. There is a separate engine to do that. The goal is to make the races different to seem like they are alive and kicking.
While a pacifist alien NPC race from a gaming standpoint may seem ill suited in doing well in a 4x game, that is not the point, the alien race is not meant to be an opponent but a part of the overall scenery that can be thematically explained.
Any thoughts or suggestions on these ideas would be great.
Thanks,
DarkDream