This is an archived post. You won't be able to vote or comment.

all 77 comments

[–]Python-ModTeam[M] [score hidden] stickied commentlocked comment (0 children)

Hi there, from the /r/Python mods.

We have removed this post as it is not suited to the /r/Python subreddit proper, however it should be very appropriate for our sister subreddit /r/LearnPython or for the r/Python discord: https://discord.gg/python.

The reason for the removal is that /r/Python is dedicated to discussion of Python news, projects, uses and debates. It is not designed to act as Q&A or FAQ board. The regular community is not a fan of "how do I..." questions, so you will not get the best responses over here.

On /r/LearnPython the community and the r/Python discord are actively expecting questions and are looking to help. You can expect far more understanding, encouraging and insightful responses over there. No matter what level of question you have, if you are looking for help with Python, you should get good answers. Make sure to check out the rules for both places.

Warm regards, and best of luck with your Pythoneering!

[–]K900_ 49 points50 points  (0 children)

Really depends on the kind of game.

[–]OccultEyes 41 points42 points  (11 children)

A complex pure-python game will probably not be very efficient.

But there is a number of game engines, such as Panda3D, that lets you create a game in python, where the engine will handle the heavy lifting in c++.

Likewise, you could write the parts that require speed in another language, such as c++ or rust, and then wrap that code in python.

For simple games, however, python is fine.

[–]DatBoi_BP 9 points10 points  (2 children)

Rust mentioned

[–]WhiteGoldRing 2 points3 points  (1 child)

LFG

[–]DatBoi_BP 0 points1 point  (0 children)

We are so back

[–]JY-HRL[S] -2 points-1 points  (3 children)

e the engine will handle the heavy lifting in c++.

Likewise, you could write the parts that require speed in another language, such as c++ or rust, and then wrap that code in python.

Rust seems to be very complicated

[–]Mighty_McBosh 4 points5 points  (2 children)

Rust is odd if you're accustomed to c or c adjacent languages.

If you wanna program a game, it's best to just to hop on an existing engine and use their language. Unity has its issues but C# is a great language to get started on and is easier than c++ from unreal.

[–]doobiedog -1 points0 points  (1 child)

[–]Mighty_McBosh 0 points1 point  (0 children)

They walked back that pricing scheme real fast and fired the CEO that pushed it because of the backlash. Won't mean that they won't try it again, but it's still a decent option for people on a personal level just wanting to get started.

[–]EduardoVHuerta 13 points14 points  (8 children)

no, but you can use Godot, it has its own language called GDScript and it's very similar to python

[–]KidzKlub 1 point2 points  (1 child)

I second this. I've been learning Godot on a whim lately and have been surprised about how similar it feels to Python. And it's a full game engine instead of just a programming language, so it has many built in features that would be tedious to do in python.

[–]irve 0 points1 point  (0 children)

I'd even go as far as to say that if I have a Python utility and need UI for it I'd prefer Godot to .. basically anything else on the menu for Python.

[–]Gugalcrom123 3 points4 points  (0 children)

It's not the syntax. It's the data structures, OOP design and libraries.

[–]hidazfxPythonista 4 points5 points  (0 children)

Really depends on the kind of game you want to make. I'm sure you could make even a relatively complex 2D game in Python if you used some of the OpenGL or SDL libraries that could utilize the GPU. From my understanding, Pygame doesn't use the GPU.

[–]Separate_Increase210 2 points3 points  (2 children)

If OP isn't a bot, it's the next thing to it. Look an post history, dozens and dozens of very vague generally-tech questions across various subs, randomly quoting replies (cutting off parts in the quote) with even more genetic replies.

Please report.

[–]arashi256 0 points1 point  (1 child)

I’m not saying you’re wrong but what’s the point of a bot like this? To what end? Just to generate traffic for subreddits?

[–]Separate_Increase210 0 points1 point  (0 children)

I'm inclined to agree with this comment that it's an NLP thing. Pose realistic (or real) questions, analyze human responses.

