#game-development

1 messages · Page 96 of 1

potent ice
#

No worries. Can poke you when I make it public

#

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 😄

dawn quiver
#

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?

potent ice
#

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

dawn quiver
#

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

potent ice
#

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

dawn quiver
#

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

potent ice
#

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 🙂

dawn quiver
#

-._.- 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

potent ice
#

The video I posted consists of 16.777.216 blocks btw

dawn quiver
#

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?

potent ice
#

Nope, but all the parts needed to do it is there

dawn quiver
#

can you perform movement operations on the gpu to speed up performance?

potent ice
#

What kind of movement?

dawn quiver
#

or is that more suited for the cpu. The movement of entities like in minecraft

potent ice
#

The camera does all the world movement on the gpu, yes. That's the least of worries.

dawn quiver
#

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

potent ice
#

Could try to start some community game or something? Like always there is a problem with direction and what to actually make lol

dawn quiver
#

yeah thats a big problem im facing

#

like id like to program a game but its hard to think of the game to program

potent ice
#

Usually better to stick to small project. A simple idea.

dawn quiver
#

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

potent ice
#

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 😄

dawn quiver
#

i loved making tetris

#

and id love making a rpg with characters and level systems and battles

#

it all sounds fun to code

potent ice
#

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

dawn quiver
#

yeah ill remeber to try that.

#

but first im gonna see about pygcurse

#

i really want to make a turn base combat system

potent ice
#

ah right. That does remove the needs for fancy graphics 😉

dawn quiver
#

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.

frank fieldBOT
#

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:

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:

https://paste.pythondiscord.com

main cradle
#

ow

#

i wanted to show the 2nd game i made in 2 years but meh

potent ice
#

Optionally you can put your game on github, gitlab or any other public code repository

potent ice
#

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.

arctic burrow
#

IK

cold storm
cold storm
high pawn
#

how come theres not a lot of python game engines?

snow hill
# high pawn 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…

https://www.panda3d.org

https://www.harfang3d.com

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.

HARFANG® 3D

HARFANG® is a software framework for modern multimedia application development. Manage and display complex 3D scenes, play sound and music, access VR devices such as the Oculus Rift and much more.

#

All this is running on Python 3.6 😅

dawn quiver
#

@marble parceladvertising

marble parcel
#

@dawn quiver next time, just ping the moderators role.

#

@dawn quiver Please don't post random videos.

dawn quiver
dawn quiver
#

can i create minecraft mods w/ python?

gaunt monolith
#

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.

snow hill
#

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 ?

past quarry
#

Is there a difference in coding language between Minecraft Bedrock and Minecraft Java?

round obsidian
snow hill
#

aaah yeah

#

makes sense

brisk yoke
#

hello

#

does any one here know Ursina

snow hill
#

no 😦

dusky garnet
timid hemlock
#

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

snow hill
cold storm
#

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

high pawn
cold storm
#

upbge is a fork where a friend of mine restored it

#

it's kept in sync with blender master

#

this is geonodes in game

#

it goes on forever, once they reach the end they start at the beginning (the ships)

ruby lion
potent ice
# snow hill I wonder what is the core of a Minecraft-like display algorithm… I assume it’s n...

@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.

maiden perch
#

what

#

ty for the info

#

you pinged the wrong person though

#

l0l

potent ice
#

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

stray kelp
willow canopy
potent ice
#

Are we staring an IDE/Editor war or something? 😉

cold storm
#

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

vestal ocean
surreal meadow
#

Hi

autumn comet
snow nimbus
#

I have a pygame related question

#

can i ask here

cold storm
cold storm
potent ice
#

Definitely starting to look like something

#

It's drawing an outline of what chunk you are standing on. The world depth is insanely overkill when starting on layer 256 initially

compact agate
#

@potent ice maybe numba for numpy operations? for more speed

potent ice
compact agate
#

i know you can do numba stuff with the gpu, but looks very cool

potent ice
#

Numba doesn't fit my use case

#

I want to see what you can do only with shaders and pure python 🙂

compact agate
#

cool!

potent ice
#

I still have 9 more millisecond to do stuff (per frame)

balmy quiver
#

hi

#

