Python and Game Development

Posted by
August 13th, 2016 10:47 am

I’m pretty new to Ludum Dare. I just recently got into game development, but I’ve been programming for years. I’ve been using python 3 with the pygame library for game development. Around the website, I’ve seen a few people using python as well. I’ve heard python isn’t the best for game development, and I’m using it currently because that’s the main language I’ve been coding in. I have a few questions about python and game development:

Is python good for game development? Why or why not?

Are there any tools or libraries you would recommend?

Have you used python for game development in the past, and do you currently?

Right now my impression is that, as python is a high level language, it is slower for memory intensive games. If I continue with game development, I would probably switch to another language. So far I haven’t had any problems with it, because I’ve been programming pretty simplistic 2D games.

Any feedback would be appreciated, thanks in advance.

Tags: , , ,

17 Responses to “Python and Game Development”

  1. Javabot says:

    Python really is not the best language for games because other programming languages run a lot faster. Especially since they usually require lots of calculations. It is slower than the rest because it is a “higher” language, while c++ is closer to hardware, or “lower”. Other than that, You can certainly use python to create simplistic 2d games.

    Also, I do not know how often python is used for 3d, but I think that is something else languages like java and c++ have over python.

  2. edve98 says:

    I am no expert on this but I’m pretty sure you can continue to use python for Ludum Dare and other game jams. However if you decide to create more complex games in your spare time as hobby (or even as a job). I can recommend c++(Cocos2d, Unreal), java (libgdx) or c#(Unity). Also there is Godot if you want something similar to Python (it has it’s own scripting language but apparently it’s very similar to python).

    Although I’d like to repeat myself again: if you are just participating in game jams and doing this just for fun/programming practice you can keep using python. To mix things up you can try something crazy like making your own game engine. I did (it’s on Github if you want to check it out: ) and I loved making it.

    Anyway, just my 2 cents :)

    • Aeolus says:

      Python definitely suits my purposes as a beginner game developer, but I will definitely keep those options in mind. I haven’t used a game engine before, and I’m under the impression that it requires less programming to make a game(?). Making an engine sounds like a cool project, I will definitely look into that. Thanks for the advice!

      • edve98 says:

        Honestly I’m not really sure what is the exact difference between framework and engine. I guess engines are supposed to do more than frameworks or something. For me there is pretty clear difference between using lets say Unity and libgdx (probably because unity has an editor) and yes, in Unity you need less programming (again, it’s probably because it has an editor and some things can be done by drag and drop, etc). It’s not a bad thing but personally I enjoy having a bit more control of how everything works.

        So yeah, have fun in LD36!

  3. Photon says:

    The major consideration I would advise you to look into is distribution. Can you deploy an executable that people can easily download and run? You can, of course, let people run the code themselves, but this potentially puts far more work into playing your game on the player and is not very elegant. Most people (during judging) are looking for games that require very little to no effort to get running, and that’s an important consideration if you’re looking for good feedback from lots of people.

    As someone who used to use Python for game dev stuff, I would definitely look into that sooner than later if you haven’t already.

    But ultimately, just make the game. Whether you get 5 or 50 people to play your game, do your best to cross the finish line. Oh, and have fun. That too. :)

    • Aeolus says:

      Thanks, I have been using cx_Freeze to create Linux and Windows distributions. I don’t think there’s a way to make it a .app unless you’re doing it on a Mac, which I haven’t gotten around to yet.

  4. microwerx says:

    I recommend continuing to use Python for this Ludum Dare. Use what you are comfortable with. You will have more than enough things to do during the 48 hours than to be looking up howto’s for a different language. I feel that in 48 hours, Python will run more than fast enough for anything you want to do. I wouldn’t look down on it too much. Many games and applications incorporate Python as a built-in scripting language. And seeing as your typical computer is able to do about a billion things a second, literally, how much do you plan on writing. Even with a 1GHZ processor and 50% efficiency with the interpretation of Python code, at 60fps, you still can do over 8 million things per frame. Pretty sure you can get away with doing a fraction of that per frame.

    My main language is C++. I like that you can compile to a .EXE and distribute it fairly easily. I’m looking into using TypeScript/WebGL whenever I do Ludum Dare the next time. I think the best way to get people to enjoy your game is to make it easy to run without needing to configure your computer a special way. I was impressed by Java and the ease of using .JAR files to distribute an executable. Perhaps py2exe, py2app, or cx_Freeze will help with the executables. I’d do a practice run on a test project to make sure you have this down so it doesn’t become a time-crunch item in your 48 hour jam.

    If you’re doing real game development, I wouldn’t recommend doing your own thing anyways. The Unity and Unreal engines are an amazing value for what you get–if money is something you want to make.

  5. tjxx says:

    If you have created a game in a language like C++ or Java, you will see that Python is much simpler and easier to build a program with. Because it is a higher level programming language, it’s use in developing games is much faster than creating one with lower level languages. Python has its share of two dimensional engines available for free, including PyOpenGL if you require a 3D binding for the language. Plus, since it comes bundled with any Linux distro, making your game run on Linux will require minimum effort.

    Due to Python’s higher level and convenient nature, runtime will see much more calculations and translations being made every second which in turn results in poorer performance for your game. With any full game written in Python, it requires you to keep scope in mind to keep performance high.

    I would encourage you to at least try it out and come to your own conclusion. If you don’t there is always the Unity engine or javascript.

    • Aeolus says:

      Thanks for the advice. I have tried it out, making a basic game which runs fine at hundreds of frames a second. I am curious, why are C++ and Java used more than Python in game development? They are all high level languages, and as far as I know, C++ only runs on Windows. Java, like Python, can run on most operating systems.

      • tjxx says:

        I’m not entirely sure either, I assume that there are more programmers who have programmed in Python but moved to Java or C++, or they just are hating on Python, but that’s only a guess. I would fall into the first category, first learning it then later on moving away from it and never touching it again.. for the most part.

        As far as Debian-based Linux distros go, they have the Gnu Compiler Collection (GCC) and G++ compilers available for doing C and C++ development in the terminal, so C++ is possible in Linux and I am sure there is something for other distros as well that I’m not aware of. Heck, you can even do C# in Linux if you really wanted.

        I totally blanked on the Java part when I mentioned the cross platform support and the fact that there are JRE and JDK download links available for Linux, Mac, Solaris and Windows on the Oracle page. So each one of those three languages actually have support in each operating system.

        • Aeolus says:

          For some reason I always thought the C languages only ran on Windows. Perhaps I was thinking of DirectX.
          I have one more question, if you don’t mind. I started out learning Visual Basic with some drag and drop GUI elements. I made some pretty basic games without an actual game architecture. After a pause from programming, I wanted to try object orienting, so I started to learn Java. I learned the basics of Java and started a simple game tutorial with it, that I never finished. I stopped programming for awhile again. Finally I picked up Python which was very versatile with a pretty easy syntax compared to Java. After learning the basics, I worked on natural language processing and basic artificial intelligence.
          Recently I got back into game development, and used PyGame, because I knew Python the best at that point. I completed a tutorial and started making some basic games to see if I could apply that knowledge. Anyway here I am now, still learning basics. Will I have trouble switching to other languages like C, C#, C++, Java, etc. because I’ve been using simpler syntax?

          • microwerx says:

            Don’t worry. You haven’t ruined yourself by learning Python. I started with 8-bit BASIC on a Commodore VIC-20 and all that spaghetti code (because of GOTO) didn’t ruin me. I recommend that you learn C because it is as low level as you can get before you would want to learn assembly. Unless you want to learn assembly–and then by all means. My first epiphany on computing came by learning assembly and I figured out that computers are really, really dumb–aside from logical and basic arithmetic, they don’t really do anything else. In fact the 6502 in my VIC-20 didn’t even have multiply/divide instructions and they could only do 8-but addition/subtraction.

            If you learn C, you will be able to extend your Python programs with faster code. So if you are profiling your Python code and you have a few functions that are taking a lot of time, you can take that and implement it in C, then call it from your Python program. Python and C are great companions because Python was written in C. They also have good documentation.

            I would go from there and learn an object oriented language. You can pick C++, C#, Java, whatever. It’s about the experience. Python is object oriented and those same principles apply in these other languages. You’re going to have objects. They can inherit from other objects. They have methods (the functions they do) and members (the variables they have). The concepts are the most important part. The syntax is a matter of experience. If you use it all the time, it’s a non-issue. It’s not hard to transfer those skills between languages either.

  6. QualityCatGames says:

    You should probably stick to what you’re comfortable with.
    I have had bad experiences with Python, probably because of its whitespace-sensitivity
    However, that doesn’t mean you shouldn’t use it.

    One thing to consider, though, is if you can compile an executable.
    The computer I’m presently using doesn’t have Python installed (to my knowledge), and it probably won’t ever.

    However, I’m also avoiding .exe’s and stuff ‘cuz I don’t want to download games to run them.

    good luck!

    For more professional games, it’s definitely a good idea to learn something else, but as people have said: adopting a new language and/or technology at last minute is generally a bad idea. Perhaps take note that for future games.

    Optimization problems don’t stop people from making full-fledged ‘professional’ games, though. web gaming is going towards HTML5, with the objective to eliminate the plugin-based options entirely. Contrary to popular belief, HTML5 is not faster than Flash and the other plugin-based systems because the actual program code is written in JavaScript. However, since so many people are using modern computers, you’d never know… >.>

    Another tidbit: the language and tools do not necessarily doom your game to run slower. (or too slow, anyways) It’s how you use them. Generally speaking, games should also be optimized by the programmers, themselves. Things like not rendering what can’t be seen, disabling the updates/collision detection of objects that are off-screen (well…if they don’t need to, RTS can’t do this) , and even sub-dividing the entities into smaller groups. (I haven’t gotten to this point…) Ofc, for Ludum Dare, the focus is to just get a game out. However, after the jam/compo is over, you could focus on optimizing/fixing your game. (there’s actually a trend of people taking their LD games to Steam or game portal sites like Kongregate or Newgrounds).

    Hope that helps?

Leave a Reply

You must be logged in to post a comment.

[cache: storing page]