DealerMUD – an Experiment into Programming with Python
Title Card

DealerMUD – an Experiment into Programming with Python

If you'd like to watch the Video Presentation on DealerMUD, you can check it out here:

               As part of my continuation of my previous blog entry where I discussed about learning some of the nuances of Python, I discussed briefly at the end I would like to create a text-based game using the Python script to cut my teeth upon the languages coding ethics. To that I have created an RPG-ish style game called DealerMUD!

What is DealerMUD?

               DealerMUD is a text-based RPG style game with some strategy and tycoon elements where you roll for random car chances and strategize if you are to take them or leave them be like the rust heaps they are. The game currently is in its extreme early stages where one can create and save a game, roll for cars, and choose to save them or leave them, with more options to be added later in the process such as the ability to upgrade cars, a selling mechanic where one can roll to sell their cars, chances increasing or decreasing based on the car’s variables through the process. For now, however, it’s posted as the “v0.00 Mega-Alpha” which is used simply as a testing ground for using python applications.

How it Works:

               The game starts with the main screen. Which shows a user the option to start a new game, load a previous save or quit the application. Selecting a new save will give the user a variety of options, including picking a username, selecting their starting budget, and how large they want the dealership to be (marked as slots, slots which get filled as you purchase cars). Once the user has entered their preferences, they will then be able to load their game through the “load game function”

This then will take them to the main screen, where users can perform a car-roll, save the game, return to the menu, or quit outright.

Car rolls are done through random selection, along with random pricing on a wide scale of variables which their ranges will vary from vehicle to vehicle. A 2005 Dodge Neon will not be priced and in the same condition as a 2019 Caravan essentially. Currently as it stands a user who purchased a vehicle has the amount costing deducted from their budget and the car will fill a slot in their dealer’s inventory, if a user has all slots filled, they will not be able to purchase any additional cars.

Translation Errors

               While Python is a great language for various applications, I often kept finding myself writing Python code as a Java programmer. I’d catch myself putting java syntax where Python has something different. One notable one would be using “else if”, which Python does not use, instead it uses “elif”. Another thing that is more IDE-specific but gave me troubles was that in PyCharm some cautionary items would be underlined with a yellow line, however it would oftentimes be a more fatal error and cause the program to crash. Another thing is that PyCharm would be quite picky on how you space and indent lines, since Python is heavily indentation based. I also found that although I learned a fair bit about the functions of using Python, I found I was lacking in the ability to create packages and classes and found this was a partial issue to my disorganization. Since I was approaching it like a Java developer would I found I conflicted myself on a fair amount, I assume with more programming and usage of the Python language that the nuances of it will come. I also thing that having more preplanning done on this application would’ve helped it come along much smoother, with a more solid idea as to what fits into where, how I will save elements and setting attributes in stone could’ve saved a lot of headspace when it came to progressing through building this application.

Planned Features

               As it’s been previously stated, this application is currently under a “work-in-progress” stage, and I would like to continue it. I think adding the ability to sell vehicles and adding some RPG and random chance elements would be a great addition to the gameplay aspects of this application. I also believe that adding some elements like the ability to repair vehicles would be a plus as well as adding detailing aspects to help with more “Tycoon” elements. I also feel this game could be helped along with some progression elements such as the ability to expand your dealership, run multiple or even sell new vehicles to spec.

               Perhaps also working translating this over to Java may make this application a bit easier to manage with packages and writing out lines of code due to its familiarity.

My overall thoughts on Python

               As I’ve worked with Python over the past for months, I’ve seen its functionality and usability. And much like any other programming language, it has some major pros balanced with some cones. One of the biggest pros is that you can write out code quicker and easier than you can with Java, without having to worry about using items like brackets and other elements that are sometimes easy to lose in multi-lined coding elements but also a physical slowdown as you must reach for the certain keys for elements more often, meaning you can write from brain to lines of text much faster than in java. However, that came with some caveats.

               The speed of which you can write was improved but I found I’d get lost in some code sometimes or would have formatting wrong and items indented in the proper order so sometimes Python would hate me for it and I initially wouldn’t know why.

Conclusion

               Overall, I think Python makes for a great language for applications and it’s very versatile and powerful in the right hands, but it does require some getting used to if you’re used to another programming language like I am with Java. But I do recommend that people pick it up as either their primary or secondary language if they’re just beginning to dive into the realm of software development.

To view or add a comment, sign in

More articles by Cadence Briand

Others also viewed

Explore content categories