could someone help me fix this

#

I don't know how to fix this

#

error that I don't know

potent ice
potent ice
#

Made a complete mess, but at least removing blocks works and it's fast enough

prime flicker
#

How can I reduce lag in ursina

cold storm
#

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)

dawn quiver
#

@potent ice hey can you come to dm

whole burrow
#

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 ...

potent ice
potent ice
#

The AABBs would just be aligned unit cubes anyway

potent ice
#

BUT... will need raycast anyway for other things.. so probably both

potent ice
dawn quiver
#

is unity game engine better or unreal for beginer?

round obsidian
dawn quiver
#

well i meant i am just starting game development

round obsidian
dawn quiver
#

mainly with python

#

only

#

i am learning c

round obsidian
#

Unity uses C#, Unreal uses C++, and Unity is slightly more beginner-friendly

dawn quiver
#

oh ok

#

thank you so much!

ionic pond
#

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

round obsidian
#

at each move, check to see if the head of the snake and any of the apples occupy the same space (collision detection)

ionic pond
#

thanks for the reply! I'm going over my lines of code rn, one by one, to make some changes

dawn quiver
#

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

ionic pond
#

Also, general question: Has pygame helped improve your general understanding of python, or do you guys simply learn pygame for fun?

cold storm
#

@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

dawn quiver
cold storm
#

with games?

ionic pond
cold storm
#

this is the generator at work

ionic pond
#

hehe, nice

dawn quiver
#

yes i need help with my game

cold storm
dawn quiver
cold storm
#

than why not just ask here

#

-_-

#

0/

#

hi

dawn quiver
#

because thats what the help things for?

cold storm
#

people ask for game dev help in game dev area 😄

#

it makes more sense

#

(also the answers remain here in the searchable history)

ionic pond
#

usually the help servers are pretty flooded tbh

cold storm
#

so we can answer future questions before they are asked

dawn quiver
cold storm
#

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

dawn quiver
#

so put print(dir(font))

#

above WIN_IMAGE = font.render(WIN_TEXT, True, BLUE)

ionic pond
#

man, my code looks reallyyyy bad T__T, i still cant make the snake game work

dawn quiver
#

im still confused on what to do for my code

ionic pond
#

how did you copy/paste your code onto here?

ionic pond
dawn quiver
#

oh i fixed my code

ionic pond
#

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

dawn quiver
#

aha

#

ill try see whats wrong

ionic pond
#

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 >:-))

round obsidian
#

Colorful instructions

ionic pond
dawn quiver
#

whats it coded in

round obsidian
dawn quiver
#

yo

#

so with game development

#

can u code games in more stuff besides pygame

#

like to make better games

round obsidian
#

@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.

dawn quiver
cold storm
#

upbge

#

this is coded in the fork of blender upbge

dawn quiver
#

alr i’ll try it out

round obsidian
dawn quiver
#

are 3d games like very hard

#

compared to pygame shit

round obsidian
#

3D games are orders of magnitude more difficult than 2D games

ionic pond
#

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

cold storm
#

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

dawn quiver
#

3D is so confusing

#

imma stick with 2d xD

ionic pond
#

it looks very cool though!

cold storm
#

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

balmy elk
#

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

lyric lily
#

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?..

potent ice
#

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 😅

normal silo
potent ice
#

Yup. That's exactly the plan. Already porting most moderngl examples to that in a branch atm 🙂

normal silo
#
>>> 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.])
>>> 
potent ice
#

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

normal silo
#

Also recommend using PyPy instead of CPython.

potent ice
#

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.

normal silo
#

Yeah, but no reason not to really, as long as your current libs are supported which they prob. are.

potent ice
#

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

normal silo
#

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)

potent ice
#

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

normal silo
#

Yeah you don't need it, but it's basically free speed.

potent ice
#

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 🙂

normal silo
#

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).

potent ice
#

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.

normal silo
#

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.

potent ice
#

I'll at least give pypy a go at some point

normal silo
#

What makes it annoying is the need to sort of synchronize the two languages, if either of them updates.

potent ice
#

I don't mind C extensions. I'm so used to it

#

I can also cheat the GIL

normal silo
#

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.

