Skip to content
Sign upLog in
← Back to Community

TextRPG: [TRADER UPDATE]

Profile icon
bryancrisso

NEW UPDATE: Traders are here! (full changelog at the bottom)

I've created a game called TextRPG. It's a roguelike, turn-based dungeon crawler, with infinite randomly generated floors. This game is still in the early stages (this is the first "playable" update), so the interface is a bit unpolished. It would be great if people could report bugs, and stay tuned for the next updates! (btw if u wanna report an error/crash please include the error message it makes it so much easier for me to track down said error with the output)

DISCLAIMER: The save system doesn't seem to work here. If you want to save your games, please fork this code into your own repl and run from there.

If you want to report any problems, ask any questions, or simply just wanna chat about the future of the game, feel free to join my discord server: https://discord.gg/aeN2wgs It would be greatly appreciated!

Important Info

Terms of use: You are allowed to use this code for personal use only, that means that you can modify the code all you want, but you are not allowed to distribute it either commercially or non-commercially. This is because I want to release this as a fully fledged game in the future.


GUIDE

It seems that the interface of the game is more complicated than I thought!
I guess I'll describe how it works.
The dungeon is made of a series of floors, which are generated with rooms every time you descend down the steps.
There are 5 different types of rooms:

  • U: This is a staircase going up. Use the "Continue" option while in this room to go up the stairs (you can't go up if you're on floor one!)
  • D: This is a staircase, you guessed it, going down! Works similarly to the "U" stairs. You can still go down the stairs even if you haven't explored the entire floor.
  • F: This is a "fight" room. Here you will find an enemy to fight, and enemy difficulty is based on your current floor.
  • L: This is a loot chest! You will always get one food item from the chest and a 1/3 chance of getting a weapon. The loot of lowest quality has the highest chance of dropping, while high quality loot is quite rare!
  • T: This is the "trader" room. Traders will either be a grocer or blacksmith. You can buy food from the grocer or buy weapons and repair your weapons at the blacksmith!
  • Traversing through the rooms is quite easy! When you have the chance, choose the "Continue" option, and you will be shown a map of your floor. Choose the options to move in the four directions. On the map, each letter represents a room. A room of colour orange/yellow means it is unexplored. Green is explored, and red is where you are currently at.
    Every 10 floors, the size of the floors increases and the quality of loot improves!
    Have fun grinding infinitely!

Early Access Update 1 Changelog:

  • Traders have been added! A trader will be either a grocer or a blacksmith. You can buy food from the grocer. You can buy weapons and repair your weapons at the blacksmith. Each trader will have a range of stock to sell!
  • A bunch more content has been added! Grind for more weapons, eat a wider range of food, and face more enemies! Check the code for all the additions! Thanks to
    @EdmundNewman
    for helping me out with this.
  • A bug has been fixed where the game could crash while moving floors beyond floor 9
  • Fixed a bug where the options list would disappear after eating while fighting an enemy
  • Fixed a bug where player position would not reset after death
  • Some QoL additions: Health now shows on top of eat screen, Current floor is now shown in stats, Current enemy info is shown at the top of the fight options screen
  • Your gold count is now halved upon death (still slightly buggy :/)
  • Escape chance is now 25% instead of 50%, and when you escape from an enemy, you will have to fight it again if you re-enter the room
    I can confirm that the next update will be centred around the introduction of armour, inventory management, and bosses. Hopefully a new save system as well, so it will work on this post!
Voters
Profile icon
KeithDaugherty
Profile icon
mapaid
Profile icon
TatianaAlsina
Profile icon
TonyWu4
Profile icon
JoshuaSealy
Profile icon
Seazyns
Profile icon
KWWWWW
Profile icon
NeoChartsu
Profile icon
lucky77
Profile icon
Stoten
Comments
hotnewtop
Profile icon
JonahElias

just a suggestion, you should make a new data save for each player because I just logged into someone else's game and had all of their stuff

Profile icon
bryancrisso

@JonahElias
yeah this is made to be a game installed on your local machine... it doesnt quite like it when j put it on repl. I'll see what i can do in the next update!!

Profile icon
JonahElias

@bryancrisso
It's a really good game btw

Profile icon
guru2050

@bryancrisso
Perhaps you should consider using the repl.it database for these SaveGame purposes. And I'm sure it goes without saying that prior to play, users should fork it into their own repl.it.
Otherwise, good job!

Profile icon
conkon300

