r/PythonLearning • u/Capable-Mall5802 • 3h ago
Terminal Based Turn Based RPG beginner project
Very new to python. This is my first semi-large project.
In the video above, I show the admittedly amateurish code, and a demonstration. I demonstrate the WARRIOR and MAGE class to show basic and magic abilities in action.
A text based turn based RPG game which runs in the terminal. Commands like attack or defend must be typed manually and as they are displayed in the GUI to avoid type errors. So far there are 4 classes(one of the classes is not functional at the moment) with the ability to create a custom class. When creating a custom class the player gets 26 skill points to distribute across the different skills.
Skills include: Strength, Defense, Evasion, Critical Hit Damage, Agility, Spirit, Mana, Luck. The flow of the game is largely determined by these skills with some RNG mixed in.
Spells and Abilities are assigned to the player at the start of the game depending on the stats selected. Magic focused characters are assigned magic abilities while, damage/agility focused characters are assigned normal abilities. For magic assignment, the change of obtaining any particular skill is determined by the value of [(0.0-0.9)*Player spirit stat)] + a base obtain value. Ability assignment works in the same way but used the players ability stat to determine obtain chance.
Evasion skill determines the chance the player will dodge an enemy attack. Both the player and enemy have this skill.
An enemy is generated in the beginning game with the players stats in mind. This is done to ensure fairness.
To determine the value of the enemy attack value, I created a formula to dynamically assign a value based on the disparity between the player and enemy health stat. The equation is as follows...
A = \sqrt{100-[(\frac{P}{M}})\cdot 100]
or...
C = (Player_Health/Monster_Health) * 100
B = 100 - C
A = sqrt(B)
There is no party system in this game, which limits strategy. The enemy turn functions through an AI which is still a work in progress. I say AI, but no neural network is used, instead, the enemy learns which actions will yield positive results based on the player follow up action. The probability of an action being repeated is increased or decreased based on how detrimental/beneficial that follow up is.
No AI was used to create this. Again, I am a very amateur programmer and understand that there lots of things i can do to improve this, like utilizing object oriented programming, or less dependence on global variables, .json files, naming consistency like: statsPlayer, Player_Stats, stats. Please give suggestions of ideas for what I should add. I am actively learning while making this project and implemented a lot of these things would require to me to rewrite everything. I would rather finish what I have and create a new and improved version with these fixes.
Please give your feedback and ideas for what I should add. Currently I am in the process of completed the Magic buff and Ability buff system as not all buffs currently work, finishing the ITEM system, finishing enemy AI(as of now, all the enemy can do is use light attacks and dodge), adding a dungeon mode alongside current single mode, and adding a shop to buy items after obtaining gold in dungeon mode.
Dungeon mode would allow you to collect XP and level up as you defeat enemies, forcing you to fight stronger enemies as you grow stronger, until you reach a dungeon boss which uses unorthodox mechanics which the player will have to figure out to win. The player will be rewarded gold after each victory which can then be used at the shop.
Some additional notes: When creating your own class, naming your character "DEBUG" will enter you into debug mode, which allows you to change the LUCK stat to artificially increase RNG values. Otherwise, the LUCK stat is assigned a value randomly. When on battle menu, typing help will give a brief overview of the GUI and how to navigate it. When on the abilities screen, typing the ability name followed by the "--d" or "--description" tag will show the description of selected ability.
as of now only the "--d" tag is available, but I want to program in different tags for debug and quality of life purposes. Any ideas on what kinds of tags I should include?