#game-development
1 messages · Page 96 of 1
From a higher level perspective it's not that hard to understand. Ignore all the rendering stuff. We have a world with chunks and they have data.
Going into details on the rendering can make you snowblind 😄
what kind of data strucutres do you use for your blocks?
do you have some sort of id system?
and do you have an editor or gui interface?
A block is a list of bytes (65k of them). 0 is air and everything else is some kind of solid block
There are no fancy bells and whistles like editors and whatnot
oh so the blocks dont have properties really. The block is determined by what byte combination it has.
or wait
maybe i ot that wrong
chunk.data[x + y * 16 + z // 16] something like that to look up a block in chunk coordinates I think
The block data is generated on the gpu and just read quickly into python as raw bytes
what im saying is can you compose a block type from the bytes like adding properties or are each byte combination a unique block unrelated to similar byte combinations.
i guess thats not as important
as it can be easily changed
They are a unique block in the chunk. There are no properties currently
Blocks can have static properties per type stored externally, but not for each individual one for now
We don't want the game to use 10GB memory 🙂
-._.- the biggest thing ive done is tetris
id love to make something like metriod though
metroid is my favorite game. I tried making something like it in minecraft
The video I posted consists of 16.777.216 blocks btw
nice
pretty good. Probably becuase there isnt dynamic about it so its not hard for the computer or gpu to handle that
have you got loading and unloading chunks working?
Nope, but all the parts needed to do it is there
can you perform movement operations on the gpu to speed up performance?
What kind of movement?
or is that more suited for the cpu. The movement of entities like in minecraft
The camera does all the world movement on the gpu, yes. That's the least of worries.
my brother says he wants to make an rpg.
he likes paper mario and bug fables.
he also said he would be interested in making an ascii art rpg. So i might show him pygcurses
Could try to start some community game or something? Like always there is a problem with direction and what to actually make lol
yeah thats a big problem im facing
like id like to program a game but its hard to think of the game to program
Usually better to stick to small project. A simple idea.
i think itd be fun to draw pixel art then have it go through a image to ascii art converter
and put that into the game
hmm start by making some ascii converter?
It can be a challenge to make it fast, but at least it's a challenge
Sounds like you might be more like me. You enjoy maybe game systems more than making the actual games
You could look at arcade for example. Figure out what the library does. That will keep you busy for a while 😄
yes exactly
i loved making tetris
and id love making a rpg with characters and level systems and battles
it all sounds fun to code
yeah
Thought about doing something similar, but too many projects going on atm
I would just play around with pre-created sprites and tiles in Tiled editor and load that into arcade
yeah ill remeber to try that.
but first im gonna see about pygcurse
i really want to make a turn base combat system
ah right. That does remove the needs for fancy graphics 😉
im gonna research some roguelikes and rpgs and make something.
and that will be the base i work from
at least ill be doing something. This is just a hobby.
thanks for the talk.
Hey @main cradle!
It looks like you tried to attach a Python file - please use a code-pasting service such as https://paste.pythondiscord.com
Hey @main cradle!
Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:
• If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)
• If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:
Hey @main cradle!
Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:
• If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)
• If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:
Like the automatic message says, you can paste the code into https://paste.pythondiscord.com/
Optionally you can put your game on github, gitlab or any other public code repository
ok
Discord is only really able to deal with small code snippets, so showing a larger project cannot be done directly. At least not here on python discord.
IK
how come theres not a lot of python game engines?
Game engine, I don’t know, but in terms of 3D engine, Python has some rather nice piece of software…
Panda3D is an open-source, cross-platform, completely free-to-use engine for realtime 3D games, visualizations, simulations, experiments — you name it! Its rich feature set readily tailors to your specific workflow and development needs.
All this is running on Python 3.6 😅
hmm cool might try that out
@marble parceladvertising
@dawn quiver next time, just ping the moderators role.
@dawn quiver Please don't post random videos.
ok thank you for the response :)
can i create minecraft mods w/ python?
Minecraft is written in Java. You might be able to use Jython or something, but that'd really first require good knowledge of both Java and Python, it's probably not a good idea.
I wonder what is the core of a Minecraft-like display algorithm…
I assume it’s not a naive approach using nested loops… probably something that takes advantage of the sparse nature of a voxel representation ?
Is there a difference in coding language between Minecraft Bedrock and Minecraft Java?
I believe it uses "instancing"
Learn OpenGL . com provides good and clear modern 3.3+ OpenGL tutorials with clear examples. A great resource to learn modern OpenGL aimed at beginners.
no 😦
Python download:
https://www.python.org/
Game download(In #downloads chanel):
https://discord.gg/52kTwgnhf9
Music from Uppbeat (free for Creators!):
https://uppbeat.io/t/prigida/cosy
License code: 6LIXEDURLR026E2F
I haven't implemented delta time yet so all my physics calculations are based on pixel per frame instead of pixel per second.
it's funny when you limit your frames to 60 lol
YESSS FINALLLYLYYY
😅

upbge
@high pawn
@high pagoda
this is generated in py and py runs in the engine
I am moving the DOF focus object with PY
didnt they remove that from blender?
upbge is a fork where a friend of mine restored it
it's kept in sync with blender master
test using collection instances [ hover car swarm]
this is geonodes in game
it goes on forever, once they reach the end they start at the beginning (the ships)
I'm getting weird rotation with rotozoom in pygame.
Any help would be appreciated.
Fixed, I forgot to recalculate the rectangle after rotation.
@round obsidian The classic approach is doing chunk reduction on the CPU. It's relatively fast to loop thought 65k blocks in a chunk (classic minecraft) and only emit the visible faces. With instancing you just get too many polygons. You only emit the visible faces of a block and blocks and sides on the same plane gets merged into larger polygons. For example a 16 x 16 x 16 block of cobblestone can be reduced to 12 triangles just like a single block. Several chunks can be reduced into a single mesh as a "patch" to reduce the number of draw calls. There is a lot of other magic as well. A lot.
I definitely pinged the wrong person 😄
@round obsidian is the right person. Apologies 😄
Will do 20 pushups
I'm doing a simpler form of chunk reduction in my engine. It only currently looks at the north, south, east and west block deciding if faces should be emitted. This alone is a HUGE saver. I know minecraft also store metadata about each 16 x 16 x 16 area (spatial hash) so it could be used to determine of the area is even reachable discarding it completely.
It's too slow do do in python on main thread, but you can do it with multiprocessing and possibly cython. I just do it all in shaders because that's even faster (but it has limitations)
For example, It takes 0.2 to 0.5 seconds to generate a 16 x 16 x 256 x 16 x 16 world on the gpu. The python version I had used 1min 37s, Can probably make it faster with more creative use of numpy, but that also have its limitations

I k
Are we staring an IDE/Editor war or something? 😉
With BPY generating blocks I was able to get a block in 1 tick (16ms)
I started with a mesh that was full of blocks, sampled the center of each block, removed all faces for a block of it was not there, and then remove any faces that share a center
I swapped to blender geo nodes and was able to get that down quite a bit
bedrock uses c++, java uses j a v a

Definitely starting to look like something
Added some basic physics to the voxel engine : https://www.youtube.com/watch?v=6G_1gybAP-U
Started to play around with basic physics trying to find the optimal/fastest way to do this. We don't have too much slack in python. So far so good.
It's drawing an outline of what chunk you are standing on. The world depth is insanely overkill when starting on layer 256 initially
@potent ice maybe numba for numpy operations? for more speed
Nah. It can be fast enough in pure python. Everything else in happening on the GPU anyway. Collision with box voxels are not that demanding.
i know you can do numba stuff with the gpu, but looks very cool
Numba doesn't fit my use case
I want to see what you can do only with shaders and pure python 🙂
cool!
I still have 9 more millisecond to do stuff (per frame)
hi
could someone help me fix this
I don't know how to fix this
error that I don't know
Would have to see more of the project to understand what is going on. You should have a button.py that contains a Button class. That's what it's looking for
Made a complete mess, but at least removing blocks works and it's fast enough
How can I reduce lag in ursina
einarf, you can use raycast to the bounding box per AABB / per chunk
and if it hits-> test vs more complete test (bvhtree?) -> no hit case to the next one,
in local space to the chunk
(so you don't have to go building a giant world bvhtree)
@potent ice hey can you come to dm
I was thinking about teaching a small programming workshop for beginners and was wondering if using pygame is an ok idea to have students make small games over a couple of weeks. what do you guys think? I heard it's a huge pain to set up ...
Keep things in public channels
Yeah that's the plan for block selection. For collision it's easy enough to just look up blocks around the player.
The AABBs would just be aligned unit cubes anyway
The fastest way just for box selection is probably reading the depth fragment at the cursor position (screen space) and convert that to world position. That will pretty much give me the exact box pointed at.
BUT... will need raycast anyway for other things.. so probably both
You probably need to be a lot more specific here
is unity game engine better or unreal for beginer?
I'm going to say your choice of engine is meaningless if you don't know programming yet, since they will be equally bewildering and intimidating
well i meant i am just starting game development
how much programming experience do you already have, and with what languages?
Unity uses C#, Unreal uses C++, and Unity is slightly more beginner-friendly
hey, i have a pygame related question. I'm trying to make my first game (the pygame snake game). I am reading and comparing different code, but I'm trying to use the least exterior resources as possible to improve my understanding of game logic
I've gotten to the point where I have a purple square (my snake) that you can move around. if you go off screen, the game closes and there is a randomly generated red square (the apple/food) that pops up. I can't, for the life of me, figure out/understand how i can make my snake "eat" the block and expand itself
basically, the snake ignores the apple and crosses over it. I don't know what I need to make the snake able to "eat" the apple and (later) expand/increase its length
at each move, check to see if the head of the snake and any of the apples occupy the same space (collision detection)
thanks for the reply! I'm going over my lines of code rn, one by one, to make some changes
hey so im new to pygame and i was making a tic tac toe game and im getting the error code 'ValueError: invalid color argument'
oh..
dont worry
got it now
Also, general question: Has pygame helped improve your general understanding of python, or do you guys simply learn pygame for fun?
@dawn quiver
there is panda3d
pygame - upbge
pyopenGL
many ways to code in python
@ionic pond apply your python stuff to blender and it gives you super powers
upbge is a fork of blender + bge restored (a py game engine) using eevee render
100% open source / free
this is generated
hey guys i need help in #☕help-coffee
with games?
ooh, this looks really cool
figured out I was rotating each face instead of the uv island, fixed it :D
this is the generator at work
hehe, nice
yes i need help with my game
https://www.youtube.com/watch?v=DTxC5L3O13I here is making that specific city
Generating a megacity and flying around in it, in around 5 minutes (uv and all)
because thats what the help things for?
people ask for game dev help in game dev area 😄
it makes more sense
(also the answers remain here in the searchable history)
usually the help servers are pretty flooded tbh
so we can answer future questions before they are asked
ok so this is my code
https://paste.pythondiscord.com/cujazaxani.yaml
and im getting this error AttributeError: module 'pygame.font' has no attribute 'render'
WIN_IMAGE = font.render(WIN_TEXT, True, BLUE)
try above this
print(dir(font))
and see what methods it has
it's saying that the method you are calling does not exist
you should see what font has or if you are doing the right thing
man, my code looks reallyyyy bad T__T, i still cant make the snake game work
im still confused on what to do for my code
how did you copy/paste your code onto here?
and sorry i cant be of help since im still a newbie ://
https://paste.pythondiscord.com/zeliwuqaxi.yaml hopefully this works
oh i fixed my code
this is a link for anyone who is interested in helping me fix my snake game
yayyyy
youre smartttt
im at school and im balancing my school work with my crappy snake game so its not going so well T__T
tbh, i think imma restart my entire code from scratch because it's THAT bad
so maybe i should do that after school??? Orrrr... i can try to sneak it in now
yeah, im restarting it >:-))
love the aesthetic
wtf is that
whats it coded in
yo
so with game development
can u code games in more stuff besides pygame
like to make better games
@dawn quiver anything you learn in PyGame can be used to learn other things with other game development systems
the general principles are what's most important.
what can u use to make 3d games
like this
alr i’ll try it out
I have never made 3D games
3D games are orders of magnitude more difficult than 2D games
i just realised that the problem with my snake game was that i accidentally had different block sizes for different loops T___T
AFTER ALL THIS TIME
thanks for the support here tbh
yall are cool
How to set up a world to stream buildings in :D
after you get to where you are really good in 3d @dawn quiver you are pretty much a rocket scientist
using vectors, matrices, converting equations into code etc
this is some next-level stuff O__o
it looks very cool though!
start with 2d
fiddle with 3d
but blender = super powers because it's api is python based
upbge BGE code is py and BPY both work in game in realtime
hey, im trying to make a basic game using pygame and pymunk for physics. im at the stage where im spawning a bunch of rectangles in random positions...
i was wondering how i would make it so none of the rectangles overlapped
this is what im using for detecting the overlapping
but i get this error
Hello want to ask.. Im new in Python.. and I want to learn to create Software using Python... anyone can recommend me.. what is the best course i need to take to mastering Python?..
Did you see the resources in #welcome ?
Playing around with block removal profiling the bottlenecks. It can still be done a lot faster, but it's a start. Remember this is a 16 x 16 x 256 x 16 x 16 (16_777_216 block) world. It gets pretty heavy. https://youtu.be/fNjuZyTJytM?t=15
Optimizing block removal. Still room for improvements. The 4k video capture makes this lag a little bit.
Still need to optimize if neighbor chunks needs to be updated or not. That alone will probably make it twice as fast in most cases + I'm using numpy for vector math (too slow). Numpy for lots of small independent 3-component vectors are not ideal. There are faster alternatives.
My respect for people making fast voxel engines have increased a lot in the process. It's a lot of work 😅
Yup. That's exactly the plan. Already porting most moderngl examples to that in a branch atm 🙂
>>> import glm
>>> a = glm.vec3(1.0, 2.0, 3.0)
>>> a
vec3( 1, 2, 3 )
>>> import numpy as np
>>> b = np.array([1.0, 2.0, 3.0])
>>> b
array([1., 2., 3.])
>>> a + b
array([2., 4., 6.])
>>>
I am used to glm in C/C++ already. There was some issues early in pyglm 2.x related to buffer protocol that stalled the adoption
Also recommend using PyPy instead of CPython.
I'm sticking to CPython for now, but maybe later. (Problem with pyglm was PyBUF_SIMPLE support)
I don't think pypy is necessary quite yet. There is a lot of room for optimizations still.
Yeah, but no reason not to really, as long as your current libs are supported which they prob. are.
I want the project to be easy to install and run on an platform from source. Most of the heavy lifting are also done on the gpu.
There are some long term plans for this project that requires easy install / access and it's important that it can run on py3.6 -> 3.10
I also can't guarantee pypy support because I don't know what this will be mixed with eventually (by end user)
Collision checking doesn't really take much time at all even in cpython and I doubt a ray cast thought simple cube voxels with a limited range would be much of a problem. I can also reconstruct world position from the depth buffer to more or less get the exact block a player is pointing at
I'm not exactly sure how the end user combing your code with theirs would make your code not work with pypy.
PyPy does not really require you to do anything special, you run the same script.
The only thing that prevents PyPy compatibility is some specific C extension stuff that is kind of rare.
(some C extensions do things that are actually bugs in CPython and PyPy fixed them, so if they use those bugs it won't be compatible)
hmm I guess you have a point, but I don't really need it at the moment. At some later stage that could be the case
Yeah you don't need it, but it's basically free speed.
It runs smooth on my average laptop with AMD integrated. Also most of the work are done on the gpu. pypy won't make that go faster 🙂
Yeah, just when you get to some code that actually needs to run on the CPU and is not something done with numpy.
And also not very small.
Like gameplay code.
(Ofc depends on type of game, but for many it's often the case because games are weird and need to do things that just require a bunch of conditions and specific code that would not really be done with numpy, the GPU, etc)
The type of stuff that can't be run in parallel at all because of tight coupling between systems.
But also it's python not C so kind of whatever. Just recommend PyPy, IMO should be the main implementation of python that's used (standard).
Don't have any plans adding a lot of gameplay to be honest. It's more or less an experiment seeing what can can be done with the gpu and cpython. Might have to change that later of course. Could also do a C extension. That's what I do in most cases.
The reason i'm in favor of just making python faster if even just a little is because i'm not a fan of having lots of dependencies in a project and "just write the slow parts in C" adds a lot of them, staying in pure python is nice, or in general any language hopping is always annoying.
I'll at least give pypy a go at some point
What makes it annoying is the need to sort of synchronize the two languages, if either of them updates.
You have the extra work of maintaining the bindings and so people get generators, but generators are buggy and also need to be maintained and have different versions and stuff (it's also another thing that anybody working on the project has to learn).
PyPy is not way faster and it never will be because of python's design, but IMO it crosses that line were the language feels just fast enough to actually make things that require a bunch of looping and such like C# and Java and such. Not super fast, but just fast enough to actually make things.
Which is all I really want from a scripting language, fast enough and to start coding I just need to make a new file and run it, no setup, nice and lazy.
For many things python is already that, but it will never be that for everything unless it itself becomes faster to cover more cases.
I'll give pypy a chance at least. I'll give you that, but pypy or C extension is far in the future for this project 😄
I should probably have tested pypy more anyway
Yeah don't worry about it i'm ranting now. Anyway GL, it looks great.
It's more than fine. Any input on optimizations are good
And yup. pyglm made collision checking 5-6 times faster \o/
Yeah, my best advice for optimization is to do non-optimization, rather than worrying about timing the code and all that and going crazy, just make the CPU only do what it needs to do and not more. Like with pyglm instead of numpy. Numpy is more general and so it was making the CPU do more than it needed to.
Less general tends to equal faster (it's why high level abstract code tends to lead to slow programs nobody likes to use ("Enterprise")).
This is also why C is just straight up faster for everything, because you are not running an interpreter and just having the CPU do less work for the same result.
But you can still do this cutting down in Python or any other language.
And the second thing is to make use of all the hardware given (e.g. the GPU or the many cores in modern CPUs), but that comes after the cutting down which is much easier to do.
I worked with C and rendering in the game industry for many years, so I definitely know
Ah ok, yeah I don't doubt it then.
Optimizing in python is weird. There is a lot of learn, so it's a challenge. For example : WeakSet is a terrible idea
Graphics programmers are built different. 
Every time I read a paper on some new graphics related thing I wonder if they are all overqualified for the job.
Yeah. I have an unhealthy obsession with optimizations at times. We used to count cycles in inner loop in assembly making sure it was inside the cache.
I'm so outdated when it comes to anything after 2012
Yeah i'm of the same breed. Trying to get MSVC to not spit out terrible assembly on Godbolt.
But I don't do any of that unless I really need to, modern computers are so fast that the just making it do only what it needs to route is often more than enough.
and the evolution of compilers have made things a lot easier
More cache, cores and whatnot certainly doesn't hurt
I mostly work in C, but since I work in ML now Python became something I had to learn and i'm glad I did because it lets me connect to the non-programmer scientific community, just wish PyPy was more popular. It's what most of them often want anyhow without even realizing it.
ah right. Now the pypy thing makes sense 🙂
upbge has NUMPY
and we have compute shader framework but I don't know how much is wrapped by gpu module right now
pypy is like a jit for python?
Isn't pypy slower to start up? That's a pretty big downside considering CPython is pretty slow already
JITs are slower to start up, and consume a bit more memory. But the point of them is that after running for a bit, they find the code that's called frequently, and use data about the data types involved, most frequent code paths, etc to optimise that code into native versions on the fly.
Hi
The first run of a function / iteration of a loop is slower, but still faster than cpython.
it depends on what you use it for - for quick-running scripts pypy might be a bad idea, because the increased startup time will be more than the decreased runtime
Don't except huge gains though.
If you are not doing any looping yourself then you may as well use cpython. But if you are running something like a game which loops forever, it will matter.
Yeah, I'm talking about applications like scripting, where the entire runtime of your program is like a second. There, pypy is a net negative.
Yea pypy for me has about a half second of extra startup time, no matter the script.
The thing about pypy is that all you need to do is just run pypy instead of python or python3 (depending on which OS you are on), and it will almost always just work, so if you happen to have something that is getting kind of big, like a whole application rather than a script at this point, then you can just try pypy.
Or from the pypy website:
There are two cases that you should be aware where PyPy will not be able to speed up your code:
Short-running processes: if it doesn't run for at least a few seconds, then the JIT compiler won't have enough time to warm up.
If all the time is spent in run-time libraries (i.e. in C functions), and not actually running Python code, the JIT compiler will not help.
*If for some reason you only want to use pypy and need faster startup times for short scripts, you can turn of the JIT compiler --jit off, then startup time (and run time) is about the same.
WRECTIFIED MEGACITY - Player is in - Next is terrain/ scaling
I think JIT is faster than interperted
and compiled is faster than JIT
there is "Nuitka"
but I think that something using AI will come along
Technically JIT can be faster than compiled but in practice not so much. The reason is that a JIT compiler could re-compile to a more optimized version by collecting run-time data.
that can take py and spit out optimized assembly
like imagine a GAN that generates C* or even optimized assembly from py
and it tests 1000's of itterations per tick
and keeps the best one
ML is not even close to generating good code. Despite the hype around the GPT code writers.
training data would be input data would be unoptimized py and then hand written optimized code
for output
case by case with 1000's of cases
(I think this is why MS is after github)
Yes, but why generate code when the entire program can be a neural network? It's even faster, and even more so with special hardware for neural networks.
I think that there is a sort of GAN in humans
we generate and evaluate plans to see if they will meet a goal
but when we sleep, we optimize helper functions
Let's move this to the data science room.
Wrong discord server
what?
This is primarily a channel for discussing game development with python. Unity is kind of off topic here unless it has some useful parallels to python itself.
does anyone here use renpy?
i tried it out for a day, but instead began learning pygame
renpy is based on pygame anyway 🙂
Hi friends !
Hi! How can I check if a circle is colliding a rect in Pygame?
I tried to use a Rect to follow the circle, but it only works with a small ball, but it doesn't for bigger ones
@deft linden i have the same problema with my code
oh really?
Yes, but i do not know how I show my code to a little help
I found an approach: Find all the points in the circle and check if that rect collide with that point
Um wait
I found a way
By that approach, I just did the method in the wrong way
Does pygame not have a function for that? Anyway, here's the general formula for checking the collisions of a rect and a circle (this example is from a Rust spatial partitioning library):
src/shape/circle.rs lines 30 to 35
fn intersects(&self, b: AABB) -> bool {
let x = self.center.x.min(b.ur.x).max(b.ll.x) - self.center.x;
let y = self.center.y.min(b.ur.y).max(b.ll.y) - self.center.y;
x * x + y * y < self.radius * self.radius
}
}```
the Python version would look like
def intersects(rect, circle) -> bool:
x = max(min(circle.center.x, rect.upper_right.x), rect.lower_left.x) - circle.center.x;
y = max(min(circle.center.y, rect.upper_right.y), rect.lower_left.y) - circle.center.y;
return x**2 + y**2 < circle.radius**2
cool, thanks
with pygame, is putting a sprite in a sprite group the same as putting one in an array
i ask because i have certain requirements i need to meet for a school project and one is an array of records/objects
#help-cheese pls?
Can I get yalls opinions
Hi! How can I check if a circle is in line of sight of player? I have several rects as wall that blocking the player's view
insane game
how can i make a game over but wait before close
I have an array of points, an array for the position of my character, and the look direction of the character. How do I rotate the entire window according to the look direction?
I'm making a 3d raycaster using Pygame
HELP ME WITH PYGAME PLSSSSS
not bad uno
@dawn quiver thanks coach
@dawn quiver you can use py + blender ot generate content for unity
You would normally do a ray cast to see if a line between the player and the target is blocked by something. You can either make that yourself or use pymunk
Putting your code here makes it easier for us to understand what you are doing. https://paste.pythondiscord.com/
A screenshot is not very useful for someone wanting to help
Just ask your question. That's the only way you might get an answer.
What do you mean by "wait before it close"?
i mean not close when the game end
You can just add an input() at the end so the user have to press enter to exit?
If that is not enough you have to be more specific
You can instead refer to he line numbers of the code you shared. Screenshots are not useful in most cases
You have three if statements checking the result and printing stuff so it will definitely print 3 times
Option 1 is always the right answer?
If that is the case, the only checking you need to do is ```py
if Player == 1:
print("GOOD")
player_score += 1
else:
print("WRONG")
You also seems to use pycharm, so you can use the debugger to visuals step though your code seeing exactly what is happening
What does that mean?
Only you know how the game works. For me it looks fine except that you never set game_over to False
how can i make that he pick a random thing
I see you have already imported the random module
You can use random.randint to generate a random number
thx
the random.randint dont work
Please stop using "don't work". You need to be more specific 🙂
!e
import random
print(random.randint(1, 3))
@potent ice :white_check_mark: Your eval job has completed with return code 0.
1
It definitely works and it gave us the number 1 (this time)
You can show me how you changed the code and I can possibly help.
Make a new paste or just paste some code here
was able to port a section of my py to GEONODES 😄
}:D - EUREKA - [ geonodes shink wrap in game is 100-250x faster ish]
was using py and hatching over many frames- can do this in geonodes now :D
I think maybe 2 people here knows what geonodes are
Are you referring to the new Geometry Nodes recently added to blender?
yeah
you can express some decent node groups now
it's still not 1 to 1 as useful as py
but it's like 250X faster or more
since it's blender, you can use py to programically create nodegraphs too
logic nodes addon for upbge writes py
so it can kinda go both ways
I and two other guys are developing a text based zombie survival game in python and I'm looking for some people who would like to contribute to the game. If you are interested in helping, dm me and invite you to our discord chat channel.
Wrectified = Rectified (CITYGRID + TERRAIN STREAMER COMBINED)
applied geonodes in game
I still have to move the 'center' of the effect around in py
it only moves if it has to, to conserve resources
this looks really cool!
By the way, does anyone have any tips for making a dialogue/text-heavy game on pygame?
Make the dialog good. Writing is hard. You are competing with books (making a game without competing with books is already hard).
Pick good fonts and make sure the font rendering is clean at multiple scales and DPI's.
Thanks, hehe. I'm just doing it for fun since I am learning python
im supposed to be doing schoolwork tbh T__T
but im trying to figure out how to make dialogue disappear without it overlapping and without using time. It's 2AM here so im 100% sure there's a simple solution im not considering
sorry i'm not english
how can i open a pygame window
First of all, Make sure you have pygame imported into your IDE (I use pycharm)
Then you need to set screen width and height and then you use pygame’s blit window feature
make sure to update display!
la#
If you don’t update the display, you’ll just get a black rectangle
Idk if that helps, I’m pretty new to Python
i have that but how i can open it
You mean open the pygame window? It should open on its own when you run your program.
I get this
You need to install pygame. Go to your windows search bar, type "cmd" then click on command prompt. In the command prompt, type "pip install pygame".
maybe you have more than one instance of Python installed on your machine
or maybe you need to grant to virtual env to access to your python modules
what happens if you open a command prompt, sa @inner wigeon said, and enter "pip install pygame" ? 🙂
what's you IDE? you should follow you IDE's guide for using python with it
looks like @dawn quiver is using Pycharm
Do you use some sort of semantic versioning for game development?
Maybe I'm overthinking but I don't have a good understanding of versioning and was curious if someone has a good write up or tutorial on it for game dev.
It's more than fine to use semantic versioning for game dev. X,Y.Z were Z increments when you do bug fixes. Y increments when features are added or tweaked. X for larger changes. You can also greatly simplify it if nothing external is using your game like some api or protocol.
Some start at 0.1.0 and work towards 1.0.0 for the first playable version of the game
Then 2.x.x is iteration 2 of the game
etc etc
If you find yourself splitting the game into several projects it really gets a lot more important doing versioning right
What client, server, utility library version fits together etc
So I need help with updating my dialogue box every time the user hits the space key. Im new to python, and i cant really figure out how to display the old text withoiut i tovewriting the new text
heres my code:
https://hastebin.com/okahobavil.http
how can i fix this
You are comparing an integer and a list in there somewhere. Just print the variables or the pycharm debugger
its working
hello
I try to convert pygame to exe with img and audio effect but it didn't work when I open it'
GEONODE TERRAIN - in game with physics (KD tree tiles)
using a kdtree to place physics tiles / reinstance their physics meshes in bullet
now the area outside the city is theoretically infinite, but floating point math means things would start to get weird
hi !
Can I made 3d games by python?
and how
UPBGE engine
Panda3d
or pyopenGL
never tried this but it could be nice
@mighty mason
I recommend moderngl over raw pyopengl if you want to go that route.
(because if you use pyopengl directly it's very likely that you will end up making your own moderngl)
On the other hand, using opengl directly in python has a learning resource advantage, you can directly follow tutorials such as https://learnopengl.com/
Learn OpenGL . com provides good and clear modern 3.3+ OpenGL tutorials with clear examples. A great resource to learn modern OpenGL aimed at beginners.
(have to convert from C to Python though)
hello?
If u wanna make 2d games then pygame is the easiest programmatical way for it
For 3d I have no idea
Hey I am new to game dev, can someone tell me where is the best site/youtube channel to learn unreal engine
I have a problem with pygame i use phython 3.9 and pyhon 2.0.2 and even if i create a window with loop it fails and closes what do i do?
Check out python arcade module
hi , i am going to start my game developing in python in this week, any basic thoughts ?
For 3d learn blender
Move to panda or upbge
For 2d pygame etc is great, so is upbge after you know enough tricks but not out of the box.
hello the parameters panel is getting cut or half visible
pls help
here is the full code
main.py - https://paste.pythondiscord.com/ogapatanen.py [code to be run]
parameters.py - https://paste.pythondiscord.com/hifoqusuda.apache
constants.py - https://paste.pythondiscord.com/vorerifimo.py
event.py - https://paste.pythondiscord.com/otiroteyas.py
ui.py - https://paste.pythondiscord.com/minojuwipa.py
line.py - https://paste.pythondiscord.com/inumuvomat.py
main.spec - https://paste.pythondiscord.com/oqocolosil.spec
hi
pls help
The window size is what?
Sometimes the window can shrink after opening it
You have hardcoded 1920 x 1080 resolution
query the actual window size to be sure
yes that's is the windows size
Move the text more to the left? 🤔
ok
There could also just be something with how you handle the text in TextUI
Often it's a good idea to isolate a single text element and see if you... for example can make it left align in the upper left or right corner
Just use your creativity to debug things
It can also often help to simplify things and build it up again slowly
make screenshot and count the actual number of pixels with some image editor
@vocal pagoda Is there a global state in pygame that can offset the rect coordinates?
I don't know about it
found this, might be worthwhile to follow... 🙂
you need a 3D modeler first, I would recommend Blender3D 🙂
I think pygame is the best for 2D games
to program at your peak you must program with drip
glasslt vsc theme is not there in marketplace
yes
@light cargo thnx
np
you have to change the parameter panels position 🤨
and/or size
I have solved it
@light cargo this is for you - https://onedrive.live.com/?authkey=!AGFudU5q0LqPcSY&id=84D7E222958B8EFB!18111&cid=84D7E222958B8EFB
open it
a bunch of wallpapers
o ty
no harmful contents
hwy
lacks tweens and stuff
Hello,
I would like to know if with Tkiinter version 8.6.9 it's possible to embeding in a tk Frame a window pygame (2.0.2).
I saw it' was possible with
os.environ['SDL_WINDOWID'] = str(frame.winfo_id())
os.environ['SDL_VIDEODRIVER'] = 'windib'
but these are olders version and it doesn't seem to work
All code find on Internet :
root = tk.Tk()
embed = tk.Frame(root, width=500, height=500) # creates embed frame for pygame window
embed.grid(columnspan=(600), rowspan=500) # Adds grid
embed.pack(expand=True) # packs window to the left
buttonwin = tk.Frame(root, width=75, height=500)
buttonwin.pack(expand=True)
os.environ['SDL_WINDOWID'] = str(embed.winfo_id())
os.environ['SDL_VIDEODRIVER'] = 'windib'
screen = pygame.display.set_mode((500, 500))
screen.fill(pygame.Color(255, 255, 255))
pygame.display.init()
pygame.display.update()
(stackoverflow)
i have added a picture but i don't get it on my screen
You might have better luck on the pygame discord server
ok
Also make you share the code drawing your image. A screenshot like that doesnt really help.
Ok thanks
make sure that you update your window by writing pygame.display.update() at the end of the game loop
anyone good at pygame that can tell me why dis dosen't work ´´´py game_font = pygame.font.Font(r"C:\Windows\Fonts\arial almindelig",40 )´´´
you should read an error message at some point 🙂
can you share it as well?
@snow hill is just says that file not found but that is the correct file path
r"C:\Windows\Fonts\Arial\Arial Almindelig.ttf
whats the diffrents? in this paths?
a truetype font usually comes with either a .ttf or .otf extension, yes
at least on Windows or Linux
my advice would be to copy the file from the Windows fonts folder to your project folder
and see if the name displayed by Windows is different (or not)
Uhm how should I handle wall collision with this type of movement : I click the screen then the player moves closer to my mouse
https://hastebin.com/aqitejuvow.rb (line 90)
For now I have tried : self.VEL = -1
and add a for loop on the top then check if not colliderect() [I have 4 walls]
I currently want the player to stop upon collision.
Let's say you want to use tkinter features and just draw with pygame or something else to a frame
That is possible with pygame, sdl, opengl etc
It's a little bit of low level window magic
yeah, we can use shared memory space and PBO to pass buffer between apps
'shared openGL context'
Even better of you don't need shared. Just make a framebuffer for the frame itself
as in.. you can reallocated the underlying pixels storage so you can draw to it directly
does anyone here have experience in MIT app inventor?
Maybe in #career-advice or something? It at least fits better there
Finished my meditation app:
https://github.com/jadenhensley/libre_mind_meditation
demonstration video:
https://youtu.be/bvVQe8Mu8oY
LibreMind is a free meditation app made in under 24 hours. It has various meditation, breathwork, and visualization exercises. - GitHub - jadenhensley/libre_mind_meditation: LibreMind is a free med...
LibreMind is a free meditation app made in under 24 hours. It has various meditation, breathwork, and visualization exercises.
Link to project's github:
https://github.com/jadenhensley/libre_mind_meditation/blob/main/
(Made using pygame)
Wrectifed Unified Procedural Robotics Motion System
Very nice.
anyone wanna help me build a game for fun
nc dude
is there anyway to get fast pixel access of a surface
?
as in in the form of an array
pygame
@valid marsh you can plot easier than inject a whole array back
if you want to act on pixels
it's best to do it in a fragment shader
good job trueman
that is almost like my blender text editor
Thnx
what do you mean ?
can you elaborate
GPU is is cheaper to run a composition of overlaying a image over a image than to upload a whole new image usually
think about how much data has to go up the pipe basically to effect how much change
if you are going to be changing the whole screen it's best to do it in the fragment shader or a 2d filter
so you send a program to the gpu to change stuff there using uniforms
and forgo shipping a whole buffer to / back each frame
ohhh
ummm
i am using pygame
pure ygame
pygame*
so i dont have access to the GPU
i need to do every thing on the cpu
PyOpenGL is a standardized bridge between OpenGL and Python. PyGame is a standardized library for making games with Python. In this article, we'll leverage the two and cover some important topics in OpenGL with Python.
@valid marsh
yeah ik that pyopengl exist but i am trynna learn how everything works
fyi i got the solution to that
in pygame there is a function
pygame.surfarray.pixels3d(surface) which return a numpy array of the surface
and i can directly just access the array for per pixel manipulation
Work in progress of my Emulator Front End
all written in Python 🙂
300 lines of Python, so far
I plan to bundle the front end with a selection of emulators
so that people. will only have to copy they game roms
I swear looking at some of the things you guys post lol....Its like looking up at the stars and realizing how absolutely tiny you are 😅
I still have "Hello World" in my rear view, and some of you guys are in the Matrix 💟
wrectified terrain streaming geonodes [ 2d smart project shrink wrap ]
@snow hill 
very nice clean ui
I would consider a SVG folder bubble with transparency though
like to make the text stand out better for the game select menu
svg are amazing for ui
looks good! keep it up!
what's tool you working?
ursina
does anyone have a cool game
Hey guys whats the best game engine for python?
idk
It depends what kind of game you want to make 🙂 2D or 3D ?
Godot
it's using GDscript which is similar to Python
pygame
Mhm
i pygame i guess
I Will tey pygame
i have never tried godot
Try*
You can use dot normal / incoming for the point light shading
Upbge
Is an amazing engine few people know about
GEONODE TERRAIN - in game with physics (KD tree tiles)
wrectified terrain streaming geonodes [ 2d smart project shrink wrap ]
blender basically gives your py super powers
i get this error new_text = label(root, text = s, size = '25')
TypeError: 'dict' object is not callable when i try to make my text
i use tkinter plugins
Hey @dawn quiver!
It looks like you tried to attach a Python file - please use a code-pasting service such as https://paste.pythondiscord.com
@dawn quiver
you have dict() somewhere
you need
dict[key]
label is apparently a dictionary?
or maybe you have a class called lable
and a dict called label
and you overwrote the class
Nice
what is the best online python website to code in?
I like replit
"Compound Entity v10" - Wrectified 👨⚕️
@solemn shale
it probaly buffers when it loads 1 time
(this was true with old bge)
one idea is to have a screen up and load mostly everything behind it, and then end it all / kill it
(in bge at least)
IDK about pygame
oh
Check out this amazing project ->
Turn your phone into a wireless game controller for Call of Duty game.
All the setup and source code available at GitHub repo (Give a star if you like).
GitHub Repo : https://github.com/YashIndane/Call-of-Duty-
My Linkedin Profile : https://www.linkedin.com/in/yash-indane-aa6534179/
Source code -> https://github.com/YashIndane/Call-of-Duty-
Give a star if u like!
hi
can someone help please
i need to convert my .py file in .exe
i tried pyinstaller
but it says im missing somthing called UPX
idk
pls send help
or help
Read the official docs here : https://pyinstaller.readthedocs.io/
UPX is covered here : https://pyinstaller.readthedocs.io/en/stable/usage.html#using-upx
Woah I didn't know you were here too einarf
import pygame
import sys
# Sprite class
class Sprite(pygame.sprite.Sprite):
def __init__(self, pos):
pygame.sprite.Sprite.__init__(self)
self.image = pygame.Surface([20, 20])
self.image.fill((255, 0, 255))
self.rect = self.image.get_rect()
self.rect.center = pos
def main():
pygame.init()
clock = pygame.time.Clock()
fps = 50
bg = [0, 0, 0]
size = [300, 300]
screen = pygame.display.set_mode(size)
player = Sprite([40, 50])
# Define keys for player movement
player.move = [pygame.K_LEFT, pygame.K_RIGHT, pygame.K_UP, pygame.K_DOWN]
player.vx = 5
player.vy = 5
wall = Sprite([100, 60])
wall_group = pygame.sprite.Group()
wall_group.add(wall)
player_group = pygame.sprite.Group()
player_group.add(player)
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
return False
key = pygame.key.get_pressed()
for i in range(2):
if key[player.move[i]]:
player.rect.x += player.vx * [-1, 1][i]
for i in range(2):
if key[player.move[2:4][i]]:
player.rect.y += player.vy * [-1, 1][i]
screen.fill(bg)
# first parameter takes a single sprite
# second parameter takes sprite groups
# third parameter is a kill command if true
hit = pygame.sprite.spritecollide(player, wall_group, True)
if hit:
# if collision is detected call a function to destroy
# rect
player.image.fill((255, 255, 255))
player_group.draw(screen)
wall_group.draw(screen)
pygame.display.update()
clock.tick(fps)
pygame.quit()
sys.exit
if __name__ == '__main__':
what to add in main loop
does anybody have a good explanation of the Player class in pygame, or just a webpage that explains it good?
Whats a good game name?
Because im looking for a name but my brain is empty for name ideas

What about ordinary highschool physics wher the character has to explore through a physics based 2d game
replit i guess
Can anyone help me?
A guide for how to ask good questions in our community.
i did it now, a person helped me
Hi
How to make it so that when two images collide print("You lost")
im really confused on how to do it in images
Maybe this is helpful? https://kishimotostudios.com/articles/aabb_collision/
i dont know if any of you use arcade but i wanna know where the resources that come with it are stored so i can open the map file in tiled
import bge,mathutils
def main():
cont = bge.logic.getCurrentController()
own = cont.owner
if 'bvhtree' not in own:
own['bvhtree']=own.meshes[0].constructBvh(transform=own.worldTransform,epsilon=0)
else:
o = own.scene.objects['Cube'].worldPosition
direction = own.scene.objects['Cube'].worldOrientation.col[2]*-1
ray = own['bvhtree'].ray_cast(o, direction, 3)
#print(ray)
if ray[0]:
tri= own.meshes[0].getPolygon(ray[2])
v1 = own.meshes[0].getVertex(0,tri.v1)
v2 = own.meshes[0].getVertex(0,tri.v2)
v3 = own.meshes[0].getVertex(0,tri.v3)
p1 = mathutils.geometry.barycentric_transform(ray[0], own.worldTransform * v1.XYZ, own.worldTransform * v2.XYZ, own.worldTransform * v3.XYZ , v1.color,v2.color,v3.color)
p1 = (p1[0],p1[1],p1[2],1)
own.scene.objects['Cube'].color = p1
main()
#code to store lighting info in floor vertex color and lerp it
#not directional atm
<@&831776746206265384> can we list upbge up top in the description
is super powerful now
You can make pin suggestions in #community-meta. Please reserve mod pings to urgent incidents that require moderation
would you guys say that you use maths a lot for game dev?
yes, but it's mostly very basic addition, subtraction and multiplication
all the time
dot(), reflect(), (p1-p2).magnitude [distance]
vector 2 = (p1-p2).normalized()
Generating a megacity and flying around in it, in around 5 minutes (uv and all)
it gives you super powers *
your work always looks super cool!
Thanks! using py blender + learning vector math makes you get really good at this
I recommend blender geo nodes as a good basis to learn this now
also eevee shaders
hehe, may consider paying more attention to my math classes
you can learn more in 2 days of concerted effort then a lifetime of school
i agree
blender looks super cool
it's 100% free
I help test/maintain the blender fork upbge
where youle restored the game engine to blender 2,8+
after it was cut out do to too much techical debt
he just ate it, and ported it to the new render engine / depsgraph
addons for blender are made in py
also the game engine has a scripting layer in py
but we use bpy meshes now, so you can use the addon api in game
- modifiers like geonodes
keep up the good work btw!
geonodes let you wield C++ / threaded
you can feed them attributes in py though
or move a object they are using a axis as a driver for
like a object moving up can drive a whole sim
"time"
that is how the wave video works above
see the purple value?
on the bottom left
I clicked 'copy as driver' on a objects position Z axis and pasted it there
so py can move the empty -> moves the waves
or terrain or whatever
Empty is moved with player controller
import bge
from mathutils import Vector
def main():
#simple demo playerController rock climber
cont = bge.logic.getCurrentController()
own = cont.owner
end = own.worldPosition + own.worldOrientation.col[2]*-3
v = own.worldLinearVelocity.copy()
v.z=0
end+=own.worldOrientation.col[0]*2
ray = own.rayCast(end,own.worldPosition,0,"",0,0,0)
if ray[0]:
#print('hi')
v = (Vector([0,0,3]) + ray[2])/4
own.alignAxisToVect(ray[2],2,.125)
own.worldPosition =own.worldPosition.lerp( ray[1]+ (own.worldOrientation.col[0]*2) + (own.worldOrientation.col[2]*2),.0125)
own.applyForce((0,0,-9.8),1)
own.applyForce((0,0,9.8),0)
own.worldLinearVelocity*=.75
else:
own.alignAxisToVect([0,0,1],2,.5)
#Update Empty code
inc = .625
val = 1/inc
pos = own.worldPosition
pos = Vector([round(pos[0]*val)/val,round(pos[1]*val)/val,0])
if own.scene.objects['Empty'].getDistanceTo(pos)>5:
own.scene.objects['Empty'].worldPosition = pos
own.scene.objects['Plane']['Reinstance']=2
main()
voronoi heightfield
I need to ask about 1 million questions pertaining to Panda3D and/or wxPython
If and when someone seems this who can help me with some answers, please feel free to ping me 🙂
ported my building generator to bmesh
Did you see the resources in #welcome ?
no
Also, please don't ping random people
That's not how it works. Helpers are just known to answer questions and help out, but we're not any different from other users.
If you want direct access to help you will have to pay tutors.
Read everything in #welcome first
play tutors? what is that
oh
i dont have money
finished reading the thing
i clicked ont he link for recomended tools
wich of the ones there should i use
y'know what
i know how to model
anyone here wanna work on a game with me?
ive got a pretty solid idea
...
is that blender?it uses python?what?
WRECTIFED [2021] - UPDATE - GamePlay Teaser
UPBGE BPY
and BGE py together in harmony
the buildings are generated in realtime in py
Hey @cold storm!
Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:
• If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)
• If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:
Un livre entier sur jupyter.... Le pied
I'm trying to learn ursina what do you need help with?
anyone knows a lightweigt game stuff?
Guys how do i go about implementing AI algorithm to a game?
Welp... That hugely depends on the type of game you're making.
Here are some funy videos on the topic https://www.youtube.com/watch?v=sQSL9j7W7uA https://www.youtube.com/watch?v=Z5LMUbjyFQM
In this 2017 GDC session, Lunarch Studios' David Churchill describes the Hierarchical Portfolio Search AI system created for Prismata, and how it can be adapted to fit almost any genre of game, including search-heavy ones like strategy games.
Register for GDC: https://ubm.io/2yWXW38
Join the GDC mailing list: http://www.gdconf.com/subscribe
...
In this 2017 GDC talk, Paradox Interactive's Mehrnaz Amanat Bari covers the design and implementation of data driven AI in Stellaris to create NPCs with unique and non static personalities in a decision based game.
Register for GDC: http://ubm.io/2gk5KTU
Join the GDC mailing list: http://www.gdconf.com/subscribe
Follow GDC on Twitter: https:/...
Soo... Can anybody recommend a c++ gamedev discord server? I really can't manage to google one(
"Together C & C++" has a graphics_gamedev channel
Thanks a lot!
See also https://github.com/mhxion/awesome-discord-communities, it has both other Cpp servers and dedicated gamedev servers
is it good practice to use a stateful decorator for dirty rect animation when working with graphics? i don't want to repeat the same lines over and over, so i made this deco
def dirty(func):
def wrapper(*args, **kwargs):
self = args[0]
dirty.rects.append(self.rect)
func(*args, **kwargs)
dirty.rects.append(self.rect)
return wrapper
How can I connect menu page with my game using pygame please help
import pygame
pygame.init()
screen = pygame.display.set_mode((500,600))
GREY =(120,120,120)
running = True
while running:
screen.fill(GREY)
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
if event.type == pygame.MOUSEBUTTONDOWN:
if event.button == 1:
print ("XXX")
pygame.display.flip()
pygame.quit()
how to fixx it
C:\Users\Admin\Desktop>python game.py
File "C:\Users\Admin\Desktop\game.py", line 19
print ("XXX")
^
IndentationError: unindent does not match any outer indentation level
**please help me **
The print statement is only 3 spaces out from the parent block. You need 4 space indentation
I'm not sure what kind of python editor that would allow you to do this without any protests
Probably also easier to just share code using this : https://paste.pythondiscord.com/
Hello Newbie here.
I'm looking to learn more of python through game dev and i want guidelines.
Like which game engine to use
??
There are lots if libraries you can use to make games. pygame, arcade, pyglet, ursina etc etc
It really depends what you want to make
Some libraries are closer to "game engines" while others are more like graphics/media libraries
which are closer to game engine
That doesn't mean it's the right choice. what are you planning to make?
i want to do 3d games
https://www.ursinaengine.org/ is probably a quick one to start with
how do i implement gjk-epa collision in python
i can't seem to find the collision point correctly
you can try pyunity though i havent finished the physics part yet
Is it possible to run a Kivy app at a high fps like 240hz?
Sounds more like a question for Kivy discord (considering it's not a common question here)
i want to make a snake game using pygame, any tips for getting started?
I think this is the correct place to ask; I made a game and am trying to compile it to be a .exe. pyinstaller is not working for me tho
There are so many pygame resources out there including pygame's official documentation
thank you
Ok
you have got to check this out. it has an editor!! https://unidaystudio.itch.io/cave-engine
(it was created in c++ i believe)
@inland robinday is my friend 😄
the dev who makes that
he larned on upbge like me
blender geometry nodes
all math 😄
these can be written by python now
as well as work in game in UPBGE
Hey @turbid spire!
Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:
• If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)
• If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:
Hello i need help with pygame and thearding
code: https://paste.pythondiscord.com/osoqaroraq.py
it's did react for any events
when i check my code it's do nothing who can give working code?
howdy everyone
what do you guys use to edit world data in a platformer game?
like, a pygame level editor for a platformer.
is it possible to code a free roam game in python
thank you!
so can paste my python into blender now
how do i fix my character kind of levitating? he looks like he is floating above the dirt blocks
blender has a text editor @dusty shuttle
you can click 'play' button and run it
upbge - has logic bricks that can run py, and py components, and callbacks
You might want to introduce a separate hit box for your sprite or your character sprite frames needs to be moved all the way to the bottom of the texture.
I think adding support for a separate hit box solves many other problems. Instead of relying on the width and height of your sprite you instead check the hit box (for collision). It can just be four values (x1, y2, y1, y2).
The more fancy collision systems use polygons instead making it more accurate. Tiled editor also support making polygons for that specifically.
BUT maybe start with boxes unless you are feeling very brave.
Thanks for all the feedback! I’ll see how I can improve it
You can also kind of automatically calculate a hit box by looking at the pixel data. Many libraries do that. That's fairly simple with rectangular hot boxes. For more fancy collision I would recommend hand crafting them in tiled editor or possibly using pymunk to automate it.
Thanks! I’ll look into that
You could possibly peak at what arcade does. It's more or less created for projects like this
Arcade 2.6.4 is out!
Full release notes here. Lots of improvements!
https://api.arcade.academy/en/latest/development/release_notes.html
Someone's going to go crazy with the compute shader support. Just waiting for it.
Hi guys l need help creating a scoreboard on my Top Trump game on Python
But its a long code, can l send it to someone via message?
Anyone playing Diablo 2 Resurrected in here? 🙂
do somebody nows how i can fix this error ":pnmimage:png(warning): iCCP: known incorrect sRGB profile
:pnmimage:png(warning): iCCP: known incorrect sRGB profile"
I’m not sure if I should be posting this in here or data-sci but I’m trying to figure out how to use ffmpeg. I’ve got a replay file that contains hit objects as well as mouse pos/movement and I want to convert the replay to a mp4
Do I have to do some sort of headless render and send that to ffmpeg or can I render with it directly?
teach me master
If you can create rgb pixel data you can dump raw frames to ffmpeg. A simple capture feature in moderngl-window : https://github.com/moderngl/moderngl-window/blob/master/moderngl_window/capture/ffmpeg.py
I've just crated pixel data with pillow once drawing lines visualizing vectors, then dumping that into the capture thing above.
It was certainly not perfect, but it did the job in minutes.
Shapely or cairo can also work if you want it more fancy
how to install ursinaengine
Sup fam, does anyone have any experience with WrapAround in games like asteroids, snake?
More specific? You're just talking about objects disappearing and re-appearing on the other side of the screen?
If that is the case: With asteroids type of games it's common to make the object leave the screen entirely before it re-appears on the other side for simplicity.
For snake it really depends on the implementation. If it's grid based it's fairly simple to wrap around the screen.
this is really cool I will have to look into some game dev stuff
was able to make a game loop using geonodes and py + upbge !
I think you can use Modulo
and if the thing goes to far on X it will pop to zero automagically
so we have its 'incident x' and its actual X
Say you have a rod 5cm (or 5cm radius) pointing north how can rotate the rod so that it points east ?
,
does surface.blit allow a list parameter?
like this one
When the object touch or go over the "screen boundaries", make it appears in the other side following the path (hypotenuse)
I would like to keep the initial trajectory.
it will I think
if you use modulo X and modulo Y
so we have - add velocity to 'base' X and y
then after to get incident x and y we do
newVector = [math.mod(old_vector[0]), math.mod(old_vector[1])]
oh nm
this would spit it out whereever it crossed on the other side I think
Cheers @cold storm I will have a try this arvo.. I did a whole calc from that (black triangle) than I set the x,y to the base and "draw" another triangle (the one with green line) to set the new position.
But with that I would have a lot of problems with collision detection as well
gosh damn.. such a basic stuff, giving me some hours of headache.
I can help I think
intesect point line
can yield where it will cross
I think you can flip the ratio
oh nm
that would be a different triangle I think
My fear is that all code that I'm typing, could be summarized in less than 10 lines.
and then I had stress over something that I didn't need to.
I've got a game idea but I'm currently only at the "how do I design a basic module?" stage. I'm wondering if there's somebody here I can chat with regularly to help me develop my programming skill, such as it is currently.
Hey, i have created a game using pygame module, have images and sounds in two separate folders.
Now I want make a SINGLE package executable file so that i can distribute it among friends.
Now the problem is everytime i am using pyinstaller main.py --onefile --noconsole
This command and run the exe inside dist. It's showing fatal error, could not read script.
I tried moving the main.exe to the folder where all my assets were. But still didn't work. Showing the same error.
Anyone have any solution?
how's your folder structure?
if you could just paste it over here
will this work?
I just shared folder structure from vscode
mainfolder
|-- Images_folder
| |--imgA.png
|-- Sounds_folder
| |--soundA.wav
|-- main.py
|-- backend.py
Hey! I am making a school project and I need help. Is there anyone that could DM me? Basically im using Pygame and I can't find a way to assign .get_rect to my character and obstacles
I dont know if this is the good channel for what I am asking tho...
100% py (bge+bpy)
I mean the dist folder
Hi
Whatcode i need to write to let a object move when i press on the screen
For mobile devices
.listen()
.onkeypress()
What is for mobile devices
is this okay?
keep the images and sounds folder in the dist folder along with the main.exe
i did that but it didn't work
this is what the error
I don't have much experience with pyinstaller
sad
like to whomsoever you're sharing this exe with, just tell him to install python and run it
it'd be much easier
:") anyway thanks for everything