@JonahElias
I keep on going into someone's named "asd" game.

Profile icon
YeetMstr

This is sadly better than my ad infinitum...

Its rly good!

Profile icon
Dylan-Pusilo

Wow this is cool. I'm working on a similar game. https://repl.it/@hello1964/An-adventuresurvival-game#main.py

Profile icon
novelboy

@hello4691
Tried it out! Very, very cool. Traveled the full 1000 miles. I liked the mage/magician appearing, and the options were good. I thought the bottle showed up too many times - but maybe that was just for me? I also thought the protagonist is kinda a bad dude lol, making trouble everywhere he goes (as those were the options). Good game!~

Profile icon
Dylan-Pusilo

@novelboy
Thanks :). The reason the bottle scenario came up so many times was because I used multiple of the same scenario. The potions gave different effects. I got kinda lazy after that and didn't add anymore scenarios.

Profile icon
[deleted]

@hello4691
I have tried your game, it is nice
I have a suggestion: you could've allowed increasing the stamina more than 100
you could've added 'save' option
I have even travelled 1000 steps also


that's it,
waiting for your game to be download...

Profile icon
JoshuaSealy

very pog

Profile icon
[deleted]

i love your text rpg series! plz post more updates asap!

Profile icon
lucky77

my name is now SAVED DO NOT WORK HERE (lol)

Profile icon
FloCal35

Noice, glad to see trader's here

Profile icon
AtharvGoel

Mysql might be a potential way for you to get save files to work.

Profile icon
AtharvGoel

Can you add a way to sell stuff to the trader?

Profile icon
Wail45

cool

Profile icon
FloCal35

Good Job, one thing tho. When I pressed continue a game it gave me a random persons game

Profile icon
[deleted]

This game is AWESOME!!
I love this game and I hope you create more games like this and you publish it soon so that I can access it from my device.
waiting to download Text RPG...

Profile icon
MegaEmailman

When trying to go from floor 12 to 13, I got the following error.

Traceback (most recent call last):
File "main.py", line 661, in
game = Game()
File "main.py", line 581, in init
self.mainMenu()
File "main.py", line 382, in mainMenu
self.intro(player)
File "main.py", line 398, in intro
self.pause(player)
File "main.py", line 428, in pause
self.floorMovement(player)
File "main.py", line 481, in floorMovement
player.floorList.append(dungeon.createFloor(player.currentFloor))
File "main.py", line 599, in createFloor
floorArray = self.populateFloor(floorArray, floor)
File "main.py", line 646, in populateFloor
j.loot = [random.choice(eligibleFood), random.choice(eligibleWeapon)]
File "/usr/lib/python3.8/random.py", line 290, in choice
raise IndexError('Cannot choose from an empty sequence') from None
IndexError: Cannot choose from an empty sequence

I also never got a weapon from a chest. Could there be an issue with the weapons list? Perhaps especially for floor 13?

Profile icon
bryancrisso

@MegaEmailman
the error you got should be fixed now. as for the weapons, it's a 1/3 chance to get a weapon from a chest, so you're probably getting really unlucky

Profile icon
AbuIbra

Great!

Profile icon
AtharvGoel

For your bat stew, you can use the random module's randint to choose a random number in some range. Use an if else conditional, so that if the random number is like 5 or something, the health you gain is negative, hence you take damage. Else, you gain 20 health.

Profile icon
bryancrisso

@AtharvGoel
it's a bit more complicated than that, but good idea nevertheless! the comment that says "dk how to implement" is from my friend, who does most of the content creation!

Profile icon
Thrill32

amazing!!!

Profile icon
FriendlyGooseMan

Im not too good at coding but would you be cool if I tried to make it online? and like gave friends the script so we could play together, ill credit you of course.

Profile icon
bryancrisso

@LukeShomper
go ahead! I'd love to see what you can come up with. I'm thinking about including multiplayer myself later on, but now i want to focus on fleshing out the singleplayer experience. Personally I want to give the game a visual experience before adding multiplayer.

Profile icon
FriendlyGooseMan

@bryancrisso
Yeah, I realized how work in progress it is, I might wait a while.

Profile icon
JBloves27

@bryancrisso
So what does the self thing do?

Profile icon
bryancrisso

@JBYT27
when you are working with classes, self attributes the variable to the current class

Profile icon
JBloves27

oh, ok. Thx

@bryancrisso

Profile icon
DragonQuester

Small problem, the game doesn’t save my name after taking a break. It changed to “asd.”

