Designing Games with Xconq - Adding Random Events

Go to the first, previous, next, last section, table of contents.

## Adding Random Events

What simulation game would be complete without random events? Random events are handled somewhat similarly to synthesis methods, in that you set the value of the variable `random-events` to a list of the methods that you want run. Note that you must still ensure that the probabilities for the events on your list are nonzero!

Superficially, random events just introduce some unpredictability into a game. However, adding it just for its own sake is not a good idea; in the worst case, the game becomes the infamous "dice-rolling contest", where nothing matters except luck. Random events are more valuable when they introduce risk, and players have to balance that risk against their goals. As an example, random losses of cities in the standard game would be pointless, since players have to have them, and there would be a chance that all of a player's cities would disappear, causing the player to lose for no good reason at all. On the other hand, the chance of losing an expensive capital ship in shallow coastal waters is enough to motivate the player to keep them well out to sea.

In the past, bugs or unexpected behavior in random event routines have resulted in hard-to-reproduce problems. For the sake of debugging, you should test the game with random event probabilities set very high, perhaps as a variant so it can still be played normally.

- Accident Parameters
- Attrition Parameters
- Revolt Parameters
- Surrender Parameters

### Accident Parameters

The name of the accident method is `accidents-in-terrain`. Accidents should be restricted to definite hazardous situations, to go along with movement constraints - for instance, carriers and battleships in shallow water should have a small chance to hit a rock and sink.

You can specify two kinds of accident; a damaging accident, which hits the unit as if it were in combat, or a vanishing accident, in which the unit disapppears instantly.

Damaging accidents occur according to the `accident-hit-chance` table, and damage the unit according to `accident-damage`. The interpretation of these is similar to their combat counterparts. The `accident-vanish-chance` table sets the probability for the unit to simply vanish without a trace.

### Attrition Parameters

Attrition is a sort of higher-probability/lower-damage type of accident. It is useful for armies in hostile terrain, where deserters and casualties slowly reduce its strength.

Attrition can be useful for "aging" a unit, if you need to keep the unit from being around too long.

### Revolt Parameters

Revolts are spontaneous changes of side, independent of any other consideration. Since there is no way to protect against this, the chance should usually be very small, less than .01; even a small chance of will cause players to maintain reserves just in case.

### Surrender Parameters

The method's name is `units-surrender`; when it runs, it checks each unit to see if it is within `surrender-range` of a unit on an unfriendly side, and if the `surrender-chance` occurs, then the unit will change to the side of the other unit. Occupants will also evaluate their surrender/scuttle/escape chances, and behave accordingly.

Go to the first, previous, next, last section, table of contents.