#game-development

1 messages · Page 37 of 1

limber veldt
#

It'd be cool if it reached that and stayed there

covert snow
#

hiya, so ive been working on this pygame platformer which used a file with a timer class(cus its better than the in built one). I noticed that it wasnt ptoperly importing my class into other scripts (wasnt highlightin but adding "." insfornt of it did???). Anyway, i followed this indian guys tutorial on import issues where you pip intsall the file/libary using venv . It made the text hightlight but it wasnt working. then i relaided that pyagem for some reason wasnt importing. after pip installing and uninstalling many times nothing is working. no files can run. Iv'e tried to revert my git commit but that chnages nothing

#

python -m pip install pygame-ce
Requirement already satisfied: pygame-ce in c:\users\manxumanew\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (2.5.2)

#

is the command i try

#

any help would be much appericated

limber veldt
bold hill
#

Am I able to call animation bits from a .zip file

neat kindle
#

I am quite confused on how to get my sprite moving in my snake game in phyton

bold hill
#

May I ask you a question about animation too sorry

muted sand
#

If I’m able to answer it lol

bold hill
#

Can I pull it from a zip file?

muted sand
#

Unless you don’t want to extract it at all

low ocean
#

Hi guys, currently creating a game in pygame and I wrote the block of code below but it does render on my screen and I can't understand why. Kindly help.

#

def display_score():
current_time = pygame.time.get_ticks()
score_surface = test_font.render(f'{current_time}', False, (64,64,64))#text, AA, color
score_rect = score_surface.get_rect(center = (400,50))
screen.blit(score_surface, score_rect)

muted sand
#

When I get back to my computer I’ll try it out and see

#

Before that though, make sure that your surface is being drawn after the background and that your display is being updated with pygame.display.update()

#

Or .flip()

low ocean
bold hill
muted sand
muted sand
# bold hill Thank you

Is this what you were looking for or did you want to load a file without extracting it?

bold hill
bold hill
sick turtle
#

Want to work or contribute on some projects if anyone reckon i may come useful let me know

muted sand
muted sand
limber veldt
#

And pygame doesn't use GPU at all (usually), so that has no meaning

muted sand
#

What they said ^

limber veldt
#