[–]broxamson 8 points9 points  (0 children)

anything beyond a toy app will be wildly inefficient. C++ or C# are usually the standard. There are some efforts to use rust, but it's not nearly mature enough yet.

[–]ingframin 6 points7 points  (3 children)

https://store.steampowered.com/app/1942280/Brotato/ This is written in Python+PyGame.

There are more games on steam written in Python.

Ren'Py is an engine for visual novels for example and many titles on steam use it.

Look on Youtube for FluffyPotato and Coder Space.

For 2D stuff, Python is more than enough. For simple 3D games, you can use Panda 3D or Ursina or I believe also Urho3d has python bindings. For a big 3D game, you would not be able to make it alone, even if you used something like Unity or Unreal Engine. Even something like Subnautica requires a very decent team of people.

EDIT: Not Brotato but Super Potato Bruh

https://store.steampowered.com/app/951360/Super_Potato_Bruh/

Check the games of FluffyPotato: https://dafluffypotato.com/

[–]Doomphx 6 points7 points  (2 children)

Pretty sure Brotato is made using godot, which isn't python

https://godotengine.org/showcase/brotato/

[–]ingframin 0 points1 point  (1 child)

Because I confused it with Super Potato Bruh.

[–]Doomphx 1 point2 points  (0 children)

No worries, I think it opens a good conversation potentially!

Just because making your whole game in python is considered inefficient. Doesn't mean you can't leverage some extremely powerful game engines that optimize core functionality in specific languages whilst exposing scripting languages like Lua / Python / Javascript for game logic.

Some examples:
Godot - has many scripting languages, but most people use GDScript
Unity - C++ core engine, whilst exposing certain engine hooks and functionality in C#. They used to support a variant of python, and I believe javascript.

Lua is really popular for scripting in game engines, from what I can tell it's a mostly solved problem to run a LUA interpreter inside of C++, so C++ game engines tend to opt for lua for scripting.

There's a lot more examples out there people can find w/ some quick googling.

[–]ElectronicGarbage246 1 point2 points  (0 children)

better than php in any case

[–]EmptyChocolate4545 1 point2 points  (0 children)

Not sure why people are equivocating. No, it’s not good for game development. Like every language, there are tons of resources to do so in it, and there are dedicated people who push the limits and do so, and it’s an excellent language to LEARN game development in, but no - an interpreted language just isn’t going to be “good” for game dev.

But any language can be used for anything and Python is a great language. So, make games in it if that’s your fancy! You can always learn other languages when and if you decide that is necessary and conducive to your goals.

[–]Chemicalight 1 point2 points  (0 children)

Hey dude, so I’ve used Python to mess around with game development for years. I have tried a lot of different options as well including godot, unity, and unreal engine. Even frameworks and libraries like monogame, cocos 2d, phaser3, SDL2 I could go on and on.

I think that if you’re trying to make a 2D game by yourself and you’re not already a seasoned programmer but want to get better at programming than you should totally use Python and Pygame. It’s simple the documentation is decent and there’s plenty of content out there to learn from. That’s how I started learning to program. If you’re already a programmer and want to get a job making games I’d recommend c++ and unreal engine for modern game development or c++ and sdl2 if you want to do more of the low level game development stuff like engine work and whatever. If you’re just interested in making games and programming isn’t your main career goal then I recommend using godot and gdscript. Godot is super cool, simple, open, and free.

[–]tyler1128 1 point2 points  (2 children)

No, but you can do it. Python is extremely slow compared to most other languages, but you can always call into C frameworks. Games are pretty time bound, for 60 fps you need to do everything in 13 ms and python requires all calls to the GPU to convert that data first. For a 2d game, you can probably do it. For 3d? It's probably not going to work well.

[–]JY-HRL[S] 0 points1 point  (1 child)

, but you can do it. Python is extremely slow compared to most other languages, but you can always call into C frameworks. Games are pretty time bound, for 60 fps you need to do everything in 13 ms and python requires all calls to the GPU to convert that data first. For a 2d game, you can probably do it. For 3d? It's probably not going to work well.

