DEV Community

Cover image for Why Python is a Great Language for Coding Games
Walker-A-1
Walker-A-1

Posted on

Why Python is a Great Language for Coding Games

Introduction
Python is a great coding language for beginners. The syntax is easy to read and it makes sense. Python is good for building beginner friendly games. The language is also useful in many more ways than just making games. Python is very popular so there are lots of resources out there to help you code and learn.

Why is python good for coding games?

  • Easy to learn There are many reasons that work together to make Python easy to learn. It has good readability and syntax. Python uses indentation to signify code blocks. This means you have to move your code around and that makes it way easier to read at a glance. Image description Unlike other languages that signify code blocks with curly braces or keywords like begin and end, which requires you to search for those signifiers and remember where they are. Python also uses its popularity to be easier to learn, by that I mean the wealth of resources and supportive communities around Python. Lots of people have already learned Python, that means most questions you have probably have their answers documented on the internet somewhere. There are lots of courses, tutorials, books, and communities around Python so if you want help or practice, there are plenty of means to do so. Python itself has robust performance. It is easy to import modules into your codebase. That means your code does not have to contain all the data that it needs to work. Whatever modules you import get carried over and combined with your existing code base. Pythons robustness makes it able to handle lots of actions at once without lagging or slowing down. The popular game Mario Kart 8 Deluxe is a good example. It has sold 45 million copies world wide. Being a high action game with lots of collisions and player interactions at high speed, that shows just how much Python can handle. Image description
  • Python can also delegate the harder tasks to more specialized languages Python itself does have some limits when it comes to rendering games. Of course there are technically no limits to any programming language. If you had a specially made computer to handle a fast paced 3D game in Python, the language itself would not stop you. The issue arises when you want to make a game on a “normal” (consumer grade) computer or have the game run on lots of other people's computers. The machine Python is running on will start to slow down because Python is not the most optimized language when it comes to graphics rendering. But that does not mean it is impossible to make Call Of Duty in Python. While Python itself can not render graphics very well, it can delegate the more specialized tasks to more specialized coding languages. To do this you will need a cross language framework. This will not be too difficult. You only need to learn how to use a framework built for the language you already know, to ask for a language that is better at handling graphics. You can use a more complex language like C++ without even knowing it! Image description
  • How many devices can Python games run on? Python has many useful libraries, frameworks, and even some services that let you give your Python games the ability to work on many different platforms. This includes Windows, MacOS, and Linux. But the one I am interested in is Num Works. More specifically the NumWorks calculator. That expensive graphing calculator is able to run python code. I am sure this has many useful applications like calculating complex formulas or storing data to cheat on a test and so on. But what I am interested in is gaming on my calculator. Now I know this won’t be an amazing coding experience, I do have a personal computer (the best gaming experience), no, my main motivator here is memes! There is a meme that I love, where people try to code the game DOOM onto a calculator. Not just a calculator but I saw someone even code an environment that you can walk around in on a digital pregnancy test! While I am not skilled enough to code a pregnancy test, I believe that putting video games on my calculator is within my reach! Normally this would be a very easy process, not even requiring coding knowledge, all one has to do is connect their calculator to the internet and download the desired game. But in this case no one has coded DOOM in Python, for the NumWorks calculator, yet! That is where I come in. Now I have never made a three dimensional game, or even played DOOM for that matter. But I believe with a little effort to code the game (and playing the game lol) I too can play DOOM on my calculator!
    • What else can you do with Python? Being an easy to learn language makes it popular for lots of fields You may think there is a limit to the things Python can do for you, since it is so easy to learn and it's popular. But those traits have become so substantial that they contribute to the usefulness of Python, instead of hurting it. Since Python is so easy to learn that makes it a good choice for people who don’t want to spend a huge amount of time learning to code but still want the benefits of automation and data visualization (more than not). Web development, automation of simple tasks, education, and finance are just some of the most widely used applications of Python. Python is good at web development because the syntax is easy to read. That means someone will spend more time coding their website with the necessities and extra stuff, rather than trying to read and understand syntax. You can of course leverage Python's extensive libraries and frameworks here. To make it so that you don’t have to reinvent the wheel while making a website and think with more abstraction (think about the big picture versus small details) while making your website. Python excels at management of data and information. Python has lots of frameworks and libraries that help organize and represent data. This could be useful for finances, making it easier to input data and see it from a different angle. Or have an algorithm do all that for you. This can also help teachers represent complicated topics to students, hopefully making it easier to understand. Image description

Conclusion
In conclusion, Python is a great coding language to learn to get your foot in the door as a programmer. Python is great for making games. Python can also be utilized in many different fields besides gaming.

Sources:
https://www.tutorialspoint.com/is-python-good-for-developing-games-why-or-why-not
https://www.reddit.com/r/learnpython/comments/12vbfev/how_complex_a_game_can_you_build_in_python/
http://programarcadegames.com/index.php?lang=en&chapter=introduction_to_graphics
https://forum.freecodecamp.org/t/why-should-i-learn-python-if-i-already-know-javascript/253988

Top comments (0)