Profile icon
DragonQuester

Just realized that it signed into someone else’s game like

@JonahElias
said.

Profile icon
AyushRajanikant

wow cool

Profile icon
pleasestop

i made a game like this but in pygame. probably won't ever upload it because it's probably trash. a quick question: how did you get things to save? that's one of my limitations right now, it has to be played in one session.

Profile icon
bryancrisso

@pleasestop
u can use the python "pickle" module to save data

Profile icon
DobbyK

Really Cool, but I have a bug to report

When you choose to eat, and after you eat an item the entire interface, ends and only says: What is you choice.

Profile icon
bryancrisso

@DobbyK
yeah that's a weird bug. It will still just take options from the battle options while not showing the menu.

Profile icon
DobbyK

@bryancrisso
I think I found the problem but it might be wrong (Under the function 'eat'):

for i in foodDictionary: if choice.name == i.name: print('The item you chose exists as a food item!') print('Your choice exists in your inventory!') print('Eating ' + choice.name + '\n') self.currentHealth += choice.healthRegen if self.currentHealth > self.maxHealth: self.currentHealth = self.maxHealth self.inventoryRemove(choiceNum) #self.saveInventory(self.inventory) #self.saveStats() selected = True break

After it actually gets the eating done, and improves your health it breaks and returns to here: (Under the Function "Encounter"):

while not hasAttacked: choice = "" while choice not in choices: choice = input("Choice: ") if choice in choices: os.system('cls||clear') if choice == '1': player.attack(enemy) hasAttacked = True elif choice == '2': return random.randint(1, 2) hasAttacked = True elif choice == '3': player.eat() elif choice == '4': player.selectWeapon() elif choice == '5': player.displayStats() else: print("Invalid number!")

I'm not sure where it goes after finishing "player.eat" but I think this may be the problem.

Profile icon
bryancrisso

@DobbyK
theres nothing wrong with the eat function, it just doesn't show the options screen after eating (because it clears screen after eating). It's a really easy fix...

Profile icon
DobbyK

@bryancrisso
Oh, I just think too much hard on everything lol.

Profile icon
SUHASTADIPARTH1

Cool

Profile icon
Phantom1800

Poggers

Profile icon
TurtleAndrew

Wow this is really cool.

Profile icon
Muffinlavania

The save system is sad... I have the same problem with the .dat files to..... (This is in this )
Also you could even make this like a full game you can move around, i made a maze game here:
https://repl.it/@Muffinlavania/Maze-thing#main.py
Using these physics you could maybe make events, like a Q is an event, and if you move into it it triggers something

Also if you want to do anything with this i can help

Profile icon
bryancrisso

@Muffinlavania
i mean, the save system was never made for repl, it works perfectly fine on a local installation. I'm prototyping ways of using the repl database for saving data, for this post.
Your maze prototype is a good idea, but I definitely have different priorities for this. Anyways, as the saying goes, don't fix what ain't broke.
I'm totally fine on this project, I have like 4 friends already working with me on it, although I do most of the programming, and a couple of them create all the content.

Profile icon
zplusfour

@Muffinlavania
what is a dat file?

Profile icon
bryancrisso

@ZDev1
it's just a file type used to store data

Profile icon
zplusfour

@bryancrisso
oh amazing
Is there a tutorial about how to use it?

Profile icon
bryancrisso

@ZDev1
search up "python pickle module"

Profile icon
zplusfour

@bryancrisso
oh gud
Can I use it with Nodejs?

Profile icon
Muffinlavania
Profile icon
zplusfour
Profile icon
WilliamRV

for me, the game crashes when I try to go down to floor 7 or 8

Profile icon
bryancrisso

@WilliamRV
could you share the error message? would help a lot when trying to fix the error!

Profile icon
SammyFicsor

wow! very cool!

Profile icon
elizurfk

It is pretty good, but I have one little suggestion. When you go downstairs, you gain a floor. When you go upstairs, you lose a floor. Why is that? I think it should be flipped.

Profile icon
bryancrisso

@elizurfk
Well, if you think about a classic dungeon, you would start at the top, and explore downwards, right? So this is what happens. We start at the top and you go downwards, and since the floors are technically infinitely generated, it's just a lot easier to get bigger floor numbers the more you go down (it helps with the generation algorithm, it's just a lot simpler)

Profile icon
elizurfk

@bryancrisso
Yeah, but why would the floors get bigger if you are going down?

Profile icon
elizurfk
</