Wishlist Yawnoc! store.steampowered.com/app/2824730/Yawnoc/ I mentioned that Python can be easily used for nearly any 2D game but not 3D. For those who are curious, the reasoning against using it for 3D is actually unrelated to performance. Most 3D games nowadays are made with an engine + scripting combination. Since there aren't any major engines that primarily support Python as a scripting language, it's not particularly easy to make 3D games with Python. Of course it can still be done (see my last 2 videos). It's just not very easy to get into with the current tooling. Things may be completely different in the future.
I prefer my tooling over engines typically (basically a custom engine specifically for the types of things I make). I've used Godot for VR projects and it's been good, but I get annoyed when there's something I could easily do on a low level, but the engine abstractions make it difficult.
It's less that there aren't any major engines that primarily support python as a scripting language, than it is that python doesn't make it easy to be used as a scripting language.
Sir got lucky with the algorithm, there's a tonne of important algos (like sorting) that are very parallelism resistant and don't run great on the GPU. Running an algorithm on compiled CPU code will always be faster in those cases
@@nathanfranck5822 while I agree on the principle, sorting is not a great example. If your list is long enough, a GPU will sort it significantly faster.
By far the most talented PyGam dev out there. Ever considered writing a book on this? I would 100 buy it. Will be looking out for when the game is released man! you rock!
Never seen your channel or work before, but i immediately thought that a shader would be your solution! I'd never really considered python for game dev before. Yawnoc looks very fun - wish listed!
Potato's problem solving skills are goals. The things I've learned with your videos have applied to more than just learning to make games, I've applied a lot of concepts I've come to understand thanks to you in a lot of different ways, and even made some discoveries of my own in regards to how to attack unique issues I had. Thank you for your content, and I'm looking forward to Yawnoc!
Except for dealing with the all the code split up in multiple places just to get one thing done and all the obscure crap that's done under the hood that you have to learn about and the documentation that often leaves you more confused after reading it than before.
@@igorthelight C is pretty nice if you are doing things that require accessing a lot of data, which Python is very poor at. C is a simple, clear, and direct language. GPU programming is a lot more complicated even to do simple things. Can get crazy performance though.
@@Khallduon Use ChatGPT to learn new concepts, not to just write for you. Also - it still writes buggy code so you should be a good programmer to use what it writes ;-)
this is such a dope coincidence, i was talking to my friend about inefficiency of the code in my cellular automaton code and you uploaded it today!!!!!!!!!!
Great video, I love shaders and this is a perfect application for them! The water colour effect that you showed off looks awesome by the way, I might have to try recreating it at some point!
Hey! Nice stuff! It was cool to see my Smoothlife(L) shadertoy shader in the thumbnail and the video :) Would appreciate if you could put some links in the description to the referenced shadertoy shader(s). Thanks!
Oops, sorry! I added them. Normally I do a zoom-out or something on my sources (note the titles/channels on the YT videos and the zoom-out on the Lenia shadertoy). I forgot that I never did that on your Smoothlife(L) shader.
Fantastic to see you consider the solutions to get the game ready. I wonder if Mojo can (or will in the near future) help with this kind of performance 🤔 Either way, good luck getting the game to release!
It would be incredibly interesting if you made a video about how to program shader code. It's such an important skill, but so incredibly hard to get into and begin your journey. There are so many tutorials on how to do exactly what you want, but what about making a tutorial for figuring it out yourself?
Honestly I feel like once you have your own standard “wrapper” around pygame it must be quite a fun time creating a game. I’ve moved away from game dev personally because I despise rendering with my entire soul but this looks awesome!
Ya the beginning is the weirdest one, you mostly don't see anything important or weird simple sprites. The more complex your "wrapper", the more everything becomes easier. The most hard part is when you need optimization or just change something and a lot of things is based around that in your game, that's where it becomes harder the more complex your wrapper is
Oh it is! Spend a lot of time figuring out how to render what you want and you never have to worry about it again. Your possibilities expand and you can realise your game designs faster. It’s a nice bonus that Python is relatively easy to pick up.
@@mint4up2zio3 ya and even rewrittng something that you've done earlier is easier. I had a huge problems with collisions in the past but today I recreated it faster and better
Clever coding can really save your game. I implemented my own A star path-finding/search algorithm in Godot that runs each square over multiple frames, allowing hundreds of pawns to path-find at once. Distributing processes over multiple frames in an amazing trick. Maybe I am just wishful but I believe that there will be a system that compiles python as C, and that it will be open source and built into godot. I know such systems exist already, but right now I think it's most productive to build fast in python. I also State-Machine absolutely everything, which drastically improves performance.
This is super cool! Is there a performance hit from parsing the completed texture on the CPU for collision/other data required for the game? Also, I love that we both ended up using images to load levels for the competition, MSPaint is a slept on level editor :P
I tried it years ago, but there were some bugs in the Python wrapper at the time. I haven't had a reason to use anything other than Pygame and ModernGL when it comes to Python-based games.
When John carmack was bottle necked with C on doom he just read a white paper and implemented a scientific approach to graphics rendering. So no big deal, all you have to do is ground breaking code! ;p
One question. i may have missed it but what about the performance penalty of getting the x,y information of each cell back and forward from the shader for collision detection and everything else?
I actually only have to pass the texture back and forth once per automata step, which only occurs every now and then. In terms of a single step, the pass is just a small texture in both directions, which is super fast. I haven't profiled it, but it doesn't really affect performance (so it's probably
@@DaFluffyPotato I take it you then have to parse that texture back into the tilemap/collision acceleration structures? Or is the map size such that brute force still is ok with python?
While I've travelled the Pygame path in an earlier life, I distrust extending my dependency chain any more than necessary these days, and framework-based development these days tends to be an update treadmill where there are plenty of underlying dependencies that make breaking changes - so the dev environment is richly structured, complex, and makes it hard to bring up the project again after time away from it or changing machines. As a result of this I've made a hard turn towards coding in Forth for actual retro machines. It's not bad - it's also interpreted, and you can do live editing with it. It can be pretty portable since the core is small and the only major assumptions are with machine word size and memory layout. Supremely self-contained. It does mean substantially more DIY to get through the early stages since most Forth systems have very little built in, but you can get it exactly how you want it. Wouldn't go this route if I were trying for this kind of GPU-accelerated 2D, though - it'd be easier for me to start in Godot and hammer away at the extension system as necessary to make the critical path go fast. The problem is mostly that once you try to make a game in the modern fashion, the expected featureset explodes, so my take on that is to go ahead and swallow one large dependency that has a lot of momentum around it.
Over the 11 years that I've used Pygame, it's been pretty stable as a library with few dependencies (since it wraps SDL). I've definitely run into some of those issues with ModernGL since it's newer and still maturing though. My game Hue Flowing can be a bit of a challenge to get running from source as a result.
great game can't wait and if you don't mind me asking what price do you expect the game to be since something this good deserves to cost money I would like to know how much so I can save up for it because it seems like a game I would enjoy ok I'm going to end this paragraph now
I was surprised you didnt mention Cython I use it in my job and it works great You write some python with extra syntax and compile it to c and then binary Just running plain code throught the cython compiler shouls boost your performance
I didn't mention it because I didn't check to see if it would cause issues with Pygame or other libraries used in Python gamedev. It's likely a valid option though.
I'm curious, super naive suggestion but would you have any interest in just compiling the python code? I believe there are some OOTB solutions for that. I'm in a compiler construction class rn and the performance increase has been rly cool to see Edit: Oop nvm u literally just mentioned compilation haha
@@Akrob55555as far as I know the only connection between them is that he recently made a video about a cancelled blackthorneprod dev challenge (devs make a game without communicating), and some people speculated that the previous dev to him was DaFluffyPotato based on the artstyle.
Nice! I expected to find Numba JIT or a similar solution (somehow knew rewriting to a lower level language wasn't your solution) and I'm surprised shaders do the trick! You said in other comments you work as C++ dev, how does it "affect"/help your views as a python programmer? Did you choose python for its development speed?
Yes, I use Python for development speed. My tooling is also all in Python and Pygame, so switching to anything else would set me back a fair bit. I learned most lower level topics while using Python before really getting into C++, so nearly everything I do in C++ except syntax and the build process is already well within my knowledge. For reference, my job is embedded SWE for rocket hardware.
yellow bullets on yellow background seems a little hard to read, making the bullets a much darker, or made from a more saturated color, would make the combat MUCH more readable
I plan on adding accessibility settings to recolor certain things for visibility. I like the way the game looks at the moment and I don't really experience issues when I play, but the features will be useful for anyone who needs more clarity.
I took the route thus far of writing functions in C and calling them using ctypes. Quick and easy and useful when you have a lot of data to iterate through since Python data accesses are so slow. Using the GPU is taking it to the next level though. I've been learning OpenGl and I fucking hate working with it. Just the whole way it works rubs me wrong, but I realize it has good functionality so I'm doing it anyway. Maybe someday I won't hate it so much.
If you're using PyOpenGL or a traditional C/C++ binding, I recommend ModernGL. It's an object-oriented interface for ModernGL instead of a state machine.
@@DaFluffyPotato yeah that looks like the way to go using Python. I've been using OpenGL in straight C though. The way I've avoided most of the state-machine crap is using the Direct State Access (DSA) functions. I still encounter a lot of technical difficulties though.....it could use better documentation.
Mainly because I just never started. Also I don't have much of a need for it and the support for some modules is a bit finicky. It may have more portability issues as well. For Pygame specifically, the heavy lifting is already done in C, so it doesn't help in most cases (although the case in this video would benefit from it).
I hate numba, also Mojo exists now. I hope it will enable better execution times with python like vocabulary and make it possible to get optimizations for gaming as well. So far, it mostly is DS language
One question, how does your gun aim, is it based on the cursor? If so, how does it get an angle to rotate at? Sorry if this seems invasive or annoying.
Yes, it uses the cursor. The cursor just has to get converted to world coordinates and you can take the difference of that position with the player position. Taking the arctangent of the difference gives you the angle.
My 6 hour Pygame tutorial has a section in it where I make a level editor if you're interested. Most people use preexisting editors such as Tiled though.
Have a look at Odin. You can build libraries and use them in python in many languages easier than C. It is an easy process, just ask your friendly llm. Odin has in-built SIMD support and is easy to write, might me a good fit.
Interesting. It could be useful in some cases where a lot of performant modules are needed, but there is a tradeoff in the build process (most people can easily build C, but haven't used Odin). That wouldn't be an issue for most people, but a lot of people like to run the source for my projects.
@@dlld6944 Well, just watch some interviews with those developers. They do struggle. I made a few non-commercial small games, so my story doesn't matter 😅
Great stuff. Too many people are quick to jump ship to another language when they run into pythons performance issues. The original point of python is to have quick dev times for the higher level stuff, and if you need to do some performance heavy stuff, you can create small 'addon' functions in like in C, or in this case shaders. That way you get the best of both worlds; the speedy dev times of python, and the performance of C.
I think this is genius and I love your vids, but a 14th nov release date! Stresses me out just thinking about it….just put 2025 and enjoy playing about with it!
Have you thought about releasing a performant (but minimal) version of the game, and then spend more time dealing with getting the more complex aspects to run smoothly? I feel like it would be good to start generating curiousity about the game, but moreso because sensitive aspects such as game speed and frame rate need a lot of care, especially to make sure you don't shoot yourself in the foot in the future. Especially since some of the potential fixes might only work in specific scenarios 😅.
Yawnoc has never actually had performance issues since I knew that smooth life would lag before implementing it (although I will admit I took advantage of knowing about that outcome for this video idea). It's perfectly fine with the shader implementation from this video. Runs at ~400fps.
Shaders sometimes work different on Intel, Nvidea or AMD (or Qualcomm) hardware, so pegging them to gameplay can get tricky! I remember some disappointments seeing my game tested on other people's computers...
I have multiple PCs and laptops (Nvidia, AMD, and Intel graphics) to test with. Plus I'll have a demo to get initial testing with. Generally older versions of OpenGL should be pretty reliable. I've been using 3.3.
being bottlenecked by your language sounds horrid, i'll pass on python for anything else than prototyping (although i'm biased because i'm a little engine nerd, and am more interested by tech than games, i imagine the overhead you get from usin python correctly isn't all that far from using a general purpose engine, but i'm still very doubtful)
You'll get bottlenecked in all sorts of places depending on your tooling (including your needs to update things if you roll it yourself) regardless of language, library, or engine choice. In the case of C++ and OpenGL, you'll be bottlenecked on scalability for many things until you write systems using the proper data structures. I will agree that the bottlenecks in that case are the most straightforward. On the other end with engines, there's a mess of random bottlenecks (that you may or may not have control over) depending on the engine. I benefit from Python due to development speed for game logic on top of my prebuilt tooling. My approach has been competitively proven in game jams, but it's definitely not for everyone.
@@DaFluffyPotato i would think maintaining a python codebase would be really hard, because even if it's easy to do stuff, it's also really easy to get lost and have all sorts of weird stuff happen because it's too lenient on what you can do, i would believe structuring a python codebase is as important as in any other language
For people new to Python or working in teams I agree. However, I rarely lose any time to Python-specific bugs or getting lost. Additionally, since I started with Python, I abuse the type looseness to quickly write some things that would have to be written with more steps due to type management in languages like C++.
@@DaFluffyPotato i don't personally think it's worth spending time to be really good at python to have kind of acceptable perfs when you could be learning something else that in the end will lead to better results. byeah as you said python is really good for throwing things together quickly, so ig in the case of gamejams it must work great, i couldn't imagine what it'd take to do a gamejam in like C or C++
Why don't you just change language? Says here you have a computer science degree, why limit yourself to poor performance at the cost of simplicity? There's no way you couldn't manage with a low level language, isn't that like literally your bread and butter? I'm a fucking dumbass and I still won't touch python because simplicity isn't what I'm looking for, nevermind the crap performance although that's a huge part of it too.
As I mentioned at the start of the video, I can make games quicker with Python. I made an example out of a potential problem to demonstrate how you handle these types of issues. I wrote the shader-based system in a couple hours, so it wasn't ever a roadblock since I've run into these situations before. C++ wouldn't have saved me time on this specific issue (and I actually use C++ for work) and it certainly would've wasted exorbitant amounts of time in the scope of the entire game.
@@DaFluffyPotato So a more complex language is better for making a game, but since you dont do this as your main work and also dont have infinite time and resources you choose python, that isn't the best but is good for making the thing fast?
Python is SLOOOOOOW. However AI compilers that can convert your barely adequate Python code into C and Raylib are just around the corner... so rejoice and write bouncy plasmas and 3d cubes from the 1980's and know that nobody really cares.
You ignored the first 30s of the video. It dramatically improves the development speed. I compete with people who are using other languages and engines in time restricted game jams all the time and consistently perform well. Yawnoc originated in a competition where it won against 5 other developers who were using engines. I also recently won 2 Ludum Dare medals for my Python games. 99% of game logic is not actually very processing intensive. The rendering pipelines can be, but that's mostly 3D games.
Wishlist Yawnoc!
store.steampowered.com/app/2824730/Yawnoc/
I mentioned that Python can be easily used for nearly any 2D game but not 3D. For those who are curious, the reasoning against using it for 3D is actually unrelated to performance. Most 3D games nowadays are made with an engine + scripting combination. Since there aren't any major engines that primarily support Python as a scripting language, it's not particularly easy to make 3D games with Python. Of course it can still be done (see my last 2 videos). It's just not very easy to get into with the current tooling. Things may be completely different in the future.
Why don't you make games in godot? It has gdscript, very similair to python's syntax
I prefer my tooling over engines typically (basically a custom engine specifically for the types of things I make). I've used Godot for VR projects and it's been good, but I get annoyed when there's something I could easily do on a low level, but the engine abstractions make it difficult.
It's less that there aren't any major engines that primarily support python as a scripting language, than it is that python doesn't make it easy to be used as a scripting language.
@@DaFluffyPotato Probably you already know this but since Godot is open-source, you could even make modifications at the engine.
Modifying the rendering pipeline in Godot is not a simple task.
In conclusion, GPU comes in clutch every time. Love the video Potato Master.
Sir got lucky with the algorithm, there's a tonne of important algos (like sorting) that are very parallelism resistant and don't run great on the GPU. Running an algorithm on compiled CPU code will always be faster in those cases
That's what options 1 & 2 were for. In the case of sorting, Python's built in sorting function is already written in C.
@@nathanfranck5822 while I agree on the principle, sorting is not a great example. If your list is long enough, a GPU will sort it significantly faster.
By far the most talented PyGam dev out there. Ever considered writing a book on this? I would 100 buy it. Will be looking out for when the game is released man! you rock!
Never seen your channel or work before, but i immediately thought that a shader would be your solution! I'd never really considered python for game dev before. Yawnoc looks very fun - wish listed!
Potato's problem solving skills are goals. The things I've learned with your videos have applied to more than just learning to make games, I've applied a lot of concepts I've come to understand thanks to you in a lot of different ways, and even made some discoveries of my own in regards to how to attack unique issues I had. Thank you for your content, and I'm looking forward to Yawnoc!
Shaders exist at the meeting place between mathematics, computing and art. They're really nice.
Except for dealing with the all the code split up in multiple places just to get one thing done and all the obscure crap that's done under the hood that you have to learn about and the documentation that often leaves you more confused after reading it than before.
TL;DR: if your python code is too slow, use C
There are so many ways to improve performance beside "just use C" ;-)
This video is just about that.
@@igorthelight C is pretty nice if you are doing things that require accessing a lot of data, which Python is very poor at. C is a simple, clear, and direct language. GPU programming is a lot more complicated even to do simple things. Can get crazy performance though.
@@undeadpresident Agree
Use chat gpt
@@Khallduon Use ChatGPT to learn new concepts, not to just write for you.
Also - it still writes buggy code so you should be a good programmer to use what it writes ;-)
this is such a dope coincidence, i was talking to my friend about inefficiency of the code in my cellular automaton code and you uploaded it today!!!!!!!!!!
>a gun that builds walls
🦅
many technical limitations have led to incredible creative choices in gamings history :D
Every new video of yours is like a fiery new inspiration. Even though didn't understand most of it..
Keep going!
Great video, I love shaders and this is a perfect application for them! The water colour effect that you showed off looks awesome by the way, I might have to try recreating it at some point!
Hey! Nice stuff!
It was cool to see my Smoothlife(L) shadertoy shader in the thumbnail and the video :)
Would appreciate if you could put some links in the description to the referenced shadertoy shader(s). Thanks!
Oops, sorry! I added them. Normally I do a zoom-out or something on my sources (note the titles/channels on the YT videos and the zoom-out on the Lenia shadertoy). I forgot that I never did that on your Smoothlife(L) shader.
Python's data science and math capabilities is what keeps me coming back to Pygame.
Thanks, your content is quite inspiring.
oh okay, thanks for this, perfect timing, i was working on cellular automaton! yesterday!!!!!
Your game featured here reminds me of some of the art and design in Cave Story. Love the channel, thank you!
Your games are always great by conceptually and graphically
kick butt keep it up you got this all ready
Bro casually uses the coolest sht ive ever seen in a video game as Broll (1:38)
That's my game Hue Flowing. :)
Hah, shaders. Damn, I'm gonna have to learn those eventually, inevitably.
Fantastic to see you consider the solutions to get the game ready. I wonder if Mojo can (or will in the near future) help with this kind of performance 🤔
Either way, good luck getting the game to release!
It would be incredibly interesting if you made a video about how to program shader code. It's such an important skill, but so incredibly hard to get into and begin your journey. There are so many tutorials on how to do exactly what you want, but what about making a tutorial for figuring it out yourself?
I'm still mostly using shaders for simple things, so I don't think I'm ready to make that type of video yet.
Eve Online actually uses stackless python for pretty much all ui and logic in the game with native interfaces to the rendering engine.
I haven't checked, but wasn't stackless Python just used for the servers?
Honestly I feel like once you have your own standard “wrapper” around pygame it must be quite a fun time creating a game. I’ve moved away from game dev personally because I despise rendering with my entire soul but this looks awesome!
Graphics programming is probably my favorite part of gamedev.
Ya the beginning is the weirdest one, you mostly don't see anything important or weird simple sprites. The more complex your "wrapper", the more everything becomes easier. The most hard part is when you need optimization or just change something and a lot of things is based around that in your game, that's where it becomes harder the more complex your wrapper is
Oh it is! Spend a lot of time figuring out how to render what you want and you never have to worry about it again. Your possibilities expand and you can realise your game designs faster. It’s a nice bonus that Python is relatively easy to pick up.
@@mint4up2zio3 ya and even rewrittng something that you've done earlier is easier. I had a huge problems with collisions in the past but today I recreated it faster and better
That's a shader. Dude, blew my mind.
very nice
Clever coding can really save your game. I implemented my own A star path-finding/search algorithm in Godot that runs each square over multiple frames, allowing hundreds of pawns to path-find at once. Distributing processes over multiple frames in an amazing trick.
Maybe I am just wishful but I believe that there will be a system that compiles python as C, and that it will be open source and built into godot. I know such systems exist already, but right now I think it's most productive to build fast in python.
I also State-Machine absolutely everything, which drastically improves performance.
Cross compiling code often kills the performance benefits offered by the languages. You are better off learning c++ and making modules in godot
mojo
This is super cool! Is there a performance hit from parsing the completed texture on the CPU for collision/other data required for the game?
Also, I love that we both ended up using images to load levels for the competition, MSPaint is a slept on level editor :P
As long as the texture is small, it's pretty fast (not profiled, but should easily be
That's when C++ comes in 💪
Very cool
have you tried go with raylib ?
I tried it years ago, but there were some bugs in the Python wrapper at the time. I haven't had a reason to use anything other than Pygame and ModernGL when it comes to Python-based games.
When John carmack was bottle necked with C on doom he just read a white paper and implemented a scientific approach to graphics rendering. So no big deal, all you have to do is ground breaking code! ;p
One question. i may have missed it but what about the performance penalty of getting the x,y information of each cell back and forward from the shader for collision detection and everything else?
I actually only have to pass the texture back and forth once per automata step, which only occurs every now and then. In terms of a single step, the pass is just a small texture in both directions, which is super fast. I haven't profiled it, but it doesn't really affect performance (so it's probably
@@DaFluffyPotato thats amazing!
@@DaFluffyPotato I take it you then have to parse that texture back into the tilemap/collision acceleration structures? Or is the map size such that brute force still is ok with python?
While I've travelled the Pygame path in an earlier life, I distrust extending my dependency chain any more than necessary these days, and framework-based development these days tends to be an update treadmill where there are plenty of underlying dependencies that make breaking changes - so the dev environment is richly structured, complex, and makes it hard to bring up the project again after time away from it or changing machines.
As a result of this I've made a hard turn towards coding in Forth for actual retro machines. It's not bad - it's also interpreted, and you can do live editing with it. It can be pretty portable since the core is small and the only major assumptions are with machine word size and memory layout. Supremely self-contained. It does mean substantially more DIY to get through the early stages since most Forth systems have very little built in, but you can get it exactly how you want it. Wouldn't go this route if I were trying for this kind of GPU-accelerated 2D, though - it'd be easier for me to start in Godot and hammer away at the extension system as necessary to make the critical path go fast. The problem is mostly that once you try to make a game in the modern fashion, the expected featureset explodes, so my take on that is to go ahead and swallow one large dependency that has a lot of momentum around it.
Over the 11 years that I've used Pygame, it's been pretty stable as a library with few dependencies (since it wraps SDL). I've definitely run into some of those issues with ModernGL since it's newer and still maturing though. My game Hue Flowing can be a bit of a challenge to get running from source as a result.
Nice !
I just noticed there was a new video release! You added a weapon that creates walls! (Similar to my old idea)
compile to faster native code, or just pre-push graphics and other logic to gpu etc.
that's the video
@@DaFluffyPotato great
This is the best comment section I've read in a while.
This disproves the myth of "Python is easy", it's easy in some ways and very cringe/difficult in others (C++ guy, no bias). Nice vid, keep it up!
Python is easy. It just has a very high skill ceiling.
Hi gary!
Nice to meet you!
Understood 0️⃣
Enjoyed 1️⃣
😂😂😂
I love your pixel art style any tips? This would help alot.
neural cellural automata might be cool as well like neural worms
2:55 neural network confirmed
latest version of python has a JIT, it's not enabled by default, give it a try
would you learn ursina as a future tool? Cuz ur game is cool but i am using ursina so I cant actually make it.
great game can't wait and if you don't mind me asking what price do you expect the game to be since something this good deserves to cost money I would like to know how much so I can save up for it because it seems like a game I would enjoy ok I'm going to end this paragraph now
$5
@@DaFluffyPotato ok cool that's a good price for such an awesome game
Woah what's that watercolor game? It looks insane
Hue Flowing
I was surprised you didnt mention Cython
I use it in my job and it works great
You write some python with extra syntax and compile it to c and then binary
Just running plain code throught the cython compiler shouls boost your performance
I didn't mention it because I didn't check to see if it would cause issues with Pygame or other libraries used in Python gamedev. It's likely a valid option though.
I'm curious, super naive suggestion but would you have any interest in just compiling the python code? I believe there are some OOTB solutions for that. I'm in a compiler construction class rn and the performance increase has been rly cool to see
Edit: Oop nvm u literally just mentioned compilation haha
Cant you also add another cpu thread just for the cellular automata
That doesn't provide enough of a performance boost and it also makes the code significantly more complicated.
Thank you Andrew Cunningham for bringing me here, I enjoyed this
Where did he post about it?
@@Akrob55555as far as I know the only connection between them is that he recently made a video about a cancelled blackthorneprod dev challenge (devs make a game without communicating), and some people speculated that the previous dev to him was DaFluffyPotato based on the artstyle.
Nice! I expected to find Numba JIT or a similar solution (somehow knew rewriting to a lower level language wasn't your solution) and I'm surprised shaders do the trick! You said in other comments you work as C++ dev, how does it "affect"/help your views as a python programmer? Did you choose python for its development speed?
Yes, I use Python for development speed. My tooling is also all in Python and Pygame, so switching to anything else would set me back a fair bit.
I learned most lower level topics while using Python before really getting into C++, so nearly everything I do in C++ except syntax and the build process is already well within my knowledge. For reference, my job is embedded SWE for rocket hardware.
@@DaFluffyPotato This sounds like very strict C++ indeed... Coding in python must be a breeze when you get home!
yellow bullets on yellow background seems a little hard to read, making the bullets a much darker, or made from a more saturated color, would make the combat MUCH more readable
I plan on adding accessibility settings to recolor certain things for visibility. I like the way the game looks at the moment and I don't really experience issues when I play, but the features will be useful for anyone who needs more clarity.
To be fair to Python, doing 4 million checks per frame is a lot for any game
1:37 I never managed to compile pygame. Looks as hard as write code in C
I wonder about python 3.13 and GIL etc speed
I took the route thus far of writing functions in C and calling them using ctypes. Quick and easy and useful when you have a lot of data to iterate through since Python data accesses are so slow. Using the GPU is taking it to the next level though.
I've been learning OpenGl and I fucking hate working with it. Just the whole way it works rubs me wrong, but I realize it has good functionality so I'm doing it anyway. Maybe someday I won't hate it so much.
If you're using PyOpenGL or a traditional C/C++ binding, I recommend ModernGL. It's an object-oriented interface for ModernGL instead of a state machine.
@@DaFluffyPotato yeah that looks like the way to go using Python.
I've been using OpenGL in straight C though.
The way I've avoided most of the state-machine crap is using the Direct State Access (DSA) functions.
I still encounter a lot of technical difficulties though.....it could use better documentation.
You chould try Go for your next project, its simple and performant
I was considering trying Go next year, but not for gamedev.
@@DaFluffyPotato I use it for games and I like it, but we all are diffrent
cool beens
How is it possible that in 2024 there's is a python compiler which produces machine code? that has to exist right?
2:14 I mentioned that PyPy does this in the video.
Mojo comes to mind
@@DaFluffyPotato never heard of it before, why aren't you using PyPy then?
Mainly because I just never started. Also I don't have much of a need for it and the support for some modules is a bit finicky. It may have more portability issues as well.
For Pygame specifically, the heavy lifting is already done in C, so it doesn't help in most cases (although the case in this video would benefit from it).
Pog Game
I hate numba, also Mojo exists now. I hope it will enable better execution times with python like vocabulary and make it possible to get optimizations for gaming as well. So far, it mostly is DS language
I wish I could try playing it on a mac
If you need custom C code for this or Cuda/wgpu I could do it
Did you see my old idea? I'm curious.
One question, how does your gun aim, is it based on the cursor? If so, how does it get an angle to rotate at? Sorry if this seems invasive or annoying.
Yes, it uses the cursor. The cursor just has to get converted to world coordinates and you can take the difference of that position with the player position. Taking the arctangent of the difference gives you the angle.
@@DaFluffyPotato cool, thanks!
wait how do you make a map editor ? , also how are maps stored (i store all my maps as images rn and need help)
My 6 hour Pygame tutorial has a section in it where I make a level editor if you're interested. Most people use preexisting editors such as Tiled though.
Its simpler to optimize the code.(I programma rpg maker like game in python and pygame and rewriten the code 3 times because itwas to slow.)
Rust is easy to use with python too as another idea
Have a look at Odin. You can build libraries and use them in python in many languages easier than C. It is an easy process, just ask your friendly llm. Odin has in-built SIMD support and is easy to write, might me a good fit.
Interesting. It could be useful in some cases where a lot of performant modules are needed, but there is a tradeoff in the build process (most people can easily build C, but haven't used Odin). That wouldn't be an issue for most people, but a lot of people like to run the source for my projects.
> Python
> game
Bro literally used potato instead of meat for steak
Is it possible to make an income as a single game dev?
Yep!
Google "games created by a single developer".
But that's not easy.
@@igorthelight It seems to be the exception. Are you able to finance yourself?
@@dlld6944 Well, just watch some interviews with those developers. They do struggle. I made a few non-commercial small games, so my story doesn't matter 😅
Great stuff. Too many people are quick to jump ship to another language when they run into pythons performance issues. The original point of python is to have quick dev times for the higher level stuff, and if you need to do some performance heavy stuff, you can create small 'addon' functions in like in C, or in this case shaders. That way you get the best of both worlds; the speedy dev times of python, and the performance of C.
I think this is genius and I love your vids, but a 14th nov release date! Stresses me out just thinking about it….just put 2025 and enjoy playing about with it!
Have you thought about releasing a performant (but minimal) version of the game, and then spend more time dealing with getting the more complex aspects to run smoothly?
I feel like it would be good to start generating curiousity about the game, but moreso because sensitive aspects such as game speed and frame rate need a lot of care, especially to make sure you don't shoot yourself in the foot in the future. Especially since some of the potential fixes might only work in specific scenarios 😅.
Yawnoc has never actually had performance issues since I knew that smooth life would lag before implementing it (although I will admit I took advantage of knowing about that outcome for this video idea). It's perfectly fine with the shader implementation from this video. Runs at ~400fps.
Shaders sometimes work different on Intel, Nvidea or AMD (or Qualcomm) hardware, so pegging them to gameplay can get tricky! I remember some disappointments seeing my game tested on other people's computers...
I have multiple PCs and laptops (Nvidia, AMD, and Intel graphics) to test with. Plus I'll have a demo to get initial testing with. Generally older versions of OpenGL should be pretty reliable. I've been using 3.3.
How about IronPython ?
Haven't looked into it
@@DaFluffyPotato
I see.
because I am developing a video game in IronPython.
I love Python, but I think it's time for me to transition to C++.
hey bro make a game using pyglet
I'd rather use ModernGL (see my last 2 videos).
bro will do anything but write c++ code lul😊
My job is C++
Probably because C++ is horrid to program in
1) did you try use __slots__ ?
2) did you try use pypy?
3) did you try use cython with new syntax?
being bottlenecked by your language sounds horrid, i'll pass on python for anything else than prototyping (although i'm biased because i'm a little engine nerd, and am more interested by tech than games, i imagine the overhead you get from usin python correctly isn't all that far from using a general purpose engine, but i'm still very doubtful)
fax, python is made for scientific purposes. we should use languages actually made for software/game dev the way it's intended.
You'll get bottlenecked in all sorts of places depending on your tooling (including your needs to update things if you roll it yourself) regardless of language, library, or engine choice. In the case of C++ and OpenGL, you'll be bottlenecked on scalability for many things until you write systems using the proper data structures. I will agree that the bottlenecks in that case are the most straightforward. On the other end with engines, there's a mess of random bottlenecks (that you may or may not have control over) depending on the engine.
I benefit from Python due to development speed for game logic on top of my prebuilt tooling. My approach has been competitively proven in game jams, but it's definitely not for everyone.
@@DaFluffyPotato i would think maintaining a python codebase would be really hard, because even if it's easy to do stuff, it's also really easy to get lost and have all sorts of weird stuff happen because it's too lenient on what you can do, i would believe structuring a python codebase is as important as in any other language
For people new to Python or working in teams I agree. However, I rarely lose any time to Python-specific bugs or getting lost. Additionally, since I started with Python, I abuse the type looseness to quickly write some things that would have to be written with more steps due to type management in languages like C++.
@@DaFluffyPotato i don't personally think it's worth spending time to be really good at python to have kind of acceptable perfs when you could be learning something else that in the end will lead to better results. byeah as you said python is really good for throwing things together quickly, so ig in the case of gamejams it must work great, i couldn't imagine what it'd take to do a gamejam in like C or C++
Lua > Python
Love2D > PyGame
Need python optimized? Learn Cython
Or just use godot for easy syntax
I prefer my tooling when possible. I've used Godot for VR projects though.
Why don't you just change language? Says here you have a computer science degree, why limit yourself to poor performance at the cost of simplicity? There's no way you couldn't manage with a low level language, isn't that like literally your bread and butter? I'm a fucking dumbass and I still won't touch python because simplicity isn't what I'm looking for, nevermind the crap performance although that's a huge part of it too.
As I mentioned at the start of the video, I can make games quicker with Python. I made an example out of a potential problem to demonstrate how you handle these types of issues. I wrote the shader-based system in a couple hours, so it wasn't ever a roadblock since I've run into these situations before. C++ wouldn't have saved me time on this specific issue (and I actually use C++ for work) and it certainly would've wasted exorbitant amounts of time in the scope of the entire game.
@@DaFluffyPotato So a more complex language is better for making a game, but since you dont do this as your main work and also dont have infinite time and resources you choose python, that isn't the best but is good for making the thing fast?
@@DaFluffyPotatouse Lua ❤
Have you ever considered using AI art? It takes time editing the art but the result would be impressive, graphics wise.
I blame your optimisation
First comment!
or use RUST~~~
Or Lua
I'm not aware of any games being made with rust at the moment. Although it should be doable with Raylib at least.
Python is SLOOOOOOW. However AI compilers that can convert your barely adequate Python code into C and Raylib are just around the corner... so rejoice and write bouncy plasmas and 3d cubes from the 1980's and know that nobody really cares.
Not very helpful. You didn't say anything new this video.
Using python just to use python. 0 benefit for your games.
You ignored the first 30s of the video. It dramatically improves the development speed. I compete with people who are using other languages and engines in time restricted game jams all the time and consistently perform well. Yawnoc originated in a competition where it won against 5 other developers who were using engines. I also recently won 2 Ludum Dare medals for my Python games.
99% of game logic is not actually very processing intensive. The rendering pipelines can be, but that's mostly 3D games.
just use a statically typed and compiled language bro