pygame - Making a 2d game in Python - which library should be used? - Stack Overflow
Anyone know of a high-level 2D game engine for Python?
Well documented 2d game library/engine for Python 3?
I can't answer much in terms of actual python libraries, but if you'd like a full game engine with a language rather close to python in its syntax, check out godot:
https://godotengine.org/
More on reddit.comPython for 2D Game Dev?
I'm currently using pygame for my first major programming project (a bullet hell shooter), and it works pretty well. I recommend reading through the whole documentation and watching a tutorial series on it. I didn't bother doing that, and I ended up having to scrap my project and start over since I wasn't using some of pygame's features properly.
More on reddit.comPygame is just a wrapper for SDL, so technically a lot of games have been made using it, most of the work is done C-side anyways. It's a little slow, though if you are doing a 2D game, it should be sufficient. Frets-on-Fire was written in pure python with PyGame, and FoFiX was written in python with C extensions, and those games are both pretty great, altough on slower computers FoFiX can have trouble running 4 player.
Pyglet is also pretty nice, though I've only used it for emulator development, drawing single layers, so I don't know how well it actually works for game development. I've found that it's much easier to use direct OpenGL with Pyglet than it is with SDL/PyGame, so if you are doing a 3D game, it's probably better than using SDL. Also, since it's written in python, it's very easy to extend classes to change how a function is handled. For instance, I was trying to load data into an openGL texture through the pyglet Texture class, but the class couldn't load the data in a format I wanted, so I extended that class and changed the function that got the texture type (comes from a string) to include the texture I wanted, quick and painless.
One library I don't see mentioned enough is SFML. The 2.0 API (currently in beta) is pretty stellar and simple to use, and, if I remember correctly, runs a little faster than SDL. It is also more "object oriented" than SDL, which is really nice if you are working in an OO language like Python. It has some nice Python bindings written by Bastien Leonard in Cython that are pretty easy to use (or you can use the old C bindings if you don't want to use the most up to date version). I used this a while back and it was quite an enjoyable experience.
The reason why there aren't a lot of shipped games using Python is pretty simple: You can't close Python source. Even if you "compile" python into an executable using Py2Exe or something, it really just packs up the interpreter and python source into an exe file, and the source can be got just by opening up the exe in a hex editor.
While I'm a supporter of the "write it in Python, write time critical parts in C", if you feel python is going to be too slow, I would probably suggest C or, preferably, C++ as the way to go, simply because you don't get that much of a usability advantage for writing in Java, and the C languages can be quite a bit faster running than Java, and Lua will just take away some of the usability of Python without giving you any noticeable performance enhancement. SFML and SDL can both be used straight from C(++).
Advice if you do decide to use python: Use it as it is supposed to be used, as a scripting language. Do not try to bit twiddle or load images in pure python, either use the interfaces available in the library you choose (they all have very good interfaces for those kinds of things) or write an extension module to do that for you. Use python for logic control and fetching data from your libraries. If you follow that simple rule, you really shouldn't run into any performance issues.
In my experience, the things that are really going to kill you aren't generally related to graphics at all. Sure, it's a challenge to get all your frame rendering done in less than 16 ms without techniques like dirty-rectangle updating, but that's not going to be the big thing you'll lose sleep over. The biggest performance considerations are going to come from much more elementary things - collision detection, spatial searching, and pathfinding are three of the big ones - that can easily send your logic frame rate into the floor if done inefficiently over even a few hundred objects. For problems like these, pure Python may not be the best choice, but it's not hard to offload these to C/C++ while retaining Python for higher-level logic. This is essentially what games like Civilization 4 and EVE Online (client and server!) do - offload performance-critical code to C++ while retaining the flexibility and simplicity of Python for 'everyday' tasks.
pygame is actively developed (they haven't had a stable release in a while, but the Mercurial repository is quite lively) and fairly popular. It also uses the well-regarded (C-based!) SDL library under the hood. pyglet is also actively developed and uses OpenGL for all of its rendering, making moving to 3D development easier if you're planning to go in that direction (since you'll already have most of the basics).
If you decide to go the not-Python route, you can use SDL directly with C/C++, along with addon libraries like SDL_gfx (for primitives), SDL_ttf (for text), and SDL_net (for basic networking). Another excellent and widely used alternative for C/C++ is Allegro. I've used both, and I will claim that it's largely a matter of taste which one you go with.
Right now, all I can find is PyGame and pyglet - both libraries are pretty low-level as far as game development libraries go. I'm looking for something that's a bit higher level; something that preferably has a scene editor and that lets me concentrate on creating artwork and designing levels instead of messing with render order and the like. Anyone have any suggestions?
EDIT: I think I've narrowed everything down to two libraries. PyGame + rabbyt or kivy. With either one, I'd have to write code on top of them to get the features I want, but they're both a lot higher-level than what I was using. I promise to open-source the code I write implementing what I want (scene editor, etc...), so this niche will be filled soon. :)
Hi r/python, sorry if this is a noobish question.
I'm a pretty new programmer and I've been playing around with python and some 2d game libraries for a while. Trying out what I can do. Recently I've been using cocos2d and I've managed to play around with creating some custom actions with simple physics and player input. I like the way it does things, and when I get my head around a concept it is easy to use.
However I find the documentation pretty terrible. There is a short programming guide but it doesn't cover enough. The API reference I find very bare-bones. And most topics online are for another language. There are some user made tutorials which have been helpful but it isn't the same as a proper manual.
Perhaps if I were a more experienced programmer I would find it usable, but right now it isn't. Now I'm looking for something else but I'm having trouble finding anything better. So I need some help.
I've tried PyGame in the past but it felt too basic for me (I'm happy to be proven wrong about this). When searching around online I've seen pyglet suggested but from what I understand it isn't a game library as such and from what I've read, not very well documented with a small community. So I don't know if it's for me. Some other alternatives I've read about seem to share the problem of poor documentation.
So I am asking you here at r/python for some suggestions. Are there any well documented game libraries/engines for python that I could use? I'm getting the feeling that perhaps Python isn't the best language for making games and I've seen that expressed by others. So perhaps I should pick another language? If so, what language and libraries would you guys recommend? Any help is very much appreciated!
I can't answer much in terms of actual python libraries, but if you'd like a full game engine with a language rather close to python in its syntax, check out godot:
https://godotengine.org/
I think you should take a look at the games people have made here: http://pyweek.org. All of the game source code is available so if you find a game that kinda looks similar to what you're thinking of, you can just see what library they are using.
Minor thing about pyglet: The pyglet mailing list has been quite active lately. The whole documentation is being reworked and they are planning on upgrading the internals and adding 3D models and what not. I've personally find the Pyglet syntax less cumbersome than PyGame's and it's quite easy to pick up if you read through the official documentation. Have you looked at arcade (http://arcade.rtfd.io)? It's a pyglet based library for creating 2D games.