-
Notifications
You must be signed in to change notification settings - Fork 13
Player ~ Interface Implementation Plan
Written in response to Issue #944 to create documentation for future implementation of the interface for the player module. This page will discuss possible functions and additions to existing player functionality, and will be especially concerned with adding functionality for interacting with new fields in the player struct added in Pull Request #898.
Currently, a player in Chiventure is stored in player.h
as:
typedef struct player {
/* hh is used for hashtable, as provided in uthash.h*/
UT_hash_handle hh;
/* Unique id identifying the player */
char *player_id;
/* The player's current level */
int level;
/* The cumulative total of experience points acquired by the player */
int xp;
/* A string containing the player's race */
char *player_race;
/* The player's current class. class_t contains the base stats, and skills for that class at
the beginning of a game. These may change throughout the game, so their current states are stored
in the health, player_stats, player_skills fields in this player struct */
class_t *player_class;
/* All of the stats, with their values, the player has. This should include
both the maximum and current health if health is a feature of the current game */
stats_hash_t *player_stats;
/* The current skills known to the player */
skill_inventory_t *player_skills;
/* All of the effects the player is currently experiencing */
effects_hash_t *player_effects;
/* The current items held by the player*/
item_hash_t *inventory;
} player_t;
The player_race
, player_class
, player_stats
, player_skills
, and player_effects
all have been recently introduced into the struct, and thus are not often interacted with in the current interface.
We intend for the new fields to be accessed/modified throughout the course of the game. Having discussed (In progress) with the playerclass, skilltrees, and quests team, they desire to interact with the playermodule in the following ways:
Classes, as currently stored in class_t
objects, are intended to store basic information about a playerclass that will set starting values for players who choose a given class.
/* A player class struct storing the name, descriptions, attributes,
* and stats */
typedef struct class {
// Name of the class
char* name;
// Number of parent classes
int num_parent_class;
// All base classes that have been multiclassed into
char **parent_class_names;
// A short description of the class
char* shortdesc;
// A long description of the class
char* longdesc;
// An object containing all the attributes of the class
obj_t* attributes;
// All the base_stats of the class
stats_hash_t* base_stats;
// Effects on the class
effects_hash_t* effects;
// Class skilltree
skill_tree_t* skilltree;
// Class skills
skill_inventory_t* starting_skills;
// Memory used internally by the UTHASH macros
UT_hash_handle hh;
} class_t;
Currently, we intend for the starting_skills
, effects
and stats
fields to set the respective player_skills
, player_effects
, and player_stats
fields when a class is selected. These fields within the player struct can then be modified/added to over the course of a game.
To allow for class_t
objects to fully serve this purpose, the player module will need to include
- An updated
player_set_class()
function that also initializes theplayer_skills
,player_effects
andplayer_stats
fields. This will require deep copy functionality for these fields.
We currently predict that basic getter/setter functions to access player skills will be required. These functions may be:
-
player_add_skill()
to add a given skill to the player's skill inventory -
player_remove_skill()
to remove a given skill -
player_has_skill()
to check if a player has a given skill
After discussion with the quest team, a player_quests
field should be added to the player struct to keep track of currently assigned quests. We can use existing functionality within the quests module to create the following functions:
-
player_assign_quest()
to add a quest to the quests field (callingstart_quest()
inquests_state.c
) -
player_quest_status()
/player_is_quest_completed()
to get the status of given quest (callingget_quest_status()
oris_quest_completed()
inquests_state.c
) -
player_complete_achievement()
to mark given achievement for given quest as completed (callingcomplete_achievement()
inquests_state.c
) -
player_complete_quest()
to mark given quest as complete and give reward item to player (callingcomplete_quest()
inquests_state.c
and the existingadd_item_to_player()
in the player module, as well asplayer_is_quest_completed()
)
The player's stats may need to be updated for a variety of reasons during a game. This would be accomplished by:
-
player_change_stat
andplayer_change_stat_max
to change a current stat and held by the player (callingchange_stat
andchange_stats_max
instats.c
) -
player_get_current_stat
to return the current value of the request stat (callingget_current_stat
in `stats.c) -
player_add_stat
to add a new stat to the player (calling inadd_stat
instats.c
) - Similar functions for adding effects to stats (will be implemented once stat functionality exists)
(UPDATE: the battles team is taking responsibility for this)
After discussion with the battles team, they mentioned that the player struct should include a player_moves
field to store any moves that they player may make during a battle. Existing functionality for battles represents players in combat through combatant_t
structs. The only extra functions that the player interface would need to provide to facilitate the creation of an associated combatant_t
struct would be:
-
player_get_moves
andplayer_set_moves
to retrieve and set the moves that a player uses as a combatant during battle
-
Action Management
-
Battles
- Design Document
- Text Based Combat in Other Games
- User Stories
- Wishlist
- Battle Planning 2022
- Battle User Stories Review 2022
- Structs in Other Modules Related to Battles 2022
- Stat Changes Design Document
- Run Function Design Document
- CLI Integration Design Document
- Move Changes Design Document
- Unstubbing Stubs Design Document
- Battle Items and Equipment Design Document
- Battle Item Stats
- Battles Demo Design Document
- Battles Testing Moves, Items, and Equipment Design Document
- Sound integration with battle (design document)
-
Custom Actions
-
Custom Scripts
-
DSL
-
CLI
-
Enhanced CLI
-
Game-State
-
Graphics
- Design Plan
- Design document for integrating split screen graphics with chiventure
- GDL (Graphical Description Language)
- Graphics Sandbox
- Design Document for NPC Graphics and Dialogue
- Feature Wishlist (Spring 2021)
- Installing and Building raylib on a VM
- LibSDL Research
- Module Interactions
- Working with Raylib and SSH
- raylib
- GDL
-
Linking the Libzip and Json C to chiventure on CSIL machines
-
Lua
-
NPC
- Dependencies: Player class, Open world, Battle
- Action Documentation
- Design Document for NPC Generation in Openworld
- Design and Planning
- Establishing Dependencies
- Implementation of Custom Scripts
- Independent Feature: NPC Movement Design Document
- Player Interaction Design and Planning
- Dialogue
- Design Document for NPC Dialogue and Action Implementation
- Loading NPCs from WDL Files
- NPC Battle Integration Design Document
- NPC Battle Integration Changes Design Document
-
Open World
- Autogeneration and Game State
- Deciding an integration approach
- Designing approach for static integration into chiventure
- Feature Wishlist
- Generation Module Design layout
- Potential connections to the rest of chiventure
- Single Room Generation Module Design
- Source Document
- User Stories
- World Generation Algorithm Plan
- Loading OpenWorld Attribute from WDL
-
Player Class
-
Player
-
Quests
-
Rooms
-
Skill Trees
- Avoiding soft locks in skill tree integration
- Components of Exemplary Skill Trees
- Design Document and Interface Guide
- Environment interactions based on skill characteristics
- Integrating complex skill (combined, random, sequential, etc.) implementation
- Integration of a Leveling System
- Potential Integration with existing WDL
- Research on game balancing in regards to skill trees
- Research on skill tree support in modern day game engines
- SkillTree Wiki Summary
- Skilltree "effect" implementation and roadmap
- Summary of md doc file for skilltrees
- Design ideas in connection to other features
- Summary of Skill Tree Integration 2022
- The Difficulty of the Reading the World
- Complex Skills Summary
-
Sound
-
Stats
-
WDL