Three Hundred :: Mechanic #082 Sites:     Webcomics   |   Three Hundred Mechanics   |   Three Hundred Prototypes
 Three Hundred
   - Index Page
   - About...
   - By Year

   - Comp-Grid
   - Procedural
   - Tactics
   - Tiny Crawl
   - Misc

PreviousMechanic #082Next

  Mechanic #082 - Card AI 2
Posted: 06/01/08

Artificial intelligence isn't just used for opponents, but also for game flow.

  Movement and Action

Just a minor addition to the previous entry. After thinking about it further, I've decided that there needs to be two decision making processes, combining both the flowchart approach of Carnage Heart and the linear decision process of Final Fantasy XII's gambit system.

Basically, trying to combine state changes, movement, reasoning, and actions together into one flow chart would make it needlessly complex. Instead, take actions out of the flow chart and split the process into "movement / reasoning" and "action". First you do movement, then actions, with the purpose of movement meant to set up an appropriate action situation.

Actions appear in a linear process like gambits with a simple condition. If I'm next to a bad guy, use a melee attack. Since you can only use one action per turn, the first action that is successful will ignore everything after - put special cases at the top and more general cases at the bottom. So you might put actions which are likely to fail first, like healing allies or casting specific spells against weak enemies.

The movement process attempts to move the unit to a position which would be most beneficial to the action sequence. For instance, it might see that there is a hurt ally nearby, so it will move towards him, otherwise, search an enemy. If done improperly, there could be a lot of repeated logic, like tracking down a flying enemy to use an anti-flying attack on it. Instead, units should be more special purpose, doing only one or two things really well and leaving much of the special cases up in the air. For instance, if the difference between anti-flying attack and regular attack isn't too great, the flowchart shouldn't make the distinction but the action sequence should.

  Dialogue Trees

You can model a lot of the object-specific game logic through a sort of dialogue tree, itself nothing more than a sort of Choose Your Own Adventure series. You know those books where you'd get to the bottom of a page and it'd say, "If you want to open the door, turn to page 80". Well, that sort of thing is modeled in page form, why not use something like that for basic game logic and dialogue trees.

You've got a small booklet or perhaps a small deck of ordered, numbered cards. Each page represents a specific state and provides several options to change that state. You begin with what is essentially a cover, providing no specific insight into the object, but gives you the basic starting states available. Choosing a path based on the action you want to take, you'll be taken through a very simple state machine. Some paths may only be open if you have achieved some criteria or even if you simply roll the dice and randomly select a path.

For instance, you come up to a door and the cover offers a short description and three options: bash it in (strength test), unlock it (requires key), or do nothing. The "do nothing" option just ends the process. If you have a key, you turn to the card that says you unlock the door and open it. If you try to bash it in, you roll against your strength - a success goes to a card which says that you bash open the door but the loud noise causes two goblins to show up, failure causes two damage to you for forcibly acting out against a door stronger than you.

These states can do things like change the game world, bestow items to the player, or simply provide a dialogue with a creature. This is not really complex stuff. The idea is literally using multiple, short Choose Your Own Adventure booklets to model interaction. Not anything special, but done properly, you could model a very complex level and sequence of events, turning your solo board game into a solo adventure game. Anything a computer can do for you, I'll bet you can replicate to some extent for a solo board / pen and paper experience. Truth be told, with enough booklets and cards, I'll bet you $10 you can model the entirety of The Secret of Monkey Island as a boardgame. I shit you not.

On a side note, I'd probably use cards rather than a booklet. Though perhaps more expensive to produce and keep track of, you'd have the ability to replace the cover to provide different initial states. For instance, saying the wrong thing in a dialogue could make the NPC mad at you, causing further dialogues to start from a different place.

  Event Sequence

One final piece of the puzzle, so to speak, is a more global approach to narrative. Basically, it is sometimes useful to have a sequence of events happen in a particular order. For instance, you might not be able to ask an NPC about an object until after you know about it (perhaps finding the object but not being able to pick it up). Or perhaps you want events to change based on how the mission is being played. With that, we've got two related technologies: event cards and the event sequence.

An event card is something which you can collect. They might be part of a dialogue sequence (for example, you might be instructed to go to card #34 and it turns out to be the event card "You have been told the door's passkey"). When you happen upon an event card, you take it out of the stack and add it to your collection (the cards would be labeled on the back so that you can return it to the proper place at the end). They are basically items that you have and are referenced by dialogue trees, like "(requires event #34) ask man about a boat".

Similarly, the event sequence is a tree that you move along, one node at a time based on your actions. Again, this could be modeled using a deck of numbered cards, a booklet, or simply as a picture of nodes with a marker to tell you where you are. You move through the sequence based on things happening. For instance, you might have a branch where you go to path A if you accomplish something within 10 turns, or path B if you don't. Moving to a new node may spawn new enemies or cause the board to change and things like that. For example, kill the boss in 10 turns will cause a new wave of enemies to appear, but you get event #57.



Copyright 2007-2014 Sean Howard. All rights reserved.