Project Amerith | Chapter 2
- zuodan

- Apr 27, 2020
- 3 min read
Updated: Jul 24, 2020
Object Oriented, Save Files and Maps
Hello :D
It's been a while since I last updated this series - mostly because of schoolwork and stuff. But with the whole Covid-19 situation going on and having to stay at home and all, I've been working on the game for quite a bit.
Object Oriented Transformation
For starters, I'd learnt how to make classes and such in python (or OOP). So naturally, I converted the entire game to be object oriented.

I also got a few friends to try out the game, and I let them make new monsters and skills (since the game is now object oriented and they're really easy to create HAHA).

Loading Save Files
Other than optimising the code, I've also created a mechanism to load the player and multiple maps, which I will be getting to later on, from an external save file.

This is what the format for the saved player looks like:
character:player:Elaine-100-100-Punch,Kick,Hide,Window Whack⬤ save-object identifier
⬤ character identifier
⬤ player string (separated by dashes, the last substring in the player string is the list of skills possessed)
And this is what a saved map looks like:
map:tutorial:30.6,30.7,1.6,1.7:30-w|1-w,22-f,1-w,5-f,1-w|1-w,22-f,1-w,5-f,1-w|1-w,12-f,8-w,2-f,1-w,2-f,1-w,2-f,1-w|1-w,3-f,5-w,4-f,1-w,9-f,1-w,2-f,1-w,2-f,1-w|8-f,1-w,5-f,2-w,7-f,1-w,2-f,1-w,3-f|6-f,1-w,2-f,1-w,6-f,8-w,2-f,1-w,3-f|1-w,2-f,1-w,1-f,1-w,1-f,1-w,1-f,1-w,16-f,4-w|1-w,1-f,1-w,1-f,1-w,1-f,1-w,3-f,1-w,18-f,1-w|1-w,2-f,1-w,7-f,2-w,16-f,1-w|1-w,12-f,2-w,14-f,1-w|30-w⬤ save-object identifier
⬤ map name
⬤ coordinates of map exit-points
⬤ map structure (w = wall, f = floor)
Maps
Last but not least, I've implemented a 2D map explorer where players can navigate their way to different exit points, and encounter and fight monsters along the way.
For now, I've designed 2 different maps, 30x30 and 30x12 respectively (the one in the example above is the 30x12 tutorial map).
Here's what it looks like when displayed on the console:

Not really the best graphics but hey it is running on the console after all HAHA
Now here's what a normal run from 1 exit point to another would look like if encounters are turned on:
Pretty cool eh :>
Was pretty proud of accomplishing this if you can't tell xD
But yes, as mentioned previously, this map was loaded in from an external save file and processed into a format that can be displayed. Pretty cool :D
Tutorial Improvement
On the last post, only the battle sequence part of the tutorial had been completed. Since then, I've linked the tutorial map with the tutorial battle.
The way it works is, after the dialogue with Dew about learning to fight, you will be able to navigate around the tutorial map and for each step that you take, you have a chance of encountering a slime.
Upon encountering the first slime, the battle tutorial will begin. However if you do not encounter a slime before reaching a certain point in the map, you will be forced into an encounter to ensure you go through the battle tutorial. The subsequent encounters will be regular battles.
Here's a full run of the latest tutorial:
As you can see, it's almost done. Just some more text after clearing the tutorial map and it should be good to go — hopefully by the next update! ^-^
Skill List
27th April 2020
Punch
Type: Damage
Power: 20
MP Cost: 0
Kick
Type: Damage
Power: 30
MP Cost: 20
Dodge
Type: Dodge
Effect: Moves first to dodge enemy attacks in the same turn
MP Cost: 20
Attack Boost
Type: Buff
Effect: Boosts damage of your next attack by 100% (cannot stack)
MP Cost: 10
Heal
Type: Heal
Heal Amount: 33.3% of MAX HP
MP Cost: 20
Splat
Type: Damage
Power: 5
MP Cost: 0
Small Heal
Type: Heal
Heal Amount: 10
MP Cost: 5
Zap
Type: Damage
Power: 15
MP Cost: 0
Shock
Type: Damage
Power: 25
MP Cost: 15
Scare
Type: Damage
Power: 10
MP Cost: 0
Hide
Type: Dodge
Effect: Moves first to hide from the enemy in the same turn
MP Cost: 10
Window Whack
Type: Damage
Power: 25
MP Cost: 0
Window Eat
Type: Heal
Heal Amount: 50% of MAX HP
MP Cost: 25
Window Block
Type: Dodge
Effect: Moves first to block the enemy's attack in the same turn
MP Cost: 15
Window Crush
Type: Damage
Power: 50
MP Cost: 30
Five
Type: Damage
Power: 5
MP Cost: 5
Fünf
Type: Damage
Power: 5
MP Cost: 5
ご
Type: Damage
Power: 5
MP Cost: 5
You might be wondering why there are 3 new damage skills that all do 5 damage and cost 5 mana. They were made by my friend who's obsessed with the number 5 LOL
But anyways, that's it for this chapter! Again, it's still a work in progress but I think you can tell things are starting to shape up ☆w☆
In the next update, I'll be working on integrating pygame (which I recently learnt :D), so there can be some actual graphics!! Really hope it turns out well!! ^-^
Anyways, as usual, I've left the download link for the latest version below if you wanna try it out. This time it also includes a save file with the 2 maps I've designed so far \( ̄︶ ̄*\))
Again, just run the code in the .py file on any python IDE and it should work fine (the game runs entirely on the console!!)

Comments