#game-development
1 messages · Page 48 of 1
I guess I gotta learn shaders next
Oh now I can see it was the monkey head model 💀
tbf ursina is a little lacking in their in-house shaders
I'm sure you've got it tho
Idk how to do that gulp
Ursina has built-in matcap shader, triplanar shader, mask shader, fresnel shader, texture blend shader (even with blend texture), cast shadow shader, so it kinda has more shaders built in than Unity for example. It's just lacking a physically based (PBR) shader
draw a texture somewhere on the screen, fix some imaginary dimensions around that texture, get the mouse position, then check if that position is within those boundaries
I want to assume you're using pygame, so you can utilize their Rect class and collide_point method for this (I think is what it's called)
Selecting all of these faces to color them is annoying. But as lack of a creative as I am, I find this better than doing it in 2D.
» decorators
» defaultdict
» dict-get
» dictcomps
» discord-bot-hosting
» docstring
» dotenv
» dunder-methods
» empty-json
» enumerate
» environments
» envs
» equals-true
» except
» exit()
Anyone got any good free royalty music and sound effects that I can use for my game?
hi guys just started learning python watched a tutorial , using pycharm as IDE , so i could not get the local host
like local host doesnt opens a page , tried many times
Hello?
Any designers here? I need some designers
Who knows blender or 2D character modelling
Anyone????
I need them for my project actually I am building and 2D game open world
The game is on the concept of micro world & microorganisms
I have a story also
A brilliant scientist just made a formula to turn himself in micro form to explore the micro world!
This game can also contain fighting with different type of viruses & bacteria with his weapon exploration and a open colourful world full of adventure
Can you open a help thread in #1035199133436354600 and share screenshots, code and error message of what you're getting?
sorry but im showing it here
@minor cloak it actually another problem i got can ya see this
Why did you select .env?
Actually, this is not #game-development related. Can you open a help thread in #1035199133436354600 and we'll continue from there please?
ok
Ping me in the help thread when you're done
ok
This is as much game dev as I can with the limited time and limited skill I have. I would appreciate any feedback from other game devs.
Thank you.
Has anyone ever implemented a workbench in pygame
i'm kinda confused on how to import functions from different files into a main loop of code. for example i have a file named "functions" and it has a bunch of fuctions like "def room()" now how do i insert "Def room()" into my main game loop?
oh i didn't realize that i could just to "import file name" i thought i had to import something specific from that file never mind then
You could do from file import room if you are sure there won't be any name conflicts
What do you mean
yes
PyOpenXR and ModernGL.
Cool
Vr?
yes
How long did that take?
looks nice, where is this game(I mean which platform steam/roblox etc?).
can you share the game link
Hi guys is there any Telugu persons here and hi to everyone
@cold pelican yah DP was awesome
this is not a job board
cant install pygame
aha i did this: pip install pygame
doc: https://pyga.me/
Anything and everything pygame.
thx
pygame is an old library, let's say. it's no longer maintained and it not available for the latest python versions
pygame-ce is
VOXEL SHOOTER MAYHEM
GunSlaw VR is a flexible free-to-play online multiplayer VR shooter featuring a wide variety of voxel-based gamemodes. Engage in PvP combat with realistic gun mechanics in destructible environments where you can build your own defenses!
MODDABLE SERVERS
GunSlaw VR allows users to host servers and write custom plugins in P…
2026
Probably ~350hrs or so atm
if you need help for creating maps then lmk, i am creating a minecraft clone in roblox with some nukes. And during this i made a system that you can concert literally any minecraft map/build to database, then concert it to obj/glb/any 3d format. If you want you can share me any Minecraft map, and i csn create it for you. This will be good for you, as you can just open minecraft find some good battle royale maps, and directly add it your game.
I already made a tool for porting the maps. I don't use standard 3D file formats because the terrain is destructible.
Whats a good type of game to make for a college project? In my first year and for our finals theyre having us make a game with pygame. Thinking of doing a simple pixel dungeon crawler, anyone got any suggestions?
trying once more with pygame to finish something, got the first 100 lines in
has a state machine and a resizeable window
Impressive achievement! Didn’t know something like this was even possible with Python. Looks awesome 👏
just pip installed pygame-ce after reading this
and setcaption suddenly takes no keyword arguments anymore😭
I'm scared how much stuff is not gonna work now💀
It's positional only args, the / at the end of the function signature indicates that the parameters before it are supposed to be passed as positional only
what do you need help with
Pygame-ce is mostly backward compatible with pygame with only a few differences like this
I need to know which libraries I need for game Dev and how I can develop games with 3d models
You can use ursina for 3d game dev in python
Thamks!
wow
rope game
Should I add some music to this hangman game or nah?
how did u upload a 44sec video without nitro?
Anyone can
in dms? or here??
Anywhere
cuz i always have to trim by videos to 10 sec or less to avoid hitting 10mb limit
bro what
The video I screen record are always under 10MB
Maybe its recording at a higher resolution
That can cause the file size to increase
i dont think u can specify that in windows snipping tool can u
little project i am working on, heavily inspired by Paradox Interactive style games
the video is mostly showing map functions, the backend is still being updated
This server has max boost level too, so the max upload size on this server is 100mb
oh kk
Does he have someone who knows the Acarde library well? plz i need help
Are you looking for the python game dev library? Your statement is not very clear
If so, what exactly are you trying to build? game, GUI, animation, etc What issue are you facing? error, not understanding concepts, setup problems
The statement IS clear. Arcade is a well-known lib, even mentioned in this channel's description
Just ask your question. Nobody will know if they can help if they don't know the exact problem
set your bit rate to something like 800kbps or 100kb/s and you'll never record anything that can't be uploaded :D
alr
I want to make a 2D RPG game using the Accrad library, and basically my problem is that the camera doesn't follow the player.
I want to make a 2D RPG game using the Accrad library, and basically my problem is that the camera doesn't follow the player.
it would help if you shared code, so that we can review and see what might cause that problem
Anyone here who can help me making minecraft hacks
Minecraft mods are probably better made in java than python
hi guys i am new here is someone interested in trying my simple text-based game because i want to add ideas to it and i don't know what to add
I'm currently working on the procedural level generation and the combat system — I've got the basic dungeon crawling working but still polishing the enemy AI.
Do you have any screenshots or short video clips of the dungeon crawling working?
Not yet, I'm still using placeholder graphics, so I haven't taken any screenshots or videos.
Thats fine. We do use placeholder graphics/models all the time when developing our games.
Like this one for example. https://youtu.be/iutyzZDoal8?si=KVLwbppsy5dZhEZ- I used basic models just to show that I got something in progress and working (eventhough its partially working at the time).
got it
does this look like a button/pressure plate?
It does. Maybe darkening the walls would make it pop up more as interactive
It might be confused for a lone, round obstacle
I don't understand what is supposed to be a pressure plate tbh
whats this app?
the app i used to make pixel art is called libresprite if thats what u r asking
cool
like the one u step on and then it activates and maybe opens a door or smt
No I mean what on screen is supposed to represent a pressure plate
the middle 2 ones are pressure plate rest are just normal tiles
ig the tiles look a bit off
Hey guys
can we actually develop 3D games with python ?
Hi Python community!
I'm excited to be a part of this vibrant group focused on the Python programming language. As a passionate developer, I specialize in full-stack development and machine learning, and I'm always eager to learn and share knowledge.
My background includes a solid understanding of both frontend and backend technologies, and I enjoy building applications that leverage Python's versatility. Whether it's creating web apps, automating workflows, or diving into data analysis, I'm all about finding practical solutions that make coding accessible to everyone.
Core Expertise:
- Frontend Development: React, Vue.js, and Tailwind CSS for creating responsive user interfaces.
- Backend Development: Proficient in Python/Django and Node.js, ensuring robust server-side logic.
- Machine Learning: Experience with building and deploying models using libraries like TensorFlow and scikit-learn.
- Automation: Using Python to streamline processes and enhance productivity.
I'm looking forward to collaborating with fellow Python enthusiasts, sharing ideas, and possibly working on exciting projects together. If you are interested in me, please DM me anytime.
yeah, you can use opengl or a pygame engine to do so and its really easy to learn
Nice. You trying to create a Doom clone?
Actually, this was just a project to see how far my phone could handle raycasting, and I discovered I don't even need it; I can use 3D.
I made a test matrix for 3D to test it out; I'm developing a new project using 3D.
Ya, I don't have a PC.
I see
Animation test for a game I’m making.
(I’m gonna be using renpy)
holy shit this looks so fire
kinda reminds me of "no im not a human"
oh that's pretty good i have a course so i will check on it ☺️ thank you so much.
but is it enough powerfull to build RPG 3D games ??
Yeah you just need to optimise if it's complex
Because it's all CPU based
But you can off load stuff to gpu
lol, yeah after I drew the initial sprite It took a sec for me to be like “wait a minute-“, eventually I’ll do a slight redesign though, but the game I’m making is about OCD and I asked my friends and family what color ocd was and they all said blue/green/purple.
nothing wrong with it being similar to that game
i love that aesthetic
Tyyyyy
im learning python, im using sololearn, is it good?
yes that's great
ok thanks
I’ve been working on a CLI Pokémon game for my first project and just finished a big update to the battle system. It now features dynamic moves pulled from an API, a working XP/leveling loop, and a way to track team stats. I managed to squash the main crashing bugs and cleaned up the UI to make it feel like a real game. As a beginner, I’m pretty stoked it’s stable, and I’d appreciate any advice on what features I should try to learn next!
Is there any 3d game making software that I can plug into renpy?,
Like for a mini game in a visual novel.
Hewwo! I'm looking for Q&A testers for my game. It's a 10 minute play and I would just like a recording of some of your gameplay, with audio if you can for reactions. It was made in Godot and is a Horror Game
Hell yeah
Send me a DM if you still want to Q&A
Hey guys! I am new here, in a little bit I am going to send a small ish message if what I am trying to do and hopefully I can get some help! I am brand new to using Python
hey guys
i made a cool game
its a.. simulator, grid based, i made it with numpy, and it simulates a bunch of materials interacting on a grid
i optimized it as much as i could, and its not too bad, considering my old machine
i packaged it into an executable, for windows only though
i dont know how to package for multiple plataforms, here's the link to the itch.io page
Flipping Numpy!? I had no idea that was possible. I'm very curious to see the code behind this!
I played around with it for a little bit and everything seems to be working well! Pausing the game does unlock the FPS but i suppose that doesn't matter.
hey im back, press f to unlock fps, and press d to toggle the display on or off to make the performance even better
@novel narwhal
also i used numba njit to optimize
i did it in about like 1113 lines
also do you think i should change anything about the page
Is there a git repo I'd love to see what you done with numpy
@feral leaf share your pong game and progress here
show a quick video of you playing it
!codd
How wow the trigger worked even with a typo
Its a start
shall i add a pause gameplay and a start gameplay thing
sure if you want. But I thought the challenge was to have 4 players playing simultaneously (except its 1 human player vs 3 CPU players)
ohh
lemme make that too
3 BOTS ARE BEING TO HARD
sorry for cap
3 bots are very hard
can i do one?
@minor cloak
wdym?
if i do vertical they just feel like one big pong line
they are gonna try and get ball no
isnt that the point?
Click here to see this code in our pastebin.
they will stick
what does that mean?
Did you understand what I said about putting them on top, bottom, left and right?
got it
Do you? 
no
Like this
I have to go. I'll check back later
Cool. But I think the game needs to be a bit more challenging. Can you introduce ball power-ups?
Various power-ups will spawn in the middle and if the ball hits it, it gains and immediately uses that ability.
Some examples:
- Multi-ball: The ball splits up into 3 new balls going in different directions.
- Fast ball: The ball speeds up really quickly but momentarily
- Trick ball: The ball splits into 2. One is fake (with no collision), the other is real.
- Spin ball: Once picked up, the ball will start to swerve. So the projection isn't linear/straight. It can curve towards a different direction (even possibly do a U-turn)
As it is, if you play the game... do you find it fun to play? If you give this game to someone, will they enjoy it?
my broter enjoyed it
it may seem extra but it's just generally a good way to practice scalability
maybe you'll find certain parts of your code that prevent that 
sadly i dont know how to mess with github so no
I'm just starting and I've been using Exercism to practice and one was to make a Pacman code
Honestly now I'm very curious, how much can you do only in Python?
Can you post the raw code then? It's all good if no but I'd love to see it since I need to use numpy to handle alot of objects too.
Hello everyone
i really don't know this lib but with some search i found this
im trying to make some code where a gif i have downloaded is moved around on a window based on keypresses. the code runs with no arrows, but nothing is shown on the window.
import pygame
pygame.init()
done = False
size = [1000, 500]
screen = pygame.display.set_mode(size)
x = 500
y = 250
stupid_mario = pygame.image.load("stupidmario.gif")
while done == False:
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True
screen.blit(stupid_mario, (x, y))
keys = pygame.key.get_pressed()
if keys[pygame.K_LEFT]:
x -= 5
if keys[pygame.K_RIGHT]:
x += 5
if keys[pygame.K_DOWN]:
y -= 5
if keys[pygame.K_UP]:
y += 5
never mind i was missing some lines
this error is happening now, and im unsure what im doing wrong
error:
File "/home/hannah/stupidmariomover.py", line 2, in <module>
import gif_pygame
File "/home/hannah/gif_pygame/init.py", line 1, in <module>
from gif_pygame.gif_pygame import load, save, GIFPygame, version
File "/home/hannah/gif_pygame/gif_pygame.py", line 29, in <module>
from ._common import is_ce, FileLike, Point, RectLike
File "/home/hannah/gif_pygame/_common.py", line 20
else:
TabError: inconsistent use of tabs and spaces in indentation
this is my code
code:
import pygame
import gif_pygame
pygame.init()
done = False
size = [1000, 500]
screen = pygame.display.set_mode(size)
x = 500
y = 250
stupid_mario = gif_pygame.load("stupidmario.gif")
while done == False:
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True
screen.fill((0, 0, 0))
screen.blit(stupid_mario, (x, y))
keys = pygame.key.get_pressed()
if keys[pygame.K_LEFT]:
x -= 5
if keys[pygame.K_RIGHT]:
x += 5
if keys[pygame.K_DOWN]:
y += 5
if keys[pygame.K_UP]:
y -= 5
pygame.display.flip()
pygame.quit()
You need to either use tabs, or use space, but not both
ok thanks
i deleted all the tabs and spaces from my code and put them back in all as tabs, but the code still gets the same error
Hey everyone,
I just released Moon Traveler — a fully offline terminal survival game where you crash on Enceladus, talk to 10 alien archetypes using a local LLM (or pre-written dialogue), explore procedural ice fields, and repair your ship before you freeze.
It’s my first real game and I used Textual for the entire TUI.
I’d love two things from the community:
-
Play it and give me honest feedback (difficulty, fun, bugs, what to add next). Download here: https://elephantatech.github.io/moon_traveler/
-
TUI game dev tips — I’m especially looking for advice on:
• Real-time game loops and live widget updates in Textual
• Clean command input / history / autocomplete patterns
• State management for games with procedural maps + many dynamic elements
• Performance best practices
• Any TUI-specific design patterns you wish you knew earlier
GitHub: https://github.com/elephantatech/moon_traveler
Super grateful for any tips or play sessions — thank you! 🚀
Still need help with this
you didn't replace the tabs or spaces to be consistent. Just replace them with tabs and it should be fine
did you save the file before rerunning it?
It forces me to, yeah
and if you rerun it, did you get a new error message?
Same error message
then you didn't change it
how are you editing your code?
Are you using IDLE or Thonny or VSCode or PyCharm or ??
IDLE
can you share a screenshot of your IDLE please?
The error is happening in a different file
Oh?
gif_pygame.py
well... gif_pygame/_common.py to be exact
oh you're using the other pygame
not pygame-ce
maybe not relevant now but I hear pygame has bugs and pygame-ce is more stable
But thats not relevant to your error atm
Now it is
it is what?
What did you set surface to?
Maybe also uninstall pygame and install pygame-ce as the warning says so
If I uninstall pygame, wouldn’t other code ive made get affected?
I’ve used pygame in multiple pieces of code
pygame-ce uses the same namespace as pygame.
Ok
The error relates to your Surface... however you've been setting it to https://github.com/pygame/pygame/issues/4015#issuecomment-1773709764
I don’t understand
what is gifpygame? where is that from if you didn't code it?
how did you use this into your game? Did you download the files from pypi or ?
i installed the package from my linux terminal
whats the command you used?
thats for pygame. not gif-pygame
oh oops
how did you get gif-pygame source files?
can you show me the output for pip list?
it doesn't look like you installed pygame or pygame-ce or gif-pygame tho
what happens when you run this?
i have it installed
how did you install it? If you installed it properly, it would show up in pip list
Did you have a venv?
yeah
ok... activate your venv first, then pip list
how did you get these files here?
ok wait, some stuff is here
(venv) hannah@penguin:~$ pip list
Package Version
aiohappyeyeballs 2.6.1
aiohttp 3.13.3
aiosignal 1.4.0
attrs 26.1.0
cffi 2.0.0
davey 0.1.4
discord.py 2.7.1
frozenlist 1.8.0
gif_pygame 1.2.2
idna 3.11
multidict 6.7.1
packaging 26.1
pillow 12.2.0
pip 23.0.1
propcache 0.4.1
pycparser 3.0
pygame-ce 2.5.7
PyNaCl 1.6.2
pyttsx3 2.99
setuptools 66.1.1
typing_extensions 4.15.0
yarl 1.23.0
(venv) hannah@penguin:~$
copy paste after downloading
you shouldnt need to copy paste after downloading... thats wrong and that breaks everything including that tabs vs spaces error
it worked in the past
like ill copy all the folders downloaded and move them where needed
whats your python version?
hannah@penguin:~$ python3
Python 3.11.2 (main, Apr 28 2025, 14:11:48) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
thats not how developers use python. We set up a venv, pip install in that venv, and thats is then ready and available for us to import into our python files whenever we want. No need to "move" or "copy paste" the files. That is very unnecessary
oh
anyways, Imma test your code and see if it breaks something else
gif-pygame is underwhelming unused but there a few issues its raised in the repo
this may be one of them
share me the stupidmario.gif file
Im getting a diff prob tho
pygame-ce 2.5.7 (SDL 2.32.10, Python 3.11.14)
Traceback (most recent call last):
File "C:\Users\User\sides\soapgame\main.py", line 2, in <module>
import gif_pygame
File "C:\Users\User\sides\soapgame\.venv\Lib\site-packages\gif_pygame\__init__.py", line 1, in <module>
from gif_pygame.gif_pygame import load, save, GIFPygame, version
File "C:\Users\User\sides\soapgame\.venv\Lib\site-packages\gif_pygame\gif_pygame.py", line 27, in <module>
from packaging.version import Version
ModuleNotFoundError: No module named 'packaging'
gif-pygame is buggy
yea but they should add that in their setuptools
And yea I'm getting the same tab and spaces inconsistencies error like you had before
And its from gif-pygame
Its buggy
i fixed that manually
Can you consider using something else?
I got it working @small pond but it involves changing a few things to gif-pygame. I've raised a couple of pull requests to his repo https://github.com/Zeperox/gif-pygame/pull/8 and https://github.com/Zeperox/gif-pygame/pull/9
Lets hope he approves them. Until then, you better unlearn how you're managing pip packages by copying and moving files across. Thats very bad practice.
how does coding fit in roblox
What does that mean ? What kind of answer are you expecting
you guys know a place where i could search for ppl interested on making a game?
the best way to get people interested in making something with you is to make something first. If you do this, then the people who are interested in working with you will have more sincere an interest.
If you want to make something that involves a lot of people, then your problem isn't related to programming anymore, it's about team building and human resources
Hello, everyone! I've been working on a free of charge open-source game and would love if y'all could try it and share some feedback. Here's a small gif
I just posted about it in the showcase channel, here: https://discord.com/channels/267624335836053506/1496942984548057258
Hey, I wanna start game developing using python and im not sure what tutorial to start with, what would yall reccomend
Tutorials by Clear Code on youtube are really good
<@&831776746206265384>
Hello @ocean pasture, I've deleted your post as this is not a job board.
I second this
I speak as someone who learned pygame and raylib from him
Hey, look so cool =))
what are the best python based game engines ngl
!pip ursina
Hello friends! I hope you are doing great.
Is it good staff to learn game development in python?
SOmetimes I watch some videos about the c++, because it's the classic and I love it actually, also for gaming is the best.
If I learn gaming in python, Can get a job or make some big project what will make for me money?
what is your experiencee, Do you recomend learn game development in python and why?
If you want to do game dev professionally then I wouldn't recommend python. You can definitely make some insane games with python, but it isn't an industry standard yet. Most companies use game engines of some sort. Unity, Unreal, CryEngine, etc.. (they stay away from oss engines though for some reason) some even have their own proprietary game engine too (which most likely run on c++ or c#).
Making games in python as a hobbyist or as an indie is good enough if you're comfortable with that
But also doing game dev professionally is a bit risky, you might want to do some research on that if you havent
Thanks a lot, for you attention)!
I agree with Jiggly. Not only for Python, but for other languages as well, there is much untapped potential when it comes to gamedev, but it is not an standard, so it means there'd be much trailblazing involved.
That said, if you care to learn Python really well, the risk is also a bit counterbalanced by the fact Python is valued both in and outside gamedev. It means the time and effort you put into learning Python, building a codebase and solid skills won't be wasted even if you don't succeed as a game developer.
Even so, as Jiggly pointed out, extra research is needed, because other factors are at play here, like where you live and the available opportunities, the state of the job market, etc., etc.
Thank you for your attention!
Yo any roblox devs here
When making a server authoritative game over websockets, how do I reason about how to construct a gameplay loop (server side, I'll leave client side for another day)?
Like, for example, suppose I would like to say, synchronise players at 10hz. Do I batch messages in 1 tick, taking their most recent action, then calculate positions and send messages back in the next tick? Any rough outline of how to do something like this would be great.
I'm also wondering if doing stuff like this over websockets means you're fighting against what TCP wants to do like queue up messages
Realtime multiplayer?
TCP is a problem. The issue is packet loss. If there is any at all it basically does not work due to TCP's resending, attempting to make sure the message gets there. With UDP games can function under like 30% packet loss.
However, if everyone playing has a solid connection, then it's fine.
This part can also be swapped out later for UDP. It's a lower abstraction layer that can be replaced if your have the right abstraction layers in your code.
In general there is the underlying sending mechanism layer, some read/write stream layer, and a remote procedure call layer (this is the level the game is built on (call function on remote host with arguments)).
I get what you're saying with respect to modularity and being able to swap it out. That's unlikely for me since it would mean moving to HTTP3+QUIC+WebTransport and I can't see that happening any time soon. But, in your experience, is it possible for me just drop packets/drain the socket when the tick has finished?
My thoughts for movement are something like we get the latest action within this tick and then process and send back a message the next tick
Then the client renders the movement.
As long as there is no packet loss TCP is often fine. You need to disable Nagle's algorithm though. For when to send sync updates, they are on their own timer, like 20 hz. In the main loop you just keep track of a counter here. This can be at the start/end before/after you call tick on your game to have it simulate, does not really matter because either way the state the client receives will always be behind (past state).
Ah wow thank you very much for your input, makes sense. In terms of disabling Nagle's, I imagine that it can come with downsides too?
Make sure your tick function is fixed delta time btw, not variable, so the clients can run something that actually matches (somewhat, not perfect match due to things like browser versions, floating point hardware config, etc).
Nagle's algorithm is really bad for games, not its intended use case.
We don't want to buffer to send less times, we want less latency.
We are ok with spamming packets like a fountain of data to the clients.
Yep, makes sense. About this:
Make sure your tick function is fixed delta time btw, not variable, so the clients can run something that actually matches (somewhat, not perfect match due to things like browser versions, floating point hardware config, etc).
I'm sorry for the rookie question but why does my client side matter in this case? Surely it just renders what the server says it renders (within reason for the sake of latency like some interpolation)? I thought all I'd need to concern myself with on the client side was matching montior frame rates to the game and that sort of stuff
For responsive realtime multiplayer the client also simulates the game, it does prediction, and upon receiving state needs to rewind and replay to fix mispredictions / sync.
Oh I see alright, does this level of sophistication on the client side reduce as we get more lax with the ticks on the server side? I really just want to do a click and move game that is a little more turn based?
So I'm thinking server side 10hz
If your game is like a RTS or MOBA, then you don't need this fancy stuff mostly.
You're a legend, thanks for the advice I'll be referring back to this often.
If you do end up needing the fancy stuff: https://www.gabrielgambetta.com/client-server-game-architecture.html
Oh nice! Bookmarked.
Start with the most simple version of just sending the state from the server to the client at some fixed rate, and then the client just setting their state to that. Once that works (it will be jumping around due to receiving old state at 10 hz and no animation/interpolation), looking into animation/interpolation so it's not just jumping from one state to the next received state, but animating between states. If that feels too unresponsive then you need prediction, not just interpolation. But at lower pings and high send rates (like at least 20 hz), this should feel find (since you just click and then the character moves themselves via pathfinding or such).
Perfect yeah that's what I'm working on at the moment. Just trying to set up the client in such a way that this is easy to test and verify.
One final thing please @normal silo , is this going in the right direction: https://paste.pythondiscord.com/IGFQ?
where pygame dc
hello i'm new here
can any of you pleaseeee try my project
https://discord.com/channels/267624335836053506/1499669444883120229
its a small game
and its my first project
the coding might be a lil crappy ngl
and pleaseee rate it after playing while keeping the fact that im new in mind :3
hey, I just try you the program and I will say if you play it for the first time it's pretty entertaining but it start to get boring. nice coding btw 7/10. I'm also a beginner and learning the fundamental of python
nice code for your first project, hope to create my own soon (idk what kind)
hello??
Yes ?
made some scuffed pathfinding!
hi
Hi
Hi Python community!
I'm excited to join this vibrant group focused on the Python programming language. I currently work as a full-stack developer with a keen interest in AI applications. My expertise lies in developing practical systems that incorporate AI alongside full-stack development, delivering real-world solutions.
Core Expertise:
- Frontend Development: Proficient in React, Vue.js, and Tailwind, creating engaging user interfaces.
- Backend Development: Experienced in Python/Django, Node.js, and Express, building robust server-side applications.
- AI Integration: Working on projects that combine AI features into web and mobile applications, enhancing user experiences.
- Mobile Development: Familiar with React-Native and Flutter for cross-platform mobile solutions.
I am passionate about collaborating and exchanging ideas within the Python community. I believe in making coding accessible for everyone and am eager to contribute to projects, share knowledge, and learn from this diverse group.
If you are interested in me, please DM me anytime.
Looks like copy pasta at this point
But nice skill set of it's true
If
!rule 6
Hello, I'm very bad at English like wrong grammar. Can anyone help me or give me a reference code on how to make a category for subclasses, Like Example dreadnoughts and Jackals. Dreadnoughts are straight forward and high damage, and Jackals are speed and evasion can anyone help me through dm's? Thank you very much^^ I'm new at coding I started like about 8 days ago.
You can post your code here and point what you tried, or at least what you want to do specifically
yo chat is this good?
also someone told those dont look like boulders
I'd probably say make the boulders a bit smaller e.g. 1.75x1.75
what did u mean by 1.75x1.75
aah gotcha
@knotty wagon which one in this?
probably the one touching the bottom of the tile
I feel like the second one works better, purely due to it taking up less screen space and being less harmful on your eyes
yea okie
Inconsistent pixel sizes. All pixels should be the same size.
didnt get u
Some object's pixels are bigger than others.
Or not aligned with the global pixel grid.
In pixel art pixels can't be half way above others.
but i made everything on 16x16
so are u saying make objects on higher resolution?
yea thats why we went with second one
This is happening in both options.
Imagine you drew the entire frame as a single image in pixel art. This would not be possible.
so u r saying is alignment is a bit off right?
Yes, alignment needs to be exact, and all pixels the same size. So you can't just scale up the sprites.
ok thanks
I know a bunch of games ignore this. But then it's not actually pixel art, and is IMO bad. It's inconsistent, no longer clear where things begin and end in the way that pixel art normally gives.
Basically it's very tempting to just take the object and set their scale to like 0.75. But really they need to redrawn to the correct scale.
This is part of what makes pixel art pretty labor intensive, since you might find you need to redraw things later when it's not what you want/need anymore.
Here can be seen that even though the character gets smaller, the pixels are always the same scale, and aligned with a global pixel grid.
This requires the character to be redrawn for each scale as how they are drawn changes.
yea the thing was, the layer i was using didnt have a good grid or tile system,rather place it anywhere which i fixed thanks
While you are on the topic of messing with this global setup stuff. I recommend getting the scaling correct (the sampling method).
So your game scales up to any screen size correctly.
IDK what engine you are using, so I can't really give advice on how to do this.
I would just be aware of it.
Ok, Pygame-ce can scale things for you well.
You can basically target some fixed resolution or set of resolutions (different screen aspect ratios). Then have pygame scale that up to the full screen size for you (or whatever the window size is). What matters is that it then matches the aspect ratio of the screen. Or you can optionally ignore the aspect ratio of the screen/window and render at some fixed aspect ratio (one resolution) and then in that case depending on the window shape some things may be out of view/outside the window, which may or may not matter in your game.
Or you can add letter boxing or pillar boxing.
hmm i will look into this
@normal silo this is my first time making a game, and i was trying to get some experince before the next game jam so i can participate in it maybe
and thanks ❤️
Ah, in that case as long as this does not distract too much. But I recommend just getting anything finished, even if not ideal visually and such. But scaling up is required (and simple) for pygame. It's software rendered (no gpu) and so it can only handle low resolutions, which happens to not be an issue for pixel art, because you can target a low resolution and have it scale it for you (it's a simple setting in pygame (SCALED IIRC)).
(Note that you don't need to leave pygame to do things that would require the GPU, it's just a lot more involved then (requires learning opengl, e.g. the moderngl library))
k
is there anyone looking for a dev?
This is not the server to look for jobs. Go and post it on Upwork or Freelancer sites. Not here.
I need help with a game
it would help if you can share the problem directly instead
I'm making a futuristic football game but don't know where to start
what is a futuristic football game and how is that any different from normal football games? Have you made any game before this? What game engine will you be using to build it? Do you have the sprite/character assets to build this game? Would you be controlling 1 football player or multiple football players?
This will be a multiplayer game that lets you build your own character and costumeise the suit and depending on your character build you'll get boosts but if playing story mode you'll only play the main character
That look very ambitious, do you gave any experience with python ?
sounds like a regular platformer game with extra steps. Have you made a platformer game before?
No, I haven't
start there. Build a simple platformer game first. If you can handle that, then you can build your football game.
How
have you decided on what game engine you're gonna use?
Python
Thats just the language. Here's a list of game engines in Python that you can look at. https://pyweek.readthedocs.io/en/latest/libraries.html
Do your research and decide if you still want to do it in a Python game engine.
Once you decided a game engine, then look up tutorials on how to build a platformer game in that game engine
I might do arcade
where were you getting platformer there?
Moving a football player around a field is the same mechanic as any platformer game
not really. there is pretty much only one platform there, platformer means jump and run usually
he may as well just start making that football game
exactly. its not that hard to make. He's just making it seem like its super complicated for the game he envisioned.
anyways, thats up to him
it's some of the same problems, I was mostly talking about actual game genre definition.
players still move of course, needs some physics or trajectory for the ball, hitboxes etc
or make it more stat dependent
anyone know of some tutorials/readings that talks about battle logic/leveling up characters? I'm pretty new to programming (few months), but trying to push my way through making a CLI game (16x16 grid/map, chance on move for a battle, some squares give you items or treasure, which ups chance of getting into a fight).
Does anyone here knows how to hack a game please 🙏
i feel like this covers a lot of it
Thanks to Brilliant for the support, you can find them here: https://brilliant.org/ClearCode/
This video covers game development in Python. We will create a spaceship shooter, a Vampire survivor style game, Pong, a platformer and a Pokémon inspired battle game. Via those you can master your knowledge of Python since we will touch on every par...
oh
really?
ye
does it start from 0 like from print hi?
oh a 11hr vid ok
no but a lot of the logic of game dev
I just want to learn python syntax and python stuff
plus he is "interactive" with the users by making you think of what is happening before it happens
https://automatetheboringstuff.com/ i would recomend this to you then
A Page in : Automate the Boring Stuff with Python
ok I tagged it #python I'm learning python after I finish something so I'll give this a try.
I already know about this I think
but I forgot to tag it... good catch.
if I don't tag it on bookmark I never find it so thx
man my task.md is already full but sadge I'll add these... For the sake of python :D
class BaseGame:
_logic_handler = None
_draw_handler = None
def __init__(self) -> None:
self.screen = pygame.display.set_mode((600, 600))
def run(self):
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
exit(0)
if self._logic_handler is not None:
self._logic_handler()
self.screen.fill(background_color)
if self._draw_handler is not None:
self._draw_handler()
pygame.display.flip()
class BlackJack(BaseGame):
def __init__(self) -> None:
super().__init__()
self.deck = Deck()
self.dealer = [self.deck.get(), self.deck.get()]
self.player = [self.deck.get(), self.deck.get()]
def _logic_handler(self): ...
def _draw_handler(self): ...
```i love my boilerplate
XD
tbh i wrote a whole notebook full of python scribbles
Thank you! I'll definitely check it out
pygame.event.get()
what do you do when you want to access the events somewhere else?
or rather, what would you do if you want to check for something like:
event.type == pygame.KEYDOWN and event.mod == pygame.KMOD_LCTRL and event.key == pygame.K_z (ctrl-z)
Still adding stuff to the boiler plate im thinking of making registery hooks to the keys or make predefined functions
(I used to have one that had most of my needs but forgot to save it online so when i reinstalled my os i lost it all hahahah)
i see, well as long as you're thinking about it
play now --> https://github.com/nytsom/Galaxy-Blast
https://github.com/nytsom/Galaxy-Blast/blob/main/GameMain.py#L20 says you have an image file but your repo doesn't have this file
GameMain.py line 20
icon = pygame.image.load('space.png')```
Hey can any one just suggest me a source from where I can learn about pygame and can actually make my own game as I have never used pygame any before
Here are some tutorials: https://pyga.me/docs/#tutorials
u can make 3d games with pygame?
you can use pygame to handle the window and use moderngl to access the opengl pipeline
it would be the same as making a 3D game "from scratch" ™
i mean technically if you know your math right you could kinda make a 3d game with the 2d objects of pygame
but it would be slower than to just use moderngl or opengl
https://paste.pythondiscord.com/Z6TQ an example of what i made i used a turtle project as a reference
i also have one where its a more modular aproach of the cubes but my math to simulate depth is a little off
true I have to push that to the gh
s
Hii
hi
Hello there
yes
Yes
i am trying to validate my product idea, so would you pay to use a ai co pilot for blender
it is like you can prompt or use voice commands , to make your desired model step by step ,you control each step as well as the next step , rather than directly prompting the entire ideal 3d model/character uncertain Step 1:
Create humanoid base mesh
Approve? → yes
Step 2:
Add proportional limbs
Approve? → yes
Step 3:
Add rough face topology
@proper inlet would you pay to use this ? if yes how much is valid to pay per month ?
Before I make more questions, what do you (yes, you again! The reader! Hello!) think of this?
Hi
Start with the first example here: https://www.pygame.org/docs/
I’m not starting pygame yet tho unfortunately I need to learn the basics
I’ve got it covered dw
More coding less social media
You can run that first example without knowing much
Yooo I’ve been sleep deprived for like 3 days I’m tiredddd can’t lock in wallah
It's pretty good but there some improvements you can make to it-
First.
Use collections.abc.Callable instead of typing.Callable as the latter is deprecated.
You can pass in arguments to the generic classes to be more specific on the arguments & return types of the callable, like so:
from collections.abc import Callable
def foo(func: Callable[[int], str], num: int) -> str:
# func takes in a callable of 1 argument which needs
# to be an integer and returns a string.
return func(num)
def my_func(number: int) -> str:
return str(number)
print(foo(my_func, 10))
Second.
Stay away from using global within functions, in many cases it's the worser option. Instead pass in arguments and return the data, as the variable mutation point becomes more explicit and easier to debug. You can read this for some more info.
Third.
A minor improvement, I see you have this over here-
qdraw_args: list[Any] = [0, 0, 1, True]
And later on unpack it to a function call-
current_question.draw(*qdraw_args)
In fact, this is the method's signature:
# method of `MouseQuestion`
def draw(
self,
start_x: int = 0,
start_y: int = 0,
draw_bombs: bool = True,
draw_question: bool = True
) -> None:
OR
# method of `Question`
def draw(
self,
start_x: int = 0,
start_y: int = 0,
qa_newlines: int = 0,
draw_question: bool = True,
draw_answers: bool = True
) -> None:
As the type of current_question is MouseQuestion | Question , If you notice, the only real difference between the default args and the arguments passed in is the 1 from the list which goes to the draw method of the Question class only.
So you can write it like this instead:
if isinstance(current_question, Question):
current_question.draw(qa_newlines=1)
else:
current_question.draw()
to be more explicit about the arguments you're passing. But either way, if you still want to unpack an arbitrary args variable like you have, use a tuple instead of a list to type hint it better:
qdraw_args: tuple[int, int, int, bool] = (0, 0, 1, True).
Fourth.
You don't need to use match case at all in your program as you're not making use of python's pattern matching system. Match case does not work like switch case in other languages. You can read about how to use them correctly here. For your case simple conditional statements is the best choice everywhere.
Fifth.
I see you catch for AttributeError in some places. You don't need them at all.
And lastly, you can use a type checker to check if your type annotations are actually correct and if your program is type safe
I see! Thank you! (But one thing, I use the Attribute error because when switching from a MouseQuestion to a Question and vice versa, the lines of code after advance_question() runs would start working on the wrong class and give me an AttributeError.
Ah that's why, my type checker couldn't identify that. Another reason to not use globals
Do any of you want to try my game?
Sure, why not
anyone here making a game with 64x64 or 128x128 pixel sprites or something like that?

pygame-ce: https://pyga.me/docs/
(btw)
guys im making a game with python and im using ursina as an engine but every time i run it doesnt run a game it just says point 0 wat engine should i use to make a fairly simple game
pygame will work fine for simple games
Or you can try to understand what's wrong with your ursina
Unless he is trying to make a 3d then i would suggest ursina and panda3d more depending on knowledge
ok thansk
First you need to define your texture
texture = pygame.image.load("path/to/image")
Then you need to blit your texture
scr.blit(texture, (0, 0)) #> texture, rect style
at very first the game screen needs to be initialized
i know there's gotta be some peeps in here who like retro video game music
Hi Python community! I'm excited to be a part of this vibrant group focused on the Python programming language. I currently work as a full-stack developer, specializing in web and mobile applications, automation, and integrating AI functionalities.
My experience includes:
- Frontend Development: Proficient in React, Vue.js, and Angular.js, I focus on creating user-friendly interfaces that enhance user experience.
- Backend Development: Skilled in Python/Django and Node.js, I build robust APIs and manage server-side logic to support seamless operations.
- AI Integration: I enjoy incorporating AI into applications, enhancing functionality with features like chatbots and intelligent data processing.
- Automation: I leverage Python and various tools to automate workflows, making processes more efficient and effective.
I believe in the ethos of the Python community that anyone can learn to code. I'm always eager to share knowledge, collaborate on projects, and help others on their coding journey. If you're interested in discussing projects, ideas, or potential collaborations, please DM me anytime!
Why post this in the game dev channel tho?
I want to learn to make API and I currently only know basics of python and don't even know OOP, can you teach me? Please..
Hi or python you need to use packages to can use some of the apis
there is existing packages that might help
like tkinker or what ever it is named and also ctypes if already installed in some versions of python. Dont forget that you have to install pygame pillow and more for some of the packages to work
I once mad emy ai with python
using deepseek
plus permanent
if yall wanna try something new yall can give me suggestions
and il make them.
People just downright advertising in this channel 😞
I tried remaking something that you might find a little familiar.. on the left is the first few days of development
Worked on some food bowls and plates. https://reqxel.itch.io/food-16
What should I pixel next? ping me.
damn
maybe furniture?
Made some modular tables and chairs here. https://reqxel.itch.io/object-iso-32
Do you have other furnitures in mind?
oo yeah you've posted this before
These are impressive
Do you have one with plants? Rocks/stones/grass/terrain would be amazing too.
i think i have a leak somewhere lmao
Tuff
Why is this channel filled with ads 😭
does anyone know about Five m?
m what?
@foggy python's YouTube PyGame tutorial: https://www.youtube.com/playlist?list=PLX5fBCkxJmm1fPSqgn9gyR3qih8yYLvMj
A showcase of some of the cool stuff you can do with PyGame:
https://www.youtube.com/watch?v=oej7DQQjSfY
All of the projects aside from Shadow Tower can be found here:
https://cmlsc.itch.io/
Shadow Tower can be found here:
https://alakajam.com/7th-alakajam/782/shadow-tower/
This is a collection of my Python/Pygame projects from 2019. Shadow Tower, Spellcaster's Forest, and Bou...
Kivy's gallery, with several games featured: https://kivy.org/#gallery
thanks for the suggestion to create this channel, @mighty rose, as you can see we went ahead and did just that. When you see this, can you tell us what some of your favorite learning resources for game dev in Python are?
Al Sweigart has two excellent books on writing games with Python, and both can be accessed for free on his website:
https://inventwithpython.com/invent4thed/
http://inventwithpython.com/pygame/
@mortal bridge @karmic patio you guys familiar with any more gamedev oriented Kivy tutorials, videos, stuff that might be nice to add to the pins here?
Getting started with Kivy, from @karmic patio's site, includes a ton of very useful information, including a game tutorial for how to make pong.
http://inclem.net/2019/12/19/kivy/getting_started_with_kivy/
damn, there are very nice things in this video, i wish i had spent more time building little games like this, but i don't get ideas for these 😐
i don't know of much documentation in this direction, aside the kivent doc https://github.com/kivy/KivEnt/wiki/An-Introduction-to-KivEnt, http://kivent.org/docs/index.html
has anyone used panda3d and/or render pipeline? thoughts on them?
Ive used it once, but found it surprisingly slow... I might have been doing something wrong though ;)
Has anyone tried python arcade? I was going to myself but since newer pygame uses SDL2 it might be good enough again
Pygame 2 (the version that uses SDL2) only has development builds atm.
So make sure you get those if you use Pygame.
@untold lodge Thanks! I really appreciate this channel's creation. I'll do my best to contribute!
In terms of learning material, there's a ton out there for sure, though the parts that seem to be missing the most are "beyond the simple", like when you get to a relatively large feature set, debugging performance problems, that sort of thing. Again, these could all be boiled down to "how to do XYZ in Python" and not specifically game development, though I had struggled for a while with performance with kivy (spoiler, I put things together really poorly at first! 😄 ).
Anyway, for the material I've learned from (specific to Python, not game design or development in general, which is a whole other ball of wax 😄 )...
Arcade is created by Paul Craven, he uses it to teach Python and programming concepts, and while there's not currently a path to mobile with it, it is quite approachable. http://arcade.academy/ is a reflection of some of Paul's teaching materials he uses in his class.
https://www.youtube.com/watch?v=Djtm1DzWSvo
Kivy
-
Richard Jones was one of the tutorial authors that really got me started. He is known for running PyWeek (https://pyweek.org/), and contributed to cocos2D-python in its earlier days. If you need an intro to using tilemaps, he frequently uses them (in the form of Tiled TMX files).
There are probably "better" ways to do things than he has in the tutorial he created for a Kivy game, but it works!
https://www.youtube.com/watch?v=U14P8gtjQmU is a talk on that, and I am hunting for the original repo of that tutorial... found it. It's probably needing updating at this point (from 2015). https://bitbucket.org/r1chardj0n3s/kivy-game-tutorial/src/master/. He also has pygame tutorials on youtube and elsewhere. -
Erik Sandberg has been creating Kivy videos, his Flappy Bird tutorial here https://youtu.be/2dn_ohAqkus
others
-
Al Sweigart is a great source for getting started in games, as well as Python in general! https://inventwithpython.com/
-
The Roguelike Tutorial (originally from roguebasin.com, updated for Python3) that uses libtcod: http://rogueliketutorials.com/about/
-
If you'd like to use Minecraft as a learning platform, there is a good book based on a mod that allows an API to be accessed via Python library https://nostarch.com/programwithminecraft
cleaned up my message a little since you pinned it 😊
And if anyone is curious what I'm working on, I try to push clips to youtube every once in a while. Eventually, once I pretty things up more, I'd like it to be another example of what can be done with Kivy.
This shows a fog of war implementation, smooth camera movement, and simple sprite animations in use:
https://youtu.be/DTv_SiIAbCE
This shows some turn-based battle "action", which uses some simple kivy graphics instructions to paint the highlighting, and more animation handling:
https://youtu.be/3ZZdyWfNvTg
Some earlier footage of an in-game editor, playing with entity state:
https://youtu.be/-ReGZBIVvks
Anyway. If anyone needs help with games in Kivy, or is running into trouble with any aspect of their project, I'll help out where I can! 🙂
since when has this been a thing
oh
I'm making a game that needs thousands of similar objects to be drawn on the screen at once. They also have "collision", so my idea was to have an pool for the actual objects themselves so I don't keep reallocating memory. I thought of achieving this by having two deques, one for active and one for inactive objects. When an object exits screen it gets moved to the inactive deque, and when I need more objects I just pop from it. If I run out I could just fill the empty deque with objects and if I have too many inactive ones I can resize the deques ETC. to 1.5x the size. I really thought this was a clever idea and I had a question if anyone had better ideas, since there could probably be cool ways to save memory
I also thought of having a separate quadtree for just the positions so I only need to search for the nearest object to a position in log time instead of having a conditional in an O(n) loop. However I need to move every object every frame and that gets real bad real fast, especially since every object needs to have an unique function that calculates their trajectory, I'm not exactly sure how I'm gonna achieve this yet, probably with some cumulative delta presenting time and then each bullet has to calculate its own possibly new position. But this seems really inefficient and I can't think of anything to make the situation better
I should probably look into particle systems for the latter part 
wait no the resizing was left over from my old ideas deques shouldn't need that 👀
lol
i think what you want is often achieved using an ECS (entity component system), to be able to manage efficiently a lot of similar resources with common rules, kivent is such a system and is able to manage these order of magnitudes of such objects http://kivent.org/ has some text explaining the concepts
https://opengameart.org is a nice resource of free artworks for games, with defined licenses so there is not too much questions about it when building your game and needing assets, be it for placeholders or for your final game
If you wanted to, you could move the operations to the gpu, but sadly I dont know how to do that with only python... and (at least for me) things can get very complicated very fast haha
Hello, nice to see this sub-channel created. I've put together the Arcade library. Feel free to ping me if anyone has questions on that library. http://arcade.academy/
Version 2.2.1 was just recently released, which has a improvements around built-in resources and better auto hit-box creation.
you should get a role or something 
I'm starting a sabbatical, and hoping to be able to sink a lot of time into it.
nice to have you here @frozen knoll 😄
I tried arcade once with my son and we really enjoyed it
Hey great to hear!
That site has some certificate issue SSL_ERROR_BAD_CERT_DOMAIN
I've never set it up for SSL, just use http. I'll add the SSL cert to the to-do list.
letsencrypt/certbot makes setting up ssl very easy
Yep, still need to do it.
Actually there is a cert in place already, but for *.cloudfront.net, i.e. some default Amazon thing.
still need to set up your own eventually, I'm just being pedantic...
Awesome to see you on here @frozen knoll! My 10 year old son has been whittling away at some of the tutorials, and I've enjoyed what I've experienced of Arcade through that exposure.
anyone done any networking/multiplayer recently with kivy, still trying to figure how best to tackle it.
I've only experimented a little with using Twisted with Kivy, and I think they have some examples for mixing the two together, otherwise I'm not sure. What sort of communication are you needing to implement?
essentially turned based, could pass the board between players or some pieces. ideally would like to get to mirror board state during the turn, rather than at the end of each
sure. end of each doesn't seem to have much disadvantage, at least on the surface 🙂 are you going to support direct peer-to-peer communication, or will there be a game server?
I was going to server in some form - though if I can get peer to peer that may work too.
Currently it works locally, with active player being switched. Tying that into nonlocal system is whats confusing me most atm.
Looked at pusher a while ago as a possible solution, but didnt dig too deep in
I was thinking about revisiting Python for game development
But I did have a question... in what ways can I optimize array iteration with python?
I want to reduce cache misses and was hoping I would be able to do that with as little C as possible haha
also I know python has __slots__ which can be used to pre-allocate fields in a python class but I do not think this would benefit me here?
list comprehensions are generally faster than full for loops, and caching method calls can help. Pypy is massively faster than Cpython for for-loops, but generally if you're doing massive iteration you ought to be using a library to do it for you--like numpy
Push as much as you can into a shader.
What types of options were you running into that you wanted faster list iteration?
Nice that you're here! I really enjoy arcade, it's very simple to use and you can goof around quickly with all the templates you posted on your site. Thank you :)
Wishlist: a Numba-like way to take Python code, decorate it with type annotations, and turn it into a shader.
I like that we can do numeric specialization with Python already by way of Numba or Cython; it would be great to leverage something like that to write shaders.
You mean convert to glsl code?
@round obsidian calling python on the gpu is a lot harder than converting it to glsl iirc
I'm not talking about running Python on the GPU, but using Python as a metalanguage for writing GLSL
glsl in itself is not very hard,
what you need to know is all the functions you can use in that, and how vector format works, and you'd need to learn that even if you mapped them in python
i don't see anything making it worth the effort of writing and maintaining a transpiler from python syntax to glsl
implementing a python on the gpu seems properly insane
Again, I'm not talking about "implementing a Python on the GPU", but using Python as a metalanguage to remove the tedium of creating GLSL by using Python to generate GLSL code. But it's been some time since I tried to write GLSL directly, so I might well have apprehensions about it that don't apply anymore. I found it very confusing at the time, so things might be different now.
i don't see anything making it worth the effort of writing and maintaining a transpiler from python syntax to glsl
I agree with this
All right.
I suppose my real problem is that I have never found a good, from-zero, soup-to-nuts tutorial for GLSL.
Hi @round obsidian, I've actually just been learning about glsl, and from within the perspective of kivy (actually thanks to @mortal bridge, and @karmic patio for helping me with the overview! 🙂 ). I'll see if I can link some of the content I found. My needs were to write a grayscaling shader that used a secondary texture for mask logic, still simpler in terms of shaders I suppose, and so I found a "live shader editor" to toy around with. While specific to kivy, they also have a live editor example to play around with in the demo section of their repo. I highly recommend doing something along these lines, at least if that is your learning style.
While it could be neat to have something describe glsl in python, I would have no idea what that would look like. I believe the challenge comes in where you would want it to generate very efficient instructions, as these instructions operate on each individual pixel. I get the feeling that, even after one "knows what they are doing" with writing shaders, it is still challenging to implement them in efficient ways.
in python, for instance, I would be inclined to write some sort of logical expression or use a conditional to solve a problem, and it could still perform decently, generally speaking. While you can use conditionals in shaders, because it is so sensitive, you could see a large difference in approaching the problem with a mathematical answer compared to a conditional, and the return of investment on that efficiency is much higher.
Whatever you can offer would be greatly appreciated
https://www.youtube.com/watch?v=u5HAYVHsasc - uses ShaderToy and draws circles, gradients, etc.
https://www.youtube.com/watch?v=uOErsQljpHs - is a bit dry, but all great info.
https://www.youtube.com/watch?v=mcoqXej5f-0 - uses webgl for the video, but the specifics I needed to understand (passing in a texture, needing to declare it in glsl, using texture as a mask) are shown.
I'm truly just starting out, so I might not be the most ideal to suggest learning material. In fact, if anyone is more steeped in the subject, I encourage you to step up and suggest sources to learn from, and how to get started! 🙂
that's more advanced but it can be motivating to see what's possible, videos by Inigo Quilez (from shadertoy) https://www.youtube.com/user/mari1234mari can be pretty dense with learning material, he does write articles about the techniques he uses, and has beautiful art on shadertoy.
Yeah, I'm familiar with Inigo's work there, amazing stuff
Just very intimidating1
So ive only recently began learning to code. Ive learnt a little bit of python, but i am wondering what coding language is best suited for game creation? because after my python course is over i planned to learn C#
Any one know of any easy to implement(Or available for python3) algorithms to determen when I circle moving in a stright path enter and leaves a OBB?
i think refer to maths modules
@sacred yarrow Most professional game development is done in C++, although the landscape is slowly shifting. There's a growing number of commercial projects developed in Unity/C#. If you're a novice just starting out, I recommend you start learning the basic concepts of 2D gamedev in an easier language like Python. Once you've got a few games under your belt and feel more comfortable with the ideas, you can try your hand at 3D, perhaps in something like Unity.
@radiant rapids so its good that i began with python?
cause ive gotten as far as learning about Modules in my notes so far
Yes, Python is a good language for novices, and there's decent facilities for making basic 2D games.
wait Is Unity its own Code language
or is it a platform to use a programming language
Ye i thought it was c#
Im gonna learn that later on in my next semester of Comp science
once im done with Python
It's better to focus on learning one thing at a time.
Your experience with Python and gamedev in Python will still benefit you when you move onto C# and Unity.
well its a course in my HS so i dont have much a choice lol
well i was told once i learn python learning other languages would be easier
because some of the coding languages are similar
It's true.
i got no idea how similar havnt tried other languages
Knowing any language will make learning other languages way easier.
And Python has a LOT of concepts in common with C#.
ah so thats why my teacher said well start it after were done with python
Yeah, that sounds reasonable.
basically python has many flavours
I m learning Ipython
if u want to hands on logical problems pls visit website Project Euler
does anyone know of a pure python implementation for creating geometric shapes, like concave hulls, for instance, from a list of points? I'd like to avoid extra dependencies, like scipy/numpy/etc.
I saw Py2D but that doesn't have support for creating hulls, it doesn't seem.
@sacred yarrow You might want to check out this if you are interested in learning via arcade games & Python: http://learn.arcade.academy/en/latest/
Im doing a n body sim on the gpu and it works great, but im only rendering the bodies as points..
Whats the best way to render spheres at each of the bodies positions?
All the bodies are in one buffer
I imagine writing a geometry shader to render each sphere would be very slow
What other options are there?
@frozen knoll Just wanted to say that arcade library is really nice! 
@fierce wraith - If you are using Arcade, I'd just create a sprite for each body. You can make them look anyway you want.
It would be like this,
Im using moderngl
Oh, nvm.
I'd stay with moderngl if you are already using shaders.
And I feel like having a sprite for each of them would be pretty slow, the num of particles is in the thousands
Does arcade support shaders?
It uses shaders to handle the sprites.
Ah but can you write your own?
But it is assuming you are moving sprites on the CPU, not GPU.
Ah. I really need the power of compute shaders here
Yep.
Sounds like you've done the hard part though. Adding the visualization might be easier?
Yeah I hope haha
I also want to add a trailing effect
this is the current state:
and its suprisingly stable haha. been running for over 3 hours at 1.7kfps
this is with a dt of 1 / 100000s
blender too much? kivy does have a mesh renderer but not had much luck with it myself
id love a suggestion on how i could make a trail renderer...
also if someone has a a starting condition they think might play out interestingly id love to try some 🙂
@potent ice might have some input on that, being closely connected with moderngl
I guess it depends how much trailing you need
The simplest way is to render your sprites to an fbo
Instead of clearing the fbo you fade the color values in it
There are several way to do it, but two fbos is probably ideal
Frame 1 : Render to A
Frame 2 : Render to B + layer over fragments in A * 0.9 (or whatever multiplier you want)
etc
@fierce wraith
So I guess in theory you can have a trail that lasts 250ish frames
Unless you are using floating point render target (HDR). This is only for RBGA8
Good old swapper fbo1, fbo1 = fbo2, fbo1 + use texture attachments. You've done this before 🙂
And yes.. stay with generating points and emit with geometry shader
Then you can render millions of particles instead of hundreds
It also means the compute shader only need to worry about points
while i have you, i think im doing some buffer swapping wrong already
so initially i write into buffer1
then i bind buffer1 to binding0
# bind the buffers to 1 and 0 respectively
self._toggle = False
self.buffer1.bind_to_storage_buffer(self._toggle)
self.buffer2.bind_to_storage_buffer(not self._toggle)```
and buffer2 to binding1
the first compute shader i run has binding0 as its input and binding1 as its output
then i swap the buffers. for my second compute shader
it has the same bindings as the first compute shader
then i swap one last time
its all very confusing
haha
That looks reasonable, but it's confusing that you are using a bool 😄
that lets me switch it easily, what do you suggest?
around like 114 in https://github.com/Leterax/Visualization/blob/master/NBody/main.py
*line
I'd swap out_buffer, in_buffer instead, but it's not a big deal. What you do should work because the binding is 0 and 1
im getting some nan problems, i think its from me subtracting two very large floats
ie position of pluto (4.5e12) and the earth (1.5e11)
hmm yeah might want to scale that down if you are using 32bit floats
or move to dvecs
yeah ive tried moving to dvecs and that ruined everything haha
Scale down the values 🙂
can i have my interleaved buffer with different data types?
yes
hm i guess i can try to just make the position a dvec
'f8' is the numpy datatype for double right?
and 4f8 for dvec4?
I haven't really used mixed datatypes in a numpy array, so I'm not sure if that would be compatible with the buffer protocol when uploading to gpu
well.. that didnt work haha
interleaved = np.c_[positions.astype('f8'), velocities.astype('f4'), force.astype('f4'), colors.astype('f4')].flatten()
np.c_ concatenates the arrays, i know that works
got an error or?
Maybe just use separate buffers for each attribute for now. It makes it easier to use different datatypes per attrib
but im using a planet struct in my compute shader
Unless you know exactly how np can handle that
{
dvec4 pos;
vec4 vel;
vec4 frc;
vec4 col;
};
ahh
i cant do that with separate buffers right?
You're right. It would work with a vertex shader, but harder with compute
Maybe print out one planet entry with tobytes() and verify the contents.
yeah its just nans after one step
I have NO idea how np concats different dtypes
yeah me neither.. @hybrid badger do you know?
Is pluto is too far out for a float32 it'd still scale down the values
the largest distance is 4.5e12
you'll probably get an error, but it may be able to convert, say, ints to float --- i'm betting on an error though
can i tell numpy to have different types in the array?
no
hmm
You may be better off with struct.pack here?
you could make object arrays i guess, but then everything get's shaky
Just store the data with python datatypes and struck.pack() them into bytes
Just get the format string right. All in the docs
ah ok. and then write the bytes into the buffer?
how would i interleave the data?
struct supports patterns for that
do i first zip the data and then pack it with something like 'ddddffffffffffff' for one dvec4 and 3 vec4?
Can't you just feed it a generator?
data = [0,0,0,1, 1,2,3,0, 4,5,6,0, 7,8,9,0]
struct.pack('ddddffffffffffff', *data)```
but how would i check if the encoding is correct?
Do a len and check that the byte size is correct. Other than that you just have to trust the struct module converts your data correctly to IEEE 754 floats. 😄
>>> struct.pack('4f', 0, 0, 0, 0)
b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
16 bytes
struct.pack('4d4f4f4f'*(len(data)//16), *data) seems to work
yup. should work. There are also more efficient ways to pack multiple entires instead of building a potentially enormous string.
4f8 4f 4f 4f has size not aligning with 64. Remainder: 16
but 80 is correct because the double is 4 bytes longer
64 would be 4*vec4
hmm checking. Maybe I have a bug?
yeah it should be 80. Do you have the code somewhere public?
yup
@fierce wraith Checking in a few
yeah np, take your time
ValueError: Requested OpenGL version 430, got version 410 crap I am cursed on OS X atm. My win PC died!
But I can isolate the buffer creation, np
lol ... ```python
BUFFER_FORMATS = {
# Floats
'f': BufferFormat('f', 1, 4),
'f1': BufferFormat('f1', 1, 1),
'f2': BufferFormat('f2', 1, 2),
'f4': BufferFormat('f4', 1, 4),
'f8': BufferFormat('f4', 1, 4),
haha
Last parameter is byte size
Pushed now.
but not to pip right?
Nope, but soon. Just clone repo and pip install it
can i then delete the clone?
I think you can just pip install -I https://github.com/moderngl/moderngl-window/archive/master.zip
haha more like moderngl not my repo hehe
fixed
thx, downloading
It's thankfully something in moderngl-window, not in moderngl itself
I'll release new 2.0.5 this weekend, so you might as well update your requirements now
i had a massive brainfart earlier.. i was trying to zoom out further but i forgot to set the far plane so something larger... i was very confused why it nolonger worked when i zoomed out haha
i now have 7e15 hah
Yes, but update your requirements.txt so us other poor bastards can run your stuff 😄
haha ok!
@dawn quiver There is also a pygame discord
I think the way you are doing your main loop is not very optimal
I would use callbacks for key events and also try to force a 30-60hz screen update
I don't know how they do that in pygame because they don't have vsync
But probably not complicated
Take advantage of all the examples they have 🙂
It's really an enormous amount
Leterax, you are not allowed to find any more bugs today, just sayin..
what are the advantages/disadvantages of making an incremental game with python vs javascript/html/css?
well, if you do them in python only, you'll need the users to install a program to play them, while if you use web tech, they can play in their browsers, but doing them in python means you have more control with how they interact with it, instead of having to care about all possible browsers and also to care about the fact that a browser is easily scriptable so they could just run their own javascript in the page to simulate clicks. if you do it in python, you have multiple very different technologies to define your interface, each with their specificicies, though a clicker game like this probably doesn't need a very elaborate UI.
if you turn them into exe you don't need to download
i think tshirtman means you need to download the game not python
and windows might not be the only platform you want to target, so exe is not enough
hey @potent ice is there a reason this is somehow resulting in nan/inf?
(f/m)*DT```
f is just a (0,0,0) vector, m is extremely large (2e25) and dt is 1
i would have thought 0/x is always 0...
Are you mixing double and single precision floats in that formula?
Try doing the same in python
I think you're going to hit several issues by using doubles
I'm not even sure if a vertex shader can emit them through gl_Position
So, you might be going down a treacherous path with this, but you'll certainly learn something
@dawn quiver maybe you mean "most people who game don't use linux to do so" because, I'm on linux, and all of my kids' computers are as well, and quite a few friends. It's definitely a thing, just a much smaller user base than windows 😉 https://www.reddit.com/r/linux_gaming/
regardless, one can certainly build binaries of python games for distribution on each desktop platform, and it's not too bad. Kivy provides a path to mobile as well.
linux_gaming that is really a thing ?
for sure! It's been growing rapidly since Valve made Steam Play a thing. Check out protondb.com, it's a database of game compatibility for steam games using proton (steam "fork" of wine, which enables most windows games to be played on linux).
It's not as good of performance for running games made for windows, but the performance difference is normally 0-15% is all. (still totally playable)
Five years ago it was a very different story!
@potent ice no im only using doubles in the compute shader
I cast to float for the vertex shader
okok. I don't really have much experience with dvecs to be honest. I've used them a couple of times in compute shaders, but they were not involved in any fancy calculations.
And yes. Linux gaming is not a complete joke any more. It's getting somewhere.
OS X gaming.. that's the biggest joke now. I say that as an OS X user 😄
I was really disappointed that they are going to drop additional OpenGL support on OS X.
Yes. That has been bothering me for a long time.
and I know it has made porting games to the platform a lot more difficult.
If they had at least stopped at 4.3 it would be a lot easier, but stopping support at 4.1 is a dick move 😄
Still.. a lot can be done with 3.3 -> 4.1, so it's not all bad. It's just that not having compute shaders adds a lot of limitations for games.
You can use transform feedback instead. That is 3.3s "compute shader", but if you need to process data in a non-linear way you have to provide it through textures or UBOs if it can fit inside 64k
hmm @potent ice im running into a bunch of nans and i have no idea why.. like even in areas i dont write to..
the initial condition in the buffer for one of my planets is
pos: (-100.0, 0.0, 0.0, 1.0)
vel (vel.w is mass): (0.0, 0.0, 0.0, 10.0)
force: (0.0, 0.0, 0.0, 1.0)
color: (0.15000000596046448, 0.5, 0.5, 1.0)```
and after calculating the force and then applying it once i have a bunch of nans
(-100.0, 0.0, nan, nan)
(nan, 1.0, nan, nan)
(nan, 0.0, -0.0, -0.0)
(0.0, -0.0, 0.0, 1.875)```
and its sets the color???
Just writing out a copy of the input gives you what values?
(-100.0, 0.0, 0.0, 1.0)
(0.0, 0.0, 0.0, 10.0)
(0.0, 0.0, -0.0, -0.0)
(0.0, -0.0, 0.0, 1.875)```
well thats with me setting the force
but not doing anything else
if i dont set the force it stays the same
but how can setting the force change the color
this is the struct:
struct Planet
{
dvec4 pos;
dvec4 vel;
dvec4 frc;
vec4 col;
};```
and i set the out planet with:
Planet out_planet = Planet(in_planet.pos, in_planet.vel, dvec4(-f_i, 1), in_planet.col);
Out.planets[x] = out_planet;```
where f_i is the force dvec3
Not sure. No time to look into it now
Is this just som buffer issue or compute shader issue
.. is the question
i might also be reading the buffer wrong
2048 clone I put together for a tutorial:
https://github.com/pvcraven/2048
Nice. Completely forgot about that game
Does the term GUI apply to all things displayed to the user?
Well. "Graphical user interface" would at least certainly imply that.
so, i know this isnt exactly python, but im making a game in unity and i have two terrain generating scripts, one generates a bunch on tiles underneath a parent, and the other determines how many parents to place in the world. I want to generate caves, but if i put it in the parent class, the caves might get cut off since those parents are just one chunk of the whole, and if i put it in the parent-placing class, it would be harder to access/destroy the cubes that make up the parent classes in order to generate caves. With you guys having a coder's mindset, i was wondering if i could help get some insight on where to add my terrain generation process.
well, text displayed to the user in a terminal is often not considered GUI (but strictly speaking i disagree and certainly would count it as part of it) (sorry it's not a response to your message AOTLevi but to the previous question)
unless you're salt I'd veer on the side of text not being graphical
@potent ice are doubles known to drift somehow?
ah ok it looks like for some reason vec3(0)/other_value will result in a non 0 vector...
You got to be careful what types you combine them with when calculating stuff
In GLSL 4.00 and above, double-precision floats are available. By default, all floating-point literals are of type float. To create a double-precision float, use the lf or LF suffixes. This will force it to the double type.
what is a suffix?
They are for defining types of literals.
so lf myvar?
but im not using any constants that i could add that
to
im just reading the data from the buffer and then using it
My buffer is filled with planets like this:
struct Planet
{
dvec3 pos;
dvec3 vel;
dvec3 frc;
float mass;
vec4 col;
};```
then in the compute shader i do some simple math to update their position/velocity
```glsl
Planet in_planet = In.planets[x];
dvec3 p = in_planet.pos;
dvec3 v = in_planet.vel;
dvec3 f = in_planet.frc;
double m = in_planet.mass;
dvec3 new_a = (f/m)*DT;
dvec3 new_v = v + new_a*DT;
dvec3 new_p = p + new_v*DT;```
and in the linedvec3 new_a = (f/m)*DT; it messes up
m is a float. That might be a problem?
I don't really have much experience with dvecs. I'm just trying to make sense of it
will glsl do implicit casting if i try to read as a double?
read how?
double m = in_planet.mass;
Cast it with double(in_planet.mass)
hmm nope still doing that weird drifting
initially:
pos: (0.0, 0.0, 0.0)
vel: (0.0, 0.0, 0.0)
force: (0.0, 0.0, 0.0)
mass: (10.0,)
color: (0.5, 0.15000000596046448, 0.15000000596046448, 1.0)```
and after a few sec
(0.0, 1.9053571453340377, 9.303502992384605e-05)
(0.0, 0.0, 0.003410035108620464)
(1.66505643915018e-07, 0.0, 0.0)
(10.0,)
(0.5, 0.15000000596046448, 0.15000000596046448, 1.0)```
even though nothing should be happening
also weird stuff like having a force in the x axis, a velocity in the z axis and a displacement in the y axis...
I would make them 32 floats and see you get the get same problem (temporarily)
no, it was fine with floats
What is DT?
paste the definition
#define DT 0//%DT%```
and i replace the last part in python
so it will be
#define DT 0.1
#define DT 0.1lf ?
i can try 🙂
That define is a literal, so I think that is a problem
now its:
#define DT 0.1lf
still the same problem
should i use a const double DT = .1?
Worth a try
nope 😦