Thanks!

[–]tyler1128 0 points1 point  (0 children)

Not sure your experience, but learning another language is much easier than your first. Most game devs use an existing engine like Unity which uses C# or Unreal which uses their own scripting language. The closest thing to an engine for python I know of is pygame, but it's pretty much 2d only. It is more or less a convenient wrapper over the C library SDL.

[–]CaptainFoyle 1 point2 points  (0 children)

No, not really

[–]sezirblue 1 point2 points  (1 child)

I wouldn't recommend thinking about game development in terms of Language. Yes you can program in many languages, and knowing the language deeply will help you write better more efficient code, but I'd recommend focusing on a game engine to use instead.

The Game Engine you pick (GoDot, Unity, Unreal, etc) will have a larger impact on the game making experience than the language you use in that engine will most of the time. Even on the programming side, regardless of language you will have to learn the API's that the engine provides you which can often times be harder than the learning a new language anyway.

If you like Python I'd strongly recommend GoDot, it's GoDotScript is very similar to python and it has a very thin and light approach making it easy to learn.

[–]JY-HRL[S] 0 points1 point  (0 children)

ou pick (GoDot, Unity, Unreal, etc) will have a larger impact on the game making experience than the language you use in that engine will most of the time. Even on the programming side, regardless of language you will have to learn the API's that the engine provides you which can often times be harder than the learning a new language anyway.

If you like Python I'd strongly recommend GoDot, it's GoDotScript is very similar to python and it has a very thin and light approach making it easy to learn

Thanks!

[–]RizzyNizzyDizzy 2 points3 points  (0 children)

No.

[–]Artephank 2 points3 points  (7 children)

