I have the bare bones of the application up and running again!!

posted in A4L
Published May 05, 2020
Advertisement

G'Day…

So I decided to get back to my hobby Text Adventure Game project a week ago or so, but going has been slow. I have been fluffing about a lot in BodHi (a super light weight build of Ubuntu), screwing with MonoDevelop and SFML.NET. I even took a look at HAXE. It is important to me that the final application be able to run on Mac, Windows and Linux. Still the end goal of the project was always to move the text adventure into a kind of “splash screen” adventure. Sorta like the old Legend Entertainment Games of the 90s. Where the game uses full screen static art assets for each location, or a portrait on screen when talking to someone. So moving to MonoDevelop or SFML, or even using the “2D” abilities of something like Duality HaxePunk or even something bigger like Unity, Godot or Unreal, was always a thing. So even though I have been screwing about a lot I feel like I am still “on the correct path” through the forest so to speak. I have to say every time I use a linux distro I just really enjoy the experience.

So, back to the drawing board?

Kinda, but not so much. Basically I am rebuilding the code with a number of factors taken into account. This has always been a learning project and in my old project I did a number of things to just “make it easy” that I wanted to avoid or do a different way. For example I have not used a single inherited class or a interface of any kind in the old project. To make matters worse the entire application was done using a single namespace and entirely with Static Classes. So much of the early days of the rebuild has been about that. Not only making sure to only use .NET(CORE) to make cross platform porting easy, but also to start using some of these more complex C# ideas in a live project.

I actually found the moving to normal declared classes to be a little tricky. There is something “ugly” in my brain about how the code looks compared to using statics. Also it feels wasteful to declare a class all over the place, when there is basically nothing in it but some readonly stuff. For example I have a class with some file name paths called FILEPATHS. So every time I want to use that class I need to do something like FilePaths inPath = new FilePaths(); The old class was actually a static struct and I could access it from anywhere is the project.

Also, working out the way the game loop works was a little tricky, or at least not as straightforward. Basically I am initialising a GameEngine Class and in that class I initialise a bunch of other stuff. As most things are called inside the engine class I actually have outputs of those called classes. So anywhere the Engine is “active” I can also access things like GameState and other things. As I am so new to programming I am not sure exactly why, or even if this is better than a static class, as it basically acts the same.

Any other major changes?

Yes actually.

In my old project I was pretty happy with how I was doing file data. Basically the idea of my project is that once I get the engine up and running I can actually build the game by just writing text files in Sublime or NotePad++ or something. These files are loaded up to be used by the app. All I need to do is add the filename to the load list. To do so I wrote my own text reader that could take in various data form a text file and I also built a custom formatting for it. Never working with programming or fileData I just jumped in and made my own thing that did it. The entire system worked fine and seemed pretty cool, it was easily the bit I was most proud of. I haven't got around to writing my “save function” for the player to write these files for loading latter on.

For this new version of the project I am switching to json.NET which is a MIT library for reading and writing json files. I have to say, that it is super easy to use and does basically the exact same thing as the code I wrote myself, but it does it in a much neater way. It also has built in write functions that will make building the file save a doddle. Basically by using json.NET I boil a bunch of classes and a few pages of code into single command lines.

So where and I at and now What?

Well, basically I now have the Basic Game Loop done, I have the File Reader done, I have the World List Builder done and the User Input Utilities done (stemming and tokenisation and stuff)

One thing I wanted to avoid this time was spending to much of my time on specifics of the actual game itself. I have a ton of code in the old project to handle drawing text on screen in a neat formatting through FrameBuffer, and Printer classes, as well as a ton of work into the auto generation of levels, words lists, item data and the like through reading files. This made the project satisfying to press F5 on and run, but it was really a distraction from what I felt should be the main focus. Command Processing.

So that is what I am working on now.

The application can read word lists and take in user input strings. I am not going to build the sudo-Language Processor. It is not going to be a true NLP, but the goal is to fool the player into thinking the application is way smarter than it is. I have some idea about this using restrictive keywords and ignoring huge chunks of the input. So “Get the book from the bookshelf” is read by the computer as “get book”.

But I really want to have the user be able to use conjunctive phrasing. So “get the book form the bookshelf and place it on the scale” is read as “get book” “use book scale”. I think this will really enforce the “feeling” the application knows more than it really does. All it is actually going to do is split sentences at a conjunction into two commands like AND or THEN and stuff. If there is a object named, but not named in the conjunctive sentence, then that object will carry over. Will this be perfect, probably not, but I think it will do for the majority of cases.

Anyway, I want to get all that stuff working, as in the “core" of how the game works rather than trying to squeeze it into a already completed frame like I was the last time. As I have the loop and lists and stuff all done, I can just sit at the console and enter user inputs till I go blue in the face to test things with out the need to have all the other crap going on.

That is it!

Well that is the state of the project as it is now. You can find the project on GiTHub if you would like. I;m always interesting in hearing comments about how to better do things and improve stuff. This is a learning project after all.

https://github.com/Adventure4Life/TextAdventure

2 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement