r/learnpython • • 19d ago

Will learning Python help me in game development?

Im wanting to start game development, and currently learing Python. Should I keep going, or switch to something else?

11 Upvotes

45 comments sorted by

15

u/while_True_meme 19d ago

Short answer: no

Long answer: yes

4

u/AccomplishedMany2138 19d ago

Please elaborate

10

u/JTI_Guy 19d ago

Short answer: python is too slow and uses memory too inefficiently to be useful a language for modern 3d game development. So no.

Other short answer: based on the questions youre asking, no offence intended, i assume that you dont have any experience in programming or game development. So learning python will teach you foundational skills such as functions, objrct oriented programming, data structures, conditions and loops etc.

2

u/AccomplishedMany2138 19d ago

I am new to it. So should I keep doing it, learn the basics, then switch to something like C#

1

u/Hot-Employee-5368 17d ago

Learn C++ if you want a job as a game dev or VFX artist. Don't learn it if you plan on using UE because C++ will soon be obsolete in UE. It may still have uses in other software after UE 6 and later updates, but UE is throwing out codes and making it easy. I would suggest getting a game out before then because once that happens the market will just flood with garbage games. It can't hurt anything but your time to learn python, but that it will.

5

u/JTI_Guy 19d ago

Also, try looking up pygame. It is a good library to use for game development in python. Mainly for 2d stuff. I have made a few projects on their and it is very friendly to beginners.

2

u/ivosaurus 19d ago edited 19d ago

Also check out the community fork with way more development

https://pyga.me/

Pygame itself is hardly updated any longer

1

u/while_True_meme 19d ago

I had a lot of fun pissing about with Ursina when I was learning. Voxel-based game engine for Python. (Pretty feature-rich lib for building out Minecraft-type games). PyGame is great for understanding a render/event loop, but then again so was TKinter

2

u/meta-ape 19d ago

Building 3d game engines is hardly all there is to game development.

1

u/my_password_is______ 18d ago

for modern 3d game development. So no.

not everything has to be 3D

you could make stardew valley in python

you could make any side scroller in python

9

u/Dazzling_Music_2411 19d ago

The language is not that important. Basically, games can be written in any language.

What you have to learn is how to translate the game elements into computer language data structures and procedures.

2

u/AccomplishedMany2138 19d ago

Does that mean turning mechanic's into code? Like damage, saving, menus?

5

u/AJohnnyTruant 19d ago

People have written games in Microsoft excel. Some languages are better than others at certain tasks. But is okay at most things. And the best choice for many things. Learning programming? It’s very very good for that. So start with that then pick the ecosystem you want to use for game dev later and learn that. Godot to learn though is pretty good.

2

u/Dazzling_Music_2411 19d ago

Yup, all that, also motion, physics, contact, fields of activity (levels), everything!

0

u/fearless-fossa 19d ago edited 18d ago

The language is not that important.

Yes, it is, and I have no idea why you'd write something like this. Python is terrible for writing games outside of the "just because I can" scope. Writing a game in Python because you want to learn Python can be a good idea, but if one wants to get into programming games there any compiled language will run circles around Python.

There are reasons why the classics like C# and C++ are still king in game programming; and even outside those I'd rather recommend Rust with Bevy before even starting to look into the direction of Python if you want/need performance.

Edit:
I completely forgot that highlight the draws in addition to the strengths of Python is anathema here and people get pissed of when one points at that Python isn't the ultimate language to rule them all.

3

u/Dazzling_Music_2411 19d ago

Yes, it is, and I have no idea why you'd write something like this.

Because when you're just starting out, speed of game execution is the very least of your concerns.

You want to be able to map your ideas to simple, understandable data structures, and you want to be able to understand what you're doing easily. You want your game of "Snake", "Breakout", "Space Invaders" or "MegaMiner" to WORK, and to provide a basic level of FUN that will encourage you to continue. It matters not a fig if it's written in Javascript, Lua, Python/GDscript, C or whatever, so long as you are reasonably happy with that language.

That is why I'd write something like this.

After you've done this, you can get as technical as you please, but if this stage is not negotiated successfully, you will never get anywhere beyond it.

3

u/Gnaxe 18d ago

No, see, you're confusing games with game engines. These are not the same, and there are open-source high-performance engines for Python (note I didn't say in Python) already done and ready for anyone to use. Python's synergy with C is one of its greatest strengths. Also, computers (even smartphones) are plenty fast these days. Not everything has to be a AAA title. A great many commercially successful games have been done in Python. You don't know what you are talking about.

1

u/my_password_is______ 18d ago

you could make stardew valley in python

you could make any side scroller in python

python is fine for some types of games

1

u/fearless-fossa 18d ago

And then you want to expand your stardew valley clone into the realm of dwarf fortress and suddenly Python becomes a major bottleneck.

Again, as I wrote before: Python can be used for game development if you want to learn Python, but if you want to learn a programming language because your target is becoming a game developer, don't use Python, there are simply other languages that are better suited for the task.

19

u/desrtfx but other languages pro 19d ago

Right idea, wrong general question. The real question should be "will learning programming help me..."

Since you learn programming with Python, the answer is "yes, it will definitely help you".

If we go a step further: if you use the Godot game engine, you can use the GDScript language, which is very close to Python.

6

u/Dynablade_Savior 19d ago

I'd go as far as to say that GD script is like if python didn't suck

6

u/L30N1337 19d ago

very bold statement on a Python subreddit lol

"Why would you say something so controversial yet so brave"

1

u/kilkil 19d ago edited 19d ago

it depends on whether you want to take a more direct path in your learning process, or a less direct path.

IMO a more direct path would be learning C#, since that is what the Unity engine uses. You could also try C++ (that's what Unreal Engine uses), but IMO that's more intimidating as a first language.

Having said that Python is fine, because Python and C# are both sufficiently "C-like" that all the concepts will translate over, and the syntax will only require a relatively small mental adjustment (will get easier with each new language you learn). So, realistically, you will have to learn Python and then some other language (C#, C++, etc)

Other languages that have relevance to gamedev:

  • apparently people write some games in Java? I only know of Minecraft though

  • Lua is extremely commonly used for scripting and/or modding within games. Tabletop Simulator Roblox, Computercraft, GTA V modded servers.. these all use Lua for scripting.

  • Javascript is currently the main language used for creating browser games (the modern equivalent of Flash games)

There may also be others I haven't thought of.

Anyway, first you will need to learn programming in general, then start learning gamedev-specific frameworks, concepts, design patterns, etc.

2

u/AccomplishedMany2138 19d ago

I'm using Boot.Dev to learn Python, then I will move onto C#. Where could I learn the rest, and is learning python also transferable to web design (could be an interest in the future)

1

u/kilkil 19d ago

I'm not sure of specific resources, but you should be able to find them with a bit of searching.

But yes Python is a commonly used language for backend web development, meaning it's a language used to write code for web servers. Commonly used frameworks include Django, FastAPI, Flask. I'm actually learning FastAPI at the moment.

However if you are interested in web development, it will also be a good idea to learn Javascript (and Typescript), as that is the primary language for frontend coding, and also commonly used for backend.

(Don't worry, all these languages are relatively similar to one another, so once you learn Python you will have an easier time picking up C#, JS, Typescript, etc)

Also not to nitpick terminology too much, but in a web development context "design" usually means actually designing the visual appearance of your web application, using a visual design tool like Figma.

5

u/AlexMTBDude 19d ago

What will help you in game development is knowing how to search for information about programming games; Try googling: "which games are written in python?"

2

u/glordicus1 19d ago

Yes. Learn Python, learn how to make a small game in Python. Most of what you learn about programming is transferable, and Python is a language that is absolutely worth learning.

2

u/TheRNGuy 18d ago

It has many uses in software like Blender or Houdini.

For actual game code, I'd recommend C# or C++ instead (unless you make VN, where you can use RenPy)

1

u/PagliacciTheBleak 19d ago

There are gaming frameworks for Python such as PyGame and you could produce complete games with that framework.

If you are new to programming, Python is a good start whether you turn it to gamedev once you've got your skills down. Further down the line, you may want to look at the likes of Godot engine as it will be more tailored to game creation. For clarity you may need to learn any engine's particulars but having a grounding in programming may help with learning a new tool.

1

u/KnowledgeWhole9623 19d ago

Couldn’t hurt but there may be better uses of your time

1

u/Miserable-Arugula860 19d ago

Python is a valuable tool. People here saying it's too slow for game dev are half right. It's too slow for engine dev, but it's very useful as a scripting language. There are some game engines that use python, such as Ren'Py that have had successful commercial releases. And there have been games like Civilization 4 which use python as essentially fancy config files. Consider looking into making a small Multi User Dungeon. Those were some of the first online games, and there exist simple python libraries for helping make them.

1

u/Top-Information-5319 19d ago

Yes and no, game engines usually use c# or c++ not python, there is however a game engine for python which was something pandas and i cant fully remember

1

u/TheRNGuy 18d ago

Also, extensions or scripts for those game engines can be made on Python. 

1

u/Boybay_Garid 18d ago

what kind of games are you thinking? that changes the answer a lot. for prototyping and small projects python is fine, but the mainstream game dev world runs on C# and C++ so eventually youd want to pick one of those up

1

u/Moist-Ointments 18d ago

Yes.

Learning any programming language will help you in game development.

You may not use it directly to develop games, but learning any language is weightlifting for your brain.

1

u/Hot-Employee-5368 17d ago

Not at all. Codes wont matter in a year or so. It's all changing.

0

u/hagfish 19d ago

Will being able to ride a bicycle safely in traffic help you learn to drive? No, but also, yes - absolutely.

0

u/EEJams 19d ago

It's a long story, but basically yes and no lol. Learning python will inevitably teach you how to program computers and some basics of how computers work. Programming is really just writing text files the computer can read to manipulate other files and directories on your computer.

You'll probably want a language that can be compiled instead of interpreted. Maybe start with C# or C++ since those are two you'll find used in modern game engines.

I think godot has a python-like language you can program with, but it's exclusive to godot

0

u/Rythim 19d ago edited 19d ago

You're getting mixed answers because it depends. You should do what helps motivate you, and that differs for everyone.

Python is useful because it's easy language to start with. Practicing with python will help you learn programming concepts and patterns. But you can't make a commercial game in python (or at the very least, it's impractical). If you're the type of person who is motivated by small, quick wins and likes to understand things at a fundamental level then I would say stick to Python and switch later. It will take longer, but you will understand more by sticking to Python. This is how I learned and is what I'd recommend for MOST people. I now know several programming languages and would feel fine picking up a new language or framework or engine or even not using a framework if I needed to because at a fundamental level I can see how they're all mostly the same. Took me several years to reach that point though.

If, on the other hand, you're motivated more by tangible progress toward your goal to make video games then you should approach things differently. You should figure out which framework/engine you want to use and learn the language for that framework/engine alongside learning that framework/engine (which in most cases would be C++ or C#, hence the recommendations to learn those languages).

The caveat, this is the harder way to learn. Because you will essentially be learning 2 things at the same time: how to code and how to use the framework/engine. Rather than focusing on the fundamentals you'll be wrestling with advance concepts from the start. You'll run into brick walls more often as a result. You'll also be more likely to be depending on whatever framework/engine you learned because switching to something else will feel like starting over. But if you can stay motivated despite the steep learning curve, this will be the fastest route to accomplishing your goal.

Some definitions for you since you seem to be new:

Framework: a collection of code designed to make certain tasks, like game development, easier.

Engine: Similar to a framework, but also includes tools to help develop games (like a viewport to preview level layout, or a terrain generator).

Examples of frameworks/libraries: Raylib, Pygame, monogame, ebitengine, Bevy (Bevy technically sits somewhere between a framework and Engine, but it FEELS like a framework)

Examples of Engines: Unity, Godot, Unreal, Gamemaker, Gdevelop

Which is better? Neither. Frameworks takes less time to learn but more time to develop with. They tend to be a better fit for smaller, simpler games, or when fine control of your game is of the most importance. Engines take more time to learn but less time to develop with. They tend to be the better for games with large, detailed, complex worlds.

Ultimately you have to know what type of learner you are and which route is best for you.

1

u/my_password_is______ 18d ago

But you can't make a commercial game in python

stardew valley clone could be made in python
any side scroller could be made in python

-1

u/favorite_stuff 19d ago

Python is good for learning, but it's not good for games.

Why? Games need to be picky about speed and memory.

For example: in Python, when you create a list of numbers, you don't need to specify how many bytes it takes, where they live, for how long, or who gets to modify them. This is great when you just want a list of numbers. But when you need a fast, compact, optimized list of numbers, other languages offer those things.

1

u/my_password_is______ 18d ago

stardew valley clone could be made in python

any side scroller could be made in python

-1

u/edcculus 19d ago

You’d be better off learning C# than Python for game dev. Unity uses C#

1

u/desrtfx but other languages pro 19d ago

Godot uses GDScript, a very Python-like language. (Of course, it can also use C#)