How "slow" is python for game development?

I would like to try my hand at developing some PC games. I keep hearing that python is slow compared to C ++. Is this something I should worry about?

I am more familiar with python than C ++. If I'm looking for some games, should I spend time learning C ++ or just stick with Python?

+7
source share
5 answers

There is a difference in slow development and slow at runtime. Be careful not to be confused.

Many games spend most of their time waiting for user input or a waiting timer. In these cases, the execution speed usually does not matter much, and the development speed is more important - to put your game on the market as quickly and cheaply as possible and make the game as good as with your budget. High-level languages โ€‹โ€‹are an appropriate choice for this type of game.

For games that require high performance, the engine is usually written in C ++, but scripts can still be run in a high-level language. Python is not the only choice. Lua is probably the most popular choice for a scripting language in games.

+12
source

Elebenty-seven.

No, indeed, it is fast enough for most things and can fall in C when you really need speed. Profile twice, optimize once.

+5
source

The game is very important. High-performance games, such as computer or console games with a big name, are almost exclusively a C ++ domain.

Random games can be written in almost any language, including slower languages โ€‹โ€‹like Python.

If you are a garage type developer who gets his hands on simple game development for the first time, Python will be more than enough. If you want to work in a studio for game developers, I definitely recommend learning C ++.

+4
source

Many, if not the most popular commercial games these days, include some kind of scripting engine for the logic of the game. Logical decisions on logic, for the most part, are not particularly sensitive to performance in that, for example, a rendering engine.

BTW - I do not require any insider knowledge of game development - this is pretty well known outside the industry. Some game publishers have even allowed users access to scripting materials and other game modding tools โ€” for many years.

If you find a game engine that will be used for use in Python, you will be dealing with the same basic principles. Write the logic of the game in Python, and you'll probably be fine.

PyGame is basically an SDL wrapped for Python, supporting basic 2D games for the most part (although OpenGL can be used for 3D in SDL - not sure about PyGame).

This is a good starting point. You may run into a performance issue by managing your game objects and starting the blit loop, since only very simple graphic material is processed by SDL, but you should find that this is just great for most things.

As Ignacio implies, worry about performance issues when you know that you have performance issues, not before. Some performance issues are predictable in advance, but if you are not writing a true game engine in Python, you should be fine - don't fall into the trap of premature optimization, IOW.

+2
source

C ++ is much easier to orient objects. When you do something, itโ€™s easier to keep track of everything, because most C ++ IDEs are more project-based, since IDLE is more based on single files.

The bottom line is regarding the development of the game, use what is convenient for you to use. I mean, game development is what you want to do, and not what would be better, because itโ€™s better == what you want.

-4
source

All Articles