Wednesday, February 13, 2013

Alien Bug Safari

There are many ways to create an "automated" opponent for solo battles. One of them, which is often used for "A.I." in computer games, is based in Finite-state Machines. Dale's post in Solo Battles has an interesting discussion about using FSMs for solo games.

Since last November, when I started again fiddling with behaviors and simulations for my little computer game experiments, I was thinking about trying to use them in solo games but so far I had not done anything about it. Dale's post inspired me to return to the subject and, since I still had some free hours during the Carnaval holiday, I proceeded to make a first test in the form of a simple solo game, presented here.


Alien Safari

After the Bug War of 2200, several planets were left with small colonies of stranded bugs. In some cases they decayed and died off, in others they became part of the ecosystem, turning into predators. Shady travel companies offer illegal "safari" trips to some of these worlds, where the rich and adventurous can have the thrill of their lives hunting these dangerous prey.

Setting up
Terrain: the game is played on a 3'x3' board and the entire board counts as covered in low vegetation. You may place terrain pieces representing woods, lakes and rivers as you see fit.

Your force: you start with three hunters standing in base contact with each other in the middle of one of the board edges. Figures do not have a defined "facing."


The opposition: in this scenario the enemy consists of the predatory bugs but could easily be converted into other aggressive life forms as you see fit. They are automatically placed and moved by the rules.

Ranged weapons: each of your hunters carries either a pulse rifle or a flechette shotgun. Each kind of weapon has three range bands: close, medium and long. They also have a number of attack dice for each range band.
- Rifle: ranges 6 / 12 / 18, attack 2 / 2 / 2
- Shotgun: ranges 4 / 8 / 12, attack 4 / 3 / 2

Dice notation
This game uses only six-sided dice. The notation "1d6" means roll one die, "2d6" means roll two dice and add the results, "1d6+X" means roll one die and add X.

The direction roll
At some points it will be necessary to determine a direction for movement or placement of bugs. This is called the "direction roll" and is performed this way: roll one die, note the result and roll another one. If the second die is even, add six to the first result. This will give you a number between 1 and 12. Read it as a direction in the face of a clock. Alternatively you may roll a twelve-sided die, if available.

Actions
On each turn, each hunter may perform two actions, as detailed in the "Playing the game" section. These are the possible actions and how they are resolved.

Movement: your hunters may move 1d6 + 2 inches with one action. The random component is due to the rough terrain.

Ranged attacks: to hit, roll the number of attack dice based on weapon and range. For instance, you would roll four dice for a shotgun firing at close range. You get a successful hit if you roll a 4 or greater at close range or a 5 or greater at medium and long ranges. These target numbers already take into account the partial concealment due to the vegetation.

Firing blind: if you do not have line of sight to the target due to a wooded area, bushes etc. you may still fire but a successful hit is only scored on a roll of 6, regardless of distance.

Ranged damage: for each successful hit, roll one die. A result of 1-3 is a scratch, 4-5 is a wound and 6 is an outright kill.

Close combat: hunters are assumed to carry a machete or combat knife in addition to the ranged weapon. Fighting in close range to alien predators is very risky. Roll one die for the hunter and one for the bug; the side with the lowest result is killed. The hunter also wins on double fives and sixes, while the bug wins on the other ties.

Finishing wounded creatures: any successful hit from ranged fire kills a wounded creature. A hunter may also move into close combat and spend one action to automatically kill it.

Guard: a hunter may forfeit all actions during his turn to be on guard. This allows the hunter to perform one action during phase 3.

Retrieving a trophy: a hunter in contact with a dead bug may take a trophy. This counts as one action. Roll one die to see what you get. 1: nothing, the bug is too messed up, 2-4: a vicious claw, 5-6: a bug head. You can only make one attempt at retrieving a trophy from a dead bug, no matter what the result. After that, remove the dead bug from the board.

Searching: a hunter may actively look around for signs of bugs. This counts as one action and affects the roll on phase 2 of the same turn (see Playing the game.)

Playing the game
The game is played in turns, which have six phases:

Phase 1: hunter actions
Each of your hunters may perform two actions: move, shoot, close combat, retrieve trophy or call for evac. They can perform the two actions at once or you may alternate back and forth between then. For instance, move hunter A, move hunter B, shoot with hunter C, then shoot with hunter B, move hunter A again and shoot again with hunter C.