potent ice
#

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

normal silo
potent ice
#

It's more than fine. Any input on optimizations are good

#

And yup. pyglm made collision checking 5-6 times faster \o/

normal silo
# potent ice 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.

potent ice
#

I worked with C and rendering in the game industry for many years, so I definitely know

normal silo
#

Ah ok, yeah I don't doubt it then.

potent ice
#

Optimizing in python is weird. There is a lot of learn, so it's a challenge. For example : WeakSet is a terrible idea

normal silo
#

Graphics programmers are built different. 5head

#

Every time I read a paper on some new graphics related thing I wonder if they are all overqualified for the job.

potent ice
#

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

normal silo
#

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.

potent ice
#

and the evolution of compilers have made things a lot easier

#

More cache, cores and whatnot certainly doesn't hurt

normal silo
#

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.

potent ice
#

ah right. Now the pypy thing makes sense 🙂

cold storm
#

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?

tranquil girder
#

Isn't pypy slower to start up? That's a pretty big downside considering CPython is pretty slow already

gaunt monolith
#

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.

sterile berry
#

Hi

normal silo
proper peak
#

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

normal silo
#

Don't except huge gains though.

normal silo
proper peak
#

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.

normal silo
#

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.

normal silo
#

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.

cold storm
#

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

normal silo
# cold storm and compiled is faster than JIT

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.

cold storm
#

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

normal silo
#

ML is not even close to generating good code. Despite the hype around the GPT code writers.

cold storm
#

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)

normal silo
#

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.

cold storm
#

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

normal silo
#

Let's move this to the data science room.

dawn quiver
#

hey so with unity

#

is it for ios only

#

or does it do android aswell

potent ice
dawn quiver
#

what?

potent ice
#

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.

alpine glade
#

does anyone here use renpy?

ionic pond
potent ice
#

renpy is based on pygame anyway 🙂

glossy umbra
#

Hi friends !

deft linden
#

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

glossy umbra
#

@deft linden i have the same problema with my code

deft linden
#

oh really?

glossy umbra
#

Yes, but i do not know how I show my code to a little help

deft linden
#

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

