My game. What to include…?
The final sections of the LPTHW book, is to make a text-based game, similar to Zork. There are iterations in this process, from making a simple working shell and adding automated tests locally, through to fleshing out the game and integrating the final solution into a web framework for deployment online.
The first time I attempted creating the game, I made several big mistakes that I aim to avoid this time:
- I spent too long thinking about the game contents rather than structure
- I created a decision flow that was too complicated
- I didn’t draw the map out or keep referencing to it
- I changed the game as I had new ideas but did not consider impacts
- I tried to refactor parts of the game and add to it at the same time
- I didn’t commit to source control anywhere near enough
As a result, I failed…badly. But fortunately, failure provides an opportunity to learn, so I am much better prepared this time, both in programming ability and working procedure.
Content and structure #
The content of the game really doesn’t matter. I need characters, events, locations and a story to bind it all together. Zed’s game was based on a spaceship, having a fight with an alien, whilst trying to escape to freedom.
My game, will also be based on a spaceship, (the Frostromo), will have characters, (Shipley, Fash) and will involve a fight with an alien or two (Faceslugger, Xenodwarf) - aptly named to avoid copyrighting issues.
The structure of the game will be the same as Zed’s. There will be a map, scenes, and an engine to drive through it. Each scene will have some introduction text and a ‘challenge’, with various results leading to different outcomes and navigational paths. There will be an inventory with items influencing decisions.
What am I going to do differently this time? #
I am going to draw the game out. It will start as a pencil and paper exercise before progressing to a state model diagram and maybe even UML Class diagram, purely for practice.
I’m also going to spend less time planning my characters and their personal traits. In my first game, I used inheritance from a base class - Person() that was that was incorrectly implemented as I didn’t understand the super() function.
However, I am also going to include everything I have learned in the LPTHW book, which I expect was probably the original goal of the game in the first place! I haven’t investigated how to implement each item at this point, so I’ll follow that up in another post, but I plan to include:
- strings, integers/floats, Booleans, lists and dicts
- various escape sequences and string formatting/interpolation
- create and import classes, modules and functions
- test functions, assertions and mocking
- inheritance and composition
- raising exceptions
- for-loops, while-loops, and break, continue, finally keywords
- if-elif-else statements
- yielding a function
- global variables
- a lambda function
I want to ensure I check-in each change or discrete piece of functionality as soon as I get it working and validate it with tests. I’ve been slack with git branching up to now when I’ve had ideas, so I’m going to work on a branch for any significant change.
OK. So, the first step is to do some research on potential ways to implement the items above and draw my game map…