As a way to shorthand a number of relatively static data points pertaining to each "evolutionary" stage of the pet, it is convenient to have an array of structures which handle the data that will be the same for every given playthrough. Every possible "form" of the pet must be represented by a stage object, so death and egg must also be defined stages.
This allows some pet forms to be "reborn" or to be terminal as the developer desires.
At present, the hope is to implement the following items in order to support planned features:
- an ID, unique to the stage as a reference point.
phase- integer number describing the phase-of-life of the character for animation purposes. 0 for egg, 1 for baby, 2 for adolescent, 3 for adult, 4 for senior.- bit/bool
sizewhich controls if the character is represented by a single char or a 2x2 grid of chars. animation, a char array that shows up to two frames of idle animation. The frames will replace each other on screen refresh.Face Right, a char array that shows the character facing to the right. This is to be used for the demonstrator game.animation_eating, a char array that shows up to two frames of eating animation.Hunger/Fun Rate, a byte in which the upper and lower nibbles correspond to the rate of change in this 'species' hunger and fun values over time. Can be used to adjust these rates over the course of a playthrough.high_evo, the ID of the stage this pet evolves into if the evolution mechanism determines the "high" criteria is met.low_evo, the ID of the stage this pet evolves into if the evolution mechanism determines the "low" criteria is met.secret_evo, if the secret evolutions criteria are met, this functionally replaces high_evostage length, an integer number of days this stage lasts before the evolution mechanism triggers.
This data is stored in a struct for each individual stage:
typedef struct Stage{
int stage_id; // This is just an ID, it doesn't get used but it's there to make the file more readable.
int phase; // Integer controls which metanim applies from the various metanimation sets. 0 for egg, 1 for baby, 2 for teen, 3 for adult, 4 for senior, 5 for final.
int size; // 1 for a 1x1 character, 4 for a 2x2 character. If adding a new size the size of animation also needs to be adjusted
const char animation[2][4]; // array, up to two frames, animating based on cells from the 16x16 font
char *faceRight; // array, up to one frame, animating based on cells from the 16x16 font
char *animationEating[2]; //// array, up to two frames, animating based on cells from the 16x16 font
int rateHF; // Byte controls the hunger and fun degredation rates
int highEvo; // If the high evolution condition is met, the new stage ID becomes whatever is set for this value.
int lowEvo; // If the high evolution condition is not met, we go here.
int secretEvo; // If there is a secret evolution condition, we go here instead.
int stageLength; // integer number of days before the next evolution.
} Stage;
What's more, the file lib/game/evo_data.h exposes an array of such structures where each structure is defined as a new member of that array. Pay careful attention to the order of this array as new evolutions are placed into the flow as the index position in the array will be the stage ID.