deft linden
proper peak
frank fieldBOT
#

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
    }
}```
proper peak
#

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
deft linden
#

cool, thanks

balmy elk
#

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

dawn quiver
lean cosmos
deft linden
#

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

dawn quiver
#

insane game

dawn quiver
#

how can i fix this

#

in my game

dawn quiver
#

how can i make a game over but wait before close

sterile berry
#

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

dawn quiver
#

HELP ME WITH PYGAME PLSSSSS

dawn quiver
lean cosmos
#

@dawn quiver thanks coach

cold storm
#

@dawn quiver you can use py + blender ot generate content for unity

potent ice
potent ice
#

A screenshot is not very useful for someone wanting to help

potent ice
dawn quiver
#

ok

potent ice
dawn quiver
potent ice
#

If that is not enough you have to be more specific

dawn quiver
#

thx

#

i have a another problem i get 3 wrongs or goods

potent ice
#

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

dawn quiver
#

yes

#

but it still dont work

potent ice
#

Only you know how the game works. For me it looks fine except that you never set game_over to False

dawn quiver
#

how can i make that he pick a random thing

potent ice
#

I see you have already imported the random module

#

You can use random.randint to generate a random number

dawn quiver
#

thx

dawn quiver
#

the random.randint dont work

potent ice
#

!e
import random
print(random.randint(1, 3))

frank fieldBOT
#

@potent ice :white_check_mark: Your eval job has completed with return code 0.

1
potent ice
#

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

cold storm
#

was able to port a section of my py to GEONODES 😄

potent ice
#

Are you referring to the new Geometry Nodes recently added to blender?

cold storm
#

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

elfin summit
#

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.

lean cosmos
cold storm
#

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

ionic pond
#

By the way, does anyone have any tips for making a dialogue/text-heavy game on pygame?

normal silo
#

Pick good fonts and make sure the font rendering is clean at multiple scales and DPI's.

ionic pond
#

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

dawn quiver
dawn quiver
#

how can i open a pygame window

ionic pond
# dawn quiver 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

dawn quiver
#

i have that but how i can open it

inner wigeon
dawn quiver
#

I get this

inner wigeon
#

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".

dawn quiver
#

i have pygame

#

i download pygame but i still get it

snow hill
#

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" ? 🙂

dawn quiver
#

its sy i have it

#

say

tranquil girder
#

what's you IDE? you should follow you IDE's guide for using python with it

snow hill
#

looks like @dawn quiver is using Pycharm

timid hemlock
#

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.

potent ice
#

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

ionic pond
#

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

dawn quiver
#

how can i fix this

potent ice
dawn quiver
#

its working

lusty canyon
#

Hi

#

Anyone here

valid marsh
balmy quiver
#

I try to convert pygame to exe with img and audio effect but it didn't work when I open it'

cold storm
#

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

mighty mason
#

hi !
Can I made 3d games by python?
and how

cold storm
#

UPBGE engine

#

Panda3d

#

or pyopenGL

#

never tried this but it could be nice

#

@mighty mason

normal silo
#

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)

#

(have to convert from C to Python though)

late fog
#

hello?

valid marsh
#

If u wanna make 2d games then pygame is the easiest programmatical way for it
For 3d I have no idea

lime sand
#

Hey I am new to game dev, can someone tell me where is the best site/youtube channel to learn unreal engine

finite quartz
#

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?

pliant kayak
#

hii guys

#

please tell me the module which is good for 2d or 3d game development

zenith bridge
#

Check out python arcade module

shell scroll
hardy laurel
#

hi , i am going to start my game developing in python in this week, any basic thoughts ?

cold storm
#

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.

vocal pagoda
dawn quiver
#

hi

potent ice
#

Sometimes the window can shrink after opening it

#

You have hardcoded 1920 x 1080 resolution

#

query the actual window size to be sure

vocal pagoda
potent ice
#

Move the text more to the left? 🤔

vocal pagoda
potent ice
#

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?

snow hill
#

found this, might be worthwhile to follow... 🙂

snow hill
mighty mason
light cargo
#

to program at your peak you must program with drip

vocal pagoda
#

glasslt vsc theme is not there in marketplace

light cargo
#

what

#

oh weird

#

this link work fine for you? @vocal pagoda

vocal pagoda
#

@light cargo thnx

light cargo
#

np

light cargo
#

and/or size

light cargo
#

what is it

vocal pagoda
light cargo
#

is it gore or something

#

i aint risking my eyes

vocal pagoda
light cargo
#

o ty

vocal pagoda
verbal sentinel
#

pygame thing

cinder reef
#

hwy

light cargo
runic basalt
#

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)

dawn quiver
#

i have added a picture but i don't get it on my screen

potent ice
dawn quiver
#

ok

potent ice
potent ice
runic basalt
mighty mason
lean lagoon
#

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 )´´´

snow hill
#

can you share it as well?

lean lagoon
#

@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?

snow hill
#

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)

near yacht
#

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.

odd cypress
#

what is the use of combinedly using pygame and tkinter?

#

ppplllllllllllllll

potent ice
#

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

cold storm
#

yeah, we can use shared memory space and PBO to pass buffer between apps

#

'shared openGL context'

potent ice
#

Even better of you don't need shared. Just make a framebuffer for the frame itself

potent ice
#

as in.. you can reallocated the underlying pixels storage so you can draw to it directly

dawn quiver
#

does anyone here have experience in MIT app inventor?

potent ice
primal pond
#
GitHub

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/

▶ Play video
#

(Made using pygame)

cold storm
normal silo
dawn quiver
#

anyone wanna help me build a game for fun

opaque thistle
valid marsh
#

is there anyway to get fast pixel access of a surface
?
as in in the form of an array

#

pygame

light cargo
#

@vocal pagoda SHOW ME YOUR THEME 🥵

#

Vscode theme

#

Im ready

vocal pagoda
#

@light cargo here's my vs-code theme

#

@light cargo

cold storm
#

@valid marsh you can plot easier than inject a whole array back

#

if you want to act on pixels

light cargo
#

YOOOOOO

#

FIRE

cold storm
#

it's best to do it in a fragment shader

light cargo
#

good job trueman

cold storm
#

that is almost like my blender text editor

vocal pagoda
cold storm
valid marsh
#

can you elaborate

cold storm
#

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

valid marsh
#

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

cold storm
#

@valid marsh

valid marsh
#

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

snow hill
#

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

wraith rain
#

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 💟

cold storm
#

@snow hill D_pikadance

#

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

tranquil girder
#

It's fake 2d top down light

#

More GLSL than Python, but still

ionic pond
humble tartan
tranquil girder
#

ursina

balmy quiver
#

does anyone have a cool game

dawn quiver
#

Hey guys whats the best game engine for python?

balmy quiver
#

idk

snow hill
mighty mason
fathom inlet
#

pygame

dawn quiver
#

Mhm

fathom inlet
dawn quiver
#

I Will tey pygame

fathom inlet
#

i have never tried godot

dawn quiver
#

Try*

fathom inlet
#

i think u should use godot

#

but slow com i guess u use pygame

cold storm
#

You can use dot normal / incoming for the point light shading

#

Upbge

#

Is an amazing engine few people know about

cold storm
#

blender basically gives your py super powers

dawn quiver
#

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

frank fieldBOT
dawn quiver
#

this is my code

cold storm
#

@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

dawn quiver
small garden
#

what is the best online python website to code in?

mild dock
solemn shale
#

hi

#

How do remove the earlier glitchy frames in an animation in pygame

cold storm
#

@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

solemn shale
#

oh

serene patrol
#

Check out this amazing project ->

#

Give a star if u like!

proven ether
#

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

potent ice
still sail
#

Woah I didn't know you were here too einarf

dense solstice
#
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

hazy zenith
#

does anybody have a good explanation of the Player class in pygame, or just a webpage that explains it good?

small garden
#

Whats a good game name?

#

Because im looking for a name but my brain is empty for name ideas plus1 python

hazy zenith
#

What about ordinary highschool physics wher the character has to explore through a physics based 2d game

snow hill
#

WIP of my emulators front-end:

mighty mason
desert kernel
#

Can anyone help me?

cold storm
proven ether
solemn shale
#

Hi

#

How to make it so that when two images collide print("You lost")

#

im really confused on how to do it in images

potent ice
swift dagger
#

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

cold storm
#
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

graceful marsh
#

You can make pin suggestions in #community-meta. Please reserve mod pings to urgent incidents that require moderation

ionic pond
#

would you guys say that you use maths a lot for game dev?

tranquil girder
#

yes, but it's mostly very basic addition, subtraction and multiplication

cold storm
#

all the time

#

dot(), reflect(), (p1-p2).magnitude [distance]

#
vector 2 =  (p1-p2).normalized()
#

it gives you super powers *

ionic pond
cold storm
#

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

ionic pond
#

hehe, may consider paying more attention to my math classes

cold storm
#

you can learn more in 2 days of concerted effort then a lifetime of school

ionic pond
#

i agree

cold storm
#

play with blender for sure

#

you can see the math

ionic pond
#

blender looks super cool

cold storm
#

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

ionic pond
#

i havent seen many people use py blender

#

but it looks amazing

cold storm
#

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
ionic pond
#

keep up the good work btw!

cold storm
#

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

cold storm
#

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

untold sentinel
#

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 🙂

cold storm
sick eagle
#

hi

#

i wanna learn to script python

#

can someone help me

#

@potent ice

potent ice
sick eagle
#

no

potent ice
#

Also, please don't ping random people

sick eagle
#

well ur a helper

#

so i pinged u for help

potent ice
#

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.

sick eagle
#

oh

#

well i want to learn to script 😄

#

where do i start

potent ice
#

If you want direct access to help you will have to pay tutors.

sick eagle
#

play tutors? what is that

potent ice
#

pay

#

money

#

Hire a person to help you for money, but we don't do that here

sick eagle
#

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

#

...

tranquil girder
#

under Get Started

cold storm
drowsy bluff
cold storm
#

UPBGE BPY

#

and BGE py together in harmony

#

the buildings are generated in realtime in py

frank fieldBOT
#

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:

https://paste.pythondiscord.com

cold storm
solemn shale
#

Hi

#

Can someone help me with ursina

#

bc whenever I run it in replit i get an error

feral jewel
autumn dagger
#

anyone knows a lightweigt game stuff?

wind gyro
#

Guys how do i go about implementing AI algorithm to a game?

drowsy shoal
#

What engine are you using?

#

Hal’s

#

Hals

quiet forum
#
GDC

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

...

▶ Play video
GDC

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:/...

▶ Play video
#

Soo... Can anybody recommend a c++ gamedev discord server? I really can't manage to google one(

lunar venture
quiet forum
proper peak
fickle rapids
#

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
peak canopy
#

How can I connect menu page with my game using pygame please help

valid cosmos
#

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 **

potent ice
#

I'm not sure what kind of python editor that would allow you to do this without any protests

onyx sapphire
#

Hello Newbie here.
I'm looking to learn more of python through game dev and i want guidelines.
Like which game engine to use

#

??

potent ice
#

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

onyx sapphire
#

which are closer to game engine

potent ice
#

That doesn't mean it's the right choice. what are you planning to make?

onyx sapphire
#

i want to do 3d games

potent ice
shrewd sparrow
#

how do i implement gjk-epa collision in python

#

i can't seem to find the collision point correctly

shrewd sparrow
cunning loom
#

Is it possible to run a Kivy app at a high fps like 240hz?

potent ice
#

Sounds more like a question for Kivy discord (considering it's not a common question here)

dawn quiver
#

i want to make a snake game using pygame, any tips for getting started?

hearty tapir
#

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

potent ice
valid cosmos
#

thank you

dawn quiver
#

Ok

dawn quiver
cold storm
#

@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

broken panther
#

Hey

#

Can I make a simple game about wood carving

frank fieldBOT
#

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:

https://paste.pythondiscord.com

hollow wharf
ionic pond
#

howdy everyone

#

what do you guys use to edit world data in a platformer game?

#

like, a pygame level editor for a platformer.

low marsh
#

is it possible to code a free roam game in python

ionic pond
dusty shuttle
ionic pond
#

how do i fix my character kind of levitating? he looks like he is floating above the dirt blocks

cold storm
#

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

twin sequoia
#

hi

#

please help me i am making my first game in python

#

i have an issue!

potent ice
#

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.

ionic pond
potent ice
potent ice
#

You could possibly peak at what arcade does. It's more or less created for projects like this

frozen knoll
potent ice
#

Someone's going to go crazy with the compute shader support. Just waiting for it.

dawn quiver
#

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?

dawn quiver
#

Anyone playing Diablo 2 Resurrected in here? 🙂

dawn quiver
#

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"

last moon
#

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?

dawn quiver
#

teach me master

potent ice
# last moon I’m not sure if I should be posting this in here or data-sci but I’m trying to f...

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

GitHub

A cross platform utility library for ModernGL making window creation and resource loading simple - moderngl-window/ffmpeg.py at master · moderngl/moderngl-window

#

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

dawn quiver
#

how to install ursinaengine

brisk pecan
#

Sup fam, does anyone have any experience with WrapAround in games like asteroids, snake?

potent ice
#

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.

frosty yew
#

this is really cool I will have to look into some game dev stuff

cold storm
#

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

left jetty
#

Say you have a rod 5cm (or 5cm radius) pointing north how can rotate the rod so that it points east ?
,

summer ledge
#

does surface.blit allow a list parameter?

brisk pecan
#

When the object touch or go over the "screen boundaries", make it appears in the other side following the path (hypotenuse)

brisk pecan
cold storm
#

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

brisk pecan
#

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.

cold storm
#

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

brisk pecan
#

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.

olive coral
#

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.

patent dock
#

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?

crisp junco
#

if you could just paste it over here

patent dock
#

will this work?

patent dock
#
mainfolder
    |--  Images_folder
    |              |--imgA.png
    |--  Sounds_folder
    |              |--soundA.wav
    |-- main.py
    |-- backend.py
ocean willow
#

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...

cold storm
crisp junco
dawn quiver
#

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

patent dock
crisp junco
patent dock
#

this is what the error

crisp junco
#

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

patent dock
#

:") anyway thanks for everything