Survival System - mganzarcik/fabulae GitHub Wiki
All player characters need to eat, drink and sleep in order to function and survive.

The player character group can carry a limited number of rations based on the characters in the group. Rations can be obtained either via shopping / looting, or by hunting on the overland map.
Each race has a number of hours defined after which it must eat in order not to get hungry. After this time passes for each character, he or she consumes a number of rations (depends on character Race).
If the group sleeps, each member consumes the number of rations that they would normally consume if they were awake for half that long. For example, a human who needs to eat every 4 hours, would consume one ration after sleeping for 8 hours. If the group runs out of rations and the members cannot eat when they would, they start being hungry. Every time a member should eat but cannot, more negative modifiers are applied to him.
Example effects:
Times without eating | Effects (cumulative) |
---|---|
1 | -5 to max SP |
2 | -5 to max MP |
3 | -1 to AP |
4 | -5% to CtDP, -5% to CtH |
5 | -1 to AP, -5 to max SP, -5 to max MP |
6 | -5% to CtDP, -5% to Cth, -5 to max HP |
7 | -1 to AP, -5 to max SP, -5 to max MP |
8 | --10 to max HP, -1 to all skills |
9 | -1 to AP, -5 to max SP, -5 to max MP |
10 | -5 to max HP,-1 to all skills |
11 | -1 to AP, -5 to max SP, -5 to max MP |
12 | -5 to max HP, -1 to all skills |
13 | -1 to AP, -5 to max SP, -5 to max MP |
14 | -5% to CtDP, -5% to Cth, -5 to max HP |
15 | -1 to AP, -5 to max SP, -5 to max MP |
16 | -10 to max HP, -1 to all skills |
17 | -1 to AP, -5 to max SP, -5 to max MP |
18 | -10 to max HP |
20 | -10 to max HP, -1 to all skills |
From here on, every next time: | -1 to AP, -5 to max SP, -5 to max MP, -5% to CtDP, -5% to Cth, -10 to max HP |
Character death occurs if the max HP reaches zero.
The negative effects of hunger will start disappearing the moment the character starts to eat. Every time he or she eats, an amount of „times of not eating“ depending on his race will be removed based on the table above, going from bottom up. That means that if the character did not eat 10 times and his recovery rate is 2, the next time he eats, he will get +5 CtDP, +5CtH, +5 max HP, +1 AP, +5 max SP and 5+ max MP if we use the table above.
Note that eating is automatic and cannot be performed manually by the player. That means that even if the player rushes to buy rations right after experiencing the effects of hunger, those will still persist until enough time has passed for the character to eat again.
Similarly to how hunger is handled, the group also carries a limited amount of water. Each time a character needs to drink, a number of units (depends on character Race) is drunk from this pool.
Water can be obtained either by looting / shopping, or by scouting for water on the overland maps. When water is obtained via scouting, it is always refilled fully.
Thirst otherwise works in the same way as hunger, but it's effects can be defined separately.
Example effects:
Times without drinking | Effects (cumulative) |
---|---|
3 | -5 to max SP |
4 | -5 to max MP |
5 | -5 to max SP |
6 | -5 to max MP |
7 | -5 to max SP |
8 | -5 to max MP |
9 | -5% to CtDP, -5% to Cth |
10 | -5 to max SP, -5 to max MP |
11 | -1 to AP, |
12 | -5% to CtDP, -5% to Cth |
13 | -1 to AP |
14 | -5 to max HP |
15 | -1 to AP, -5 to max HP, -5 to max SP, -5 to max MP |
16 | -1 to AP, -10 to max HP, -5 to max SP, -5 to max MP, -1 to all skills |
17 | -1 to AP, -10 to max HP, -5 to max SP, -5 to max MP |
18 | -1 to AP, -10 to max HP, -10 to max SP, -10 to max MP, -1 to all skills |
From here on, every next time: | -1 to AP, -10 to max HP, -10 to max SP, -10 to max MP, -1 to all skills |
Recovering from dehydration works in the same way as recovering from hunger.
Every adventurer needs to sleep after a certain period of time has passed from the last time she slept, based on her race. Sleep always takes 8 hours and the whole group always sleeps together, which effectively means that the character with the shortest sleep period will probably define sleeping patterns of the whole group.
In order to sleep, the party needs to either be in a location designated as safe to sleep (where they will always sleep without interruptions), or in a location designated as hostile, but with no enemies in sight (here, they run a risk of being ambushed by a random encounter which depends on the Scouting skill of the character with most skill points in it).
On overland maps, characters need to break camp in order to sleep. Breaking a camp on the overland map takes an hour of game time. Once the camp is set up, the members of the group can engage in hunting and scouting activities to get rations and water (respectively). This can be done in parallel. Each activity takes an hour, even if it fails. The group can also decide to sleep, regardless of whether or not they did anything else, but only if all members have returned to the camp from any activities they might have been performing. Sleeping on overland maps can also trigger a random encounter based on the Scouting skill and the hostility of the area (same as sleeping in a hostile local map). Once the group rested, they need to pack up the camp before moving on, which takes another hour.
Sleep deprivation otherwise works similarly to hunger and thirst. Every N hours (depending on the character race) the character has not slept after getting tired adds more negative modifiers to the character.
Example effects:
Hours not sleeping when tired | Effects (cumulative) |
---|---|
N | -5 to max SP, -5 to max MP |
N*2 | -5 to max SP, -5 to max MP |
N*3 | -1 to AP |
N*4 | -5% to CtDP, -5% to Cth |
N*5 | -1 to AP |
N*6 | -5 to max SP, -5 to max MP, -1 to all skills |
N*7 | -1 to AP |
N*8 | -5 to max SP, -5 to max MP |
N*9 | -1 to AP, -5% to CtDP, -5% to Cth |
N*10 | -5 to max SP, -5 to max MP |
N*11 | -1 to AP |
N*12 | -5 to max SP, -5 to max MP, -1 to all skills |
N*13 | --5 to max SP, -5 to max MP |
Every N hours thereafter | -5% to CtDP, -5% to Cth, -5 to max SP, -5 to max MP |
Sleeping when tired removes all the negative modifiers from the character immediately.
Random encounters can only happen in game locations that are owned by Factions currently hostile (-100 disposition) to the player. Each game location can have a dangerousness modifier defined, which modifies how likely are random encounters to occur.
Random encounters can be triggered by one of the following:
- breaking camp and sleeping on the overland map. Chance for random encounter: 10% + dangerousness modifier
- sleeping in a hostile area on a local map. Chance for random encounter: 10% + dangerousness modifier
- changing tile on the overland map. Chance for random encounter: (10% + dangerousness modifier). A random encounter cannot occur again on tile change for at least 4 tile changes (configurable).
Once it was determined that a random encounter should occur, the game will scan the current game location for a list of potential groups of enemies to use in a random encounter. These can be defined per game location and the game will pick one based on the average level of the player character group. If the enemy groups are defined without level, they will be considered regardless of the level of the player.
Once the specific enemy group has been determined, the player can make a scouting skill check to see if it can be avoided. If it can, an option will be presented to the player to either skip the encounter, or fight it anyways. This option will contain details about the enemy group, as defined for the group.
For how combat behaves on overland maps (including enemy placement), see the Combat on the overland map section.
For local maps, enemy placement can be tricky depending on where the player chose to sleep. The algorithm will try to place the enemy characters as close to the group as possible, since they were caught unaware. It will search for empty tiles next to player group members and place the enemies there. If no empty tiles can be found, the enemy currently being placed will just be silently skipped. If no enemy could be placed due to missing free tiles, no combat occurs at all and sleep will continue uninterrupted.
https://github.com/mganzarcik/fabulae-showcase/blob/master/showcase/races/Human.xml
https://github.com/mganzarcik/fabulae-showcase/blob/master/showcase/survival.xml