Today I focused on a key gameplay element: the crafting and use of potions
Potions offer a lot of interesting gameplay:
- You can drink them for (hopefully!) positive effects
- You can throw them at monsters
- You can use an analysis lab (pictures) to identify a potion and determine what ingredients a potion requires. This costs you a potion though…
- You can create them if you find the right ingredients and know the recipe. But ingredients are scarce! So you need to plan with care….
Gameplay around potions took quite a bit of time to get right. I’m now running very short on time to finish the game! But I think it was needed, potions are the whole point of being an alchemist after all…..
One tricky thing I had to work around from a technical standpoint was Clojure’s lack of circular dependencies in namespaces / compilation units. Normally this isn’t a problem, but I had a tricky problem:
- The main GUI depends on the world model
- The world model depends on the core engine
- The engine needs to trigger GUI actions when certain things happen (e.g. what happens when you bump into an alchemy workbench? you want to show the “create potion” GUI right?)
I didn’t find a totally satisfactory solution to this. I’m sure I could do a big refactoring and/or some dependency injection to make it work, but I don’t think I have time to waste on that. Instead I went with a compromise, and put more engine code in the GUI. Not pretty but it works. I’ll have to revisit this after the challenge and figure out the best way to do it.
Game starting and completion
I added code to generate the entry staircase and The Philosopher’s Stone so that the game has a clear goal. Did some testing to make sure that it is completable.
I also added a config.clj with some global parameters to enable “debug” mode. This means I can skip down to the bottom level quickly to test things like the end of game sequence etc.
With a short time left to finish the game, I’m finally spending some time on polish. Main tasks
- Trying to get a reasonable difficulty level
- Testing out gameplay, fixing minor GUI annoyances (e.g. no need to show the “select item to pick up” screen if there is only one item in the square.
- Adding extra monsters, potions and effects