-
Notifications
You must be signed in to change notification settings - Fork 13
NPC ~ Design and Planning
This document will outline how existing interfaces of Chiventure will be used to create non-playable characters, and how new modules will be designed to implement and future-proof NPCs. For a more in
- Important Existing Interfaces
- New NPC Module
- Dialogue
- Integration of NPC Module
- NPC-Battle Integration
- Task allocation between team-npc and team-rpg-npc
- game struct includes iteratable hash tables for players, rooms, and items
- item struct includes hash handle, string id, string short description, string long description, hash table of actions, and hash table of attributes
- attribute struct includes hash handle, string id, tag, and value (union of types to be loaded from WDL/used by action management)
- player struct includes hash handle, string id, int level, int health, int xp, hash table of items inventory
NPC struct should include:
- hash handle
- string id
- short description
- long description
- player class
- dialogue tree hash table
- item hash table inventory
- will_fight (bool)
- npc-battle struct:
- health
- stats
- moves
- ai
- hostility level (friendly, conditional friendly, hostile)
- surrender level (ie the level of health at which the NPC will surrender the battle)
- maybe: a range of levels that a player has to be to fight the NPC
- npc_mov struct:
- room npc is currently in
- movement type (definite or indefinite)
Code mockup:
typedef struct npc {
UT_hash_handle hh;
char *npc_id;
char *short_desc;
char *long_desc;
convo_t *dialogue;
item_hash_t *inventory;
class_t *class;
npc_battle_t *npc_battle;
npc_mov_t *movement;
} npc_t;
Also considering:
- item corpse (to be dropped when health <= 0)
- enum category (hostile, friendly, merchant, etc)
- See https://docs.google.com/document/d/1g5NAXelgCi4JqmNQ2aAC_t-eAh8PnLgcUzSfG42Qmo4/edit?usp=sharing for more potential features
- npc_new
- npc_init
- npc_free
- get_health and change_health (borrow from player.h?)
- get_inventory (borrow from player.h?)
- See https://github.com/uchicago-cs/chiventure/wiki/RPG-NPC:-Independent-Feature:-NPC-Movement-Design-Document for current documentation and design of NPC movement
Dialogue employs a branching dialogue methodology, as described here and here. For more information, please see the dialogue Wiki page.
npc.c and npc.h would take the form of game-state modules listed above.
Currently, the main game struct includes lists of all items and rooms present in the game. We would propose a similar list for NPCs so the game has access to that information. Additionally, the presence of NPCs in various rooms also needs to be stored either through the NPC struct or the room struct.
Specifying an NPC should not be too difficult, as the struct is essentially a mix of components of items and players. The only issue I foresee is dialogue trees. As mentioned above, it is relatively simple to code dialogue trees using functions that print different text then call another function based on user input. It will be more of a challenge to program a framework for WDL/WDL++ specification of dialogue trees.
Note: As of the beginning of the 2022 edition of the class, this issue has been addressed. (See "CLI Integration" section of "NPC ~ Dialogue")
A current issue with the way conversations are run is that it requires opportunities for players to select options that are not specifically actions. The problem with this is that it puts the user in a state where they can both take actions and select dialogue options. This would let them, for example, leave the room in the middle of a conversation.
Possible solution: Modify the CLI to offer two different "modes" - (1) normal mode for regular interactions (including talk that could initiate a conversation), (2) conversation mode (in which the program only checks for dialogue options). This solution has other benefits, such as it potentially being used by the battle team if they need a way to isolate battle options from game actions.
- NPC struct currently contains two class_t structs defined ambiguously:
-
- npc_class (the npc’s class)
-
- class (pointer to existing class struct)
-
- There is no clear distinction between these, as mentioned in the New NPC Module Section
- Class struct currently contains a skilltree_stub_t struct
- This skilltree is stubbed, but is currently being integrated properly into the class struct
- New ideas:
- Implementing a set of passive skills or a “player_class_skill_tree” where alignment with a specific player class results in a set of passive skills then added to a player/npc general skill set.
- Hostile NPCs that can engage in battle
- Weapons and spells that NPCs can have and use
- NPC battle related stats
- XP
- HP/damage
- HP regenerating (heal)
- Players should battle NPCs with similar battle stats
- NPC death
- NPC item drop post death
- We can add battle related stats to the NPC struct directly. To avoid clutter, we can have an npc-battle struct including health, moves, stats, etc.
- Then in the battle module, they can get rid of the npc_enemy struct because all of that information would already be stored in the npc struct. The set_enemies function could just take a list of NPCs and return a combatant struct.
- Finally, to address item drop post death, we were thinking that players should be presented with a list of items owned by the NPC they killed and should get to choose whether or not to add those to their items. We aren't totally sure how to implement this yet but will keep this in mind as a future step.
- a new enum type, hostility, which specifies if an npc never fights (friendly), fights only when attacked (conditional_friendly), or attacks first (hostile)
- Note: we should maybe change this because no friendly npcs should have a battle struct; maybe change it to just hostile (attacks first) and not hostile (fights when provoked)? Code mockup:
typedef enum hostility {
FRIENDLY = 0,
CONDITIONAL_FRIENDLY = 1,
HOSTILE = 2
} hostility_t;
- an npc_battle struct with relevant information for battles:
- note: this should only be made for npcs that will fight (ie for whom will_fight = true). Npcs that never fight should have npc_battle be NULL instead of being a pointer to an npc_battle struct.
- should we add a range of levels that the npc will fight?
typedef struct npc_battle {
int health;
stat_t *stats;
move_t *moves;
difficulty_t ai;
hostility_t hostility_level;
int surrender_level;
} npc_battle_t;
- Basic functions for npc_battle struct:
- npc_battle_init: initializes fields of a new npc_battle struct
- npc_battle_new: creates a pointer to a new npc_battle struct
- npc_battle_free: frees a pointer to an npc_battle struct
- More advanced functions for npc_battle struct:
- npc_add_battle: adds a pointer to a battle_struct to an npc struct
- will_npc_fight: returns true if npc will fight, false otherwise
- get functions for different fields in npc_battle (get_npc_surrender_level, etc.)
- will talk with the battle team about which get functions would be the most helpful
- set functions for different fields in npc_battle (change_npc_hostility, etc.)
- again will talk with the battle team about which functions would be the most helpful, but should definitely include hostility_level, ai, and surrender_level
See the RPC NPC Dependencies: Player class, Open world, Battle wiki page for details about our future plans for integrating NPC and Battle.
- NPC:
- Movement
- Rooms
- NPC2:
- Dialogue trees
- Skill trees / Player classes
For a different document revision of this Wiki: Design Doc.pdf
-
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