Phase 2: bug detection
If there are less than five bugs on the board, new bugs may appear, UNLESS they are in "scatter mode." Roll a die for one of your hunters. A bug will appear on a result of 5-6, or 4-6 if the bugs are in "frenzy mode." Add 1 to the die roll if the hunter was searching. The distance the bug appears (in inches) is given by 1d6+2, or 1d6+6 if the hunter was searching. Make a direction roll to determine the direction from the hunter. If the spot is outside the board, the hunter just hears some suspicious noises. You may adjust the bug's initial position so that it is at least 4" from all hunters, as long as they remain on the board. Repeat this procedure for each of your hunters.

Phase 3: bug actions
Each bug on the board may perform one action. Activate them from closest to hunters to farthest. Wounded bugs do not act in this phase. Actions will depend first on the current "action mode" for the bugs.

In "scatter mode," they will each flee 1d6+4" away from the hunters to the closest board edge, intent on leaving the board.

In "frenzy mode", they will behave as follows:
- if the bug suffered a scratch, roll one die. 1: flee 1d6" from hunter, 2-3: stay in place, 4-6: charge 1d6+4" towards hunter who shot it.
- other bugs will charge 1d6+4" towards the nearest hunter.

When neither mode applies, bugs will behave like this:
- Is there is a wounded bug within 8"? If so, roll a die. 1-2: flee 1d6" from hunters, 3-4: stay in place, 5-6: charge 1d6+4" towards nearest hunter.
- Otherwise, did the bug suffer a scratch this turn? If so, If so, roll a die. 1-3: flee 1d6+2" from hunter, 4-5: stay in place, 6: charge 1d6+4" hunter who shot it. Add 1 to the roll for each bug that is not wounded within 6" of it.
- If the above conditions do not apply, roll a die. 1-2: stay in place, 3-5: make a direction roll and move 1d6" that way, 6: charge 1d6" towards the nearest hunter.

NOTE #1: bug movement stops at the board edges unless it is fleeing.

NOTE #2:If a bug charges a hunter and reaches base contact, close combat is resolved immediately.

Hunters that were on guard may act once at any point during this phase. They may even interrupt a bug's movement at any point after it has moved at least 1". In this case the movement is resumed after the hunter's action, if possible. For instance, a wounded or killed bug is stopped in its tracks.

Phase 4: wound effects
Roll a die for each wounded bug, they die from their wounds on a result of 1. Remember to add them to the count of killed bugs.

Phase 5: bug stealth
If the bugs are NOT in either "scatter mode" or "frenzy mode," roll a die for each bug that is over 12" away from all hunters and not wounded. On a result of 4-6 they are removed from the board -- their movement is concealed due to distance and vegetation.

Phase 6: consolidation
If one or more bugs have been killed during the game (not only this turn), roll 2d6. On a result of 2 the bugs will enter "scatter mode" from next round on. Otherwise, add the number of killed bugs to the result. On a total of 12 or more, the bugs will enter "frenzy mode."

If the bugs are in "scatter mode," skip phase 6 of subsequent rounds. If they are in "frenzy mode" they still can switch to "scatter mode" later.

Ending the game
If the bugs are in "scatter mode," the game ends at the end of the turn if there are only wounded or dead bugs on the board (or none at all.) At this point you may automatically retrieve trophies from any remaining bugs BUT the trophy roll is the following: 1-4 nothing, 5-6 claw.

If the bugs enter "frenzy mode" you can call in an evac shuttle. This takes one action from one of the hunters. The shuttle will arrive two turns later, ending the game.

You may also end the game by leaving the board with any alive hunters through the same edge you entered.

If all the hunters die or you leave the board without trophies you lose. Otherwise you win and you may calculate your victory points:
40 points for each living hunter
40 points for each "head" trophy
20 points for each "claw" trophy
10 points for each bug killed

Halve the victory point total if you had to leave using the evac shuttle.

Conclusion

This was a simple experiment to try to build an engaging automated solo game. The three "states" the bugs may use are not formalized but spread throughout the rules, and their use, along with conditional rules and a custom turn sequence, define the behavior of the "non-player entities." Of course, it is a lot more simple than Dale's efforts to model actual strategy and tactics of a force.

One thing I had not noticed before is that the titles from Two Hour Wargames also employ FSMs, even if informally: at the top level there are states like "carry on" and "duck back" and then there are sub-states used when performing reaction tests. Still, the reaction tables make a very compact solution to present that model.

Thinking in terms of states for the unit or the entire automated opponent can be another useful tool for modeling solo scenarios, along with overall plans and objectives, random events, undetermined enemy information and conditional rules.


2 comments:

Dale said...

Ricardo,

Thanks for the plug. I saw more readers as a result.

I like the game. It is a good kernel for thoughts on how to do a completely free movement system.

Keep it up.

Dale

Ricardo said...

Hey Dale, thanks for the comment!