Last time I blogged I was adding a few features (add items/drops to rooms, talk to NPCs etc) to expand on the interactivity of the rooms/cells.
Items seemed easy. They’re there; you pick them up or you don’t, right?! Not really.
I created a basic json file to store the bulk list of items, including a basic description and a single feature and I’ve added a pair to my json map file that represents the item numbers found in each room. At this point I’m using three items and adding some of these to each of my map cells currently active. Without running around for hours I’d like to be able to test adding these items to my storage, removing them from the room and destroying them when I throw them away. I’ll be looking into using the items as I expand on the party functions.
For party storage I’ve created an ArrayList with an expectation that I would need to limit this and then potentially allow players to expand this throughout the game. I’ve created a new Inventory class that parses the items json file and fills the ArrayList with Item objects. The long and the short of it is this: the map json has a delimited list of item numbers, those numbers relate to the element within the ArrayList. When a player enters a room and scans the area the list of item numbers is found and the correlating Item objects are gathered from the ArrayList.
If the player wishes to add this item to their own storage there is instance ArrayList for item objects. The item is added to the Heros Item ArrayList but before adding the list is checked for duplicate items. If an identical item is discovered then they are stacked and the total is incremented rather than using a second array element. The item class allows the player to check the number of each of these items, to reduce the number of items for any stacked items and to delete items once they are reduced below one.
Things still to consider:
- How many items can be stored? Is it based on weight, volume, or a simple number of cells?
- Separate allocations for equipment, materials, and useable items?
- Can items be used on all characters?
- Removing items from the room so that they don’t re-pop every time the player enters.
As for talking to NPCs there hasn’t been a lot of coding happening – mostly figuring out how to make it all work. Looking into the points I was considering last time I think the numbered chat is a logical place to start. For user input I think it makes more sense to move away from the “type 1, 2 or 3 – press enter” option and move to giving the user three options replacing the keyboard and accepting input via the user selecting/pressing on one of the text options. I’m adding conversations in a delimited list as a pair in my NPC json file and at this point will simply loop through to gather the user selected input and then return the next NPC response. I imagine that it can’t possibly be that simple so there’s some more planning to do, but I think I’ll move forward with that over the next couple of days.
I’d like the text responses to not feel too scripted. As taking turns simply printing out values limits the ability to replay the and also reduces the ability to play the game as an individual version of the storyline. Previously I was considering free text options, but after running through a few potential issues (abbreviations, looking for keywords/whole sentences/both, varying levels of familiarity with English and spelling skills) with this I’ve decided to shelve that for now. This leaves me looking for a different way to open up the linear conversation thread to allow more flexibility. The question is, how?
TL;DR – ITEMS! They get added, they get removed. Obvious expansion required as they currently re-pop indefinitely. NPCs Talking! Harder to conceptualise in a workable way than I expected. Clearly more planning required.