Live data from Hacker News

I've just started mixing shaders with Pygame

dafluffypotato.itch.io

11–20 of 26 posts

Re: I've just started mixing shaders with Pygame

#15

How?! How did you get PyGame not to be so brutally slow? Is it basically that all the graphics are done separately and pygame only offers up IO and game loop? This is just brilliant and wonderful and beautiful. The premise of this game is just amazing.

pygame isn't that slow if you use pygame 2 that depends on SDL2 (2D hardware acceleration, yay!) or go with OpenGL directly.

I used to do a lot of amateur gamedev with Python (pygame and pyglet). If most of the work happens on the GPU or external libraries, it is usually OK if you aren't doing anything stupid.

Re: I've just started mixing shaders with Pygame

#16

How?! How did you get PyGame not to be so brutally slow? Is it basically that all the graphics are done separately and pygame only offers up IO and game loop? This is just brilliant and wonderful and beautiful. The premise of this game is just amazing.

If you offload graphics to the GPU (which is what shaders are), there's surprisingly little CPU work left in a 2D platformer game.

Think of (fragment) shaders as programs that run in the GPU per-texture-pixel. There is some initial CPU/memory-bound work setting everything up (e.g. uploading textures to GPU RAM, compiling the program, sending vertex buffers...) and then per-frame you just call the shader with some parameters (e.g. character's current position) and the GPU does the rest.

In-CPU you mostly do the non-parallelizable work such as collisions, game logic, keyboard input, etc. which can be very light for a simple 2D platformer.

Re: I've just started mixing shaders with Pygame

#17

How?! How did you get PyGame not to be so brutally slow? Is it basically that all the graphics are done separately and pygame only offers up IO and game loop? This is just brilliant and wonderful and beautiful. The premise of this game is just amazing.

The author made a video about optimizing pygame performance here: https://youtu.be/3hGcW77M-84

Re: I've just started mixing shaders with Pygame

#18

Can you share anything about your stack or process? This looks beautiful!

DaFluffyPotato's channel is filled with lengthy explanation videos and dev log streams showing the processes his code, pixel art and music composition.

If I recall he also makes code available via Patreon.

Post reply on HN