Pygame's Performance - What You Need to Know

  Рет қаралды 203,108

DaFluffyPotato

DaFluffyPotato

Күн бұрын

Пікірлер: 320
@DaFluffyPotato
@DaFluffyPotato 3 жыл бұрын
All gameplay footage shown in the background is from my own games. They're all open source (at least the ones that are released projects): dafluffypotato.itch.io/ For those of you who are saying I’m wrong about SDL. Read the docs for the update from 1 to 2. It *says* it added hardware acceleration. SDL2 is very different from the SDL Pygame originally used (and I mentioned that in the video). SDL2 adds hardware acceleration and Pygame 2 will give access to that functionality. Pygame was created in 2000 and the development stalled for a long period of time, so it was never updated to use SDL2. Pygame 2 is a huge improvement over 1.9.x.
@Pridetoons
@Pridetoons 2 жыл бұрын
My main concern is Android development. Can you develop Android games with Pygame?
@mayhemx0119
@mayhemx0119 2 жыл бұрын
Hello just wanted to say hi and I plan to be a developer for python just starting out tho glad I find this good info
@petrmachcz
@petrmachcz 7 ай бұрын
​@@Pridetoons yes, with pydroid 3
@Geofinnstar
@Geofinnstar 3 жыл бұрын
Description: Many people say that Pygame is slow. Is it really? First Few Seconds: People say the Pygame is slow, *and that's because it is*
@eboatwright_
@eboatwright_ 3 жыл бұрын
yeah XD
@eqqx1108
@eqqx1108 3 жыл бұрын
It is, but not as much people think. Did you even listen?
@howtofree519
@howtofree519 3 жыл бұрын
@@eqqx1108 meh man, he was just trying to make a good funny comment lol
@eqqx1108
@eqqx1108 3 жыл бұрын
@@howtofree519 mmm yes, but no
@soupnoodles
@soupnoodles 3 жыл бұрын
@@eqqx1108 ikr
@badjano
@badjano 3 жыл бұрын
Small tip for pygame performance is to prerender images, if you´re drawing shapes and lines, draw it on a surface on load and then paint that surface on screen every frame, it will be a lot faster then drawing lines every frame... this is only for the case the lines aren´t moving relative to one another, because if not, it won´t make much sense to do that
@nathanlamaire
@nathanlamaire 3 жыл бұрын
A lot of programmers don't know about this, which is ironic since even the old days of game programming this technique is heavily used for optimisation since Assembly alone did not help.
@badjano
@badjano 3 жыл бұрын
@@nathanlamaire Yeah, I thought "baking" was a pretty well known process, but it´s not common to see people using it more often. It´s amazing how much you can precalculate using only textures in a shader
@oscartriano7262
@oscartriano7262 2 жыл бұрын
precache everything, use memory pools. Don't create or destroy objects in your game loop because that run the garbage collection.
@Milkymalk
@Milkymalk 2 жыл бұрын
@@oscartriano7262 Could you explain the concept briefly? Let's assume I have an enemy that shoots stuff at the player; how would I not create a new bullet object every time he shoots and destroy that object when it hits something?
@oscartriano5976
@oscartriano5976 2 жыл бұрын
@@Milkymalk Use flags, like "used" so if a bullet collides with an enemy or something set its flag to "false". Here you dont destroy or create an object, just reuse them.
@Orionhart
@Orionhart 3 жыл бұрын
You may not have heard of it, but there was a game engine developed using Python called Zero Engine, which was a proprietary engine used and created by DigiPen Institute of Technology whom I worked for and went to tech classes at. It was pretty alright. I don't remember too much, and I believe it was either discontinued or is simply no longer in use as many of the classes teach Unity instead.
@prometheus9096
@prometheus9096 2 жыл бұрын
Cython is also perfect to optimize your games, :) and it's wonderfully easy. Cython translates your Python code to C. For a beginner it is as easy as just compile a pure python file with Cython. This alone can increase your execution speed by 2 - 5 times! You can then start to slowly add C-Types and functions. Cython in fact is so good that it beat most code written directly in C, at least if you are just an average programmer.
@ralfwright
@ralfwright 2 жыл бұрын
Please explain? How can python code (but translated to C) beat C itself? Shouldn't the language itself always run faster than when it is being translated to from another language, or at least run the same because they are translating to the same thing?
@prometheus9096
@prometheus9096 2 жыл бұрын
@@ralfwright C itself dose run faster. Please read the sentence as is: Cython in fact is so good that it beat most code written directly in C, *at least if you are just an average programmer* C just don't magically runs fast if you write a mess of a code and writing good C code is very hard. Most average programmers might see that their Cython--Code runs faster than their C code. However a skilled C programmer will write faster code than Cython.
@javadkazemi5063
@javadkazemi5063 2 жыл бұрын
@@ralfwright not an expert on this, but i think i know what's up. compilers are pretty smart these days and here we are talking about average programmers. an average programmer might not be able to write a highly efficient c code, but he can write a pretty good python code. the compiler on the other hand is designed to translate that python code to a c code in the most efficient way, so at the end the translated code might be better than a c code written by an average programmer.
@pranavnyavanandi9710
@pranavnyavanandi9710 2 жыл бұрын
What do you mean by slowly adding c types and functions?
@Noober666
@Noober666 4 ай бұрын
I have a massive pygame that I want to rewrite into cyphon it’s gonna take so long 😭
@superscatboy
@superscatboy 3 жыл бұрын
Thanks for shouting out PyMunk! Chipmunk is an amazing little physics engine and really deserves more love.
@luisernestodeltoropena6606
@luisernestodeltoropena6606 3 жыл бұрын
A nice and informative video. Just to add some more, there are a lot of ways to increase speed of python code, like using numpy for heavy array and matrix calculations, writing your own C extensions, using another python implementation like PyPy or mixing your code with language extensions like Cython.
@DaFluffyPotato
@DaFluffyPotato 3 жыл бұрын
Python compilers don’t help much with Pygame. It’s usually only useful if you’re writing a ton of calculations in Python.
@luisernestodeltoropena6606
@luisernestodeltoropena6606 3 жыл бұрын
Indeed, I should have clarified that, PyPy only speeds up pure python code.
@dicember92
@dicember92 3 жыл бұрын
Thank you, this argument has been a pain since the beginning, even tho, for the moment, I’ve never had performance issue with pygame (always converted image and avoided to write useless code)
@Beeftitan
@Beeftitan 3 жыл бұрын
when you say convert image do you mean just the sprites or are you converting the surface and rendering with opengl?
@dicember92
@dicember92 3 жыл бұрын
@@Beeftitan I meant the sprites. I never made big projects with thousands of rects, so I never had the necessity to look for other optimization methods :)
@luisangel-zt8op
@luisangel-zt8op 3 жыл бұрын
Just discovered this channel and im already a big fan of it.
@PerryBattles
@PerryBattles 3 жыл бұрын
You have some of the most awesome videos on game dev. It's awesome you've been able to monetize your products as well.
@snesmocha
@snesmocha 3 жыл бұрын
since i started working on shader work, i moved to godot, but i'll always have a special place with learning pygame as it taught me all the basics of programming
@Moon-wn5rm
@Moon-wn5rm 3 жыл бұрын
Big fan of your content. Do you plan on making more in depth pygame tutorials in the future and advice to beginner programmers?
@DaFluffyPotato
@DaFluffyPotato 3 жыл бұрын
Yeah. Just been super busy lately.
@unanimous4367
@unanimous4367 3 жыл бұрын
@@DaFluffyPotato i'd bet, making a third game is challenging!
@corelysium2139
@corelysium2139 3 жыл бұрын
Honestly. PyGame for 2D games is perfectly fine in terms of speed although I would say that a language that desperately needs more libraries or docs for existing libraries is the nim programming language. It manages to get that beginner friendly rapid code development down, while still being a fairly high performance statically typed language and yes I am a little biased, cause it is similar to Pascal mixed with Python. Bite me for likeing Pascal I guess XD. SDL2 does already have a wrapper in nim for those who are wondering.
@CDcodes
@CDcodes 3 жыл бұрын
I always enjoy these discussion vids from you
@TheHungarygamer
@TheHungarygamer 3 жыл бұрын
with my optimized tile system when i stress test, i can load around 1.3k individual tiles with around 70 fps i guess i have to check out your video on the particle system
@TheHungarygamer
@TheHungarygamer 3 жыл бұрын
im stupid, i can use the same for particles because smaller areas are way faster to load i have no trouble rendering 10k of them if they are small enough
@ZgavY
@ZgavY 2 жыл бұрын
what optimizations? I made no optimization to my game, didn't even implement a chunk system, and my friend was getting 240fps with vsync on and 400 with vsync off, while playing a level with thousands of objects. Were those 1.3K tiles in the same area, on the screen? Or was it like a normal level with around 1.3k tiles?
@simonjakobs6969
@simonjakobs6969 2 жыл бұрын
@@ZgavY how do you do that? with the gpu?
@ZgavY
@ZgavY 2 жыл бұрын
@@simonjakobs6969 what do you mean?
@simonjakobs6969
@simonjakobs6969 2 жыл бұрын
@@ZgavY how do you get that many fps, do you enabled opengl or something
@jfklittle
@jfklittle 3 жыл бұрын
6:11 Randy: I'm gonna pretend like I didn't see that...
@l5248
@l5248 3 жыл бұрын
Meh, pygame's faster than the Javascript 2D canvas API at least.
@alexander0296
@alexander0296 3 жыл бұрын
It's really not, the Canvas2D is insanely optimised + js is faster than python
@raianmr2843
@raianmr2843 3 жыл бұрын
That's not true at all lol, aside from the obvious fact that tons of large corporations actively fund and contribute to the JS ecosystem, it has enjoyed being the only language for frontend for quite some time. Also, most people using JS are benefitting from JIT compilation but most people using python are not. All these things add up and this is just sad because Python is clearly the more elegant language.
@l5248
@l5248 3 жыл бұрын
@@raianmr2843 Hmm. I thought pygame would be faster even though python doesn't have JIT because pygame's backbone SDL is written in C. To be honest, I don't know much about python nor SDL though. Faster WebGL libraries and frameworks like Three.js and PIXI.js are always the talk of the town in the Javascript world, but maybe Canvas2D is faster than most people will give it credit for. It's performance has actually seemed to improve over the years, I can tell you that much.
@NathanFranckGameDev
@NathanFranckGameDev 3 жыл бұрын
@@l5248 Oh yah canvas 2d is fast, I mean essentially javascript is calling out to chrome methods written in c++ and displayed using the gpu, so rendering would be at least equal to sdl and given javascript is better optimized at runtime, the whole system should be faster on the whole compared to pygame
@oukid2633
@oukid2633 3 жыл бұрын
@raianmr how is python a clearly more elegant language? JavaScript is based on lisp which is functional language. While python is inheritantly oop.
@stickzman
@stickzman 3 жыл бұрын
Your pixel art and animations look great!
@Gabryx_
@Gabryx_ 3 жыл бұрын
2:49 yes, it does, so you shouldn't say "SDL Makes Pygame Slow" when in reality pygame just couldn't figure out how to implement hardware acceleration fully after 8 years of SDL2 existing
@DaFluffyPotato
@DaFluffyPotato 3 жыл бұрын
Pay attention to the very next sentence. It’s being implemented right now. Pygame was made in 2000 long before SDL2 was released and the development nearly stalled for an entire decade before getting picked back up in ~2018 or so.
@Gabryx_
@Gabryx_ 3 жыл бұрын
@@DaFluffyPotato I know, the problem itself was that pygame didn't implment SDL2 before
@dawndev2740
@dawndev2740 3 жыл бұрын
Great video!! You really show off its full potential!
@manas6340
@manas6340 3 жыл бұрын
Good video and explanation, thank you!
@UnidayStudio
@UnidayStudio 3 жыл бұрын
Amazing video, as always! At 8:35, UPBGE (basically blender game engine) is a 3D game engine that uses python. I'm also writting my own free engine (Cave Engine) in C++, but scriptable in python.
@broor
@broor 3 жыл бұрын
Hi. Im working on a pixel art pygame game. I usually load images, scale them up, store them in variables that i assign to other variables every frame, and then blit them all onto the screen and update it every frame, and i dont convert them because that makes them opaque. Now i wonder if i should maybe store them downscaled and draw them onto a surface and then scale that surface up and blit it onto the screen instead? (also makes it pixel perfect pog) I love this channel btw
@DaFluffyPotato
@DaFluffyPotato 3 жыл бұрын
Use convert_alpha().
@Sebastian-42-69
@Sebastian-42-69 3 жыл бұрын
Oh man thanks so much for the help information! It's so useful for the python game I'm currently working on.
@RH_Guitar
@RH_Guitar 2 жыл бұрын
Super informative! Thank you for your videos! 😁
@sebastianwojciechowski1576
@sebastianwojciechowski1576 3 жыл бұрын
I was wondering how have you done it that, the borders of images don't turn semi-transparent while rotating on such low resolutions. Could you explain it?
@agcummings11
@agcummings11 3 жыл бұрын
Not 100% sure but look up disabling anti aliasing
@debrikislaw
@debrikislaw 3 жыл бұрын
very helpfull video, thank you
@thecombatcactus4254
@thecombatcactus4254 8 ай бұрын
Pretty much answered all my questions. Excellent
@theorozier
@theorozier 3 жыл бұрын
Just a side note, Wargaming is using Python in many part of their games (World of tanks) and this runs pretty well (even if the API is awful).
@Mupersega
@Mupersega 3 жыл бұрын
Been a day and still waiting for your potato boiling simulator 2021..
@slimmello6516
@slimmello6516 3 жыл бұрын
I really love your videos and beginners tutorials and I want to good at pygame like you. Keep going sir. 😁
@monohero231
@monohero231 3 жыл бұрын
Yay i can make my potato boiling simulator 2021, thanks!!
@karmdesigns9368
@karmdesigns9368 Ай бұрын
Did you later make this?
@Caldera510
@Caldera510 3 жыл бұрын
Software engineer here...I dig it. To be honest, a lot of people blame languages or paradigms for a lot the issues associated with crap code. Subbed.
@demiansims728
@demiansims728 Жыл бұрын
Or crap concepts. And who the hell is going to learn C++ for casual/hobby game building?
@ЭнрикеЧурин
@ЭнрикеЧурин 3 жыл бұрын
Have been watching you for ages. Now I actually switched from pygame/python to cpp/sdl cos yes.
@benrex777productions9
@benrex777productions9 3 жыл бұрын
Thanks. I'm currently working on a pygame game. As a beginner I prioritize my learning experience over an efficient game. I haven't had any performance issues so far even though I didn't put the .convert() behind the load image. I changed that.
@thinkingspace3438
@thinkingspace3438 Жыл бұрын
no .convert() ? then try on ur mom's pc xD
@benrex777productions9
@benrex777productions9 Жыл бұрын
@@thinkingspace3438 By now I do have performance problems. At least when I call my perlin noise generators for the clouds too often, aka when the wind is too fast and the clouds fly by. Is there a more efficient way than using the noise.pnoise2?
@thinkingspace3438
@thinkingspace3438 Жыл бұрын
@@benrex777productions9 so yea if your issue is not about rendering try to use multiprocessing or something directly written in c maybe ?
@benrex777productions9
@benrex777productions9 Жыл бұрын
​@@thinkingspace3438 I have this as a casual project and I like to do things in low effort. I'm aware that pygame is not the product to do high performance games and if I don't find a solution I will just do workarounds or less resource hungry game features. With that in mind how do you do multiprocessing in python? Also do you mean writing a few lines in c-code which get imported as some form of library into my pygame game?
@thinkingspace3438
@thinkingspace3438 Жыл бұрын
@@benrex777productions9 the multiprocessing lib allows you to make processes (kinda like threads but they are really executed at the same time), and the ctypes lib allows for using functions written in C
@skaruts
@skaruts 3 жыл бұрын
Well, there is one game genre that I'm not convinced you can do efficiently in any language other than the most speedy ones (C/C++, Rust, Nim, etc), and that is *falling sand games* (stuff like Powder Game or Noita). I would like to be proven wrong though. I don't like static typing...
@Bruh-hd4rj
@Bruh-hd4rj 2 жыл бұрын
You can If you have a NASA computer in your basement
@yames_games
@yames_games 3 жыл бұрын
Very informative, thank you
@RaghunathTambde
@RaghunathTambde 6 ай бұрын
Very informative video thank you from the heart ❤️
@debek818
@debek818 Жыл бұрын
thank you so much for this video
@artcadedev
@artcadedev 3 жыл бұрын
Love your content, what’s the editor, theme and font used in 2:55 ?
@mynameupdatesannually
@mynameupdatesannually 3 жыл бұрын
That's not an editor, that's just GitHub
@gwentarinokripperinolkjdsf683
@gwentarinokripperinolkjdsf683 3 жыл бұрын
Game logic can get heavy, but it's really not normal in most games, typically thing like many entities path finding and shit like that.
@EgoCheap
@EgoCheap 2 жыл бұрын
Thank you for this video.
@warrenhenning8064
@warrenhenning8064 3 жыл бұрын
Worrying about whether your tools are going to eventually give you performance problems and researching potential performance issues is a satisfying alternative to doing the much, much harder work of designing and building a fun game. If you have a demo of a fun platformer but some SDL FFI issue is affecting framerates, it would be more straightforward to port that to C++ and eliminate the issue than to have a super efficient game engine but no game and have to design a fun, original platformer that feels really good to play.
@ark5458
@ark5458 3 жыл бұрын
Hi, i've been trying out pygame for a while now, but i find raw coding everything really tedious, is there a wrapper or a makeover over pygame that makes it moreeasier to code in
@DaFluffyPotato
@DaFluffyPotato 3 жыл бұрын
It really just depends on how you think about things imo. I find Pygame fits my thought process well and adding features is very low effort. Arcade may be worth a shot if Pygame feels tedious.
@saadusmani78
@saadusmani78 2 жыл бұрын
I found you through this video, so this video did get the traffic you expected
@flamendless
@flamendless 3 жыл бұрын
I dont think sdl is the issue why pygame is slow. I mean, löve (and alot of steam games) also uses sdl but it's not slow. Perhaps it's python + the way it was written using sdl
@LucasBenninger
@LucasBenninger 3 жыл бұрын
Yeah he says sdl2 has hardware acceleration but it's not fully implemented in pygame2. Which is pygames fault not sdl2 being slow.
@sempersolus5511
@sempersolus5511 2 жыл бұрын
Please do more videos about this, because my project is stupid ambitious and I don't want to learn Lua. Also--I'm not quite sure how to say this, but--you don't _sound_ like a fluffy potato, somehow. Have you considered changing your name to "DaPotatoStraw"?
@samdavepollard
@samdavepollard 8 ай бұрын
i've dabbled in raylib/sfml/sdl using c++ and have to say that for me, pygame is the perfect place to start if only because setup is just so darned simple; a beginner can get any number of quick easy wins under their belt (which is a great motivator to keep going) compared to the torture chamber that is the tooling and build system of c++ sure, later on, if you want a bazillion aliens and particle systems etc, needing to squeeze out every drop of performance then, maybe - maybe - go c++ but get the basics down first with pygame/python would be my advice
@b3ast1234567890
@b3ast1234567890 6 ай бұрын
If i write .convert() behind the image file like in 5:30 in this video, it doesn´t work in my game. Is this because I use python 3 or is there a problem with this specific file? Somewhere I read that there is a problem with 32 Bit Images. The Datatype is PNG.
@selo2410
@selo2410 3 жыл бұрын
Hey man, just wanted to ask, what makes you choose the Python IDLE over Atom for your projects?
@imaginaoYouTubesoquecomarrobas
@imaginaoYouTubesoquecomarrobas 3 жыл бұрын
iirc the main use case he once talked about was to avoid autocomplete and autodebug sometimes because they are tools that, although they can make you faster when you know what you're doing, they aren't as helpful when you're trying to learn from your mistakes and expand your knowledge on something like, for example, a Python library you've never used. And I suspect it helps that you already get the IDLE once you've just setup Python. However, I think he mostly uses VS Code as of right now.
@adye88
@adye88 Ай бұрын
greetings from the future. Thank you for aiding my research.
@pencilgame
@pencilgame 3 жыл бұрын
@DaFluffyPotato Curious what your thoughts on Pyglet are? How you feel it compares, etc.
@undofix
@undofix 3 жыл бұрын
SDL is cool for its simplicity but it's strange to see this library in use for something other than just create context for the OpenGL, the Vulcan, etc. It is more designed to process input and work with audio. P.S. I meant that pygame is great but I think pure SDL was not the best idea to make such game libraries.
@dimitribobkov-rolandez5729
@dimitribobkov-rolandez5729 3 жыл бұрын
Nowadays, SDL2 is used for windowing and input for games (if you're willing to write the renderer in OpenGL or Vulkan), but I've seen people use SDL2 functions (which are usually just OpenGL calls) for things like game jams.
@cpK054L
@cpK054L 3 жыл бұрын
To compare Python to C in terms of yelling at your subordinates C/C++ will get straight to the point about why you are getting yelled at Python will include a lot of unnecessary details and mistakes you did some other day that you forgot you did. Hence the performance issue.
@alexale5488
@alexale5488 11 ай бұрын
And at the end of the day, Python comforts me and gives me a hug.
@demiansims728
@demiansims728 Жыл бұрын
Is there anything similar for Ruby or JS? Obviously with JS you have the browser but are there and Pygame equivalents?
@robertoaguilera8290
@robertoaguilera8290 3 жыл бұрын
How about love2d and Lua? What are the advantages and disadvantages over pygame?
@herre3147
@herre3147 3 жыл бұрын
From my own experience, love2d is a lot faster, and it just feels more modern imo. You can also write shader code and pretty easily pack the game into an exe (it uses a system where it basically packages your love2d project together with love2d)
@jishusingh8361
@jishusingh8361 2 жыл бұрын
Very informative.
@Beeftitan
@Beeftitan 3 жыл бұрын
Curious as to why you are using pygame, and what appears to be pygame1 without using any Opengl rendering. I hear pyglet has faster framerate without really changing anything. Also pygame can render opengl which allows you to offload atleast updating the screen which id assume would be a performance gain. You have pygame create a headless surface essentially and then have opengl render. The issue I am having is framerate drops pretty quickly when the camera needs to move, or when the scenes get large. I know you implemented a chunk system, but im just curious as to why you are sticking with pygame 1 and without pyopengl
@DaFluffyPotato
@DaFluffyPotato 3 жыл бұрын
Rendering stuff with OpenGL takes more code. I can develop quicker with raw Pygame and performance is almost never an issue for me.
@ekrem_dincel
@ekrem_dincel 3 жыл бұрын
Pyglet is both faster and better at rendering btw.
@Nakameguro97
@Nakameguro97 2 ай бұрын
How do you release commercial pygame products when your code is essentially open-source (scripted python code)?
@DaFluffyPotato
@DaFluffyPotato 2 ай бұрын
You can decompile most Unity games. That's not an issue. There are workarounds if you want to hide it, but it doesn't matter.
@TowelPanel1852
@TowelPanel1852 3 жыл бұрын
Got this in my recommended, interesting vid
@xeschire706
@xeschire706 4 ай бұрын
What about pygame community edition(CE)?
@prietjepruck
@prietjepruck 9 ай бұрын
Want speed and easy of use doing graphics? Use Processing. Great integrated IDE, amazing speed.
@robotpainter7159
@robotpainter7159 2 жыл бұрын
Hi I am pretty newbie at python, i use 3d maya for 20 years i am newbie there too.. You say 3d + shaders not used very well in python.. OK i belive that. Pls explain to me that why all of the 3d programs post production softwares (long list belive me i wont start), integrated python at the first place and made it into a common universal language?
@hossumquat
@hossumquat 3 жыл бұрын
Hey, I have a question you might know the answer to. I'm wondering if there is a python library that has an API very similar to pygame.Surface but instead of drawing in 2d mode will draw in OpenGL mode instead. I am thinking of writing such a library if one does not yet exist. Making a 2d game using 3d mode had many advantages over 2d. I haven't been able to find such a library in my research but I thought I'd ask to see if maybe with your wider experience you knew of any I've missed. Thanks in advance!
@ekrem_dincel
@ekrem_dincel 3 жыл бұрын
Pyglet maybe?
@hossumquat
@hossumquat 3 жыл бұрын
@@ekrem_dincel Not really, no. Pyglet seems to be an alternative to pygame. What I'm thinking is more an extension of pygame. Pygame (and the SDL it is built on) really is great, with 3d really being the only weak part of it. Going full OpenGL though, you lose the simplicity that pygame has with doing things. A big part of what makes pygame successful is how easy it is to use.
@ekrem_dincel
@ekrem_dincel 3 жыл бұрын
@@hossumquat I don't understand what is the problem with pyglet, you wanted a 3D OpenGL rendering for your 2D game and pyglet does that.
@hossumquat
@hossumquat 3 жыл бұрын
@@ekrem_dincel There is nothing wrong with pyglet. It just isn't what I have in mind here. It takes a different approach to doing things than using pygame does, and I'm looking to keep the pygame way of doing things. For myself personally, I prefer having control over the main loop instead of using a callback system.
@ekrem_dincel
@ekrem_dincel 3 жыл бұрын
@@hossumquat you can write your own game loop in pyglet. Pyglet supports that and even have a doc page on that. But writing your own loop in pyglet is mostly pointless because not only that it allows you to query any user input or schedule any function, the default game loop of pyglet is heavily optimized for multiple OSes specifically. As a person that used both pygame and pyglet I encourage you to try using pyglet, you seem like you don't really know it and it is not hard to use even though the default way of handling things is not very similar to pygame.
@reengineer2497
@reengineer2497 3 жыл бұрын
found this video on recommendations btw
@starfaxmc
@starfaxmc 29 күн бұрын
.convert() made my game ( a simple Pong, my first game with pygame ) go from ~70 fps to 1200+ ( that's a lot ), thank you so much
@mastermike666
@mastermike666 2 жыл бұрын
perfect i was looking for something like this, and with new python searches it found me a bit
@ezloomi
@ezloomi 3 жыл бұрын
How did you start and practice python and pygame
@bini420
@bini420 3 жыл бұрын
how do you recommend I start learning Python? I know the basics of python and made a register/login system with no encryption but I don't know how I should go further from here. I don't have a clear goal in mind other than I want to be able to make software and games with python.
@imaginaoYouTubesoquecomarrobas
@imaginaoYouTubesoquecomarrobas 3 жыл бұрын
If you wanna start learning Pygame, just straight up learn how to mess with libraries and start reading Pygame's docs. You'll probably want to watch some video tutorials, at least for knowing how to create a simple blank window and how to display some graphics. But once you get a general idea of how it works, the Pygame docs can serve you as a great handbook for helping you with the library's functions. I'd recommend to start by thinking of a not that difficult game to make and just find out how you'll do it. For example, I'm planning on making a Pong clone.
@yamin2000
@yamin2000 3 жыл бұрын
does solving interview questions make you better programmer or building games make u better ?(noob i could not solve easy questions )
@DaFluffyPotato
@DaFluffyPotato 3 жыл бұрын
Interview questions will get you a job. Making games is a better problem solving experience imo. You will very rarely use those concepts from interview questions in normal jobs.
@bueno_excelente
@bueno_excelente 2 жыл бұрын
Using Cython, pySDL2 and pyOpenGL can lead to unexpected performance
@rare5x
@rare5x 3 жыл бұрын
Please reply if you see this, would you recommend using VERY low resolution images, scaled up instead of regular low res images (does this make a big difference to performance?)
@luciusoflegend
@luciusoflegend Жыл бұрын
I'm curious about your decision to use Pygame over an engine for you commercial titles. What are the advantages when compared with an engine like Godot, which uses a similar language for scripting? I'm planning to make a game with Zig and OpenGL, to get a solid understanding of low level systems, but I would work with a game engine if I were going to sell something. I'm not trying to give advice, because I have a 2.2/34 experience level (don't ask). I'm just looking to learn more :)
@DaFluffyPotato
@DaFluffyPotato Жыл бұрын
It depends on what you're doing. Engines are slightly less flexible, but frameworks/libraries require you to write boilerplate and some systems. I use it because I have my own framework on top of Pygame that's more efficient to develop with than an engine (for the types of games I make).
@luciusoflegend
@luciusoflegend Жыл бұрын
That makes sense. Thanks for the reply :D
@almond5560
@almond5560 3 жыл бұрын
For 3d rendering, as long as it is not high definition, why not let numpy handle the 3d object image color information and flatten it before displaying it on the screen? Would that performance still be slow?
@agcummings11
@agcummings11 3 жыл бұрын
Yes, modern games do conversions from 3D objects to 2D raster in GPU. Numpy will be faster than straight up python, but it still runs on CPU in most cases (see CuPy, basically identical to numpy and runs on GPU)
@almond5560
@almond5560 3 жыл бұрын
@@agcummings11 yes I get that the performance would be better by using GPU. But my point was: as long as it is pixel art like his games, would numpy with CPU still deliver to display "3D" images with acceptable FPS?
@xsupremeyx9923
@xsupremeyx9923 Жыл бұрын
So my main problem is dealing with classes while learning sfml, it never gets to my head when i see tutorials using them I was able to make sense of what to do with classes in python while learning pygame somewhat but not in c++. But at a point my potato pc wasn't able to handle my "copied" mario game from yt tutorials so i thought it might be good to switch to c++ and now apparently i need visual studio in order to set things up easily, especially classes and that visual studio is too much hard on the memory, that i started getting memory issues while running programs. Should i switch back to pygame since I'm accustomed to python alot more Or do i go for language like Lua and pair it with Löve
@blackholesun4942
@blackholesun4942 8 ай бұрын
What did you end up doing?
@ninjarunner
@ninjarunner 3 жыл бұрын
I'm just using pygame as a graphics library to make an app right now rather than to make a game so performance isn't really a major issue for me thankfully
@riyamandal7667
@riyamandal7667 3 жыл бұрын
What do you use to draw the sprites?
@zyugyzarc
@zyugyzarc 3 жыл бұрын
8:48 where upbge
@renatocesar9972
@renatocesar9972 3 жыл бұрын
Thanks for this video. I was watting for it. Last week I implemented image particles (particles generated with image as the particle) and i can't get 60 fps. Sure that i have bad code on it, and needs to improve. If someone have any kind of hint int this aspect, I'm accepting. Thanks
@avidrucker
@avidrucker 2 жыл бұрын
Do you have some code available somewhere to inspect?
@HanProgramer
@HanProgramer 3 жыл бұрын
You can use python with godot too
@Djellowman
@Djellowman Жыл бұрын
Curious what you mean when you say that dictionaries are often the solution to performance issues. Do you have an example?
@DaFluffyPotato
@DaFluffyPotato Жыл бұрын
It's the nature of the data structure. It makes a bunch of stuff O(1) runtime.
@Djellowman
@Djellowman Жыл бұрын
@@DaFluffyPotato yes i understand that. but don't you usually want to access everything in a container anyway?
@Djellowman
@Djellowman Жыл бұрын
let's say you have a list of objects, and you want to check if they collide. wouldn't you just loop over every single object? i guess if you have to a build a graph of some sort, you'll want to use dictionaries to keep track of interactions?
@Djellowman
@Djellowman Жыл бұрын
i'm guessing using lookup tables also isn't that common in videogames
@prostoopid
@prostoopid 3 жыл бұрын
amazing
@matthewsharp1178
@matthewsharp1178 3 жыл бұрын
4:10 oh my god that code seriously temps me to end it all now
@user-sl6gn1ss8p
@user-sl6gn1ss8p 3 жыл бұрын
Does anyone know what kind of cpu/memory is required for Wandering Soul? Like, a ballpark estimate at least?
@DaFluffyPotato
@DaFluffyPotato 3 жыл бұрын
Anything works pretty much
@user-sl6gn1ss8p
@user-sl6gn1ss8p 3 жыл бұрын
@@DaFluffyPotato oh, nice, I'm going to try it out then. Thanks for the reply : )
@megaing1322
@megaing1322 3 жыл бұрын
I successfully used `numba.cuda` to implement shaders and 3d rendering without using another language. You can use just use (mostly pythonic) code and run at a few hundred FPS with a full screen shader when your GPU is good enough. (More if SDL and pygame would do a better job at exposing the GPU side buffers).
@DaFluffyPotato
@DaFluffyPotato 3 жыл бұрын
I said that it shouldn’t be done with Pygame, not that it shouldn’t be done with Python. I mentioned multiple ways you can work on 3D games with shaders (such as Ursina) in the video.
@megaing1322
@megaing1322 3 жыл бұрын
@@DaFluffyPotato Oh, I don't disagree. I am saying that you can use pygame as the core and easily do the performance critical parts (like shaders or 3d rendering) also in 'Python' while still using pygame.
@vinren1041
@vinren1041 3 жыл бұрын
6:43 Potato boiling simulator 2021. Hahaha it made me laugh so hard
@bhangrafan4480
@bhangrafan4480 2 жыл бұрын
I just wrote my first game in pygame and the only problem I have is that the keyboard scanning for player input seems extremely slow. it is like having 'sticky' keys.
@leobozkir5425
@leobozkir5425 2 жыл бұрын
Can you share the code?
@thinkingspace3438
@thinkingspace3438 Жыл бұрын
1- be sure to collect the inputs correctly, there's a key pressed event and a key unleashed event 2- don't tick the line that gets the inputs, it's a newb mistake
@Kyu-us6xu
@Kyu-us6xu 2 жыл бұрын
1:12 guys what game is this i can't find out
@DaFluffyPotato
@DaFluffyPotato 2 жыл бұрын
It’s a game I’m working on
@MacronLacrom
@MacronLacrom 7 күн бұрын
1) Pygame graphics use the CPU instead of the GPU because its SDL (PC's with weak GPU) 2) People don't write fast code so the games they make are slow
@golevka
@golevka 3 жыл бұрын
Let's get this guy a motherfucking silver play button
@neito7103
@neito7103 3 жыл бұрын
Is pygame powerful enough to make a Sonic CD Remake.
@ArguetaLab
@ArguetaLab 3 жыл бұрын
Do you have any tutorials of pymunk?
@DaFluffyPotato
@DaFluffyPotato 3 жыл бұрын
Nope. I don’t know it well enough to do that at the moment. The documentation will do the trick though
@ArguetaLab
@ArguetaLab 3 жыл бұрын
@@DaFluffyPotato ok! Thank you! I am having fun watching your videos 😁
@dhdhdudshdhd1041
@dhdhdudshdhd1041 Жыл бұрын
Is there a game engine made in pygame? And if there isn’t, why not?
@pissmilker2313
@pissmilker2313 3 жыл бұрын
Pygame is slow but at the point you reach its limits your scope might be more suitable for for a native language anyways.
@jxmmybeats8130
@jxmmybeats8130 3 жыл бұрын
Can you use pygame to make iOS and Android app ??
@thinkingspace3438
@thinkingspace3438 Жыл бұрын
for android yes
@bhangrafan4480
@bhangrafan4480 2 жыл бұрын
C++ and C are compiled languages, but python is interpreted, surely this affects its speed? I'm no expert, I don't really understand why once source code has been written in a Python interpreter, where it is easy to test, it can't be put through a 'Python Compiler' to create a high speed executable file.
@IPlayWithFire135
@IPlayWithFire135 2 жыл бұрын
Isn't that basically what happens when you have the final product? You make an executable file.
@bhangrafan4480
@bhangrafan4480 2 жыл бұрын
@@IPlayWithFire135 Hi, that's what I'm trying to find out, because in the past (I'm old) interpreted languages were translated into machine code at run time. (I've been out of computing for a while, I'm trying to do a bit again) There is also an issue of portability I am trying to find out about. C executable files were portable, because they were in machine readable instructions so the computer did not need to 'know' the language. Thanks.
@holthuizenoemoet591
@holthuizenoemoet591 Жыл бұрын
Python 3.11 and future versions are also getting faster
@levioptionallastname6749
@levioptionallastname6749 3 жыл бұрын
you are making me want to try some python.
@blmb4274
@blmb4274 3 жыл бұрын
I think they referenced it with c++ it can go as high as 5000 fps
@randomviralshorts1501
@randomviralshorts1501 3 жыл бұрын
I learned C# and Unity because of this
Free Gamedev Tools I Use
9:00
DaFluffyPotato
Рет қаралды 181 М.
How to ACTUALLY get into Gamedev
14:01
DaFluffyPotato
Рет қаралды 725 М.
when you have plan B 😂
00:11
Andrey Grechka
Рет қаралды 64 МЛН
Girl, dig gently, or it will leak out soon.#funny #cute #comedy
00:17
Funny daughter's daily life
Рет қаралды 63 МЛН
25 nooby Python habits you need to ditch
9:12
mCoding
Рет қаралды 1,8 МЛН
When Python is too Slow for my Steam Game
5:30
DaFluffyPotato
Рет қаралды 42 М.
I made Games with Python for 10 Years...
28:52
DaFluffyPotato
Рет қаралды 334 М.
C++ Developer Learns Python
9:26
PolyMars
Рет қаралды 2,7 МЛН
Pygame vs Raylib vs Arcade Pyglet: Which One Will Suprise You?
14:17
Optimizing my Game so it Runs on a Potato
19:02
Blargis
Рет қаралды 582 М.
It's Hard To Make Games
18:01
Acerola
Рет қаралды 245 М.
Making Successful Indie Games Is Simple (But Not Easy)
12:08
Jonas Tyroller
Рет қаралды 71 М.
When you Accidentally Compromise every CPU on Earth
15:59
Daniel Boctor
Рет қаралды 822 М.
Pygame CE - Better & Faster
6:29
DaFluffyPotato
Рет қаралды 37 М.