Тёмный

Pygame's Performance - What You Need to Know 

DaFluffyPotato
Подписаться 94 тыс.
Просмотров 205 тыс.
50% 1

Опубликовано:

 

16 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 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.
@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 5 месяцев назад
I have a massive pygame that I want to rewrite into cyphon it’s gonna take so long 😭
@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.
@superscatboy
@superscatboy 3 года назад
Thanks for shouting out PyMunk! Chipmunk is an amazing little physics engine and really deserves more love.
@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 :)
@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
@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.
@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.
@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.
@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!
@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
@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.
@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.
@stickzman
@stickzman 3 года назад
Your pixel art and animations look great!
@jfklittle
@jfklittle 3 года назад
6:11 Randy: I'm gonna pretend like I didn't see that...
@CDcodes
@CDcodes 3 года назад
I always enjoy these discussion vids from you
@slimmello6516
@slimmello6516 3 года назад
I really love your videos and beginners tutorials and I want to good at pygame like you. Keep going sir. 😁
@dawndev2740
@dawndev2740 3 года назад
Great video!! You really show off its full potential!
@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?
@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
@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.
@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().
@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
@ЭнрикеЧурин
@ЭнрикеЧурин 3 года назад
Have been watching you for ages. Now I actually switched from pygame/python to cpp/sdl cos yes.
@monohero231
@monohero231 3 года назад
Yay i can make my potato boiling simulator 2021, thanks!!
@karmdesigns9368
@karmdesigns9368 2 месяца назад
Did you later make this?
@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).
@manas6340
@manas6340 3 года назад
Good video and explanation, thank you!
@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
@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.
@Mupersega
@Mupersega 3 года назад
Been a day and still waiting for your potato boiling simulator 2021..
@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.
@RH_Guitar
@RH_Guitar 2 года назад
Super informative! Thank you for your videos! 😁
@thecombatcactus4254
@thecombatcactus4254 9 месяцев назад
Pretty much answered all my questions. Excellent
@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
@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
@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.
@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.
@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.
@debrikislaw
@debrikislaw 3 года назад
very helpfull video, thank you
@samdavepollard
@samdavepollard 9 месяцев назад
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
@sempersolus5511
@sempersolus5511 3 года назад
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"?
@pencilgame
@pencilgame 3 года назад
@DaFluffyPotato Curious what your thoughts on Pyglet are? How you feel it compares, etc.
@b3ast1234567890
@b3ast1234567890 7 месяцев назад
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.
@saadusmani78
@saadusmani78 2 года назад
I found you through this video, so this video did get the traffic you expected
@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
@demiansims728
@demiansims728 Год назад
Is there anything similar for Ruby or JS? Obviously with JS you have the browser but are there and Pygame equivalents?
@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.
@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.
@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 Год назад
And at the end of the day, Python comforts me and gives me a hug.
@RaghunathTambde
@RaghunathTambde 7 месяцев назад
Very informative video thank you from the heart ❤️
@riyamandal7667
@riyamandal7667 3 года назад
What do you use to draw the sprites?
@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.
@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?)
@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.
@ezloomi
@ezloomi 3 года назад
How did you start and practice python and pygame
@Nakameguro97
@Nakameguro97 3 месяца назад
How do you release commercial pygame products when your code is essentially open-source (scripted python code)?
@DaFluffyPotato
@DaFluffyPotato 3 месяца назад
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.
@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.
@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 9 месяцев назад
What did you end up doing?
@debek818
@debek818 Год назад
thank you so much for this video
@yames_games
@yames_games 3 года назад
Very informative, thank you
@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?
@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?
@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 😁
@EgoCheap
@EgoCheap 2 года назад
Thank you for this video.
@mastermike666
@mastermike666 2 года назад
perfect i was looking for something like this, and with new python searches it found me a bit
@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)
@adye88
@adye88 2 месяца назад
greetings from the future. Thank you for aiding my research.
@TowelPanel1852
@TowelPanel1852 3 года назад
Got this in my recommended, interesting vid
@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
@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
@xeschire706
@xeschire706 5 месяцев назад
What about pygame community edition(CE)?
@bueno_excelente
@bueno_excelente 2 года назад
Using Cython, pySDL2 and pyOpenGL can lead to unexpected performance
@reengineer2497
@reengineer2497 3 года назад
found this video on recommendations btw
@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?
@jishusingh8361
@jishusingh8361 2 года назад
Very informative.
@starfaxmc
@starfaxmc Месяц назад
.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
@jxmmybeats8130
@jxmmybeats8130 3 года назад
Can you use pygame to make iOS and Android app ??
@thinkingspace3438
@thinkingspace3438 Год назад
for android yes
@neito7103
@neito7103 3 года назад
Is pygame powerful enough to make a Sonic CD Remake.
@vinren1041
@vinren1041 3 года назад
6:43 Potato boiling simulator 2021. Hahaha it made me laugh so hard
@MacronLacrom
@MacronLacrom Месяц назад
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
@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.
@ABrainrotAwayFromHeaven
@ABrainrotAwayFromHeaven 3 года назад
Why dont u do games in SDL then ? Its pretty similar to python but its in C
@thinkingspace3438
@thinkingspace3438 Год назад
the performance issues in pygame don't come from python if u know how to code correctly, the slow rendering is a SDL issue, because it doesnt use gpu
@thinkingspace3438
@thinkingspace3438 Год назад
@@ABrainrotAwayFromHeaven that depends of the the complexity of the game, on my own i try to not update everything all the time and i use multiprocessing for the different things, the only performance issues i have come from rendering big surfaces
@Yash-u8e8e
@Yash-u8e8e 3 года назад
What do you think about panda3d?
@dhdhdudshdhd1041
@dhdhdudshdhd1041 Год назад
Is there a game engine made in pygame? And if there isn’t, why not?
@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
@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 : )
@nobodyofconsequence6522
@nobodyofconsequence6522 3 года назад
SDL2 has been out since 2012, how in the name of all that is efficient, is it still partially undocumented?
@DaFluffyPotato
@DaFluffyPotato 3 года назад
Pygame 2 (which uses SDL 2) is in active development. I didn’t say SDL 2 was partially undocumented.
@nobodyofconsequence6522
@nobodyofconsequence6522 3 года назад
@@DaFluffyPotato 2:50 - sorry I misheard
@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
@HanProgramer
@HanProgramer 3 года назад
You can use python with godot too
@prietjepruck
@prietjepruck 10 месяцев назад
Want speed and easy of use doing graphics? Use Processing. Great integrated IDE, amazing speed.
@wulfo1999
@wulfo1999 2 года назад
I always heard people say that python is slow, so I wanted to test that. Got to a conclusion that its almost 170x slower than c++, with using only the barebones of the language
@matthewsharp1178
@matthewsharp1178 3 года назад
4:10 oh my god that code seriously temps me to end it all now
@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.
@golevka
@golevka 3 года назад
Let's get this guy a motherfucking silver play button
@somebody31415
@somebody31415 2 года назад
I’m a bit confused about this, but I’m using .convert_alpha instead of .convert, is there a difference, and if so, which is better and why? I tried looking it up for a while and it seems like maybe they do the same thing? Then I got annoyed and just went back to designing character sprites
@DaFluffyPotato
@DaFluffyPotato 2 года назад
convert_alpha is if you’re using the alpha channel (transparency)
@somebody31415
@somebody31415 2 года назад
@@DaFluffyPotato okay, so I have a TON of sprite animations that all have different geometries even though they are the same character model… I am using transparencies and I would like for them to have damage collision with their pixels instead of with a rectangle, I think I should probably be using convert_alpha and I’m looking into the collision thing
@somebody31415
@somebody31415 2 года назад
We’re talking something on the order of probably hundreds of animations if I ever get that far
@somebody31415
@somebody31415 2 года назад
I’m already on over fifty unique animations, and that’s just walking, running and jumping
@somebody31415
@somebody31415 2 года назад
I’m making a 2D parkour game with pseudo realistic physics and every action is coupled with an animation
@johnstarfire
@johnstarfire Год назад
Have you noticed improvements with python 3.11?
@DaFluffyPotato
@DaFluffyPotato Год назад
Haven’t used it yet.
@ChadDidNothingWrong
@ChadDidNothingWrong 3 года назад
Well hello Mr. Fluffy Potato
Далее
Free Gamedev Tools I Use
9:00
Просмотров 182 тыс.
I made Games with Python for 10 Years...
28:52
Просмотров 349 тыс.
КЛИП ЛИСА УЖЕ ВЫШЕЛ!
00:16
Просмотров 420 тыс.
25 nooby Python habits you need to ditch
9:12
Просмотров 1,8 млн
Pygame CE - Better & Faster
6:29
Просмотров 38 тыс.
How to ACTUALLY get into Gamedev
14:01
Просмотров 732 тыс.
When Optimisations Work, But for the Wrong Reasons
22:19
A Programmer's Guide to Pixel Art
9:28
Просмотров 189 тыс.
C++ Developer Learns Python
9:26
Просмотров 2,7 млн
Optimizing my Game so it Runs on a Potato
19:02
Просмотров 623 тыс.
How to Code (almost) Any Feature
9:48
Просмотров 689 тыс.
Harder Drive: Hard drives we didn't want or need
36:47