So I have gone through all my code and got back up to scratch on everything. I am now confident in my methodologies and logic paths I was thinking of for the game loop. If this experience has taught me anything it is that I HAVE TO START USING COMMENTS MORE.
There was a lot of tweaking as I went through as well. Turns out a lot of functions really could have been culled. Process_AllCommands and ProcessCommands for example (and the other Process Functions) could all be condensed into a single function by using internal variables being filled by function arguments. I feel that the code is more readable now that it ever has been by removing a lot of these nearly identical functions.
State of the Project
I now have gotten the game to go through most of the functions needed. I still have not worked on the rudimentary commandProcessor that I wrote just to get some testing done 6 months ago before my break. This is the next phase of the project. I seem to have everything "in" now.. so now I just need to manipulate it and I think we are good to go!
These are compleated!
- Text Utilities : to manipulate text and print it to screen in a number of ways. Like adding margins, a "typing" effect that prints a letter at a time, a "skip" function that will complete a given paragraph instead of waiting for it to type. This also handles all the stemming, and input collection and cleaning stuff for input strings from the user.
- DataFile Phraser : that can load data from text files and use it to populate classes like Areas, Items, CommandLists, ObjectLists and more. It can also process lists, where each item corresponds to a file name. This allows me to process a file like "ActionConstants" to batch load perma action commands in a single code block. For example, things like move, get, look and stuff are always active. This also allows me to load lists of items and actions and commands and stuff that is unique to the area as defined in the Area data file. There are other datafile applications fo the list functions as well. In short, it just allows me to dynamically control the loaded data by editing a list file rather than changing the code. So I can add or remove words, items or w/e from the game without the code. These data files "should" be able to be edited externally of all coding to populate the game world.
- GameWorld Class Chain : has been completed, assuming everything works. The "GameWorld", holds a grid of "Areas", which in turn contains "Items" and "Exits". These all contain word lists for "Actions" and "Objects". So, for example, if "ball" is an item in the area, this ball adds the object word list for "ball" and all its synonyms as well as valid player actions like "kick". The idea is that an "active action and object" list is created at the time an area is initialised by the player entering. So the input phraser has a massively condensed list of "active words" to look out for instead of understanding the entire breadth of the English language. It is my hope that this will give the illusion of the app understanding English a lot better than it does but narrowly focusing what it is required to understand. Each of these classes all holds a variety of information. For example, the "Item" and "Area" holds all the text to be printed by commands like "get" and "look" and the GameWorld holds global switches like understanding if a player has already entered a location before.
- Player Class : has been completed for a while now. It mainly holds location data to move the player through the map and retrieve its location, set global area values and stuff like that, score, move counter etc etc. If all is working to plan.. only the variables in this class need to be saved to disk to facilitate "save" and "restore"
What to do now?
So with all that done, I am really getting close to getting up and running the full demo project. That consists of a small network of interconnected room, a narrative and a few puzzles. To get this into a playable demo I still need 3 major additions to be completed. One of them is 1/2 done already.
- Build the "Action" Class : I have (with help of some forum members) worked out a method I think will allow me to build the specific events needed to run an actual game. The class has basically 3 functions. Taking single commands like "look" that consists of only 1 word, taking multi-word single commands like "get the lamp on the desk" and taking multiple commands in a single line, like "take the lamp from the desk and throw it at the hideous beast". So the actual input system is done.. all that is left is the processing of those inputs to do things with the collected and cleaned data.
- Build the "inventory" : as no inventory means no Advent! This is going to basically be a specialised "area" that stores items and it carried around by the PlayerClass so it and all its wordlists are active anywhere the player is. It will also have its own unique print to display the items. I would like to use this same idea for an ingame map as well, which I consider as part of the inventory.
- Full in all the Data : as the game is currently just using place holder data to make debugging fast and easy. This means writing out and putting into the datafiles all the text descriptions, cinematic descriptions, and action response descriptions and of course all the word lists. This is a ton of work and will be the last thing I do. The app should be fully working before I start on this part of the project. Basically all the rest is building the "engine" and this is building the game itself.
Anyway.. thanks for reading!