You are on page 1of 12

Log 1 5/02/18

Hello! Today i started on my text-based rpg game developed in python.


I’m excited to give this a try, because python is my most fluent
language, and I find it fun :). I read out site’s tutorial on how to
approach coding a game.. But I’m gonna try another approach.

I stored my data about my game (rooms, player, items, enemies) in


Classes​ instead of ​dictionaries​. I think this is a good idea because
I can be able to be more specific with my data, using the class
scaffold, and by using subclasses.

This lesson, i worked on developing the room class, with a moving


function for the player in mind.

I was focusing on the first 3 components of this class^^(x, y, and


coord). I was trying to design a Room class that could easily be used
when trying to move the player to different rooms.

Here is the concept I had in mind while making the class: a


dictionary that maps room coordinates to corresponding room objects.
This is prioritises the coordinates: if you have a “room.coord”, you
could easily edit it and substitute into the dictionary to locate the
room object to the left, right, etc.
^^this is the dictionary. It is called “room_index”.

I tested it and it worked! Here is my proof:

Log 2 7/02/18
Hello! Today I made a player class. The player has important
variables about themself (eg. name, health, location, etc). The
tricky part of today was trying to develop a ‘move’ function, for the
player. This would automate most of the moving process.

Making a “move” function was tricky because I had to integrate all


the bits of code correctly. I was rusty with some coding syntax
(regarding global and local scope, and class objects). I consolidated
my knowledge by experimenting with the python interpreter. Here is an
example.

I named a variable “c” in my room classes program. I then ran the


interpreter from “main.py”.
I think these small parts of programming usually catch me off guard.
I’m sure that this learning experience will become useful later on in
my game.

Log 3 11/02/18

Finished the move function!

What does a “move” function need to do? There are many steps:
-show player the possible movements
-ask which direction user would like to go
-use this information to transform player.coord
-use player.coord and room_index.ri to find the correct Room object
-do something with this new room information. Eg “hi! You are in
[player.room.name]”

To see the proper logic for my move function, check out the diagram I
made in the flowchart tab.

Log 4 26/02/2018
It is week 5! I’m trodding along pretty successfully. It is well
aligned with my gantt chant
I’ve thought of a concept for my game. The concept is that the player
can choose who they play as at the beginning of the game. This will
have consequences, like a special soundtrack for each character.

This week I have been working on items. Ideally the player will be
able to:
- Equip a weapon
- Use a potion (to heal health)
- Check inventory
The first thing i did to accomplish this was create a class (a
scaffold) for potions and for items.
Then I made functions for the player to ‘use_potion’, ‘equip_weapon’
etc.

More coming soon..


Log 5 16/03/2018
Today I finished item functionality! Previously I had finished the
item menu, using items, etc.

The final thing I needed to do today was delete the items from the
player’s inventory once they used them. To give an example, before I
fixed my code, my character could drink infinite green potions
without ever running out of potions.

My first step in approaching this problem was learning how to remove


items from a list. I already had a list variables called
“player.potions” or “player.weapons”. To solve this problem (learn
this new skill), looked it up on stack overflow and them experimented
with the ideas in a program:

After seeing this information, I still had some questions about how
the ‘use’ function worked. To figure it out, I started up a new
terminal and experimented:
This was successful! It printed out [2,3,1], which indicated that the
first a of ‘list_’ had been removed. All had to do next was implement
this coding idea into my game, and then I was done :)
Log 6 21/03/2018
It is week 8 and I am trodding along with my game. I am nearly
finished the fight function.

Previously work, I had developed a functional but uncompleted


prototype of the fight function (player.fight()). This version had 3
options: change items, check stats of enemy, and fight enemy.

I just had to revisit and fix my “look at inventory” option. All the
invalid responses gave the error “too many words”.

TESTING TABLE

Input Expected output Actual output

Check check sword “Too many words” “Not a possible item


error command. Too many
words”

check sword Prints sword Prints Sword


description description

check fake_item Generic error msg: “Not a possible item


“not a possible command. Too many
command” words”
adsdas Generic error msg: “Not a possible item
“not a possible command. Too many
command” words”

“” (nothing) Generic error msg: “Not a possible item


“not a possible command. Too many
command” words”

I fixed this by looking at my if statements. It turns out I was


individually sending the same error message for different
conditions..

Even though I had accounted for ​different reasons​ that there could be
an error, I was still giving the same incorrect response. A pretty
silly mistake :’). Luckily, it was very fixable: I just changed what
each conditional error message said.

Log 7 26/03/18

Hi hello. It’s week 9, and im kinda scrambling to finish the basic


infrastructure so I can actually make objects that belong to all my
classes. I finished the fight function today. It was basically done
already, except that nothing happened when the player or the enemy
ran out of health. To fix this problem, I create yet another function
in my Player class called “player.game_over”.
Log 8 26/03/18
I am sneaking in some coding this afternoon. It has been really fun
so far actually. I am actually making content for my game. I just
finished joining all my functions together. And now I am making
different players and enemies and items. So yeah, that’s pretty fun
and for me. I want each of my characters to have their own soundtrack
and special abilities.. So I will have to try that next time. I
reckon I could do it by adding if statements to certain functions. Eg

if self.name == ‘yun’
Do this, do that

Here is my main.py script. I wanted it to be as simple and small as


possible, so I had to edit my other functions (especially the “move”
function) to make it more self contained.)
Log 9 31/03/18

Today I started creating my players, adding more potions and weapons,


and adding custom music for each character.

When I was playtesting my “items select menu”, i noticed I wasn’t


getting the expected output:

TESTING TABLE: CHECKING AND USING THE EQUIPPED IDEA

Input Expected output Actual output

check sword prints details about prints details about


sword sword

check gauntlet prints details about prints details about


gauntlet gauntlet

check amulet prints details about Error “not a possible


(equipped) amulet item command :( “

How did I fix this? I looked at the corresponding code.


Basically, this function works by heavily filtering the possible
command inputs so only specific ‘valid’ ones can be entered. Most of
the if statements already in place check if the command is the right
length, or if its using the correct keywords. I just needed to add
another statement for ‘if the first word of the command is ‘check’
and the second word an equipped weapon’. So, I added that if
statement, and all is good.
You can see the statement I added up in that screenshot ^^. It’s the
last if statement.

Log 10 7/04/18
Hi. Welcome to SUPER SPEEDY CODING. Today and last night I have been
editing my code at LIGHTNING SPEEDS to meet the Monday deadline.
Here is my main action menu, and a testing table showing what each of
its reactions are.. Because I have already finished, most of the
expected output matches with the actual output.
TESTING TABLE: MAIN ACTION MENU w/ doors = [“right”, “down”]
Input Expected output Output

move right Calls the move Calls the move function (and
function (and changes changes player’s location)
player’s location)

move diagonal Error msg “not in prints("can't go that way :(


doors” not in 'doors'")

move Error msg “invalid print("invalid command. type


command” 'help' if you are stuck")

invent Opens the item Calls


inventory “character.select_items_menu
()”. Opens the item
inventory

self Prints info about Prints the character’s


character health, name and atk

help Prints an about Prints an about section with


section with some some helping instructions
helping instructions

‘ help’ Error msg “invalid print("invalid command. type


command” 'help' if you are stuck")

asdfgasf Error msg “invalid print("invalid command. type


command” 'help' if you are stuck")

You might also like