I'm not sure why one would want to unzip a file in code, if it's image assets, unzip on your desktop (like in a project's assets folder) and load the images in to the project at game startup

#

Like there is nothing to gain by leaving it as an archive and loading/unzipping it in code

#

This is my image loader when I want an entire folder of images loaded into a dict of image name': Surface key/value pairs ```py
def import_folder_to_dict(path):
surface_dict = {}
for _, __, image_names in walk(path):
for image in image_names:
surf = pygame.image.load(path.joinpath(image)).convert_alpha()
surface_dict[image.rsplit('.')[0]] = surf
return surface_dict

muted sand
#

That’s really nice

#

And then if it was a sprite sheet or tile map you could set the width and height of each tile and divide it into multiple images you can store in a list

limber veldt
#

labels = import_folder_to_dict(Path('..', 'Assets', 'labels')) where Path is pathlib.Path

muted sand
#

I made a function that can do that for a single image

limber veldt
#

I find it handy to have most general images in a dict, those for animation, I usually have in a list sometimes as a value in a dict, sometimes as just a variable to be passed to the sprite and setup as images to iterate through a timer based on dt or state or whatever kind of logic

#

Just depends on implementations. If I have a sprite with animation states, a dict is nice

low ocean
#

Can someone please explain to me why I can't see time being displayed on my screen. I've tried calling the function, changing the position of the lines of code because I thought it was running behind the background but none of it worked. Any help would be appreciated.

limber veldt
# low ocean

Can you share the draw function or code relevant to drawing your screen? This looks like it should be doing something so likely the problem lies elsewhere

low ocean
limber veldt
#

Have you tried using a different color for the score_surface just to rule that out? What about the size of the test_font is it big enough?

#

Nothing popping out to me there, you have your font loading, it's definitely big enough, what about the drawing? Specifically, the draw order

#

!paste and you can use this to paste the entire code

frank fieldBOT
#
Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

low ocean
limber veldt
#

I don't see any call to display_score() in your main loop (or anywhere for that matter)

#

Try adding it just above the pygame.display.update()

low ocean
limber veldt
#

Sure, that's just an issue of what it's actually doing in the function

#

But at least you can see it now

low ocean
limber veldt
#

Maybe you can pass your game_active variable to the function and if that's True or False, update or not update the score_surface

#

If game is not active, don't make a new surface, just keep drawing it as is

low ocean
limber veldt
#

No problem

neat kindle
muted sand
#

I would recommend inserting change_direction as a method in the snake class rather than having it separate from the class

oak jungle
#

Any audio library compatible with pyodide that allows me to play some audio?

I am trying to add a soundtrack to my TUI game and I'd like to export it using pyodide but I don't want to get crazy rewriting and overwrapping some SDL lib to HTML5 APIs.

vagrant saddle
#

btw ❤️ pyTermTk

#

but writing html5 api calls is probably the simple and efficient way if you have a single file or a streaming source, as long as it is .ogg

oak jungle
# vagrant saddle btw ❤️ pyTermTk

Thanks. 😁
About writing the HTML5, I am trying to avoid it because I want to run it also on a terminal and having a library already compatible wth pyudide would help a lot.
Thanks, I'll have a look to the libraries you mentioned.

vagrant saddle
oak jungle
#

oh, great, I'll have a look

vagrant saddle
#

by SDL2 i mean pygame-ce

#

you probably don't want to write C 😬

oak jungle
# vagrant saddle by SDL2 i mean pygame-ce

oh wow, amazing, pygame-ce is shipped in the pyodide prebuild packages:
https://pyodide.org/en/stable/usage/packages-in-pyodide.html
Definitely I am gonna use it.

First thing I am gonna recycle my parallax scrolling routine to make TTKanabalt the Terminal Canabalt
https://www.reddit.com/r/unixporn/comments/1b50jat/xterm_terminal_multiplexer_with_a_parallax/

Reddit

Explore this post and more from the unixporn community

vagrant saddle
#

one thing use files to feed audio not pkgressources

oak jungle
#

Thanks, I will do.

zinc onyx
#

I need help with my bombs in bomberman game, they explode do the animation while its visibl (active) it can kill me but my problem is that when it dissapears it is still killing me and i need to fix that

muted sand
#

!paste

frank fieldBOT
#
Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

zinc onyx
muted sand
#

Oh nevermind there isn't meant to be

#

I haven't used tkinter so I double checked, let me keep looking

proper dome
#

my 3d game raycast wolfenstein made in python, I didn't use libraries like pygame and opengl, just import math and import tkinter.
my engine.py converts 2d map to 3d.
I had to do render.py and it gets the 3d map and displays it on the canvas.
If the video doesn't play, download it, it's fine. 😆

muted sand
# zinc onyx https://paste.pythondiscord.com/5L3Q

I think the issue is that you have two different attributes for active explosions. One is in the Program class, self.active_explosions, and one in the bomb class, self.active_positions. In the cleanup_explosion method, you're removing the bomb from active_positions but not from active_explosions which is what's used to determine if the player is hit in update_game line 263

gentle junco
#

hi guys can anyone help me fix this text input button, trying to get it to draw the inputted text but the text isnt getting updated

restive axle
#

guys what the better to my use V-S-C or .......

muted sand
gentle junco
restive axle
#

visual studio code thes is the best to use right?

muted sand
muted sand
restive axle
#

how can i know if my computer 64pit or 32pit

muted sand
restive axle
#

thanks

gentle junco
muted sand
gentle junco
muted sand
#

let me show you what I had

#

def loadgame():
pressed = False
in_text=' '
textbox_button=Button(0,250,270,'savedgamename ',pygame.font.SysFont("arial", 30),(255,255,255))
while True :
screen.fill((0, 0, 0))
current_time=pygame.time.get_ticks()
mouse=pygame.mouse.get_pos()
#screen.blit(intro_bg2,(0,0))
#screen.blit(enteryoursaved_img,(250,150))
#screen.blit(gamename_img,(330,210))

    #back_button=Button(back_img,5,30,0,0,0)
    #back_button.draw(False)
    textbox_button.draw(True)
    for event in pygame.event.get():
        if event.type==pygame.QUIT:
            pygame.quit()
            exit()
        if event.type==pygame.MOUSEBUTTONDOWN:
            #if back_button.checkifpress(mouse):
                #load_new_vs()
            if textbox_button.checkifpress(mouse):
                pressed = True
        if event.type==pygame.KEYDOWN:
            if pressed:
                in_text += event.unicode
                textbox_button.text=in_text
                print(in_text)
                textbox_button.update(in_text)
                print(textbox_button.text)

    pygame.display.update()

loadgame()

#

The comments are there because I didn't have the images

restive axle
#

shoud i install debugging symbols

#

in python setup

muted sand
#

I would

restive axle
#

what the best extensions shoud i take to help me in code

gentle junco
restive axle
#

Starman; how can i install library in python with command

#

shoud i write /python.pip/

muted sand
restive axle
#

yes

#

i study the python language from 2 years

#

but thank you for informations

muted sand
#

If you have Python3 installed, use the command
python3 -m pip install {library}

restive axle
#

what is the library i shoud have to creat game

#

2D game

muted sand
#

PyGame is the one I use

restive axle
#

i install the pygame

#

and i

zinc onyx
limber veldt
#

Chat, if there was one thing you could add to pygame, what would it be?

wary compass
#

easier tutorials

low ocean
# wary compass easier tutorials

https://youtu.be/AY9MnQ4x3zk?si=u7uIRnCCEh0VG3JE This tutorial I am currently following seems easy enough for me. You could check it out

In this tutorial you will learn to create a runner game in Python with Pygame. The game itself isn't the goal of the video. Instead, I will use the game to go through every crucial aspect of Pygame that you need to know to get started. By the end of the video, you should know all the basics to start basically any 2D game, starting from Pong and ...

▶ Play video
limber veldt
#

I've learned a lot from him, among others too but my style is much like Clear Code's

limber veldt
low ocean
limber veldt
#

Agreed, covers every detail

#

Which kinda leads to longer than average tutorials from him but that's a good thing

#

He does some big projects too, not just little stuff

restive axle
#

can anyone give me an idea for my new game

#

and i want some one help me at grafic

potent grotto
#

Henlo guis

#

Can u code codm in python

#

😁

vagrant saddle
#

and fyi TF2 has already been remade in python

potent grotto
vagrant saddle
#

i've guessed

potent grotto
vagrant saddle
#

and FYI a lot of game content in call of duty series is coded in GSC which is not more clever than python

potent grotto
#

Gsc is ?

vagrant saddle
#

the scripting language shipped with ID tech engines

potent grotto
vagrant saddle
limber veldt
#

I quit online FPS games a couple of years ago, the aimbotters per square meter ratio is too high for me these days. Some estimates say as many as 1 in 3 overall in online FPS are cheating. They say AI is going to save gaming by being able to detect these guys but I'm pretty sure those guys will continue to counter cheat detection with even more clever hacks

#

Setting up two PCs (game client and AI assistant) with a hardware connection from client screen to AI and feeding keyboard and mouse inputs back to the client, eventually they'll have the AI assist tuned to be more human-like and less detectable and the snake vs rat game continues

pine smelt
limber veldt
#

Yeah, that too

graceful yew
#

isometric support would be great, too

dawn quiver
#

Sorry for saying that. Just not my type of game.

vagrant saddle
dawn quiver
#

oh then I'm not sorry. And that game is bad. It's just furries with guns.

#

Terrible mechanics too.

vagrant saddle
# dawn quiver Terrible mechanics too.

That is more constructive, if you want to talk the author into improving them or fix Panda3D to provide better mechanics to newbies then just go to Panda3D discord

dawn quiver
#

I will never tag you again

vagrant saddle
#

thanks

vagrant saddle
obtuse pivot
#

\U0001F602!

vagrant saddle
graceful yew
#

pyscroll?

graceful yew
limber veldt
graceful yew
limber veldt
#

I'm pretty sure the errors will matter to the first victim of such mistaken identities, if they actually haopen, that is

#

I'm also quite sure it mattered to those killed in tesla auto pilot crashes so far too. Like when the one in Florida killed a man because it couldn't distinguish the sky from the side of a semi-trailer

#

It hit the trailer without even applying the brakes

restive axle
#

can any one joined me to creat a game about Gaza

#

@restive axle

vernal ginkgo
#

hello guys , im looking to create a 2d multiplayer shooting game , im good with pixel art , so i can create assets

What program its suits the best to create the enviroment?

vernal ginkgo
#

should be like this

#

im getting a little help from copilot , so right now im setting up unity 2d to get started

vagrant saddle
vernal ginkgo
#

yup

#

a tiled map

vagrant saddle
vernal ginkgo
#

i want to create a game like dayz but reconstructed as a 2d multiplayer game

#

thanks pmp-p imma save the link

restive axle
#

who knows Gaza

#

i am looking for a frind to help me to creat a 3Dgame about Gaza

restive axle
#

in Gaza

#

Thes is happen in gaza evry day

vagrant saddle
#

this is not the place for that

restive axle
#

i know

#

but

vagrant saddle
restive axle
#

and what is thes

#

ok i just want eny body to help me to creat a game about thes country

#

and see you later

vagrant saddle
restive axle
#

thanks

pine smelt
#

the duality of man

mystic saffron
#

Can you guys teach me how to build a game but using python

vernal ginkgo
#

@vagrant saddle hey man i ve been struggling to import the tiled map into unity

muted sand
# mystic saffron Can you guys teach me how to build a game but using python

This is what I used to get started https://youtu.be/6gLeplbqtqg?si=vVW-g-_O488MzN-G

Learn how to build a platformer game in Python. This game will have pixel-perfect collision, animated characters, and much much more!

✏️ Course created by @TechWithTim

💻 Assets and Completed Code: https://github.com/techwithtim/Python-Platformer/tree/main/assets

⭐️ Timestamps ⭐️
⌨️ (0:00:00) Project Demo
⌨️ (0:01:32) Project Brief/Getting St...

▶ Play video
graceful yew
#

clearcode is also pretty nice to follow along: https://www.youtube.com/watch?v=8OMghdHP-zs

Thanks to Brilliant for the support, you can find them here: https://brilliant.org/ClearCode/

This video covers game development in Python. We will create a spaceship shooter, a Vampire survivor style game, Pong, a platformer and a Pokémon inspired battle game. Via those you can master your knowledge of Python since we will touch on every part...

▶ Play video
candid blaze
#

Hello, everyone; I am seeking more developers for my top-down strategy game, Terra-tactic. We are looking for developers who want to help see the project through and, hopefully, developers looking for a long-term team to work with. We allow anyone 16+ to join.

If you would like to join you can find our discord on our website: http://terra-tactica.com 🙂

limber veldt
#

!paste

frank fieldBOT
#
Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

limber veldt
#

!code

frank fieldBOT
#
Formatting code on Discord

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

For long code samples, you can use our pastebin.

broken glade
#

hey so I am working on a top down tile based scrolling game. It was working at one point but I redesigned the map and now it won't work. There are a BUNCH of other issues that I need help with but the biggest one is that now I can't move at all. I suspect the issue is with my code for stopping scrolling but I don't know how exactly to fix it (mostly because I made that a week ago and can only kinda remember how it works lol)

#

I will send the code for a moment

#

!paste

frank fieldBOT
#
Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

broken glade
#

here is the code

limber veldt
# broken glade here is the code

Try commenting out the collision checking, lines 242-249, just to rule that out. Once things are moving again, you might uncomment them, but try simplify until things are moving again, maybe some printing in the drawWorld() function to be sure your math is mathing as well

broken glade
#

I did remove the collision, this has moved to a help post now btw called Scrolling Game

limber veldt
#

Oh ok

restive axle
#

hello

#

can any one help me

bold hamlet
#

This is flappy bird

muted sand
white jasper
#

Hey guys, I want to explore game dev for a bit. Would you consider game engines part of what I should check out? UnrealEngine seems interesting, not sure if I should spend time on that or something else when exploring game dev as newbie (to SWE as a whole).

muted sand
#

I’m pretty new myself so take this with a grain of salt, but I believe it’s up to you and what your goal is. For me personally I tried Unreal and Unity and I really didn’t enjoy using them because of the lack of customization and the complexity. I much preferred making games from scratch because I had full control over how the game turned out. Of course, the downside to that is losing the power of a game engine

quasi hinge
#

is there a way to decrease size of a sprite in pygame?

limber veldt
dawn quiver
#

umm help

#

it crashes after seconds

#

anyone??

#

pls

#

I fixed it it was supposed to be
def check_events(self): (line 12)

and I forgot to call the "check_events" function in the run loop

#

thx for nothing

lunar obsidian
#

hi

muted sand
#

Hey

weak hazel
#

Hi which game engine should i use if i only know python?

frank dome
#

Hello, I am making some pseudocode about movement and getting items in a text base game and was looking for advice on improving it before i submit it for my class

muted sand
limber veldt
#

Thinking about changing my Robot Quest game to scrolling instead of room-based, basic test setup is working

#

It would certainly simplify some logic in the robot game

#

Basically the first section of one of Clear Code's tutorials, except the animation which I did

#

So the next step would be to assemble a test level as a RQ map and add some of the RQ objects, changing them to work with one map instead of a map of many rooms

#

I'd also need some teleporters for those levels that cannot be laid out in a single 2d shape

limber veldt
#

Which could be pretty cool, I could make graphics for little buildings and stuff, maybe signposts on or near them or some kind of icon to indicate what's inside

#

Bring Robot Odyssey/Droidquest into the 21st century, a game well worth it

modest ivy
wicked sequoia
#

what are all the types of apis?
ie i can get a api froma movie website to show the movie dates and names
what else can i do with apis

weak hazel
#

Hi which game engine should i use if i only know python?

pine smelt
#

pygame for 2d
ursina for 3d

vagrant saddle
#

or panda3d for everything ( especially if wanting to apply shaders over pygame surfaces )

low ocean
#

Hi guys, what could be the reason as to why my frames are not animating?

limber veldt
#

To be clear, this does nothing fly_frame_index == 1 as in, it doesn't assign the value to the variable, it compares one to the other, not what you want

low ocean
limber veldt
#

Maybe think of the double == as is_equal or something that will remind you that this is a comparison operator, not an assignment, and will always be True or False

low ocean
hasty nacelle
#

does anyone know how to print out the variable name instead of it saying: <__main__.Player object at 0x000001EB40740170>

dawn quiver
hasty nacelle
#

in the class?

#

i have initialised it

dawn quiver
#

Is the player class yours

#

Did you define it

hasty nacelle
#

yes i made it

#

wdym define

#

i easily get confused with these oop terms so pls be patient with me

#

i mean i do have 2 methods (one being __init__)

dawn quiver
#

Can you post the entire class?

hasty nacelle
#

i just needed a name attribute for my class

dawn quiver
#

repr method also works

hasty nacelle
#

and the problem i had was that i was printing out the whole object

hasty nacelle
dawn quiver
#

Repr method tells python what to print if you print an object. More or less

dawn quiver
#

guys what is the average salary for a beginner

muted sand
hasty nacelle
teal pelican
#

what is the best way to start game development in python?, should i use pygame or is there a better or different framework?

muted sand
teal pelican
#

i was trying to install it in vs code but it wasnt working for some reason

muted sand
teal pelican
muted sand
teal pelican
#

i should have put to and to together lol

atomic bronze
#

hello budies

storm meteor
#

Hello, everybody.
I am a Full Stack Web3 developer.
With many years of rich experience, I am ready to create something new with you.
If you have any projects to work on, please contact me.
Let's make your ideas a reality.

odd reef
#

I'm working on a word search and crossword suite of puzzle makers. I'm publishing them in print form. I'm stuck on the process of outputting the answers. The word search solutions aren't outputting properly. My python skills are limited.

frank fieldBOT
#
Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

wicked sequoia
#

do you guys do free recall to learn coding or deliberate practice?

rare ledge
#

Hey is it ok if I show you guys what I made

topaz flume
odd reef
barren torrent
#

So

#

this isn't strictly a Python question... more... well, here...

let's say, I have a series of different forms that a shapeshifter can obtain each with different bonuses, unlock requirements, and custom code that runs while the form is active.

If I'm operating in C++, I've got two options for representing that series of forms.

Option 1 is some kind of switch-case based on a form ID and other factors being queried for in a function.
Option 2 would be to create sub-classes for each based on a Form class, load instances of them into something like a hashmap to retrieve the active one (or set a pointer on the character when they transform), and then use polymorphism. Or, the poor man's version, a hashmap of FormID->Struct where the struct contains flat bonuses and possibly a lambda...

The problem is when there's 400 of these.

if I'm using Python, then I can do things like just flatly import a whole module and shove every class in it into a dictionary where the key is FormID and value is the class, and heck, I can just use class properties and classmethods, it is a thousand times easier. both defining them and managing the whole collection is 100x easier and less verbose.

But I'm wondering. Is there some even better approach that I'm overlooking.

#

In my design this doesn't just cover transformations it can also be used for like, buffs/debuffs and other effects

errant oxide
#

it might look a little weired because i live in a different country so the time zone here is a little different

#

ok im sorry, ill stop yapping, i might become a little anoying

sweet inlet
#

😭

turbid needle
normal silo
#

Keep your data as basically a spreadsheet (literally even, so you can easily tweak the game design) / database, and your logic separate.

#

For this kind of game about combinatorics.

barren torrent
#

"a list of functions that is separate" huh

normal silo
barren torrent
#

ah.

#

whihc is basically the switch-case stuff in option 1 there

normal silo
#

You can view it from the POV of compression. If there is nothing repeated, it won't compress well (if at all).

#

So to some degree you just need some giant number of cases in code for a problem like this.

#

But if your forms have a lot of overlap, then you can have just a few systems that are composed together. Each form being a composition.

#

For example, maybe forms A and B are both affected by gravity. So the gravity system / function will query for all objects of forms A and B, and apply gravity to them.

#

With a giant switch this would be duplicate code in cases A and B (which can be moved out to its own function (compressed)).

normal silo
#

But this only applies to cases where your gameplay involves forms that have a lot of overlap.

#

Otherwise it's wasted effort to make all this (simple switch is the most straight forward and direct solution when there is no overlap, and in a sense, optimal (for amount of code)).

barren torrent
#

hm

#

At present these things only really affect stat calculations.... what I've got going on is something like....

#
        {
            FormID::Lycanthrope, {
                {APPLY_CVIT_MULT,   0.0, ~0,                    [](struct char_data *ch) {return 1.0 + (0.1 * getMasteryTier(ch, FormID::Lycanthrope));}},
                {APPLY_DTYPE_BON,   0.0, static_cast<int>(DamType::Physical),            [](struct char_data *ch) {return 0.4 * 1.0 + (0.10 * getMasteryTier(ch, FormID::Lycanthrope));}},
                {APPLY_COMBAT_MULT,      0.0, static_cast<int>(ComStat::Parry),                    [](struct char_data *ch) {return 0.3 * 1.0 + (0.10 * getMasteryTier(ch, FormID::Lycanthrope));}},
                {APPLY_CVIT_REGEN_MULT, 0.0, static_cast<int>(CharVital::PowerLevel), [](struct char_data *ch) {return 0.2 * 1.0 + (0.10 * getMasteryTier(ch, FormID::Lycanthrope));}},
                {APPLY_DTYPE_RES, 0.0, static_cast<int>(DamType::Physical), [](struct char_data *ch) {return 0.5 * 1.0 + (0.10 * getMasteryTier(ch, FormID::Lycanthrope));}},
                {APPLY_DTYPE_RES, 0.0, static_cast<int>(DamType::Physical), [](struct char_data *ch) {return 0.25 * 1.0 + (0.10 * getMasteryTier(ch, FormID::Lycanthrope));}},
            }
        },
#

other forms are simpler, like

real heath
#

yo guys

#

i wanna make my own DMA ( Direct Memory Access ) cheats for a game and do you think you could help me with that?

barren torrent
#

well actually none of them are as simple anymore I guess

#

the def is supposed to be {stat_family, modifier, mask, std::function which might be empty}

#

but my associate basically turned all the bonuses into dynamic calculations using the function pointers 😐

#

ayiyi

normal silo
#

But you can make it shorter.

#

Since this is C++ you can use X-macros, or you can just do something similar to a TOML file (easy for a human to edit, and concise (easy to parse too)).

#

As a side note, these could probably use an order of operations sorting value for each.

#

You could also setup some Python scripts to make use of a spreadsheet.

barren torrent
#

hrn.

frank fieldBOT
#

5. Do not provide or request help on projects that may violate terms of service, or that may be deemed inappropriate, malicious, or illegal.

robust egret
#

what do you call a game that mostly depends on exterenal files (e.g json files) to make updates

pine plinth
#

text editor

errant oxide
barren torrent
#

hmmm

#

Damn I've got a lot of thinking going on right now

errant oxide
obtuse osprey
#

hello and this is my first time in this channel
i guess i got complicated and deep enough to belong here!
https://github.com/GDOlivercoding/ABE-cli
^ here i am making a cli "copy" of angry birds epic (deprecated project by rovio, later sold) for fun and stuff
here ive gotten to a point where i dont know how to store the abilities of my lets say units
they are too unique for flags, and there is gonna be like a 100 different functions if i make unique functions for each ability
also i have issues with effects as in effects.py, the order and all the events in which everything is executed

GitHub

my agry birds epic cli game. Contribute to GDOlivercoding/ABE-cli development by creating an account on GitHub.

silk kettle
obtuse osprey
#

none

#

everything is me

silk kettle
#

okay

#

well make a dictionary

frigid basalt
#

Anyone know NASM here?

silk kettle
#

with the key that triggers the move

#

and then the value as a lambada statement

#

for the move

obtuse osprey
#

example

silk kettle
#
moves = {
    "how ever you hande player input here": call_action()
    }

# input loop
 lambada moves["corrosponding key"]
#

@obtuse osprey

#

or atleast thats what i would do

obtuse osprey
#

its lambda btw

silk kettle
#

sorr

#

im on phone

#

typing code

obtuse osprey
#

i dont think its that simple

silk kettle
#

well if the move is a function

#

then it is

#

just implement it into your code

#

and it should eork

obtuse osprey
#

i dont understand sorry

silk kettle
#

best to wait for somebody experienced

obtuse osprey
#

:C

#

experienced people do their own shit and dont spend time on failures like me

obtuse pivot
obtuse osprey
#

how do i learn on my own???

#

eivl is uhhh none of those

silk kettle
obtuse pivot
#

Learn what you have to learn before making a project out of your league

silk kettle
obtuse osprey
#

how do i get an answer for a very specific problem though?

silk kettle
obtuse pivot
obtuse pivot
silk kettle
obtuse osprey
silk kettle
#

and im an idiot

obtuse pivot
obtuse osprey
#

omg that fucking song out of my league

obtuse pivot
#

It's just practical advice...just compartmentalize what you need to learn.

silk kettle
obtuse pivot
obtuse pivot
silk kettle
silk kettle
obtuse osprey
#

how do i like learn something which has been already done in a way but i dont know how to get that information

obtuse pivot
silk kettle
#

but im doing it as an excersise for other things, classes, project management, apis, sockets, databases, user authentication, marketing, audience

#

its great

obtuse pivot
silk kettle
#

time is so valuable

#

wish we had more <3

obtuse pivot
#

ML is cool but you should learn - Algebra 1-2, Calculus 1-2, Linear Algebra, Statistical probability, abstract thinking, and then code.

silk kettle
#

mhm

obtuse pivot
obtuse osprey
silk kettle
#

mind if i add you? @obtuse pivot

obtuse osprey
obtuse pivot
obtuse osprey
#

im just using cli with rich

obtuse pivot
obtuse osprey
silk kettle
obtuse pivot
silk kettle
obtuse pivot
obtuse pivot
#

Although I am curious @obtuse osprey Why don't you use libraries? just to sharpen your skill?

silk kettle
#

so do all .net languages

obtuse pivot
obtuse osprey
silk kettle
obtuse osprey
#

also wheres the fun in that

#

and the skill improvement as well

obtuse pivot
obtuse pivot
obtuse osprey
#

omg the emojis

#

im fucking dying

#

stop lol

silk kettle
#

because i broke boy!

obtuse osprey
#

i use vsc

silk kettle
#

are you python main?

obtuse osprey
#

yes

silk kettle
#

please use pycharm or atleast try it 😭

obtuse osprey
#

why?

obtuse pivot
obtuse osprey
#

almost a year now

#

since feb of 2024

#

@obtuse pivot

obtuse pivot
#

Oh nice broo. What are you aiming to do using computer science? Game dev, software engineer, machine learning?

obtuse osprey
#

i dont know

#

yet

#

i guess

#

something that gets my family out of minimum wage hell

obtuse pivot
#

Haha I understand that. I do believe that the more you enjoy it and it's not just as means to an end, the more lucrative you become. I'm sure you enjoy it, else you wouldn't be doing things the long way.

obtuse osprey
obtuse pivot
#

That statement sounds a bit supersillious. Though if you want something harder...there's..C++ awaiting you.

limber veldt
#

I've been watching some basic c++ vids lately just to see how, quite interesting, the speed ups are probably worth it for some of my games

obtuse pivot
limber veldt
#

I'm 6-7 years into pygame, so it is kind of the next logical step

obtuse pivot
#

Oh wow nice. I agree with you...or godot

limber veldt
#

I could always learn more python though, that's always

obtuse pivot
#

Godot is amazing. I love it . But it's niche

obtuse pivot
#

I am intermediate in pygame, I was a pygame developer for a bit then went to godot for a while then moved back to pygame to learn more programming concepts. And now I feel confident in my pygame abilities.

limber veldt
#

I have checked out some godot and even used it a little bit and while it's cool and all, it just doesn't feel the same to me

obtuse pivot
#

I definitely understand. It takes care of most of the work for you. Though their state machine is just unbeatable.

#

I do love pygame though, it does take a lot of libraries to do higher quality stuff though. Like pymunk for physics, pyglet, etc.

#

I just found out about something called "erusna engine" or something like that

limber veldt
#

Ursina maybe?

obtuse pivot
limber veldt
#

Yeah, that's another framework too, I've pretty much stuck to pygame

#

pygame-ce these days, get_frect() and get_just_pressed() are just too good to not have

obtuse pivot
#

I like get frect because it does allow for floats. Though I still have a habit of using rects, I will make the switch forever to frect s. And get pressed so I don't have to do pygame.mousebutton down for everything.

#

Have you tried making 3D games using open GL?

limber veldt
#

Not yet, though it is on my todo list

#

Even to implement some basic 3d elements into 2d games, sounds interesting

obtuse pivot
#

I haven't tried it either. I'd like to make a voxellizer to voxelize my 2D assets...soo we can fake 3D.

limber veldt
#

Sounds fun and complicated

#

But some kind of chunk rendering?

obtuse pivot
#

Yea, I'll Gladly download a plugin if someone had it like they do for godot. 😂

Yes, definitely chunk rendering..maybe understanding how to have the computer section out a photo into a grid that can be voxellized. So you can increase the subdivision for a higher quality voxel

#

Something lke that...

#

Definitely complex...I'm not skilled...are you working on any big projects currently??

limber veldt
#

My latest is refactoring a 400+ room-based game into scrolling levels

#

So like room-based being player moves to right side of screen and the next room appears with player on left side of screen. All rooms linked together in the same way, with up rooms, down rooms, etc, so the map is all one room after another, all logically linked

#

Scrolling will place the player in center of screen and scroll the entire level, with some sub levels since some map layouts cannot be laid out in a single 2d map

#

It'll be a lot of work but most of the sprites (logic gates and things like that) won't need many changes

#

And it has many levels, to refactor into scrolling, like 14 of them or so

#

It's my biggest game so far, many thousands of lines, mostly data, which is another thing I want to refactor in the process, using Tiled (a 2d map editor)

#

And just generate the csv files for map layouts

obtuse pivot
#

Oh wow that is extensive. I'd love to see the project if you do complete it, it sounds really unique. And 2,000+ lines of code is more than commendable. My biggest game has probably been 200+ lines and I thought that was a lot lol

#

How long have you been working on it so far?

limber veldt
#

Including all the data, the project is at about 30k lines, and it's been an off and on project for a year and a half or so, just getting to where it is

#

It's really simple graphic-wise, but it is a full locic gate and circuit similator wrapped in a game

obtuse pivot
#

I can see why. It's a complex system to do alone.

obtuse pivot
limber veldt
#

Really fun and educational game from the mid-80s, Robot Odyssey from The Learning Company

#

So it's a remake in modern python

#

Logic gates and robots wired with them to solve maze-like puzzles, open doors, things like that

#

The robots have thrusters and bumpers on each side with inputs and outputs inside them, to be connected to circuits

radiant storm
#

can someone help me please?

limber veldt
radiant storm
#

in cmd i installed it

limber veldt
#

Ok, so what happens when you run your file?

radiant storm
#

this

limber veldt
radiant storm
limber veldt
#

See the arrow in the top-right of that screenshot? Click it

#

For 'Run python file'

radiant storm
#

yes

limber veldt
#

Ok, so what happens when you run it?

radiant storm
limber veldt
#

Ok, so it looks like you have multiple python versions installed. Your pygame is in python 3.13 but your vscode is currently set to use 3.11.9

radiant storm
#

oh

limber veldt
#

Lower-right corner of VsCode, where it says 3.11.9 (Microsoft Store) click that and you should see at the top, all version of python you can select to use in VsCode, see if 3.13 is available there, if so, select it

radiant storm
#

thank you

#

it works

limber veldt
#

If so, try running your file again and check for that error

#

Great!

radiant storm
#

it works thank you

limber veldt
#

No problem

radiant storm
#

have a nice day

limber veldt
#

You too

radiant storm
#

does anyone know what is wrong?

limber veldt
#

Try indenting your line 18 so it aligns with the while statement above

radiant storm
#

ok

limber veldt
#

Also, you'll probably want to update your display in the while loop

radiant storm
#

not working

limber veldt
#

I didn't say add a while to the line, only indent it

radiant storm
#

oh

#

how can i do it?

limber veldt
#

How did you indent the other lines?

radiant storm
#

i found it on you tube

#

it worked to him

#

it is in some course

limber veldt
#

Like you have indented lines in your code but don't know how to indent? Did you copy and paste your code from somewhere?

radiant storm
#

mostly yes

#

i want to create a loop

#

to show the game

limber veldt
#

So you have a lot to learn, usually just pressing tab indents a line one time

radiant storm
#

i know its wrong

#

i want to create a game in python

#

i dont know where to start

limber veldt
#

I recommend watching some beginner pygame tutorials, that will probably be more effective than walking through every step here in discord. Like I can show you how to create the game loop but I think a video would teach you better

radiant storm
#

ok i will start with it

#

thank you

limber veldt
#

And if you're also new to python itself, I do recommend some time learning the basics of that before starting on pygame

radiant storm
#

ok

#

i will try

gritty axle
# radiant storm i will try

try learning about data structures, loops, ways to utilise, read, write data in dicts, list, and such first
i would recommend waiting untill u get to learn about classes before u go with pygame

if u want, try to make games focused with terminal instead of graphics

limber veldt
#

Sound advice^

dawn cipher
untold pier
#

Hi guys!
Do i need to have unity to design the game or I can do that in python?

untold pier
#

3D?

fleet grove
#

Yes

#

Try Panda3D or Ursina

untold pier
#

Thanks

errant oxide
dawn quiver
#

I'd make scrabble, chess, checkers, mancala, hangman.

#

Alot can be done with python and no modules

errant oxide
errant oxide
#

also for the adventure game tingy i showed like a few days ago i think, well i updated it and uhm, thats some long line of code

#

you dont need to see anything, its just a showcase how long the code is

#

ok, ill stop yapping

limber veldt
#

It's always fun to look at the minimap or line numbers and appreciate how far a project has come along

#

Or even how far your ability to code it has come along

#

So satisfying when it all works and it's been a struggle

#

I do it all the time in this channel, share my excitement or even just talk about my projects, it helps to have some place to bounce thoughts, at least for me

dawn quiver
#

No minimap for vim unless maybe you have sixel

limber veldt
#

It's not totally necessary but kinda nice to have it

#

I think at some point, a single file gets too long and I start moving extra classes in it to other files

hasty nacelle
#

it should load everything quicker hopefully

manic totem
balmy mulch
#

i want to make a simple 3 dimensional first person game using python, what module/game engine do you guys suggest I use?

radiant storm
#

YouTube or some course?

gritty axle
#

one thing tho, dont try to overshoot because of ur interest, learn things simple, one by one

radiant storm
#

Ok thank you

agile cargo
#

hey guys i am not new to python but i am for pygame, any pointers?

dawn quiver
#

@gritty axle do you mind if I dm you?

gritty axle
gritty axle
#

Well coding again atleast

errant oxide
#

guys i finally fixed the inventory for my adventure game code :DDDDD

#

now i just need to add more maps, and bosses to truly make the game better, i might also add a stats menu tho

balmy mulch
fluid grail
#

somebody plz make this code better

print("press 'ENTER' for cookies")
count = 1

def clicker() :
global count
end = False
while not end :
_input = input("[+1 cookes!] ")
if _input == "" or _input == " " :
count += 1
elif _input == "show" :
print("['YOU HAVE " + str(count) + " COOKIES']")
elif _input == "end" or _input == "stop" :
print("GAME OVER WITH " + str(count) + " COOKIES")
end = True
clicker()

is like..., a cookie clicker, but made in like 5 mins

#

and is using enter

glass light
#

Been working on some ballistas for my game and an off-by-one error meant that the ballistas were firing ballistas lol

pine smelt
#

anyone have any resources for linear algebra

modern flint
outer quail
#

Hey, i need some help to program a simple game for my school project, hmu if you can help.

balmy mulch
#

Ignoring how much more/less effort it'll take I just want to ask, is it possible to make an rpgmaker level game on pygame?

pine smelt
#

if it's jist an rpg game definitelu

balmy mulch
#

should I be worried about how efficient my code is for complex rpg games?

pine smelt
#

it shouldn't be too big of a deal, prioritise quality and visual content over hyperoptimising every function imo

#

at a certain point u will come to fps issues undoubtedly but it's not a big worry

supple lantern
#

Recently learned of python binding for raylib. Any reason to use this over pygame for 2d games? I might just try it out anyway, but I am wondering when you would prefer one over the other.

https://pypi.org/project/raylib/

gritty forge
#

Can I do 3d games by python ?

fleet grove
#

Yes

vernal ginkgo
errant oxide
#

guys, is it ok if i share the entire updated code of my adventure game?

glass light
cosmic olive
wraith wren
#

Can anyone help me make a minecraft game?

celest osprey
#

hey guys i have a question
whats better pygame ce or normal pygame
why?
im asking bc i am making a few games

pine smelt
#

pygame-ce

#

its more readily updated and (its in the name but) supported by the community more

#

its pretty much the same as base pygame usage wise but has more stuff and optimised - i.e. entirely better

bold hill
#

I'm having a problem with a fill command what can i use to have it run?

#
geass_green = (63,155,11)
screen.fill('geass_green')
bold hill
#

fixed it

rich hill
#

Help me create a card games

bold hill
rich hill
#

Solitaire

bold hill
rich hill
#

I do not unfortunately

bold hill
gritty axle
#

i was making my first util class and i think i made my greatest block of code upto date

rich hill
bold hill
#

How do I make an monster AI @e player tracking exetera?

pine smelt
#

the simplest way is getting the vector between the monster to the ai, normalising it, and make the monster move along it at some speed

empty hazel
#

Hey guys, not sure if this is the right channel. I have two global TkInter variables, gridWin and gridCanvas, both of which get set. However When I try to call either of them, I get an error saying they are NoneType.

gridWin = None
gridCanvas = None

def CreateGridWin():
    print("Create Grid Win")
    gridWin = tkinter.Tk()

    gridWin.configure(bg='red')

    gridWin.attributes('-fullscreen', True)
    gridWin.attributes('-transparentcolor', 'red')

    gridWin.bind('<Escape>', lambda e: gridWin.destroy())

    gridWin.focus_force()

def CreateGridCanvas():
    gridWidth = gridWin.window_width()
    gridHeight = gridWin.winfo_height()

    gridCanvas = tkinter.Canvas(gridWin, width=gridWidth, height=gridHeight, bg="red")

def DrawGrid():
    CreateGridWin()
    CreateGridCanvas()
#

I am getting error at the declaration of gridWidth

#

NoneType object has no attribute 'winfo_width()'

#

(I have a typo in the code I posted, lol, but that isn't the issue)

#

Could it be some kind of thread problem? DrawGrid gets called through
keyboard.add_hotkey('alt+a', DrawGrid)

muted sand
empty hazel
#

window would be much more readable, but that's tk for ya

muted sand
#

Well I was wondering because the line above does say window

#

window_width()

#

Oh, it's because gridWin is a local variable inside the CreateGridWin function. It isn't defined in the scope of CreateGridCanvas. You can create it outside of a function, make it global with the global keyword, or pass the object as an argument into the function

#

Oh you defined it above

#

It must not be changing for some reason

#

Are you calling the CreateGridCanvas function alone? That would cause the error

empty hazel
#

Hmm so I used global and it worked. Kind of really weird.

muted sand
#

It might only change it within the scope of the CreateGridWin function

#

I don't use global variables often because they can become confusing like that

muted sand
#

I don't have tkinter so I haven't tested it but you get the idea

empty hazel
#

aaah, looks way better than my code 😄 thanks man

bold hill
rich hill
#

Hey

bold hill
#

yes?

pine smelt
# bold hill So ```py Class Monster(player.pos.x,(player.pos.y): Speed = 1 player_tracking...

no more like

player = Player() #whatever ur player class is with its own position too
monster = Monster() # whatever ur monster class is, that has a self.pos attribute

... #ur other code

#inside the monster moving code
vec = pygame.math.Vector2()
displacement = (vec(player.pos) - vec(monster.pos)).normalize()
monster_speed = 2
monster.pos += displacement * monster_speed
bold hill
#

thank you

rich hill
#

Can u give me an example of a simple pong game

bold hill
pine smelt
#

right click the file and press rename

cedar frost
#

yes, but do not rewrite the file format

bold hill
#

Thank you

crystal totem
#

Hello, can anyone help me with a code I've made with the pygame library?

vagrant saddle
crystal totem
vagrant saddle
#

ho my bad, on pygame-ce discord you can drop zips

crystal totem
#

DM?

vagrant saddle
#

no need i think you just need to refactor your code a bit

crystal totem
#

Okay

manic totem
#

the music suppose to play in menu screengame_start == False) but it didnt and it play when i start the actual game(game_start == True) instead

#

oh btw you can ignore the other pygame.mixer.music.load on the below

potent grotto
#

Oh henlo guys can anyone tell me about pygames how to use it

vagrant saddle
sinful field
#

hey i have a modernGL project from a tuto on youtube and it supports 1 light only and i dont know how add the suport for a modular amount of light. if anybody has ever done this or if they know the programming language used for the shaders, i would greatly apreciate some help. Thank you !! https://github.com/StanislavPetrovV/3D-Graphics-Engine/tree/main

GitHub

OpenGL Graphics Engine in Python ( Pygame, ModernGL ) - GitHub - StanislavPetrovV/3D-Graphics-Engine: OpenGL Graphics Engine in Python ( Pygame, ModernGL )

muted sand
# rich hill Can u give me an example of a simple pong game

Here you go! https://paste.pythondiscord.com/CJ6Q

I spent about a day on this. It doesn't use any assets, so as long as you have Python and PyGame, you can copy and paste the code and run it.

The code is pretty self-explanatory, but here's some important info:
The game will be in fullscreen if the attribute self.fullscreen within the Config class is set to True. Otherwise, it uses the integers within self.screen_size.
The controls for player 1 (on the right) are the up and down arrow keys by default. This can be changed within the attribute self.p1_contols in the Config class.
Player 2 (on the left) can be either an AI or a second player, using W and S as controls. You can toggle between AI and 2p by setting the self.twop attribute within the Config class.
The game will work on any window size because the position of objects is based on the window size.

If you want to, you can download some sounds, then load them and play them whenever there's a collision. Hope this helps!

rich hill
#

Thanks man

#

Ill try it

spice ingot
#

whats the best pygame/pygame-ce course on youtube

pine smelt
#

clear code's probably

pine smelt
#

perhaps a new project may be to make a GUI for all of that?

spice ingot
pine smelt
#

In this tutorial you will learn to create a runner game in Python with Pygame. The game itself isn't the goal of the video. Instead, I will use the game to go through every crucial aspect of Pygame that you need to know to get started. By the end of the video, you should know all the basics to start basically any 2D game, starting from Pong and ...

▶ Play video
#

thats the one most people talk about

spice ingot
#

looks fun

#

any other tutrials?

#

or just this

pine smelt
#

I'm sure most tutorials on YouTube are good

#

notable ones I tended to follow are clear code and dafluffypotato, but thr latter is pretty advanced

spice ingot
#

maybe becuase his games look so fun

wraith wren
#

i got this problem the 3rd time, can anyone help please?

pine smelt
#

lines after if, elif and else need to be indented

pure jay
fluid plank
#

I'm considering intersections between game engines and physics.
Thought's?

pine plinth
#

you have to know a lot of math

radiant storm
#

Does anyone have a list of all the code in pygame?

pine smelt
outer tundra
#

Hi. Who uses pyglet?

blissful furnace
fluid plank
fluid plank
blissful furnace
blissful furnace
#

The ideal situation would be that you have a good grasp of maths and can just read some research papers and fiddle your way round to a viable application.
If you are not quite there, then you can find articles/videos which will help outline what you need

#

Sebastian Lague has a couple of good videos on it

fluid plank
dull sequoia
#

What exactly can I use python for in game development?

vagrant saddle
raven kernel
#

TIL raylib has GPU acceleration

#

it looks like its only post processing?

#

pyglet allows shaders + its regular usage together, in a non post processing way afaik

#

which is very cool

vagrant saddle
#

arcade is pyglet based

raven kernel
#

oh, yes

#

i forgot about that

radiant storm
#

What is the best way to memoryze all the codes in pygame?

pine smelt
#

code as much as possible in pygame

limber veldt
#

Memorizing all code in pygame would be a lofty goal, nobody really does this. Take a look at some of the most important modules like pygame.sprite, pygame.display, pygame.Surface some of how to use the event queue and a few others (like pygame.math and so on as you go). The docs are always there for reference when you need them

worthy moth
#

So are there some other cool alternatives to pygame?

vagrant saddle
radiant storm
#

how can i add some images into my folder in my project?

potent grotto
worthy moth
vagrant saddle
#

pygame-ce is the thing to use

raven kernel
radiant storm
#

why does it keep telling me this

#

i have that file in data

#

code is here

pine smelt
#

should be "Platformer/data/images..." from the looks of it

radiant storm
dawn quiver
#

hey hey guys

#

I am also trying out pygame to make some stuff

#

I am new to this but i am giving it a shot

#

Also does anyone use thumby as well?

candid blaze
#

We have been developing a top-down strategy game. We built the engine, and the entire game and engine are in Python cause why not? Lmao! We also utilize cython and GLSL.

Our discord is on our website: https://terra-tactica.com

bold hill
#

Is there finding out specific coordinates I want a specific interior line of a circle

wind oyster
#

Does anyone know how to make 2D 8 directions movement?
Right now I can only make 4 directions (up, down, left, right) with the usual If Key_Up -y, if Key_Down +y

raven kernel
#

you'd want to have the same logic as 4 directional movement, but allow for simultaneous key presses, and also normalize the vector when its moving in the diagonal direction

wind oyster
bold hill
#

What do I mean to use for a circular player instead of a square player object

muted sand
bold hill
#

No I want to make a circular player it's for a game it's a point collision or point click to put the piece on the board

bold hill
manic totem
#

Can someone here explain to me how pygame.mixer.music work

#

Because when i use it, its doesn't work like i hope to

#

Like, it play the file but it doesn't play it in when i want to

pine smelt
#

assuming u have multiple sounds or music, I'd look into "pygame mixer channels" over anything

#

the .music.play stuff is quite restrictive

manic totem
#

i try to look for example in github for better understand how mixer channels work and what i got is just this

manic totem
pine smelt
#

are you using .play every frame?

#

cuz it sounds like the audio keeps getting reset far too quickly

#

im not exactly sure what ur code is but from what i can see, perhaps try

#
if not background_channel.get_busy():
    background_channel.set_vol(0.2)
    background_channel.play(background_music)
manic totem
#

wdym by using .play every frame? this is my the second time using .play

pine smelt
#

when u did background_channel.play

#

is that in the main update loop

manic totem
#

yes that is the main update loop and i did background_channel at the above

manic totem
#

does this have anything to do with using .play inside a class

fallen jungle
#

hi

#

I'm trying to make face tracking for VRChat, but it is not working. Can someone help

pine smelt
#

r u using mediapipe for the face tracking

pine smelt
robust egret
#

and "not working" won't get you any help, be clear about the issue, attempted solution, examples/samples

bold hill
#

How do I rotate a pygame draw.rect?

turbid needle
bold hill
turbid needle
#

do you use rect for collision?

bold hill
turbid needle
#

why not surface?

bold hill
#

I'm trying to make lines going from the center to the corresponding circle across

turbid needle
#

do mean rotate the cirlce?

bold hill
#

No rotate the squares or the bars in this case from the center to another point both on the vertical, diagonal, horizontal line

turbid needle
#

can you draw it because i didnt understand what are you trying to do?

#

my englisg is bad

bold hill
turbid needle
#

like go from center to his pos?

#

i mean rotate lines from center to circle pos?

bold hill
#

Yes

turbid needle
#

you can do it by pygame.draw.line

#

and use sin and cos

#

pygame.draw.line(your_surface,your color,(center.x,center.y),(center.x+cos(angle)*line_wdith,center.y +sin(angle) *line_wdith))

#

@bold hill sin and cos in python mathtake radiant so you need every frame add the angle += math.radians(1)

turbid needle
# bold hill

to rotate
try one and do every one to his angle
like here the red angle degree is 180 and balck is 120 i think and.....

bold hill
#

What do I need for rotation I don't mind changing it shape I just need to rotate

#

Thank you

turbid needle
tender wyvern
#

i wanna do 3d stuff with python like 3d graphics and maybe even games can someone recommend great frameworks ?

pine smelt
#

pyglet or ursina probably

turbid needle
#

don't use pygame for this
is hard 😔

#

you can use opengl
is not easy but great

tender wyvern
#

i thought pyglet is more like pygame 2d ? (im a total beginner here )

turbid needle
#

use ursina then

pine smelt
#

i dont see why 3d isnt possible with it

tender wyvern
#

yea was thinking about it but cant decide if ursina or panda3d ^^

bold hill
tender wyvern
#

true

bold hill
#

Also for growing a line for its coordinates it start coordinates does it have to be a tuple?

pine smelt
#

could be a vector as well

#

or a list

turbid needle
#

i think
not every tuple

tender wyvern
#

im gonna try pyglet now .. 😄

turbid needle
#

@bold hill take look about this code
import pygame
from math import sin,cos,radians
pygame.init()
screen = pygame.display.set_mode((400,400))
angle = 0
width = 20
center_pos = [100,100]
while True:
screen.fill(0)
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit(); raise SystemExit
pygame.draw.line(screen,(255,255,255),(center_pos[0],center_pos[1]),(center_pos[0]+cos(radians(angle))*width,center_pos[1]+sin(radians(angle))*width))
angle += 1
pygame.display.flip()
pygame.time.delay(10)

#
import pygame
from math import sin,cos,radians
pygame.init()
screen = pygame.display.set_mode((400,400))
angle = 0 
width = 20
center_pos = [100,100]
while True:
    screen.fill(0)
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit(); raise SystemExit
    pygame.draw.line(screen,(255,255,255),(center_pos[0],center_pos[1]),(center_pos[0]+cos(radians(angle))*width,center_pos[1]+sin(radians(angle))*width))
    angle += 1
    pygame.display.flip()
    pygame.time.delay(10)
#

sorry

#

see this is what you are talking about?

bold hill
#
#===#[import]#===#
import pygame
#===#========#===#

#===#[inits]#===#
pygame.init()
#===#=======#===#


#===#[color bank]#===#
sand_stone_color = (245,235,216)

rota_wheel = (218,134,32)
rota_peice_slot = (187,134,11)

player_red = (255,0,0)
player_blue = (0,0,255)
#===#=============#===#

#===#[game screen]#===#
screen_width = 800
screen_heigh = 800

#
screen = pygame.display.set_mode((screen_width,screen_heigh))

game_running = True

while game_running:
    screen.fill(sand_stone_color)

    #===#[player]#===#
    player_peices = 3

    # click based token placement 

    #===#[board]#===#
    pygame.draw.circle(screen,rota_peice_slot,(400,400),349,width=59)
    

    #===#[slots]#==#

    #===#[exterior slot]#===#

    # center ring
    pygame.draw.circle(screen,rota_peice_slot,(400,400),100)
    
    #top ring
    pygame.draw.circle(screen,rota_peice_slot,(400,100),100)

    # left top ring
    pygame.draw.circle(screen,rota_peice_slot,(200,200),100)

    # left middle ring
    pygame.draw.circle(screen,rota_peice_slot,(100,400),100)
    
    # left bottom ring
    pygame.draw.circle(screen,rota_peice_slot,(200,600),100)

    # right top ring
    pygame.draw.circle(screen,rota_peice_slot,(600,200),100)
#
# right middle ring
    pygame.draw.circle(screen,rota_peice_slot,(700,400),100)

    #right bottem ring
    pygame.draw.circle(screen,rota_peice_slot,(600,600),100)

    # bottom ring
    pygame.draw.circle(screen,rota_peice_slot,(400,700),100)
    #===#===============#===#

    #===#[line to image]#===#
    pygame.draw.line(screen,rota_peice_slot,(200,200),(600,600),width=59)

    pygame.draw.line(screen,rota_peice_slot,(600,200),(200,600),width=59)

    pygame.draw.line(screen,rota_peice_slot,(100,400),(700,400),width=59)

    pygame.draw.line(screen,rota_peice_slot,(400,700),(400,100),width=59)
    #===#==============#===#

    #===#[inerior slot]#===#

    # center center ring
    pygame.draw.circle(screen,sand_stone_color,(400,400),70)

    # top top ring
    pygame.draw.circle(screen,sand_stone_color,(400,100),70)

    # top left center ring
    pygame.draw.circle(screen,sand_stone_color,(200,200),70)

     # left middle ring
    pygame.draw.circle(screen,sand_stone_color,(100,400),70)

    # bottem left center ring
    pygame.draw.circle(screen,sand_stone_color,(200,600),70)

    # top right center ring
    pygame.draw.circle(screen,sand_stone_color,(600,200),70)


    # right middle ring
    pygame.draw.circle(screen,sand_stone_color,(700,400),70)


    # right bottem center ring
    pygame.draw.circle(screen,sand_stone_color,(600,600),70)

    # bottom ring
    pygame.draw.circle(screen,sand_stone_color,(400,700),70)
    #===#==============#===#

    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            game_running = False

    pygame.display.update()
pygame.quit()        
#===#=============#===#
turbid needle
#

do you mean it's work?

bold hill
#
#===#[line to image]#===#
    pygame.draw.line(screen,rota_peice_slot,(200,200),(600,600),width=59)

    pygame.draw.line(screen,rota_peice_slot,(600,200),(200,600),width=59)

    pygame.draw.line(screen,rota_peice_slot,(100,400),(700,400),width=59)

    pygame.draw.line(screen,rota_peice_slot,(400,700),(400,100),width=59)
bold hill
#

I got after a lot of cross referencing each coordinate I got the line to work perfectly

#

It's a surprise to me

turbid needle
bold hill
#

Sorry

turbid needle
#

about what?

bold hill
#

For not being clear

bold hill
#

How can I make things clickable?

cosmic olive
#

!paste

frank fieldBOT
#
Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

cosmic olive
bold hill
bold hill
manic totem
spice ingot
#

any idea where i can download a pygame-ce pdf guide?

#

or does it come with a built in help system

raven kernel
#

or pydoc pygame.<function name>

spice ingot
raven kernel
mental wave
#

can i make a game in tkinter

#

or is that dumb

fleet grove
agile cargo
#

its worse to use vpython

turbid needle
hallow matrix
#

anyone know any good game dev courses for pyglet

#

for 2d and 3d?

dawn quiver
#

hellow

hallow matrix
#

That or your mental health would be

#

You're basically reinventing the wheel

#

And it would be slow

raven kernel
pine smelt
#

r u planning on making it online

#

lan based is still rly good tho I'm surprised there's so little latency

raven kernel
pine smelt
#

oh

raven kernel
#

But not because it's LAN, I'm using TCP and there's something else out there I'm not sure what, but it is the other cause of slowing it down

pine smelt
#

I thought u were still moving it

#

right I see

raven kernel
# pine smelt r u planning on making it online

I believe making it online in this case is just changing the IP from a local one to the one of the server that is being hosted
This would require me to invest some time so probably not now (to buy and test such a server)
I'm just trying to make a 3D lan game I can play with my hostel-mates

pine smelt
#

sounds good

#

good luck

raven kernel
#

ty!

slow copper
raven kernel
#

Maybe, I'll see

slow copper
#

It's more suitable for games where low latency is required as you don't require any packet recieved / sent acknowledgement

#

But it risks of packet loss / corruption tho I think

raven kernel
#

UDP will be faster, but I think the TCP connection I have going is way slower than it should be. Once I figure out what the speed issue is, and I come to conlude it is indeed the TCP connection, I will switch to UDP

raven kernel
edgy salmon
#

very nice, how did you make that ?

pine smelt
#

is it just as smooth connecting it to another device

raven kernel
raven kernel
# edgy salmon very nice, how did you make that ?

The issue was the game was running at 5000+ FPS, and it was queueing up that many packets every second. The server couldn't keep up with processing and broadcasting those packets to everybody at the same rate, so the solution was to send a packet only every 0.01 seconds instead so that the server could process it and send it to the other clienrs fast enough.

#

But the visual FPS can still be how much ever it needs to be

raven kernel
#

Different refresh rates and screen tearing are reasons why this statement is short sighted

supple dagger
#
import random

pygame.init()

WIDTH, HEIGHT = 800, 600
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
BLUE = (0, 0, 255)

screen = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption("Catch the Falling Object")
clock = pygame.time.Clock()

paddle_width, paddle_height = 100, 20
paddle_x = (WIDTH - paddle_width) // 2
paddle_y = HEIGHT - paddle_height - 10
paddle_speed = 7

obj_width, obj_height = 30, 30
obj_x = random.randint(0, WIDTH - obj_width)
obj_y = -obj_height
obj_speed = 5

score = 0
font = pygame.font.SysFont(None, 36)

running = True
while running:
    screen.fill(WHITE)
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False

    keys = pygame.key.get_pressed()
    if keys[pygame.K_LEFT] and paddle_x > 0:
        paddle_x -= paddle_speed
    if keys[pygame.K_RIGHT] and paddle_x < WIDTH - paddle_width:
        paddle_x += paddle_speed

    ojb_y += obj_speed
    if obj_y > HEIGHT:
        obj_x = random.randint(0, WIDTH - obj_width)
        obj_y = -obj_height

    paddle_rect = pygame.Rect(paddle_x, paddle_y, paddle_width, paddle_height)
    obj_rect = pygame.Rect(obj_x, obj_y, obj_width, obj_height)

    if paddle_rect.colliderect(obj_rect):
        score += 1
        obj_x = random.randint(0, WIDTH - obj_width)
        obj_y = -obj_height

    pygame.draw.rect(screen, BLUE, paddle_rect)
    pygame.draw.rect(screen, BLACK, obj_rect)

    score_text = font.render(f"Score: {score}", True, BLACK)
    screen.blit(score_text, (10, 10))

    pygame.display.flip()
    clock.tick(60)

pygame.quit()```

Why it's not working anyone Please tell me and how I can fix it.
candid blaze
#

TERRA-TACTICA is a top-down, turn-based sandbox strategy game where your choices shape a dynamic and ever-evolving world. Build, battle, and thrive in an immersive realm where strategic depth meets creative freedom. Lead your faction to victory by managing resources, crafting powerful units, and adapting to unpredictable challenges.

The game and our engine is written entirely in Python 🙂 We are launching to Steam soon!

https://terra-tactica.com

mental tusk
#

Hi guys, Im just getting started on pygame and I've written a few easy programs like dodging the falling objects, etc. Can someone let me know the next few steps and what I should learn?

#

please ping me if you respond

rigid sun
noble rapids
raven kernel
#

the networking was written with sockets

noble rapids
#

ohr

#

i thought it was godot lmao

sturdy sandal
pine plinth
#

looks nice 👍

pine smelt
#

the gui elements are really smooth looks great

#

maybe consider elastic easing curves too

noble rapids
#

i know its sounds like a stupid question but i dont understand how people do that

#

like did you use a pls?

sinful field
#

Hey anybody knows what is the language used for modernGL shaders ?

sinful field
#

Do you know glsl well ?

#

I would like to know how i could apply the effects of multiple different lights when rendering a face / object

#

Because i can render with 1 light that is defined as a variable i give to the shader but idk how to give it a modular amount of lights

#

Can you help ?

normal silo
sinful field
#

Do you know where i could find a wiki that would help me for that ?

normal silo
sinful field
#

Does it work the same as modergl ?

normal silo
#

ModernGL is OpenGL.

sinful field
#

Idk i just follow a tuto

normal silo
#

"ModernGL is a Python wrapper over OpenGL Core. ModernGL simplifies the creation of graphics applications like scientific simulations, games or user interfaces. Usually, acquiring in-depth knowledge of OpenGL requires a steep learning curve. In contrast, ModernGL is easy to learn and use. ModernGL is capable of rendering with high performance and quality, with less code written."

sinful field
normal silo
sinful field
#

Yeah ok thx

#

I will work with that !

normal silo
normal silo
#

For an example difference between ModernGL and plain OpenGL.

sinful field
#

Oh

normal silo
sinful field
#

Yes i see

normal silo
#

The shader code part is the exact same.

sinful field
#

Thx

sturdy sandal
sturdy sandal
# noble rapids how did you learn to use python?

programming isnt "learning a language" programming is a skill that you have to practice
you need to understand the different programming patterns and different methds and algorithms, as well as how to creatively build things using the "building blocks" of programming
the things like if statements, for loops, etc.

the actual syntax of python is just up to memory, but once you understand how to program as a skill, you can program in almost all programming languages, it just takes a little bit of time to understand, what syntax correlates to what action you want to achieve

sturdy sandal
# pine smelt maybe consider elastic easing curves too

i just realised something

the way i have my animations set up right now is i just have a list of lerp values (start, end, progress) for each animation i want, and i add more when i need to

but i realised, i can easily make easing functions with this by just taking the output to the list value and applying a function to it lmao

pine smelt
#

just be careful if ur using the pygame vector's lerp func

#

iirc it doesn't accept values less than 0 or greater than 1 which messes with some easing curves

sturdy sandal
sturdy sandal
#

(i got the easing function math from online tho)

sturdy sandal
pine smelt
#

sweet

quasi canopy
#

hello guys I want to make a scale of my game in 320x180 : for exemple if I put my spirit in x = 160 he will be at the middle but it doen't work

#


VIRTUAL_WIDTH = 320
VIRTUAL_HEIGHT = 180

try:
    SCREEN_WIDTH, SCREEN_HEIGHT = arcade.get_display_size()
except OSError as e:
    print(f"Erreur système lors de la récupération de la taille de l'écran : {e}")
    SCREEN_WIDTH, SCREEN_HEIGHT = 800, 600
except Exception as e:
    print(f"Une erreur inattendue est survenue : {e}")
    SCREEN_WIDTH, SCREEN_HEIGHT = 800, 600

WINDOW_WIDTH = SCREEN_WIDTH // 2
WINDOW_HEIGHT = SCREEN_HEIGHT // 2

class Platformer(arcade.Window):
    def __init__(self):
        super().__init__(WINDOW_WIDTH, WINDOW_HEIGHT, "Platformer", resizable=True)
        self.camera = arcade.Camera(VIRTUAL_WIDTH, VIRTUAL_HEIGHT)
        self.center_window()  
        self.set_update_rate(1 / 120) 
        self.x = 0
        self.y = 100
        self.time_since_last_render = 0

    def center_window(self):
        self.set_location(
            (SCREEN_WIDTH - WINDOW_WIDTH) // 2,
            (SCREEN_HEIGHT - WINDOW_HEIGHT) // 2,
        )

    def dessiner(self):
        arcade.start_render()


        arcade.draw_rectangle_filled(self.x, self.y, 50, 50, arcade.color.RED)

    def on_resize(self, width, height):
        super().on_resize(width, height)

        self.camera.resize(width, height)

    def update(self, delta_time):
        self.x += 0 # temp
        self.time_since_last_render += delta_time
        if self.time_since_last_render >= 1 / 60:
            self.dessiner()
            self.time_since_last_render = 0  



game = Platformer()
arcade.run()

sturdy sandal
#

@rugged echo

rugged echo
#

ayy good man!

#

you can change code_length in intro() to 5 or 6 for a challenge if you want haha

sturdy sandal
rugged echo
sturdy sandal
split mortar
#

Hey guys, my name is Felix and I’m learning game development
I’m making a simple connect 4 game using a matrix and am getting an error for this
It’s probably a super simple fix and I’m just missing it but I’m very new to this
Any ideas?

split mortar
pine smelt
#
    if is_valid_position(...
      ):
      print_board(board)
#

by the way why are u using a matrix for connect 4

#

wouldnt a nested array be enough

turbid needle
#

idk what is called

pine smelt
#

indent

split mortar
split mortar
#

Here is an example of the game
Very very basic and it doesn’t have a win screen or announcement or anything but it’ll stop you from Putin too many pieces in one column etc

split mortar
wheat gulch
#

this is killing me

how do i get polygons from an image and then draw them in pygame

i literally cant find it anywhere

pine smelt
#

what do you mean get polygons

wheat gulch
#

sadly i cant use cv 2 because it uses a diffrent type of coordinates

wheat gulch
#

i cant rlly explain it too we

#

*well

#

ok so i have this world map and i want to make the countries into different polygons

pine smelt
#

not too sure what you mean can you like draw it