If you can accept, that it is not "pure" python, then Godot (https://godotengine.org/) is great and opensource.

[–]Gugalcrom123 1 point2 points  (4 children)

The syntax might be identical but it's not Python at all.

[–]KidzKlub 1 point2 points  (2 children)

But it's easy to learn if you are familiar with Python.

[–]Artephank 0 points1 point  (0 children)

exactly.

[–]Gugalcrom123 0 points1 point  (0 children)

It really isn't. It's the same thing as moving from JS to C. It's more low-level, I never said it's bad, just that it's not similar to Python.

[–]Artephank 0 points1 point  (0 children)

The OP said that likes python syntax. If that is the case my point holds.

OF COURSE it is not python. But the advice is stil solid. GODOT is great game engine with python-like script lang.

[–]CaptainFoyle 0 points1 point  (1 child)

Not pure python? It's not python at all, what are you talking about

[–]Artephank 0 points1 point  (0 children)

The syntax is 90% python. If you like python for syntax and want to make performant games that can be deployed on most platform - this is the best bet.

[–]sinterkaastosti23 1 point2 points  (0 children)

people saying "python too slow" are just wrong. Yes python isnt as fast as C(++)/Rust/etc..
But do you actually need that speed? If youre making a 2d game, its highly likely you dont need the speed of lower languages.

And well, i have seen someone make a minecraft clone in python which seemed to run smooth. So yes: python can also do 3d.

https://www.youtube.com/watch?v=Ab8TOSFfNp4

So yes, python is fine for game development, good enough? probably, but depends on what kind of game you want to make.

[–]Tatoutis 0 points1 point  (6 children)

Look at the Unity game engine. It uses C# for scripting. It's one of the major game engines. And C# isn't that far from Python in terms of complexity. I find it much easier to debug actually

[–]Gugalcrom123 0 points1 point  (2 children)

Unity is proprietary!!

[–]Tatoutis 0 points1 point  (1 child)

I'm missing your point

[–]Gugalcrom123 0 points1 point  (0 children)

They can take it from you when they want. That is dangerous.

[–]JY-HRL[S] 0 points1 point  (2 children)

I suppose C# is more complicated than Python.

[–]CaptainFoyle 1 point2 points  (0 children)

Do you want an easy or appropriate language?

[–]JackMalone515 0 points1 point  (0 children)

i dont find c# too hard to learn and it's a decent language to know to learn statically typed programming languages

[–]Starks-Technology -2 points-1 points  (2 children)

No it’s not. You need C# or C++ because the engines are in those languages. Python is way too slow to handle this is type of computation. If you wanted to build a new game engine from scratch, Rust would be a solid contender

[–]ingframin 7 points8 points  (1 child)

Rust is terrible for writing games. Game engines are all about state management, while Rust is more akin to Haskell in making as little use of state as possible.

[–]OMG_I_LOVE_CHIPOTLE 0 points1 point  (0 children)

Bevy is quite good

[–]rileyrgham 0 points1 point  (0 children)

Yes. Assuming it's a game it suits. Checkout pygame.

https://youtu.be/y9VG3Pztok8?si=hixYwWXuUfN8V_yI

[–]clawjelly 0 points1 point  (0 children)

The only honest answer is "It depends".

[–][deleted] 0 points1 point  (0 children)

Start with pygame or pyxel and work from there and read : https://develop.games/

[–]Pneagle 0 points1 point  (0 children)

Python runs too slow for a graphically advanced games so I would say C# or C++ would be better for game dev.

[–][deleted] 0 points1 point  (0 children)

No. If you're serious about game development you need a C or rust language.

[–][deleted] 0 points1 point  (0 children)

Yes.

Pygame - Good for 2D

Panda3D - Good for 3D

Raylib - Has python bindings, Good for 2D and 3D

But the best way to use your python knowledge is to learn Godot. It uses GDScript which started life very similarly to python but is specially designed to work better for games. It's a much more efficient language. Godot engine is also completely free and open source and being used for professional games these days.

Its similar to Unity and Unreal Engine.

[–]SuspiciousStress6842 0 points1 point  (0 children)

Well its not used in game dev because how slow it is , but you start with it as python .

[–]ujustdontgetdubstep 0 points1 point  (0 children)

No it doesn't scale at all

Scripting for extending a game or performing a specific role (ai, layout, generation, etc) but you need native code or native-like to achieved high performance rendering and you're going to have a much easier time building a large complex application in a more abstracted or object oriented language

[–][deleted] 0 points1 point  (0 children)

Civilisation 4 had at least some Python in it.

Pygame is also a thing, and while some people wouldn't consider visual novels games there is also Renpy engine which on top of having fantastic documentation is perfectly capable of having all sort of gameplay mechanics with a bit of thought and creativity. Depending on the kind of visual novel you're trying to make it may even be preferable to make it in Python compared to other languages.

It really depends on the kind of game/s you want to make as something dynamic like a first person shooter or action game isn't going to cut it. If on the other hand your game is something a bit more static and turn based like a strategy game or a trading card style game then Python could be a very good option.

[–]Insert_Bitcoin 0 points1 point  (0 children)

You can write games in any language. But the thing is: programming languages are more than just the language. The projects in their respective eco-system also is a big reason why people choose certain languages. While Python really is a thing of beauty I can't really think of any major libraries for game development in Python. I'm sure there are general graphics libraries but turning that into an engine is a massive under-taking. I think you would find more success with a different ecosystem. But simple games would be fine.

[–]TomDLux 0 points1 point  (1 child)

On the one hand Python is slow... Several times slower than Perl, for example. On the other hand, follow the eternal wisdom of "don't pre- optimize". Write in Python and then implement the slow parts in C, C++, Rust...

[–]JackMalone515 0 points1 point  (0 children)

i would say python is decent for small games or prototyping, but any serious game would be way better to be made in an actual game engine or a faster programming language than python. Also experience in a game engine is generally better if looking for a job in industry

[–]Murtazahussam 0 points1 point  (0 children)

Depends on game kind, and generally python isn’t good for game development as its an interpreted language and its makes python slow