-
Notifications
You must be signed in to change notification settings - Fork 13
Action Management ~ Item Stacking Design
Borja Sotomayor edited this page May 15, 2021
·
3 revisions
Currently, an item has to have a unique item_id to be added to the following:
- A game
- A player's inventory
- A room
- An NPC's inventory
This wiki concerns itself with developing a design to allow multiple items with identical item_ids to be added to these containers.
Some notes:
- Items with the same item_id should NOT have to be otherwise identical; for example, there could be two items with item_id "apple," but one has the effect of increasing HP when eaten and one has the effect of poisoning the player when eaten
- That being said, two completely identical objects should be allowed in the same container
- Contact the NPC team to inform them of any changes that may become necessary for their functions.
- For reference while coding: uthash User Guide, utlist information
- Add a field to the
item_t
struct - a pointer to another item- This pointer points to an item with the same
item_id
as the current item
- This pointer points to an item with the same
- Add two new functions to item.h:
add_item_to_hash
andremove_item_from_hash
- When adding an item, remove the current hashtable entry, have the new item point to this item, and store the new item in the hashtable
- Note that if there is not already an item at this hashtable entry, the new item will just be pointing to NULL
- When removing an item, store what the item is pointing to in the hashtable
- Note that if the item is not pointing to another item, the new hashtable entry will just be NULL
- Afterwards, set the item being removed to be pointing to NULL
- When adding an item, remove the current hashtable entry, have the new item point to this item, and store the new item in the hashtable
- Replace the body
add_item_to_[blank]
functions with a call toadd_item_to_hash
- Will be necessary to unwrap the item hashtable from the passed struct first
- Add functions to remove an
item_t
from a game/room/inventory:- Similar to the
add_item_to_[blank]
functions, simply callremove_item_from_hash
after unwrapping the item hashtable
- Similar to the
- Add a function to convert an item hashtable to an item linked-list
- Add item to list
- Check if item's next != NULL
- If so, iterate to next item and repeat
- When performing an action on an item:
- Try action on head of the list (passed as the item to
do_[blank]_action
) - If
possible_action
,all_conditions_met
, anddo_all_effects all fail
, and item's next != NULL, try again with the next pointer
- Try action on head of the list (passed as the item to
- Merge PR
- REFACTORING:
- Wrote
add_item_to_hash
function & updated code that uses identical functionality - Wrote
remove_item_from_hash
functions - Wrote functions to remove item from game/room/player inventory/NPC inventory (using
remove_item_from_hash
functions) - Wrote
get_all_items_in_hash
function & updated code that uses identical functionality - Wrote/updated tests for refactored code
- Wrote
- ITEM STACKING IMPLEMENTATION:
- Edited item struct with a pointer to another item
- Updated
add_item_to_hash
to take pointer into account - Updated
get_all_items_in_hash
to take pointer into account - Updated
remove_item_from_hash
to take pointer into account - Reworked
kind1_action_operation
andkind3_action_operation
to check all identical items if anything fails - Updated
look_operation
(operations.c
) to mention there being multiple of an item - Wrote/updated tests for handling items with identical ids in the various item hashtable functions
-
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