-
Notifications
You must be signed in to change notification settings - Fork 12
Enhanced CLI ~ How to Implement a New Action Operation
Note: there are already groups of actions that are grouped into 4 kinds (5/23/2022). If you have a command that matches these types of input, there is a distinct workflow. These are:
ACTION <item>
- Such as
take chair
ACTION <path>
- Such as
go north
ACTION <item> <item>
- Such as
put orb on chair
ACTION <self>
- These are actions that involve some attribute about the player, like quests, stats, class, etc...
- Such as
view stats
- Such as
This would be for implementing a unique action that does not follow the formatting of any of the 4 types of actions.
Previous examples include view, quit, and credits.
In the operations.h file, you will find many commands with the following type ascription:
char *operation(char *tokens[TOKEN_LIST_SIZE], chiventure_ctx_t *ctx);This is the formatting all operation functions must fall under, where tokens is an array of strings outputted from parsing the command line input, and ctx is the chiventure context struct which holds basically all other relevant information about the game.
Once you've decided to implement a new action type that is NOT any of the existing types, you need to actually write your function! Usually as CLI we are validating the input to make sure it has the correct parameters, such that we can feed those parameters into someone else's function. Generally, it will have the following control flow: (in pseudocode)
char *operation(char *tokens[TOKEN_LIST_SIZE], chiventure_ctx_t *ctx)
{
if (game is null)
return status message
if (missing game element, like curr_room == NULL)
return status message
if (too few or too many arguments
return status message
else
//often there will be a string which we pass by reference into another groups function,
char *return_string;
run someone else's function
}As of now (5/23/2022) the list of tokens will contain just the action word in the first slot, then
At this point, chiventure probably will not recognize your input and run your new operation because it won't recognize your action token.
To fix this, you have to add the function and the associated action command verb (e.g. fight, talk, help, look) to a hash table of commands. This hash table is created upon the start of a game as a lookup_t struct (defined in cmd.h), and is initialized with all possible action commands and operations.
To include an operation which does not fit into one of the four action kinds (re: above), you must call the add_entry function directly in the lookup_t_init function. It should follow this format:
add_entry("LOOK",look_operation, NULL, t);-
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