#game-development
1 messages ยท Page 45 of 1
I am working on implementing the dungeon crawling aspect of my game, this will be very important later on because the dungeons are going to be one of the main legs of my game's simulated economy (you might also find npc adventures and their camps in the dungeons as well, and I have been testing out some environmental skeletons ๐), I am really trying to make them interesting, just early generation implemented right now but I hope to add some more variety in the near future: https://www.youtube.com/watch?v=oWEVWb3s3zE
Messing around with dungeon generation, currently the combat system isn't totally implemented so I just use commands to kill the enemies. I have created a simple dungeon system that generates dungeon rooms that are connected by corridors, going to make them more interesting in the future, maybe add some more decorations with some living armour e...
watchu libs yall use to develop games
and who even develops games in python
๐ญ
godot goated ngl
Probably pygame-ce
Booooo godot boooo
haha godot seems nice, but i've never used it
rip
pygame-ce is pretty nice to work with imo
Is godot closer to lua than python?
And like the most important question, is it faster than normal pygame-ce or morden gl
Hello guys, recently I posted my first game on itch.io (https://randomtutel.itch.io/dice-and-bullets) it's a pretty simple game nothing wow, but I learnt a lot from developing it. (I'm still a begginer, and I'm learning new things) and I would like some honest opinions about it, if you have some spare time :) . Thanks everyone.
And I forgot to specify.. this was made in Python Arcade.
Hello Devs or anyone here lol, currently working on a game. https://terradev01.itch.io/blocknova its simple kinda feels like a arcade. I would like some feedback please if any could spare some time thank you all yall. ๐
gdscript is more like python than lua, It shares more similar datatypes and stuff too iirc. Including type annoations too.
And gdscript has a completely different implementation of it's language than python. It's more or less faster than python in some benchmarks but you don't need to worry about it that much really.
godot uses vulkan graphics pipline on it's newer versions
Soo instead of using pygame-ce I should use godot for heavy games?
People do recommend using game engines to make games in general, but if you wanna learn python or you're more comfortable with python then pygame-ce is also fine
just see what fits you the best
Godot does many things neither pygame nor modern gl do. The way performance works with engines like Godot is that they are written in C++, so they are internally as fast as it gets (they still need to do optimization work, but assuming they did that). So when you use gdscript you might tell the engine to set your objects velocity to some value which can be run trivially in no time at all (set a single variable). The real work is then done in the engine C++ side where it takes all the physics objects and moves them according to their velocities and handles collision and such. Because of this gdscript can be really slow and it does not matter. It just needs to do some very simple high level game logic and configuration.
Pygame on the other hand does not have such systems for you. So you need to implement them. If you implement them in Python you will run into performance limits of Python at larger scales (many objects). So if your game actually has many such objects (many games don't), then you might have a problem. However, there is nothing stopping you from implementing such a system in something like C++ just like Godot and then using that in combination with pygame. And also someone may have already done so. In the case of physics people have and you could use something like box2d.
As for rendering performance if you use modern gl that is using OpenGL just like Godot does internally.
So can morderngl compete with gdscript?
GDScript is closer to Python then anything
Godot uses Vulkan for quite some while
And its not enough to just use C++, to be fast.
C++ just enables you to write code that doesn't waste a lot of resources.
It takes a lot more, write a performant game engine.
And Godot is really not the fastest engine around.
If you want top performance and an open source engine, see O3DE instead.
Godot is the better engine for newbies.
I like Panda.
https://youtu.be/8jljSTpIkVY
This is a rundown of the most popular game engines using the Python programming language, 2D and 3D, full engines and frameworks in the same list. We will be doing these videos for several programming languages.
Key Links
https://gamefromscratch.com/python-game-engines-in-2025/
------------------------------------------------------------------...
These two things can't be compared. They have nothing to do with each other. Modern gl is a graphics library. Gdscript is a domain specific programming language.
Also how do u use socket?
Yes, but most are probably OpenGL ES for compatibility.
Probably WebGL.
most?
Hence the assuming that work was done comment I made. The way performance works with this is that while simple loops and other things have a much better constant factor you are still under the same issues one always is in programming of having to do things that are not terribly slow by design. C++ can't magically solve that. @wooden night
You mean most existing projects? I can tell you that fast forward is what almost all do.
Most will target mobile and even more so web.
Aha, ok.
Both mobile and forward use Vulkan
And compatibility is really rarely used.
Mobile vulkan is iffy, the vulkan drivers are still bad in many cases. Many smaller devices like mobile will advertise vulkan support but it's bare minimum and buggy. Hence the heavy usage of OpenGL ES still.
Web being like a weird messed up version of OpenGL ES with WebGL too.
Not in Godot's control but in the future they will be ready for Vulkan once all those old devices eventually expire.
Or one can just target new devices.
If you want to use Python and are worried about performance of stuff like pygame you can use Panda3D. Which like Godot is implemented in C++ and has significant effort put into it.
Although it can be hard for beginners and for that you can use Ursina. Which is built on top of Panda3D.
Isn't panda3d/ursina made for 3d games rather than 2d?
They can do 2D.
Do they have collition check?
Yes.
For 2d
It's 3D, but can be used. If you want 2D physics specifically you can use box2d or pymunk.
Also 2D physics can be usually done manually yourself because it's typically simple for most 2D games (which is the case for pygame games).
Wait, so if i use pymunk or box2d will my project run faster(in pygame-ce)
Yes.
For many physics objects and with more complex physics.
I am trying to make paper minecraft so it will help increase the FPS
Pygame's main limitation is rendering performance, since it's CPU rendering.
So is there any pygame style renderer module?
Unless you use like modern gl with it, but in that case you are using pygame mostly for the window, input and audio.
Moderngl uses gpu or cpu?
As in draw some things to surfaces?
GPU.
Isn't pygame made using morderngl
No.
SDL(2).
Does sdl use cpu too
Yes, and no. It has an API that uses CPU and it can also provide an OpenGL context (which is why Pygame can do that too).
The CPU API is basically what pygame's is, the surfaces and such.
Newest version of SDL has its own graphics API for the GPU.
(Which Pygame is not using)
What about pygame-ce?
SDL is basically a platform layer, so instead of working directly with the OS, it provides a layer on top, but it does not do much more than that.
Yea but doesn't the pygame community update it once in a while?
Yes, they do.
Multiple orders of magnitude, because of the GPU's design.
Average?
Like faster as in certain things are not feasible with pygame at all.
Like you won't be making a full modern 3D game with pygame's CPU rendering.
Nor can you have fancy effects in 2D.
(Like fancy lighting or many particles)
But will moderngl will havr that?
(You can still do some of that, but with limits)
ModernGL just gives you access to OpenGL, which is a graphics API. It does not give you high level features, you need to make that all yourself. But basically you can use the GPU in whatever way you need to (without getting into details of missing things more modern APIs have and that probably don't matter to you (nor to most games)).
No not like have that feature(like a class) I mean like enough performance to handle it
Yes, it's as good as it gets basically (without getting into more modern APIs).
GPUs are very fast.
So my slow fps is not python's but pygames fault, got it
Now gotta go and learn modern gl
Kind of, if what your game needs to do is some CPU intesive stuff then it's Python maybe (in some cases). Like if you are doing a ton of CPU side physics. But as mentioned you can fix that by using stuff like box2d or pymunk.
It turns out most games don't really though. If you look at most 2D indie games count how many dynamic objects are on screen. It's probably like 4-10 in a side-scroller.
There may be some fancy visual effects going on though and for that you need the GPU.
Yeah but the thing is if you have 1600x900 screen size and 4 imgs(with convert_alpha()) it still drops your fps from 500 to 150
I'm not talking about the visuals there though, I meant the physics.
Like look at this:
Count how many dynamics objects are in this scene.
It's like <= 100 for sure.
Oh, if I use moderngl will it use cpu for pyshics?
No. Ok, so you have two things in a game. The actual game physics/logic, which you can think of as the actual game itself being simulated. And then you have the visuals, which are separate from that.
Is like one big bg img and then invis rects for coll?
The actual game logic is (usually) on the CPU, and the visuals happens on the GPU.
Yes, so each moving object here might be updated in your Python code by moving them around in a loop. But the visuals happen GPU side.
So for pyshics python is not fast enough
There are not that many objects so Python can handle that no problem.
Python (and C++, etc) just can't handle filling in all the pixels, that is what the GPU is for.
It is in many cases, as I just wrote.
Oh ok, but will the calculations be faster in cpp vs python?
It depends how much you have going on in the scene.
But many (most) games have very little if you count the number of dynamic objects.
Yes, and it's why if you have thousands, hundreds of thousands of objects you really want to do that not in Python.
This is where stuff like pymunk comes in, it can do that for you.
Ohhh, alright thx for the help!๐
The problem with CPU side rendering is that at 1920x1080 resolution you have 2073600 pixels to fill in.
That is a lot of looping even for C/C++, etc.
The GPU can fill these all in in parallel, it's specialized in this.
That is A LOT
And you need to do it in less than 17 milliseconds for 60 frames per second.
With some extra time to spare for other things in the game.
https://www.youtube.com/watch?v=HghJoNAY8tg Can you give me guys your feedback?
Pet project to write a multipler game, with acceptance tests, continuous delivery, tdd, ci.
Part #1: https://youtu.be/Rjv8t7p_Fp4
0:00 - Intro
0:26 - Previous video
0:53 - Feedback from community
3:59 - Reflection on previous decisions
4:35 - Core and the player
5:14 - Data flow diagram
6:22 - Controls
8:35 - Basic view
9:59 - View model
11:14...
Lol I made a "guess the number" game:
have u started rn or what???
btw who have used the ursina lib
yea simply amazing
No I just got bored at work so I wrote this in my spare time
so u r a software engineer
I mean u have a job
No I manage the network at a textil mill
so how did u program
most of my job involves pinging large amounts of computers and making spreadsheets
oh
so u have to ping ppl
i like pinging in discord
scripting is a skill that's very important for managing large networks.
gimme ur public ip addr
jk :)
oh
no I mean sending ICMP packets to every computer on a network
guys im new and i want to learn how to make a game
ihave 0 clue how to start
i just downloaded python and then joined this server
can any one help
yea
learn pygame
what???
what is that
what u dont know??
learn from tutos
youtube?
do i watch tutos from youtube?
i will show you my progress in 3 days
bye
idk prolly
That's 4real or sarcasm? ๐
Any recommendations for tutorials to learn python for free most YouTubeโs I tried watching just made a game with no explanation to what everything in the code was
Iโm just trying to learn
I've been focused on any kind of testing in game development, as well as architecture for awhile personally. Love to see this type of content! I don't really have much to comment. I'd love to see it applied to slightly more advanced behaviors like say When a coin collides with the player, the score should go up. I think that the engine (or certain patterns on top of pygame for example really will effect the approach on this stuff).
Yes! I'm going to do that too! Did you watch the first part too? I linked in the description.
I'm 11 minutes through the one you linked, haven't seen the first one. My personal opinion after researching a lot is that while a separation of concerns is important the usual patterns that apply to development (like ports and adapters, and others) doesn't really work for automated testing in games. If you have a lot of math in your game and stuff that you can isolate and test with unit tests, you should absolutely, but for a game a lot of the logic isn't in the math and doesn't prove that anything is fit for release. I think when doing automated testing and even certain architectural patterns, the typical separation of concerns/framework independence has to be adjusted, you have to couple to the engine to get the kinds of tests you want, and avoid coupling to anything in a given ecosystem. For example, at rare for sea of thieves the majority of their tests are "Actor" tests which are a part of the unreal engine, they also have integration tests, where they load up a map, place a player and a wheel for example and test the interaction. In Unity you don't really get to do much through code which is disappointing and there's no normal entry point so stuff is messy architecturally (outside of certain dependency injection plugins), a lot of your behaviors come from what you setup in the UI with behaviors you attach to your object, I think there for example you could create a "prefab" which is a template for your object that you can instantiate in the engine and spawn in, and test it against other prefabs, and treat the engine/world space the same way you treat your programming language, like for example, spawn in your player object, spawn in your coin, move them across each other then observe something happen and it could be treated as an acceptance test.
I'm happy to hear more about that. I think I can test-drive pretty much everything in the game; maybe I'm wrong, we'll see ๐ I'll let you watch the video to the end, let me know what you think!
I agree, i just think it takes more like a bit of stuff not seen elsewhere on top (be it simple patterns), or an engine that gives you more to work with, sort of like what you've got going in the video. I finished the video, regarding testing the executable at Rare they have something they call "boot tests" that test if the game launches correctly iirc. I think a basic test would be to start the executable and verify it doesn't crash, maybe a snapshot, they also some tests that compare if before and after are at least 80% similar or something.
I'm prepared to agree that certain stuff is not subject to tests, like story, gameplay, appeal of graphics, etc.
@hearty tapir I'd like to hear what would you like to see in part #3? I will be making it in a couple of days.
Yea, I don't think you can drive the whole game for an acceptance test especially not a 3D one but specific pieces I think can be tested together or probably structured in a way to allow for it and work with modularity and a good separation of concerns
I'm opening my mind to the idea, that there are some "undriveable stuff"; I just can't pinpoint any example where that would be not-doable ๐ค Maybe I need to think on it more. Do you have an example of such not-doable thing?
@hearty tapir I appreciate your feedback very much! I can't thank you enough.
I think not-doable isn't the word just not worth it necessarily, it would probably depend on the game. For example, would you want to start the game, go to a specific level and walk from point a to point b and make sure it works? or would you want to place a player and some other objects on a map as part of a test, give them your input and see how they interact and what happens. Like I can't imagine driving the whole game like a normal acceptance test.
I would do the smallest/simplest thing, that demonstrates a certain feature of the game.
I think if I do enough of those features, then the whole game will be driven with that.
And I appreciate you taking the time to make the video and also having the same interest! I think that architecture is lacking too. I feel like to be productive and test in isolation there needs to be a better separation of concerns for the coordinates, like there should be containers that you can put stuff in and test them in isolation, having them size to their parent like display objects in the flash APIs architecture.
So yes, I will not have a test that executes every feature!
But I think the whole test suite will execute every feature, though not at once.
Yes, I agree. The coordinates should be abstracted in a way, that allows other code that uses them to not depend on the specifics.
Hey am new here
@hearty tapir When I'm creating the new version, you can be online/oncall and you can give feedback as we work. Would you be interested?
Then I will edit it, and publish.
Yea, every feature tested, but with stuff setup in isolation, supported by whatever architecture you're working with. I generally work fast building piece by piece, like for example it would be ideal making a score board or a health bar to build it up and put it on something else, in isolation. When i run this method, does the score go up? Maybe even some snapshot tests for an individual component
Last time it took me 20-30 minutes to code the increment, then 2-3 hours to record, and 5 hours to edit, and 30 minutes to render.
I can't promise to be available or anything so I'm going to say I can't do that. I also don't really have much to add for doing this stuff in pygame at the moment.
I don't think of it as "pygame game". It's just a game, that happens to be using pygame as ui, but it's an implementation detail.
If there is other ui for games, I'd need to only swap the PygameEngine for tests and Game layer that knows about pygame. Everything else can stay unchanged
I definitely think that is valid in stuff like pygame because it just does rendering and you layer whatever on top. I think that 2D games are where architecture/decoupling might be a lot more powerful if done right, maybe even 3D to an extent if doing from scratch.
The way I look at it, 2d or 3d is just a presentation layer of the application. It shouldn't fundamentally change the architecture.
I think this works better in less visual applications. If I isolate the business logic from the presentation then I can change the presentation to whatever is out there and there is a lot to choose from, it's abstractions are largely meaningless and isolated to just presenting results. I think life would be better making a 2D game with abstractions tailored to it over one made for 3D. But maybe I'm biased because the current architecture out there like with unity for example doesn't try to abstract/do both of them well. I guess what I'm saying is this doesn't seem to come with portability and as many benefits. But maybe I'm thinking about it wrong.
For this separation, I highly recommend looking at how Quake is structured. They really figured this out back then, especially for multiplayer (and more engines should copy it).
This video was sponsored by Brilliant.
To try everything Brilliant has to offerโfreeโfor a full 30 days, visit https://brilliant.org/Tariq10x/ . Youโll also get 20% off an annual premium subscription.
In this video I analyze QUAKE 3 Arena project by id Software.
Comment, like, subscribe, letโs trigger the algo!
The focus will be on sof...
They have the presentation separate from the core. Making testing easier, they also took it a step further and the core is in a VM. This was for better isolation for mods too.
Testing the core can be done. And I recommend even having tons of assertions and fuzzing.
However, the real issue with acceptance testing in video games is time. Games have too many interactions (depends on the game), and testing all of them would take too much time.
Games have combinatorics that a lot of software does not.
But it's worth testing the core engine parts, since the engine itself is not subject to as much change or combinatorics of game design.
So like fundamental systems like animation.
I think that acceptance testing is possible but with a reduction in scope. You can write a test that checks if when a player is spawned in and they collide with a coin, the score will go up if you use the engine you're working in and treat 3D space as you would your environment/programming language. You just spawn in a player, spawn in a coin, move on on the other and see what happens, see if one disappears, sort of like how you'd test the dom/your browser. I think that isolating the core is important but it isn't enough. You can reduce the scope of your tests, and focus on the game or select parts of it meeting the acceptance criteria for release.
Yes, but the problem is that you start making that coin test and in the next 3 hours you decided your game no longer has coins.
Game development tends to be under such rapid drastic changes until the final sprint of polish in many cases. Not for larger companies, they can't correct course so quickly (and it's a common cause of failure).
The problem is that unlike other software whatever game design idea one might have is often wrong until it's tried. And so such tests can only really be done for things that have not changed in a long time (which is often not many things other than core systems (engine stuff)).
If however you are developing a variant of an existing game, then you could know all of what you need and have it all tested. Some companies do just that, variants.
Maybe you're right and it isn't a fit for games with rapid changes. But if I know what I want and it's stable, why wouldn't I write a test for it to assure that it isn't broken and is still fit for release?
So if I was a mobile game company making N variants of existing games but with better polish, I would totally just test it all.
Yes, if you know what you want. And you already know it's good upfront.
So it's less about game design, and just producing it.
Which means it will probably need to be just like another game but a slight variation and different art/assets.
Like another Tetris for example.
Many companies do that, and in that realm of game development it makes a lot of sense to have heavy testing since it's all about the production of a fixed target.
Or if you are making a game engine.
I think a lot of companies end up with stable stuff and prioritize testing, they just do it with QA people and manual testing.
Yes, they could probably do better.
They are often just overloaded with other things and it's a kind of "don't fix what is not broken" situation.
This can be said about normal development though and end to end testing in general. There are many situations I'm sure where if people wanted to they could write an automated test to assure that stuff has the behavior that they want, and to verify that it isn't broken later, and testing isn't always quick or easy, but even unit tests can seem like a lot when you're just starting out.
Yeah, it's just that in general it applies better to things that "crystallize" better. And things that do that tend to be well defined things like data structures and algorithms, things that in general could be done under waterfall development.
Been building python bindings for Bevy Engine, and it's looking very promising. Hot-reload with python iteration speed, typings with autocomplete and Rust/Bevy performance. Wonder if this could be useful...?
yo wait this is actually pretty fire
do you have a github link?
how would you do queries via type annotations?
That would be roughly like below, almost as similar except the Query1 for unpacking a single element instead of a tuple for (name,) in query:. For now, maybe I get this still simplified just to a Query
@component
class Name(Component):
def __init__(self, name: str) -> None:
self.name = name
def update_people(query: Query1[Name, With[Person]]) -> None:
for name in query:
if name.name == "Elaina proctor":
name.name = "Elaina Hume"
break
(no repo yet, planning to open source soon though)
will publish to https://github.com/pybevy/pybevy/ later
guys this is my frist ever piece of code is it good i want to become a game devolper one day this is my frist day
not bad but try using a more concise variable name whenever possible. Instead of coins_you_got you can put coins_obtained, instead of coins_you_spend you can use expenditure and instead of you_get you can put net_coins
something you'll learn with more practice but nice start!
I think it's very good for a first and understandable.
yea my names are bad lol
thanks
They're good. Some people just put x y z and so on.
Yeah try avoiding using such names at all
with python people usually go with pygame-ce or arcade
or even ursina
check those out and see what you feel comfortable with
is unreal engine a good one
yeah but you need to know C++
i will try pygame thanks
and its a pretty heavy engine, you'll need a really good PC to run it
C++ is another programming language but nowhere close to python lol
oh so i will stick to pygame
lol sure
pygame is probably your best option given that you've just gotten started writing python code, and there's the most material out there for it compared to other options in the python ecosystem afaik.
sure keep us updated
its good in what sense? And you most likely won't be doing any gpu related rendering when you get started
It won't even use your GPU to do any of the computing. You're good.
no i mean in pygame
pygame runs on your CPU
If you can run an operating system you can run pygame.
in most cases it wouldn't really matter what CPU you have, the result will most likely be same across most gens/brands too, unless you're doing some crazy calculations which causes lag, and at that point you just need to optimize your code
can you give me a game that uses pygame
anygame becuse i want to see how do pygame work
you can check out dafluffypotato on yt, he does dev log and stuff with pygame
oh sure
do it have a leveling system?
leveling system?
yea
pyweek game jam is an event where people create games and submit there
its a competetion basically
some of the games submitted there probably have levlling system in them
oh i will check it out thanks bro fr if i get good at making game it all you
Good luck
@hearty tapir I watched the video you linked with the quake. There are some good ideas there, especially the event sourcing! The further parts of the video went into implementation details, but it was a fun watch anyway. Thanks for the recommendation!
I think I could use event sourcing in my game too!
I'm not the one who linked it, @normal silo did, but I saw it awhile ago and it was quite interesting.
The key ideas are events and separation of the game core from the rendering (and inputs). For networking and reproducible bugs.
It also making porting a lot easier.
Hello
I want to ask if its possible to write a "cloud-system" for a minecraft network.
Is there maybe someone here that can help me out with that?
The base idea is that i have an script that running in a screen that got a connection to a redis-server and a mongodb-server, download a list of json files from a github repository for the versions that can be installed, and maybe run the server in a docker container each?
I would appreciate other Ideas for that project.
I'm building a game that would help get my kids to exercise but its gamified that for one push up, increases their character str+1, etc. With a stronger, faster character, they can then go and fight monsters. Something like RPG style or 3D fighting style, idk yet. However, I dont want it to feel too grindy. Any suggestions to keep it interesting enough to keep incentivizing them to workout more?
Maybe model the progression as not "did you do this exercise", but as "how long a streak of different exercises have you completed"?
Reward variety not grind
That's actually physiologically valid too in a sports-medicine sense.
(Elite athletes can lose strength by doing the same exercise even twice in a row.)
Also maybe more points for more limbs involved in the exercise
You're right, loops should be removed from the final solution
Iโm building a Growtopia-like multiplayer text-based game in Python. For networking, should I use socket, asyncio, Twisted, Flask, or something else?
make it a mini game?
buy monkey bars
no sorry, the true answer here is to buy a trampoline
anyone got a working macro ? the records keystrokes mouse clicks and mouse movements ?
It's an implementation detail. Put a simple class around it and implement it the simplest way you can.
If there's some aspect that's understandable, then you can think to upgrade it
For those who are have done networking for both local and multiplayer games over the internet and can somebody put the files here so I can at least take a look because I've been having trouble
@worthy moth I've thought about a test that could allow for killing the release candidate if the game is really bad once packaged with pyinstaller or anything else really. Since you can put your own engine class over top to handle a lot of the details you could have it output that it is ready, or at another point, for an executable release you could have an adapter print something to the console, if in the future it's in a browser, the JavaScript console. My idea is like when you deploy a normal application for production or even production like automated testing you might smoke test it with some health check, you could do the same with a simple console output. If the binary is bad you'll never get it, if something is wrong before that engine part you can kill the release candidate.
Hello
How to load 3d model into python?
In making a vehicle sim, and i need to load a 3d model with track, curbs, gravel and barriers into code. Then i need to render w/ vulkan or opengl (shouldnt be too hard)
More importantly, i need the pitch and roll of each track segment for the physics engine to work properly.
Raylib, Panda, Armor3D
I recommend Panda 3D
Also why are you using for models are they fully rigged currently
I havent made any yet.
Im going to learn blender
Okay what is the game supposed to be about
Because then you'll have to think of what type of modeling you're going to use
Its a vehicle sim
And then you're getting mean to use heart surface modeling which is easy
Huh
hello guys i need some help, im started out python as a hobby and im trying to make a lil game on VS code and when i run the code the game just breaks and i get an error "TypeError: Enemy.update() takes 1 positional argument but 2 were given"
what do i do..
We would need to see the code. You can share it using this paste link. You can also open a help thread if you like
!paste
If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.
That just brings up the embed. You need to click the link
i pasted it
Read the embed
and where is the error happening?
The error message should include the line number where the error was
Where can i download pygame
you don't have a line 556. Share the full traceback
Internet.
oh
Is this chatgpt code?
!mute 1375139665237245953 1h take a moment to collect your thoughts before you post any other messages
:incoming_envelope: :ok_hand: applied timeout to @hybrid wren until <t:1760980034:f> (1 hour).
alr guys
player_inventory = Player.inventory()
ngl, i feel like making a game now, but im bad with everything front-end, so probably not gonna happen
but to those making games, yall are cooking
How do u use socket?
You mean the builtin socket module?
I'd suggest making a thread in #1035199133436354600
Im using Windows
But do you guys know replit.com?
Because on the same wifi, when I run the code as host in VS code and then run as client at replit its not working
Windows has this same API, they borrowed the network stack from BSD
Oh ok
And later rewrote it, while still retaining the same API, yes.
Alright, but how do I integrete into my game? Its a LAN multi
I wish I had a better answer for you than "learn everything on that cheatsheet", but if you want to gloss over any of that, it'll be your game engine's framework doing it for you
What system are you using?
I am using windows
I mean, game engine development toolkit etc
Or are you writing your own engine?
In which case you will definitely need to know everything on that cheatsheet
Oh, I am using pygame-ce and its over the same wifi multiplayer
OK, you'll want to read whatever docs pygame-ce has about networking then.
It probably offers a few higher-level abstractions.
does anyone know if i have a sprite in pygame that I wanna do pixel collision with against many rects per frame will using masks really tank performance?
Another handy resource handling class is for network connections. Functions to open sockets, pass data with suitable security and error checking, close sockets, finger addresses, and other network tasks, can make writing a game with network capabilities relatively painless.
seems to be EVERYTHING pygame-ce says about networking?
So I guess it doesn't offer anything and I guess you're back to "understand that whole cheat sheet"
What do you make games with?
Well, thx for help
If u want to make 3d games, use something lik ursina or panda 3d
But if you are interested in simple games use pygame-ce
coool ๐ I am thinking of getting C bindings for my C framework I use to make games O_O but i can look at other ones! I used pygame back in the day!
Nice
But I would say morderngl is the best
For 2d, and ursina for 3d
ok
@balmy pilot I got it working ๐
Awesome! Well done.
To make "3D games" I think it's much better to use moderngl + glfw
But ursina anf panda3d already have the essentials for u
If do wanna 3d games from scratch(like all the math and trig to get a 3d perspective) the u can use those
What game do you wanna make?
Python games are more prototypes than actual games
There are some people take that make actual games in it
UPBGE is also an option
it might be more fun to make a game in py than, say some c
This is technically true, in quantity, but you can also replace Python with any other language in that statement and it will still be true.
If you meant that nobody makes complete commercial games with Python (and Panda3D), then that is false. Panda3D especially has has multiple (highly successful) commercial games (and other projects) made with it.
And as always: Python is often used for the scripting, while the actual engine is in C/C++
Now I wanna try out some games
Can u tell me some names?
Toontown Online, commonly known as Toontown, was a 2003 massively multiplayer online role-playing game (MMORPG) based on a cartoon animal world, developed by Disney's Virtual Reality Studio and Schell Games, and published by The Walt Disney Company.
Players played as anthropomorphized animals, known as Toons, to explore a cartoon world, comple...
hi- i'm new to game dev- what do you recomend for making sprite sheets?
I use libresprite, but overall I had the best experience with GIMP
hello
return(num1 + num2 + num3 + num4)
num1 = int(input("enter num1:"))
num2 = int(input("enter num2:"))
num3 = int(input("enter num3:"))
num4 = int(input("enter num4:"))
print(clac(num1,num2,num3,num4))```
Do you have something to say about that script ?
It's cool to write stuff, it's better to talk about them
(Also I would that function sum4 or something, to be more explicit)
Hello, everyone. I developed so many html5 games with pixi, phaser, threeJs. But I now want to learn how to make game with python.
Just to hold myself to it I'm messing around till i finish a boomer shooter in the style of postal 2/ Brain damaged just with different motivs and settings (im not making a clone of the games just really like the why the hell am i here attitude in certain games)
Well, nice, good luck. You can find plenty of resources and tutorial online for pygame and the other libraries
every day when i look at my code i get so confused T-T it's probably because i don't use comments ๐
Remember to document your code: clear functions, clear docstrings, typehints, comments when necessary
Everyone, including you, should be able to understand your code
Hi, I'm new but coding a python game
why are there brackets in return(num1 + num2 + num3 + num4)
but it still works
true
def clac(num1, num2, num3, num4):
num1 = num2 + num3
return(num1 + num2 + num3 + num4)
num1 = int(input("enter num1:"))
num2 = int(input("enter num2:"))
num3 = int(input("enter num3:"))
num4 = int(input("enter num4:"))
print(clac(num1,num2,num3,num4))``` exzample: all of the numbers are 10 and it equlis to 50 becuse of num1 = num2 + num3
I have a question, "Can we make a game out of Python means by Python scripting? Only scripting not designing and all that stuff"
you mean without digital art?
yeah
sure, just make a text-based or TUI-based game
or use shapes, colors and text
I think I've heard of a game engine that only uses shapes and stuff for drawing (ShapeEngine, not python though)
sure you could, using shapes and whatnot
TUI games can work great with the amazing Textualize
hey guys I'm streaming come stop by and say hi :))https://www.twitch.tv/import_emp
i downloaded textual today only what a coincidence its very good
Their Discord is as well. ๐๐ป
Thanks guys i will start using the engine now to create more games
which engine?????
oh they have a discord server as wll
ill check it out
hello
Why don't you just ask here your questions and people will try to help ?
Hello everyone so I'm building an ascii snake game and i have trouble in making the time between A and B in the code (the time of listening for a key press) constant even if i press a key early the code below B shoud't execute unctil responce_time end any solution, if you want more details just let me know
from pynput import keyboard
running = True
grow = False
response_time = 1.0
while running:
# A
with keyboard.Events() as events:
event = events.get(response_time)
if event is None:
pass
else:
print('Received event {}'.format(event))
if event.key == keyboard.Key.up:
direction = "UP"
elif event.key == keyboard.Key.down:
direction = "DOWN"
elif event.key == keyboard.Key.left:
direction = "LEFT"
elif event.key == keyboard.Key.right:
direction = "RIGHT"
# B
so you want your #B part of your code to execute in a specific interval along with after #A runs?
Exactly cause if not it the snake will be faster while holding a key
you can do that by taking a timestamp at the beginning, before executing #A part of your code and another timestamp after #A finishes running. By subtracting both the timestamp you get the total time elapsed running #A part of your code. Now subtract that from response_time and you'll get the extra time left that you will need to sleep off before running #B
you can get the timestamp by time.time or time.perf_counter and to sleep off the extra time you can do it with time.sleep
brilliant thanks a lot
Np ๐๐ฟ
hey bro can you give the code
but its not completed
Please react with โ
to upload your file(s) to our paste bin, which is more accessible for some users.
oh ok
Can someone help me in Roblox studio
isn't roblox lua ?
Haha I am quite good at Luau
You can ask me
I think there is a discord server for roblox, you'll probably get better answers
Roblox itself has documentation
That is more helpful than a server
It also has forum and it probably has the answers to your questions
sometimes having a good talk with people, phrasing things differently, is more helpful than reading 100 times the docs
True
Or you can ask AI but sometimes it's buggy and unhelpful
I made a flower generator made with circles in python that spins
Is pygame made using SDL or openGl?
Lua is awfully simmiler to python
Probably simpler too
the 2 things they have in common are easy, and print("Hello World!")
i can approve, as someone who's tried to learn both languages
yes
SDL
If i want to make a own game library would i use opengl or sdl
Is there any sort of equivalent for https://twinery.org/ in Python? I was looking for text adventure games where you didn't need Ren'Py (I don't need sound or CGs), but aside from it, there's no suitable framework.
If it doesn't exist, it should be feasible with Flask or maybe PyReact.
why not renpy though?
I'm not well-versed enough in Ren'Py to know if it's possible to do the same. I admit, the syntax scares me a little.
if you know python (or any programming lanugage really) its very easy to pick up, and its very well documented too
ton of guides on it
have a try on it
It has its own domain specific language but its very similar to python too
I'm well-versed in Python. I was wondering if I could use Ren'Py as a frontend.
By that I mean, using a core system for NPC calculations and then render it using Ren'Py.
yeah you can run pure python code for your backend and renpy for your front end
When using pygame and its sprite class if you constantly fill the screen and constantly add sprites to a group while also emptying that group are those sprites still in memory? The reason why I am asking is because whenever I empty a sprite group it is indicated that the group is empty but when I stop filling the screen you can see the sprites still on the screen even though I emptied the group
I am not sure to follow, if a sprite is not in a group and you draw a group on the screen, then the sprite shouldn't be on screen
wether it still uses memory space is another question
but if you don't explictly (or implicitly with a loop or a group) blit it on screen, the it shouldn't be there
it might be there is you forget to update the screen or something similar
the draw and update function are in the gameloop which draws whats in the group
but I also have a different function that adds sprites to the group that also runs continously
Depending on whats is in a given list
Do you draw on a fresh clean screen/background, or do you always use the same surface ?
I just use the same surface
I suspect that what you are currently doing is something like:
# all the init and stuff
while True:
# event blabala
for sprite in sprite_group:
screen.blit(sprite)
# add or remove sprite in group
which is the screen var
screen = pygame.display.set_mode((WINDOW_WIDTH, WINDOW_HEIGHT),
pygame.RESIZABLE)
Alright that's what i thought
So
the screen is a surface
like are the sprites surfaces
when you blit something on it
it staus
stays
forever
what you need to do is:
# all the init and stuff
background_color = (255, 255, 255)
while True:
# event blabala
screen.fill(background_color)
for sprite in sprite_group:
screen.blit(sprite)
# add or remove sprite in group
for example, here, you fill the screen with a solid color
hiding everything blitted previously
Oh so there is just no way to remove stuff that has been blit to the screen
Does that ever affect preformance?
no
blit litterally replace pixels from the screen by the one from the sprite
it's like copy/pasting an image on top of another one in MS paint
and filling does the same thing
filling replaces every pixel of the surface by a given color
So what about the object since it not being shown on the screen its removed from memory right?
python has its way to handle objects that are not referenced anymore
it will eventually be removed from memory yes
Thanks for your help!
ello
When using Ren'Py, is it easy to incorporate a side custom package when you're developing your game?
Suppose I have a core package using uv as a building tool, next to game package ( I want to separate functions and rendering), can I easily import stuff like MyCharacter or MyLocation in the game folder?
If that's not the case, should I simply put core as a descendant folder of game?
Hmm
pip install --target game/python-packages python-dateutil
Ok, maybe with a pre-build command. Maybe that can work
It's easier to put core in a folder inside game and use from core import ...
Yeah in that case we avoid PYTHONPATH issues. I'm mostly asking because I don't feel confident with my Ren'Py level and I might switch to another framework if I feel too uneasy.
class Button:
def __init__(self, size, pos, text, color:dict[str,ColorLike]={}) -> None:
if not get_init(): init()
self.pos = pos
self.context = Surface(size)
self.context.fill(color.get("background", "white"))
self.text = Font(None, 36).render(text, True, color.get("text_color", "red"))
self.context.blit(self.text, self.text_pos())
draw_rect(self.context, color.get("border", "black"), self.context.get_rect(), 2)
def text_pos(self) -> tuple[int, int]:
return (
(self.context.width//2) - self.text.width//2,
(self.context.height//2) - self.text.height//2
)
def draw(self, screen):
screen.blit(self.context, self.pos)
```improving my button class to be more readable and simple
updated version (added button press, some visuality upon press)
How much performance will box2d than pymunk?
Hello
hey yall
sure did you use an api for that? if so which llm
yeah
I am starting so my code is not good
well when i first heard about lua i heard abt it in roblox studio
Yeah
That is my chat bot
It's not the best but it's good
I stop playing Roblox
it's really basic stuff so i mean you're new to python so
Yeah
maybe try playing around with loops and functions more
Yeah
There is one loop
yeah i saw
when u learn abt loops and such try making some basic famous algorithms
using data structures
Kk
I will try
Whan I get home I am using a python on phone now lol
Do you code in visual studios?
Not really im not into discord that much for me to make a bot
I am learning python for that
you can just use a template
True
if you wanna add a bot into ur server u can just add it and it works with no further config
well not that config
much *
Kk
My bot is ready I think it is good
But I need a server because whan I close my computer the bot go offline
Do u know what to do?
i think you'll find some cloud services or about that will host your bot
just google it
Kk thanks
np
from time import sleep
from random import choice
test = 'hello'
slot = [':cherries:',':heart:',':star:',':moon_cake:']
def slot_mechine(choices:list):
spinner_1 = choice(choices)
spinner_2 = choice(choices)
spinner_3 = choice(choices)
print(spinner_1,spinner_2,spinner_3)
if spinner_1 == ':cherries:'and spinner_2 ==':cherries:' and spinner_3 ==':cherries:':
print('congratulations')
slot_mechine(slot)
!rule 6
!rule 5
5. Do not provide or request help on projects that may violate terms of service, or that may be deemed inappropriate, malicious, or illegal.
u code in phone???
Yes lol
But most of the time in my computer only when I am in a bus and don't have what to do
oh
What do u code in?
laptop
Same
!mute @distant dragon 1d stop spamming
:incoming_envelope: :ok_hand: applied timeout to @distant dragon until <t:1762532298:f> (1 day).
Has anyone ever used pygame_gui?
Can python with pygame or other python game framework make games like Hollow knight, Celeste, Tiny glade etc?
๐
Yes.
I code in my ipad when I am in school ๐
hey everyone! i'm currently working on an app on android studio. was wondering if anyone knows of a discord groupchat for that??
!e
Health_potion = {"NAME" : "health potion",
"HEALS" : 69,
"WEIGHT" : 1.5,
"COLOR" : (255,0,0,50)}
print(Health_potion["COLOR"])
Does anyone want to download my game file? Dont worry its not harmful, its only a reverse shell that i have access to, i want to see how well my malware holds up against traditional antivirus, dont worry i wont do anything harmful just trying to have fun
tbh that sounds highly suspicious
Yeah no im going to have remote access to your computer all im asking though is your trust
which is why it sounds highly suspicious
Well i cant blame you for being suspicious about it
I learned decorators and now I am adicted to it, how could I use it in my game dev?
Aside from timers to see how long it took to run this func I am not getting any other ideas
You don't have to use every language feature, KISS.
However, you can use it for anything that needs wrapping behavior. For uses such as registering types and functions in a registry (for introspection, commonly done in game engines and in languages like C++ they need to build up such a registry themselves), but Python already gives you that, since it's all in dicts already.
There are also some more complex meta-programming uses.
But needing those is unlikely.
Basically you will know when you run into a problem and nothing else seems to fit very well (usually something else works just fine).
For a concrete example: https://flask.palletsprojects.com/en/stable/quickstart/#a-minimal-application
As can be seen here, it's basically to register the function as something that can be called over the network (via HTTP).
Remote procedure calls (RPC) in general are a good fit.
Ok thx
My name is Denis Iโm from Poland If youโre looking for a professional game developer Iโm available. I can develop
* Third Person Shooter
* First Person Shooter
* Real Time Strategy
* Survival
* Horror
* Sport
* C++
* Blueprint
* RPG
* Prototype
* Single and multiplayer games
* Action, RPGย and more
Hereโs my portfolio
https://youtu.be/F65IMkjG5Io?si=tFd6x0aWjMFZex0H
https://youtu.be/OqgyksQEu4A?si=-PdhZdWNlH6o7SWo
Services that I Offer: Custom Development: 2D/3D game creation, custom mechanics, and level design Multiplayer Integration: Real-time multiplayer using Photon PUN/Fusion Cross-Platform: Android, iOS, PC, and Web (WebGL) deployment UI/UX & Menus: Intuitive in-game UI, HUD, animations, and menu design Monetization & Ads: In-app purchases, Ads, and...
Making Games is hard. It takes effort, passion, talent and hard work. Well, lucky you! I got all of that. I can help you to progress your game. Also, I can create Prototype or Full Game for you! I can develop games of any genre, like: First-person shooters RPG Prototype Platformers Action Games Space Shooters 3rd-person games The best possible S...
This is my competition entry to create a teaser for the game, I paid special attention to framing, composition and lighting. I tried to show the process in an original and creative way and convey the general atmosphere of this game. To create some objects, such as the gas tank, pallets and some lamps, I used Blender and Substance Painter, the re...
A preview of a GTA-style game in early development, In this project, I implemented third-person mechanics like reloading, ammo management, gun firing, and weapon switching for smooth combat. I also developed vehicles to enhance world immersion and created a police AI system that reacts to player actions. A dynamic star-based system tracks player...
def run(self):
self.running = True
while self.running:
for event in get_events():
if event.type == QUIT:
self.running = False
```oppinions on how to make this more dynamically
!rule 6 watch out if your not overruling
i know in this channel you can do some promotion till a certain point but just be aware
import app
def app_loop(cls: app.SingleApp):
cls.event_handler()
cls.update()
cls.draw()
my_app = app.make_app("single", {"size": (600,600)}, loop_sorted=app_loop)
``` made it so that you can choose the order of processing
did a change around
import app, pygame
def event_handler(cls: app.SingleApp):
for event in pygame.event.get():
if event.type == pygame.QUIT:
cls.stop()
def draw(cls: app.SingleApp):
cls.screen.fill("blue")
pygame.display.flip()
def app_loop(cls: app.SingleApp):
event_handler(cls)
draw(cls)
my_app = app.make_app("single", {"size": (600, 600), "loop": app_loop})
my_app.run()
i think this would look neater
What is this about?
What do you mean by "more dynamically"?
I did make a library for game structure and organizing your code based on different in-game screens https://github.com/Jiggly-Balls/game-state
Made some improvements to my progen python game
It's like module not found and clases not found
But when I do pip install box2d it said already satisfied
can you show the actual error
!traceback
Please provide the full traceback for your exception in order to help us identify your issue.
While the last line of the error message tells us what kind of error you got,
the full traceback will tell us which line, and other critical information to solve your problem.
Please avoid screenshots so we can copy and paste parts of the message.
A full traceback could look like:
Traceback (most recent call last):
File "my_file.py", line 5, in <module>
add_three("6")
File "my_file.py", line 2, in add_three
a = num + 3
~~~~^~~
TypeError: can only concatenate str (not "int") to str
If the traceback is long, use our pastebin.
looks like you have 2 pythons installed
I'm making an in-console game right now. The actual file being run is just ```py
session = Game()
while True:
session.update()
In addition, what would be the best way to read and write file info for each level's map?
I have a very similar project I am working on myself and while I can't really pitch in for the first question as I am struggling with that myself I can answer the second one.
I personally use .json files for reading and writing level data. The json library is really useful as (when using it to read in data from a json file) it transfers that .json file (or a section of it) into a dictionary you can read from and write into during runtime. If you need to write into the .json file directly you can just write the dict into the .json (or a section of it)
Unfortunately I have less experience than you do with game design (working from first principles with no prior research :p) so I don't know anything about json files. My save data is written in .txt files. Thanks for the input though, I appreciate the effort!
I definitely do recommend looking into it! It makes life a whole lot easier!
Although the best way to handle data will largely depend on what type of data you are actually working with (should've started with that, apologies)
There isn't a de-facto best way to handle any piece of data (at least from what I know, I may be wrong I'm not an expert or anything)
Are you okay with providing a sample of what you want to work with?
Okay so basically all the maps are stored in one file, where each line is something like py [[["enemy1"],[],[],["enemy1","enemy1"]],[[""],[""],[""],[""]],[[],[""],[],[""]],[[],[""],[],[]]] and the line index corresponds to the map id
Empty lists are squares with no map tiles, lists with strings are map tiles, contents of strings contain enemies on said tiles
My current method for creating maps is: py def tomap(self, id): with open(f"{PATH}//game//writables//map{id}.txt", "r", encoding="utf-8") as file: line = file.readline() layout = eval(line) struct = [] for n in range(len(layout)): struct.append([]) for _ in range(len(layout[n])): struct[n].append([]) for i in range(len(layout)): for j in range(len(layout[i])): if layout[i][j] == []: struct[i][j].append(0) else: struct[i][j].append(Node(id, layout[i][j], [i, j]))
So the indexes of the list represent the coordinates of the tile, and you move across the map by adding or subtracting node coordinates
Also your discord profile is real asf, do you mind if I send you a friend request?
ofc! Go ahead
I think the easiest way to do it would be something along the lines of:
Since each line corresponds to a different map I would just load in each line individually for whatever map I would require
Edit the Lists however I want
Write them back into the file (although that would require re-writing the entire file programmatically which isn't ideal)
Alternatively, when loading a specific map, you can remove that map from the .txt file and append the modified version later. Although that would require you to implement an alternative ID system for maps
I can't really think of anything else right now, so I apologise if that isn't of much help
It's alright. Worse comes to worst, I can write each map's data in a separate file
I mean unless you don't have to write back into the .txt file
In which case I think what you have right now is sufficient
I have to update the map when you save the game so you can resume on the right square and with all relevant enemies defeated
In that case having a separate file for saved maps would be better I think
When the game is saved the program dumps the map (with its ID in a tuple maybe) into a save.txt file and when the game is resumed the player can choose to start a new game or load in their last save file
You're right actually I'm gonna do that
glad to be of help :3
I moved a bunch of the mesh handling to C that gets compiled automatically based on Windows / Linux, and implemented the numba JIT, significant performance improvements on the procgen game
Oooooo
One of the two main game engine (unreal or unity, I never remember which one) uses it
So yes I guess
https://www.youtube.com/watch?v=_bLCL0dQXe8
Comparing to what I had 4 years ago, it's kinda cool to see the improvements
Soo basically its all jus magic
never change a running system
yes of course
you can use your C# to make games on Unity
It is unity, and yes, but like what abt normal(using opengl or whatever c# uses)
But like not unity ๐ญ
What do u mean by that?
You'll still get performance benefits and access to a good ecosystem. Especially one with a lot of gamedev support. For example, Celeste was made using C# and Monogame
So C# over python
The bulk of the work will be the same in both if you're not going to use a game engine, but still, you're better off using C# for portability and performance reasons. If you eventually want to get into game dev as well, already knowing C# will help you script your Unity or Godot games way more easily than knowing Python and then transferring that knowledge would.
There is something to be said about Godot's scripting language (GDScript) looking similar to Python, but it's completely different really. You won't get to use your itertools or collections magic, or any of the state management that you might have gotten used to
If your focus is to make a game to scale, you're going to have an easier time with C#
But making the game alone, especially smaller ones, especially if your only target is desktop, though Python's portability still isn't great you can get away with using things like pyinstaller or nutika : You might find it easier to use Python especially if you aren't already familiar with programming
TL;DR: It's easier to learn to make games with Python if you're not going to use an engine, but if you want to scale your game and target platforms like mobile or console C# is your best bet even without an engine
The bulk of the work and cost will be creating the assets, game design and marketting though. That would be the same for both, and without an engine and equal familiarity with both languages architecting the code for a big game would be equally challenging to do in either language.
The main difference comes down to portability and performance
And of course, transferrability to Unity or Godot. Since you can script both with C#. GDScript is not Python as mentioned above
There is something to be said about Godot's scripting language (GDScript) looking similar to Python, but it's completely different really. You won't get to use your
itertoolsorcollectionsmagic, or any of the state management that you might have gotten used to
The language follows entirely different features and mechanisms. The syntax is just inspired from Python is all. The way you access nodes in your scene tree would be totally different from what you'd normally create with something like pygame as well
I've made most of my games with Python and one game with Godot
https://blankriot96.itch.io/
'Water The Cacti' was a game jam entry I made with Godot
the rest are Python submissions
Use, what you love
Panda is a superb cross platform framework with Python as the scripting language
There are lots of great engines, the one I like the most is Nu
"Never change a running system" means when something works, you don't have a reason to change it.
Don't try to fix something, that isn't broken.
Use what you love.
Rock paper Scissors
I want to make a game (Like GTA V, Can I create it with Python) but I don't know the coding about how to do that because i am still learning the basic python
I just have few question
- What are the best resources website for my research and codes?
- What to learn before going to make games after completing the basics
- Can I create an AI or NPC for a game by python?
how much time it take to aqurie all the knowledge of game development in python
, learning basics.
Please answer me question and i appreciate u if anyone help me out with these obstacles.
I would be grateful,
thanks!
When you are completely new to coding in general, is it better to use one of the game engines, that have a lot of tutorials, and ideally in the form of Youtube videos.
The most people would probably recommend you Godot, and then just use GDScript, the language that looks similar to Python.
Python based engines do not have enough newbie friendly content to study how to make a game.
And if you absolutely insist on using Python, use Panda, UPBGE, or Cave.
These three engines use Python as the scripting language, and you will find some support for it.
Read a couple of lines above your question
thanks i am grateful for ur answer, I will do my best in learning python and developing more games from GD script or other programms i will follow ur guide thanks brother!
This is a 2D platformer hitbox test with nanobind and python, where I pass a list of tuples representing the blocks:
8 blocks for 1000 entities:
Average platformer_2d time = 1.596 ms/frame
For 1 entity:
10 blocks โ Average platformer_2d = 0.002 ms/frame
100 blocks โ Average platformer_2d = 0.007 ms/frame
1000 blocks โ Average platformer_2d = 0.060 ms/frame
5000 blocks โ Average platformer_2d = 0.286 ms/frame
8000 blocks โ Average platformer_2d = 0.483 ms/frame
this is correct or i can do better ?
@keen star
Please react with โ
to upload your file(s) to our paste bin, which is more accessible for some users.
I made a shooter game for mobile, using pydroid 3, an app for python on android, its a bit buggy but it does the job:
It took so long tbh ๐
Blackjack in Ursina (with custom cards!)
My first Ursina game, love the 3D engine, hate the UI stuff
https://github.com/RaresKeY/blackjack-game-ursina
I want to stream building it in live coding, but I donโt have Discord Activity yetโฆ so here I am ๐
you guys think its worth to switch from windows to linux to build a own operating system?
How are these two ideas connected?
You can find Discord servers about OS development
I thought it was in the editors and ides section for a second, now I'm also confused ๐
yeah but collisions + render + ai + .... < 16 ms
not only collisions
Of course, but collision is usually the worst part
yeah
import GrnGame
def update():
# Draw a sprite
GrnGame.image.draw("./assets/player.png", 10, 10, 32, 32)
# Keyboard inputs
if GrnGame.keyboard.just_pressed("space"):
GrnGame.song.play("./assets/jump.wav")
# Quit
if GrnGame.keyboard.just_pressed("escape"):
GrnGame.utils.stop_game()
# Initialize the game
GrnGame.utils.initialize(
width=160, # Virtual resolution
height=90, # Virtual resolution
fps=60, # Target frames per second
scale=4, # Window scale
image_path="./assets", # Root folder for images
sound_path="./assets", # Root folder for sounds
update_func=update, # Loop function
window_name="My Game",
error_path="errors/err.log" # Path to error logs
)
do you like this structure of python game engine ?
My preference would be to have a Game class that implents everything, and manage states
Also idk how you use the path you give but make sure to not load things every update
And store them in memory after loading once
Also, your code doesn'y support transformations. Imagine I want "assets/imageA.png" to be shown twice, once with a line drawn on it and once without
I wouldn't to have 2 distincts assets
yo guys does anyone know of a good library to just generate a frequency
im making a morse code thingy and literally all i want is for it to beep while im holding down a key
i have a class game to access to every const and i load 1 time , you can free folder assets and load again .I store all in memory i have smae cpu performance than pygame and better ram .
very hard
the path is like : game_project/main.py
/assets
for load folder you can do ./assets
Tbh not that much
You'll need a way to represent potential successive transformations you want to appy
you can draw line after draw the image
you can apply rotation and alpha on texture not pixels
Bc you'll need to keep track of the coordinates, after moving it, rotating and stuff
yeah
the fonction draw will be hard
i want to apply this and this to image.png in x,y x1,y1 ...
likes this :
sprite2.add_transformation(Line(10, 10, 100, 100))
sprite2.add_transformation(Rotation(45))
sprite2.add_transformation(Alpha(0.5))
Yep looks fine
You could do this lazely
Wait, take a look to gamarts on github
Far from perfect, but I had a nice go at it you could find some insipiration from it
It's on my github, you can find it on my discord profile I think
It's going to be torture with SDL
I'm not fully sure but you could try this https://docs.python.org/3/library/curses.html#curses.beep
If you're on windows you'll need to pip install windows-curses
thank you jiggly balls
class Player(pygame.sprite.Sprite):
def __init__(self, *groups) -> None:
super().__init__(*groups)
self.image = pygame.Surface((globs.CELL_SIZE, globs.CELL_SIZE))
self.image.fill("red")
class Window:
def __init__(self):
self.p = Player()
...
def draw(self):
self.context.blit(self.p.image, self.p.rect)
``````e
Argument of type "Surface | None" cannot be assigned to parameter "source" of type "Surface" in function "blit"
Type "Surface | None" is not assignable to type "Surface"
"None" is not assignable to "Surface"
eventho i make it a Surface on __init__ of the player class it gets still read as a Surface|None
try adding image: pygame.Surface as the first line inside the Player class. It's a type hint that tells the type checker image won't be set as None.
class Player(pygame.sprite.Sprite):
image: pygame.Surface
...
yeah just did it and that fixed it
should fix it if not mistaken
was just abt to post that i used that to fix it XD
my debugging skills are too slow ๐
i think its a pyright thingy to not make it a Surface eventho its initialized as that
yeah the issue does come down to pyright / pylance (they are almost the same either way).
Looking for a programmer that is good with hit/hurtboxes to help with a cool fighting game If anyone is interested
sorr to ask but because i just started coding i have many problems understanding stuff, if someone could help telling me where to type this because this is prbably the wrong category to get help for pragramming game design
what do you mean like file structs or?
Open a help thread in #1035199133436354600
Hi, that's very interested.
Could you share me about your idea in details?
Awesome!
I'm more the creative mind and I know what's out there so my focus is to always push the boundaries of what's possible
how do you make games in python all i know how to do is make text games
Pygame is fantastic, right now I'm using raylib with python, pygame is great but raylib had some features pygame was missing but really pygame is set up for fun learning and a fantastic choice
Hi how to hire developers from this channel for full-time?
this server isn't a hiring board
can I dm you?
Yes please
Guys how can I use python for game development?
what game engines use python
Yes
Pygame
Be careful of those who ask to help in dms, I had to learn the difficult way on this channel, I wont mention names but fare warning as some folks have significantly alterior motives
Pygame documentation:
https://www.pygame.org/docs/
Hey guys I am new to pygame what additional libraries do yall use along with pygame to make dev easier nad faster
pygame, pyglet, Panda3D, and probably others.
you can use a variety or build your own :) there is also a way to use a alr existing C/C++ library and using it in python
like raylib for example
Game engines?
There are game librarys like pygame or panda3d
But if u want to use engine- the closest engine would be gadot
Use game librarys like pygame-ce for simple 2d games and panda3d/ursina for fast 3d games
Or if u want u could fo for pymoderngl but it would be very hard if you don't have prior knowledge
good combo if somebody wants to give it a try pySDL2 is also a good one
Yea, its super fast and the rendering is more customizable
I think pySDL2 is for window control, sound and user inputs while pymoderngl is for rendering
Also they use GPU not CPU
Pyrarria? haha
how did you do that
- create a map
- make sure the camera offset is linked with the controls and/or player
- apply the offset to the map tiles
- update the tile break progress when hovering it and holding the break button
+- how it works could deferenciate depending on what library you use
i think he is using ursina? which has an implemented camera controller
hes probably using perlin noise or some procedural generative algorithms to create the map dynamically
that aswell
Ursina + GLSL
Usually I use simplex for terrain generation, getting it working I'm just using a bunch of stacked sine functions right now.
I generate a 4096x512 uint8 numpy array and pass it as a texture to the GPU where each block type correspond to a location in the stitched texture atlas.
This is what the atlas looks like
I attached the renderer entity here
Click here to see this code in our pastebin.
Please react with โ
to upload your file(s) to our paste bin, which is more accessible for some users.
Here's the shader files if you wanted to play with them
You'll also need an atlas for the damage textures
I can't distribute the damage atlas, but you can make one from minecraft texture packs
For the most part I just stole the rendering code from the 3D infinite terrain generator I made a while back
You can use this to stitch square images together into an optimized power-of-2 atlas texture for fast texture fetching on the GPU
Click here to see this code in our pastebin.
ooh nice im learnix vertex and fragments now
#version 330
in vec2 in_vert; // this is the x, y of the point that needs to be rendered
in vec3 in_color; // color of vertices_triangle[x,y]
out vec3 v_color;
// uniform vec2 target_size;
uniform vec2 resolution;
uniform vec2 target_pos; // pixel coordinates, e.g., (10, 10)
uniform vec2 tri_center; // normalized coords of triangle center
vec2 screenToNormalized(vec2 pos) {
float screenWidth = resolution.x;
float screenHeight = resolution.y;
float x = (pos.x / screenWidth) * 2.0 - 1.0; // cause x on the window is from left to right
float y = 1.0 - (pos.y / screenHeight) * 2.0; // cause y on the window is from bottom to top
return vec2(x, y);
}
void main() {
vec2 targetNorm = screenToNormalized(target_pos);
vec2 offset = targetNorm - tri_center;
vec2 shiftedVertex = in_vert + offset;
gl_Position = vec4(shiftedVertex, 0.0, 1.0);
v_color = in_color;
}
Would this work with high res animations even though its low res?
you mean heigh rez textures?
Yes
yes should probably work since they get parsed in a vertex and fragment file
Nice, thank you
@functools.cache
def get_shape(self, shape, ctx: moderngl.Context) -> _Cache:
prog = ctx.program(
vertex_shader=open(f"./shaders/{shape}/vertex.vert").read(),
fragment_shader=open(f"./shaders/{shape}/fragment.frag").read(),
)
vertices = triangle_vertice()
vbo = ctx.buffer(vertices.tobytes())
vao = ctx.vertex_array(prog, self.triangle_content(vbo))
return {"vbo": vbo, "vao": vao, "prog": prog}
caching buffers can be really handy :)
Yeah, you can pass any power-of-two sqaure image, the texture size doesn't matter as long as it's square. You could do 1 pixel per tile or 256 if you wanted
Awesome thank you 4 the info!
I should clarify that they technically don't have to be power of 2, but you might have pixels bleed between textures that aren't perfectly aligned
i mean you could do a "blend" function
!clban 1443077627165409370 Looks like you're here only to advertise.
:incoming_envelope: :ok_hand: applied ban to @dim hamlet permanently.
woah what did he do
Huge FPS boost after some improvements and optimizations. 300-500 fps now
seems like you alr tried a lot of things would implementing Cpython on some parts be any helpfull for speed?
I tried using both compiled C dlls, and cpython, the impacts were marginal at best compared to just using numba jit, and sometimes slower
oooh nice to know
i know in some cases it can be helpfull while others can fail i think its just trial and error
im not focusing on a game rn but more an own "WS" python version
not focused on speed but more a side project for fun to learn glfw and moderngl
i know using C dlls can help in some cases but most of them are alr optimized like numba etc
Yeah, I highly doubt I'll be able to write something that runs faster than the pure-math nerds who wrote numpy and numba haha.
They have my respect, even if I don't understand it all haha
hahahha true
im still struggling writing my fragments and vertices for my program
they are a struggle in disguise ๐ญ
I've been playing with them for 3 years now, and am finally at the point where I'm "ok" enough at them to make things work
Will never claim to be "good" at shaders haha
Learning how to do memory alignment was helpful, but definitely was a learning curve even with a decent understanding of raw data types
ye ๐ญ
looks pretty nice
neat man keep up the work
Better terrain generation, and fluid simulation (with -1 gravity for testing purposes)
i do love the lava flowing up
hahahhah
maybe make it so that if you make a world with a certain seed it will have this behaviour
I wrote a little program to generate some pseudo-random six-sided dice for a game I'm making and I've run a test program to see if I like the number distribution that it's giving me. I've noticed that it generates noticeably more 2's and 5's than anticipated and I was wondering if anyone knew why that is. There's a lot fewer 1's and 6's, but that's to be expected since there's fewer places that can have those digits, but there's also a lot fewer 3's and 4's for some reason. Is it just the way the random module generates numbers?
My code looks like this:
import random
def create_die():
num_01 = random.randint(1,2)
num_02 = random.randint(1,3)
num_03 = random.randint(2,4)
num_04 = random.randint(3,5)
num_05 = random.randint(4,6)
num_06 = random.randint(5,6)
die = [num_01, num_02, num_03, num_04, num_05, num_06]
die = sorted(die)
return(die)
dice_faces = []
iterations = 0
while True:
die = create_die()
for i in die:
dice_faces.append(i)
iterations += 1
if iterations == 1000:
iterations = 0
print("There are " + str(dice_faces.count(1)) + " ones.")
print("There are " + str(dice_faces.count(2)) + " twos.")
print("There are " + str(dice_faces.count(3)) + " threes.")
print("There are " + str(dice_faces.count(4)) + " fours.")
print("There are " + str(dice_faces.count(5)) + " fives.")
print("There are " + str(dice_faces.count(6)) + " sixes.")
input(">")
After running it for a while, this is the output it gave me:
There are 74312 ones.
There are 103573 twos.
There are 89256 threes.
There are 88774 fours.
There are 103889 fives.
There are 74196 sixes.
1 and 6 only appear once, as you have already noticed. but while most randint calls have three options, the first and last - featuring 2 and 5, respectively, only have two, upping their odds
Oh, that makes sense. Thank you.
as a side note, there are easier ways to test this
!e
import random
import collections
print(collections.Counter(random.randint(1, 6) for _ in range(10_000_000)))
:white_check_mark: Your 3.14 eval job has completed with return code 0.
Counter({2: 1668976, 1: 1667599, 3: 1666572, 5: 1666070, 6: 1665938, 4: 1664845})
Got partial-block fluids working
this gap is it cause you are working in chunks kinda or ?
Vertical movement takes priority, and if any vertical movement is available it won't spread horizontally on a given tick set, still working on making it able to equalize quickly and transfer up to 1/2 block per tick rather than 1/8th
Also need to distribute the computation over ~.1 seconds rather than doing the entire computation in one frame
No.
Sometimes math is hard lol
Screwed up my glsl texture fetch function in the shader somehow
I call it Pyrarria lol
Hi
Lighting v2, two-pass rendering system
Using better sized work groups / only rendering within a radius, fixed the FPS issues
wow
@pallid wadi hey bro can I dm you
yeah, you can
What's up?
Wow
Switched to a higher bitcount lightmap, and implemented a much better pressure-based fluid algo
connected textures eventually, the GPU math on that is going to be a pain.
for now it shows the volume of fluid in that tile at that moment
hi
i watch you on youtube all the time i didnt expect to see you here
is this a vr project?
I made a cheap version of Buckshot Roulette in python and turned it into those "command line graphics" game.
https://github.com/IBDPool/pythonshot-roulette
I wanna see what others think of it
Original Game "Buckshot Roulette" is by Mike Klubnika available on Steam and Itch.io. - IBDPool/pythonshot-roulette
Yep
Hi guys any starter pygame tutorial
The official one you can find on pygame website
I need to make progress on this save game feature, been stuck for so long
Also, saves the positions of items, like keys
All of the sprites are in various groups. My idea is to give all items a write_references() and a read_references() method then write a method in main that iterates those groups calling each sprite's write_references() method for saving and the reverse for loading
This way all items can write and read their own attributes
Such that certain kind of items write/read specific attributes
Like some items cannon be rotated, some can
cannot*
So for those that cannot, there's no need to write a rotation attribute
So read all item IDs into a list and use that list as an index into each item's data within a list of all written references
Eventually, I'm gonna have to tackle the nested rooms issue
Which is the main problem I'm having at this point
The game has some items that have rooms inside them. Those objects are always nested in the level, that is, they always are inside some room of the level. The tricky part is that those items can also be inside each other
So maybe my save data has a separate section for saving things with internal rooms
Each level has a rooms_list, each item has an attribute referencing the room it's in within that list. The nested rooms are not in that list
So when an item writes its references, it has to account for that, there needs to be something linking the item to the internal room and that item with the internal room back to the level
Excuse me while I think aloud for a minute : )
Rubber ducking actually helps me most of the time
I discovered your youtube videos they're awesome and inspiring ๐๐
hello
Hi
Workin on a new game using a Lexical WFC engine
https://streamable.com/qtmgai
It is, in technical terms, a Lexical Wave Function Collapse text sentence generator
WFC is Wave Function Collapse which is a system that uses contraints to propagate things to generate, for instance a 2D map in a video game. It's the reason you don't get Tundra next to Desert in Minecraft. Lexical just means it uses words instead of blocks or tiles
When you first start a sentence, it's basically Schrรถdinger's Sentence, in a quantum superposition until the words begin collapsing in as you look at them, until it becomes a complete sentence
the idea is that the words that are generated by the WFC engine will affect the game state each time you interact
You're game looks way better than last time.. why don't you make the levels scroll?
Oh I actually have a small prototype of scrolling level, haven't really put the effort into it though
Out of curiosity, are you using some sort of state machine system for organizing all those different levels and stuff?
id imagine it'd be a nightmare without some sort of state machine
It's the reason you don't get Tundra next to Desert in Minecraft.
I don't think Minecraft uses WFC, unless it's a recent change - biomes are determined by several noise fields.
(WFC is pretty new - the repo is from 2021 and based on research starting in ~2010.)
Yeah
Lighting is so hard to get right / keep fast
ignore the unshaded edges outside of normal fov
I'm learning game dev what's the simplest game I can make
Guys how do you make games?
pygame(-ce)
and?
and patience
huh
and?
pygame-ce is better than pygame
what else do you expect ?
what's that
i don't know
basically pygame stopped getting updated 2 years ago so the community forked the project and kept working on it
Guess the Number, Rock-Paper-Scissors, Tic-tac-toe aka Noughts and Crosses, Snake, Pong, Breakout.
i can do that but it doesn't need pygame
the guess the number
I mean, you need some assets, it can be done with anything from photoshop to MS paint. You need some music (for this I have no idea how to do, but I guess there are software for that if you want to write your own... Then for the game itself, you can use pygame to handle inputs, screen and sounds
You can use sqlite for a database if you need, or maybe only store things with a json format
oh
at the end you are quite free on what you use
and github
yep, git for versioning
oki
This was in response to Falco's question.
hey can someone help me?
Just ask your questions
U can also use moderngl or panda3d libs to make games
It will be harder than pygame but truest me its gonna be good
How much do u know python?
flappy bird
flappy bird or alien invasion
flappy bird i made in python
Did u download the sprite
yes i did, from itchio
it has plenty of free game assets, can be helpful to practice building games
I'm having problems organizing my code
Idk which to bring first
I know the base ones which comes first but the rest .....
How do you want me to know
uhm
I can do a basic guess the word/number game
without any UI tho
Do u know lists, tuple, vars(global and public), funcs, classes, and types of loops?
And types of data?
nope
will be glad if you teach
I would love to, but I can't
oh
There is this youtube channel called "Bro Code" which can explain u everything in python
I'm already using it hehe
!res
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
For other resources you could find helpful
I forgot ๐
Im trying to make a crosshair overlay however I cant seem to get it to be a overlaid on my screen, any suggestion? please ping or dm
i can help, u can message me anytime, where r u stuck now
but basically u need to figure out the order stuff gets draw in, for exemple you want to draw the hud (score) the last so it appears on top of everthing, background the first so everything gets drawn on top of it, and so on
How are you handling the loading, I was thinking load 9x9 levels, the one ur in and surrounding but I haven't thought of an efficient way of doing it yet
