💾 Archived View for lantashifiles.com › gemlog › entries › 2022-09-13.gmi captured on 2023-05-24 at 18:07:08. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-01-29)
-=-=-=-=-=-=-
It has been a long time since my last entry! Lantashi, that beautiful but demanding Sylvan, has been pushing me to write more, and program more (personal coding, at least). I finally took a vacation in the last week of August.
During the vacation, I worked on the Lantashi's Dungeon code, which is written in C++. We already had the ability to map out the environment, and move about it with n (north), s (south) etc. But part of the fun on playing a text-based adventure game is figuring out the language it accepts.
So, you can still go north by typing 'n', but you can also type 'go north', 'go to the north', 'please go to the north thata way you silly human', etc.
I haven't programmed in the ability to use 'Yoda-speak' (from Star Wars)... so 'to the north I go' does *not* work. I'll make that a stretch goal!
Over vacation I also programmed the ability to pick up and drop items, pick up and drop treasures (I have items and treasures as separate classes... maybe treasure should have been a subclass of item).
You can now encounter monsters and fight them. Armor and weapons help you, which you must find... later I will build in a store, in which you will be able to purchase items with the treasure you find.
That was a lot of work for one week off! Especially since I had other things to do rather than sitting in front of a computer, which I do for my job anyways.
Challenges - I messed up the polymorphism for the Item class (and sub-classes, like Bronze Key). It isn't hard to declare a method virtual, and override it in the subclass... but if you declare a "Bronze Key" and then store it in a vector of "Item", then a new object is created, a Item object, not a "Bronze Key" object.
My code was not originally designed with the vector redefining/recreating Item subclassed objects to Item.
Solution - I need to either store pointers in the Item vector, or in a more modern-C++ way, store smart pointers (maybe unique smart pointers). So when I get more time, I am going to refactor my code to do that. For now, I am probably just move some of the subclass logic into the super-class (Item), and use some if-then-else logic.
Life can be busy. Keeping a Sylvan-lass out of trouble is almost a full-time job in itself!! But next time I jump into the C++ codebase, I am going to put in the "quick fix", which will allow the use of special items (like a key to unlock a door, or an NPC named Lantashi to help you on your way). Then I can start updating my data files to make the game interesting.
A lot of progress in a week... hopefully I will have more time to write code with my personal projects, and also write more entries in Lantashi's gemlog!
Email: lantashi [at] protonmail [dot] com