Day one following the new construction plan and this afternoon has been quite successful. At the beginning of this sit down I had a bunch of empty rooms/cells with a very basic text identifier to print whenever I changed location. So I could move around without ever leaving the map but what was the point? There was nothing to see, nothing to do. This presents an obvious problem that needs to be resolved!
From a practical standpoint I’m currently using my map JSON to keep track of the cells/rooms and the contents of these rooms are a set of integers held in name:integer pairs. I’ve created a JSON file for non-player characters that includes their descriptions and their conversation responses. At this point I’m keeping things simple and I’ve included only one response and one description. Given that I will be using a basic set of commands that will be used by many of my classes I’ve reordered some of my existing code to include an abstract class that includes the getters and setters for basic uses, such as descriptions and interactions. I’ve extended this for use in my NPC class which creates an array of NPC objects that my character can interact with.
Each area that has an NPC present has one or more numbers listed in its name:integer pairs and this is where I came across an obvious issue. The “one or more”. Specifically, though, just the “or more”. If I was going to list more than one integer it would simply become a bigger integer as it wouldn’t allow me to have spaces or another delimiter. To resolve this issue I’ve moved to a string which I then split based on the delimiter. I need each of the numbers individually because that number relates directly to an element in the NPC object array.
NPC_Present: “1 5 6” gets split into 1 5 6 which is then used to get NPCObject.get(1) and so on, which then becomes NPCObject.get(1).getName().
At the conclusion of tonights sit down, upon entry into the room the description is output and a listing of NPCs present is also printed.
TL;DR – I’ve got a new plan and the first step is to build on what I’ve got working. The working part is moving from room to room and now it has that added excitement of potentially having something in that room. It’s clearly getting close to being finished now, right?