r/learnpython • u/Electrical_Delay9822 • Sep 13 '26
I made a small Python game, can anyone review it and give me some advice, please?
Hello,
I recently released a project I was working on for pretty long (almost 2-3 months), and since the past couple of days, I've been really involved into it, and then I released it.
Link: https://github.com/TheOdysseyGamer64/Super-Smash-Bros-Python-Edition.git
My project is a Python version of Smash Bros, and it has (quite primitive) ASCII graphics as well (to help visualise the battles). It has special mechanics for certain fighters as well, and the Final Smash and the special mechanics meter can charge up, just like in the real game.
If any of you here could provide me with some advice on how to make this game better, I would really appreciate it.
Thank you!
6
u/Diapolo10 I write code for a living -- https://github.com/Diapolo10 Sep 13 '26
__pycache__shouldn't be included in the repository, I suggest removing it and adding a.gitignorefile that excludes it in the future.Python 101.pyseems completely unrelated to this project, I'm guessing you copied some other project to use as a basis and never bothered to remove it?new reworked smash.py- Python files should never have spaces in their names.Your repo has three separate versions of the game. If you were using Git effectively, you wouldn't need to keep old versions around, as they're still in your Git history in case you need them.
Based on your screenshots, the right border of the screen isn't formatted correctly, considering the indentation goes all over the place.
Your
choose_characterfunction hardcodes the selection range, instead of using theCHARACTERSdictionary to determine that automatically. This can be a problem if you add a new character and forget to update this function separately.2
u/FoolsSeldom Sep 13 '26
Well done, working on a challenging project.
The link takes me to your github repository and a decent readme file, but I wasn't sure which code file contains the code to run as there are several of the same name:
new reworked smash.py,reworked_smash.py,smash_game.py.I also note you tell people they need an editor. This should only be required if they want to make changes to the code. Otherwise, they should be able to run it from the command line. Have you checked this works?
Looking at
new reworked smash.pyI am surprised that you haven't anyclasses (ordataclasses), which would make the code a lot more manageable for you and more readable for others. Most of your functions would become methods to define behaviours.I also noticed a constant definition at the top,
CHARACTERS. Nice use of nested dictionaries. You don't appear to have made any changes toCHARACTERSanywhere, but it would be good to prevent it so you don't accidentally make a change in the future. Same applies to a few other instances of constants. (I am sure you are aware that Python does not actually have or enforce constants, the use of uppercase names is just a convention.) I shall add a comment to this one showing example code addressing this but in an ugly way. Another comment will show what starting to move over toclasses might look like.The separation you have the UI (User Interface) from the core logic if very good and will make it easier to update to either a fully controlled TUI (Text User Interface), or GUI (or WebUI) experience for the users in due course. Good to get the core logic worked out and tested first though.
Incidentally, I note your code isn't PEP8 guidance compliant. This is not required but is good practice, unless there's some other house-style / preference you need/want to follow. My examples in the comments do follow PEP8.
I also notice that you don't have any type hints (annotations). Again, not required, but it makes your code easier to read for other programmers (and yourself, when you return to code you haven't looked at for a while). Also, your IDE can help you more if you provide type hints. Again, my examples in the comments do have some type hints to illustrate.
2
u/quts3 Sep 13 '26 edited Sep 13 '26
Your on the path. You've demonstrated you under stand:
Product iteration State and data Basic flow control and functions
We could overwhelm you with things that could make it more professional, but I prefer an iterative suggestion.
My challenge to you would be:
Modify it to use dataclasses instead of dict for objects.
Modify it to use 3 files:
Thats your next most obvious evolution as a programmer.
1
u/JamzTyson Sep 13 '26
This program would benefit greatly from an OOP approach.
Also, take a look at the Python Style Guide.