Data types - Maruno17/godotmon-project GitHub Wiki

In Godotmon Project data types are composed of two categories:

  • Persistent Data: Any data type that is supposed to be stored in a tres file and not supposed to be mutated in runtime. Most of the time, this data has class name ending with "Data".
  • Dynamic Data: Any data type that might use Persistent Data and will encounter several mutation in runtime. (Might also be in player's save file).

Most of the data types can be discussed in the related issue. If you want something fixed or add new stuff, don't hesitate to use this issue for that purpose.

Persistent Data

Element

Element of Attack or Species. This data type is used to define which element is strong or weak against another element in battle.

Field Type Description
id StringName ID of the element so it can be used as a reference to the element in each data entity that needs to refer to it.
strong_against Array[StringName] List of references to element of Monster that gets x2 damages when an attack of this element is used.
weak_against Array[StringName] List of references to element of Monster that gets x0.5 damages when an attack of this element is used.

ElementRepository

Repository of elements. This repository is supposed to be the .tres file holding all the Elements so they can be easily accessed in game.

Field Type Description
elements Array[Element] List of elements that this repository give access to

Note: Use of repository pattern won't always happen. It's convenient to do it for the Element data type but will be annoying for Attacks and Monsters.

MonsterData

Generic information about a potential Monster. Should be used by both Encyclopaedia and Monster.

Field Type Description
id StringName ID of the monster. For form support, you should write things like SLIME_DEFAULT or SLIME_FIRE
species StringName Species of the monster (allowing to group each forms together)
elements Array[StringName] List of element of the monster
base_stats Stats All the base statistics of the monster (scaled by level)
stat_rewards StatRewards All the statistic points distributed when defeated
experience_reward int Experience reward given (adjusted for the level diff) when defeated
evolutions Array[Evolution] All the evolutions a monster can have based on internal conditions to be met
grow_rate GrowRate Type of grow rate (experience -> level)
breeding Breeding All the breeding related data (groups, hatch steps, female rate, baby when breeding)
skills SkillDistribution All the possible skills the monster can have (based on some conditions)
learnable_attacks LearnableAttack All the attacks the monster can learn while growing or for other reasons
resource MonsterResources All the resource used to represent the monster in various situation (battler, cry, etc...)
weight float Weight of the monster (TBD: can it be a stat?)
height float Height of the monster (TBD: can it be a stat?)

Note: loyalty could be part of stats

Stats

All of the stats a monster can have.

Field Type Description
hp int Base health point
physical_attack int Attack stat used when Monster uses a physical Attack
physical_defence int Defence stat used when a Monster is struck with a physical Attack
special_attack int Attack stat used when Monster uses a special Attack
special_defence int Defence stat used when a Monster is struck with a special Attack
speed int Speed stat used when processing action order
loyalty int Loyalty of the Monster when caught
accuracy int TBD: Initial accuracy when starting a battle
evasiveness int TBD: Initial evasiveness when starting a battle

StatRewards

All of the stat points that can be added to stats when defeating a monster

Field Type Description
hp int Health points added when defeating this monster
physical_attack int Physical Attack points added when defeating this monster
physical_defence int Physical Defence points added when defeating this monster
special_attack int Special Attack points added when defeating this monster
special_defence int Special Defence points added when defeating this monster
speed int Speed points added when defeating this monster
loyalty int Loyalty added when defeating this monster

Evolution

Condition that makes the Monster evolve into another Monster

Field Type Description
evolve_to StringName ID of the MonsterData the Monster would evolve to if conditions are met
condition EvolutionCondition Condition to verify when an evolution trigger is met
EvolutionCondition

This part describe the 1st alternative: Hook functions that all are called whenever necessary

Generic evolution condition that is always true on evaluate_battle_end and always false otherwise.

Note

EvolutionCondition must implement a evaluate_<trigger>(monster, <trigger_context>) function that would verify if the evolution can happen.

List of evaluation methods:

  • evaluate_battle_end(monster, battle_context)
  • evaluate_trade(monster, monster_that_was_traded)
  • evaluate_apply_item(monster, item_id)
  • evaluate_level_up_in_daycare(monster)

This part describe the 2nd alternative: singular function that is called with the necessary context whenever necessary

Evaluation method:

  • evaluate(monster, context)

This method is responsible of checking the context variable to assess the evolution trigger (eg. context is BattleEndContext, context is ApplyItemContext etc...)

EvolutionMinLevelCondition extends EvolutionCondition

Evolution that returns true on evaluate_battle_end if battle_context.monster_that_leveled_up contains monster and monster.level is greater or equal to the min_level attribute of the condition.

Field Type Description
min_level Int Level when the monster can evolve

GrowRate

Enum describing all the possible grow rates: FAST, NORMAL, SLOW, PARABOLIC, ERRATIC, FLUCTUATING

Breeding

All the breeding related information (including naturally generating Monster in the overworld)

Field Type Description
groups Array[BreedingGroup] List of compatibility group the Monster can breed with
hatchSteps int Number of steps required for the monster egg to hatch
femaleRate FemaleRate Type of female rate that naturally generate when hatching or encounter in the overworld
baby StringName ID of the monster that hatch when this monster is female in breeding

FemaleRate

Enum describing all the possible gender generation rates: ASEXUAL, MALE_ONLY, FEMALE_12_5, FEMALE_25, FEMALE_37_5, FEMALE_50, FEMALE_62_5, FEMALE_75, FEMALE_87_5, FEMALE_ONLY

SkillDistribution

The distribution of skill the monster can have when it's generated. This data is also used when Skill must be change (due to any kind of effect in game).

Field Type Description
common StringName ID of the common skill
rare StringName ID of the rare skill
hidden StringName ID of the hidden skill

LearnableAttack

Data entity describing an Attack that is automatically learnt

Field Type Description
learnable_attack StringName ID of the attack to learn

LevelLearnableAttack extends LearnableAttack

Data entity describing an Attack that is learnt at a certain level

Field Type Description
learnable_attack StringName ID of the attack to learn
level int Level when the attack is learnt

EvolutionLearnableAttack extends LearnableAttack

Data entity describing an Attack that is learnt when evolving to this Monster

Field Type Description
learnable_attack StringName ID of the attack to learn

ExtraLearnableAttack extends LearnableAttack

Data entity describing an Attack that can be learnt by other mechanism (using an item, using an Attack teacher, etc...)

Field Type Description
learnable_attack StringName ID of the attack to learn

MonsterResources

All the resource tied to a Monster so it can be shown properly anywhere needed.

Field Type Description
front String Path to the image for the front sprite
back String Path to the image for the back sprite
icon String Path to the image for the icon in menu
cry String Path to the sound effect for the cry of the Monster
conditional_resources Dictionary Record of special resource that might be checked under certain condition (eg. female sprite).

SkillData

Data entity describing a (passive or active) Skill

Field Type Description
id StringName ID of the skill
effect_class StringName Class of the the effect to use (in battle or overworld)
effect_data Dictionary Data of the effect (so the class can work properly)

AttackData

Data entity describing an Attack a Monster can use

Field Type Description
id StringName ID of the attack
element_id StringName ID of the element of this attack
power int base power of the attack (0 = no damage)
accuracy int base accuracy of the attack (0 = always hit without check)
use_count int Number of time the attack can be used
target AttackTarget target the move reach when used

Note: Move that apply an effect or a status condition will inherit from Attack and describe their conditions or what to apply in code using extra attributes (that you can store in data, eg. StatusApplyingAttack with status field).

AttackTarget

Enum describing which target a move can reach: SELF, ONE_ADJACENT, EVERYONE_ASIDE_SELF, EVERYONE, ENEMY_SIDE, ALLY_SIDE_ASIDE_SELF, ALLY_SIDE, RANDOM_ADJACENT, RANDOM_ASIDE_SELF

TamerClass

Data entity describing a class of tamer

Field Type Description
id StringName ID of the tamer class
appearance String filename of the sprite to use in battle
money_rate float base rate of money dropped (money = money_rate * last_mon_level)
ai_type Enum TBD type of AI to use in battle

World map information: TODO

WildEncounterGroup

Data entity describing a group of wild Monsters that can be encountered in the overworld

Field Type Description
encounters Array[WildEncounter] List of encounters that can happen when condition are met
conditions Array[EncounterCondition] List of conditions to meet in order to be able to encounter any Monster of this group

EncounterCondition

Field Type Description
relation_with_previous 'AND', 'OR' Type of relation of the condition with the previous one (OR = ignore previous if previous failed, AND = check next if previous failed)

EncounterTileTagCondition

Field Type Description
relation_with_previous 'AND', 'OR' Type of relation of the condition with the previous one
tile_tag String Value to match with the tile tag the player currently is on

Note: Other conditions can be expressed similarly

WildEncounter

Data entity describing a single wild encounter (one Monster that can be encountered in the overworld)

Field Type Description
monster_id StringName ID of the monster to encounter (inc. form)
base_rate float base rate to use in random selection to encounter this monster
min_level int minimal level this encountered monster can have
max_level int maximum level this encountered monster can have
setup Array[WildEncounterSetup] All the extra information to generate the monster (eg. shiny attribute, attacks etc...)

EncyclopaediaData

Describe the content of an Encyclopaedia a Player could have.

Field Type Description
start_id int First ID shown in the encyclopaedia
monsters Array[StringName] ID of all the monsters in this Encyclopaedia (by appearance order)

EnvironmentMeta

Living object describing all the information about the environment the player is in

Field Type Description
world_id StringName ID of the world the player is in (overworld, indoor, etc...)
variant StringName Name of the world variant (for seasonal purpose or scenario related purpose)
position Vector2 Position of the player in the world
weather StringName ID of the weather the player is currently seeing

MapMeta

All the meta about a specific map

Field Type Description
scene String Path to the scene to load when the map is active
name_key StringName Key used to retrieve the name of the map in the text data
map_type TBD Value used to guess which kind of map panel to show when player enters the map
position Vector2 Position of the map in the world it's in
encounter_table Array[WildEncounterGroup] List of encounter group the map shows when loaded an primary

Note: I'm not sure about stuff like weather, I'd make the gd script responsible of this kind of stuff.

WorldMeta

Field Type Description
id StringName ID of the world
maps Array[MapMeta] All the maps the world contains
flags Array[StringName] All the flags related to gameplay (eg. CAN_USE_FLY, CAN_USE_DIG, etc...)

Dynamic Data

PlayerMetadata

All metadata related to the player entity.

Field Type Description
name String Name of the player
tamer_class StringName ID of the player's tamer class
character_set String Base name of the currently used character set (can be declined in several states)
character_state Enum TBD State of the player (running, surfing, biking etc...) so we can setup the right movements and graphics to the player entity
party Array[Monster] All the Monster the player can use in battle
item_inventory ItemInventory Item inventory of the player
encyclopaedia PlayerEncyclopaedia Bestiary status of the player (note: could be moved under game_progress)
game_progress GameProgress Game progress of the player (eg. play time), can be extended with any other kind of required data (eg. number of boss defeated)
settings GameSettings All the settings tied to a player (eg. message speed)
environment EnvironmentMeta All the meta data about the environment the player is in

ItemInventory

TODO!

PlayerEncyclopaedia

TODO!

GameProgress

TODO!

GameSettings

TODO!

EnvironmentMeta

TODO!

⚠️ **GitHub.com Fallback** ⚠️