#game-development

1 messages · Page 6 of 1

pallid patio
#

yeah exactly

#

I might make it myself someday, though likely I'd try it out in cpp if can be

dawn quiver
#

well

#

yeah you could

pallid patio
#

I've done some 3d stuff with it but I'm well out of my depth to make my own thing there

dawn quiver
#

youd want to use opengl not vulkan

pallid patio
#

yeah most likely

dawn quiver
#

Thing im stuggling with is idk what game i want to make. I want to get enough skill so that i can work on another persons project.

#

Alot of them want people who can use unity and C#

#

which is fine but i personally like C

pallid patio
#

you shouldn't worry about the language too much imo, not at first. since you're still experimenting with the ideas it's best to stick to what's comfortable

#

the problem with C is seg faults but yeah I'm also a sucker for it lol

rain hinge
#

Is pygame good

tranquil girder
rain hinge
#

Any tutorials for pygame

eternal vessel
#

has good tutorials

rain hinge
eternal vessel
rain hinge
eternal vessel
#

youtube video

rain hinge
dawn quiver
#

does pygame support python 3.11.1 ?

vagrant saddle
dawn quiver
#

Interesting. My laptop throws an error that it cannot generate metadata when installing pygame

vagrant saddle
#

you should open an issue detailing what os etc ...

toxic sail
#

hello guys im new to python and i need some help

#

using this space invaders game from github im trying to make some changes i ve been trying for hours now but i cant make it work although i guess there is a simple solution

#

im trying to give each enemy invader a diffrent random speed between the values 1 and 3

#

can anybody maybe help me how to do it?

broken citrus
#

is there some sort of fork of pygame

toxic sail
#

its in turtle

#

something like that

wicked grotto
#

Do all online games store player data in memory? Or can it be stored in packets over the network as well?

scenic dome
#

I would like some forum/voice chat/etc to have an in-depth back and forth game dev conversation. For example:
Alice: "all the guns are just spray and prey or snipers, but I want to make a gun with a third mechanic"
Bob: "Maybe a gun where the bullets are 'magnetic' and curve toward metal, so you can shoot around corners?"
Alice: "How is this different than a heat-seeking missle?"
Bob: "It doesn't seek people down, since their carbon armor isn't 'metal'. But a skilled marksman can give the illusion of a homing bullet as it curves around and hits them".
Alice: "Should we have a static environment or have a way to add/remove metal?"
Bob: "Mostly static, because it's a tricky mechanic and if things are too arbitrary it would be too much chaos. But allow a few dynamic things such as bombs destroying doorframes and the occasional metal crate".

This is a form of human interaction that is hard to get online. Hard but not impossible. But Python isn't the best place to discuss since this isn't really a Python-specific issue?

dawn quiver
#

the boss could steal one of your items.

#

the boss could steal your abilities

#

could teleport to different places changing the enviorment

#

like in the tundra a very cold place you occasionally freeze for a turn or two

#

but if you have a fire sword you are protected

coarse field
#

im having problems rendering textured quads

#

lemmie get code and put it into hastebin

#

@dawn quiver

#

scroll to the bottom

#

like all the way to the bottom

#

and you should see it

#

the camera isnt the problem

#

ive tried enabling GL_TEXTURE_2D and it still didnt work

dawn quiver
#

this looks like legacy opengl code

coarse field
#

it kinda is

#

is there a way to make it not render quads like that

dawn quiver
#

like what?

coarse field
#

or was i using the wrong vertex function

#

with textures

#

textured quads

coarse field
#

i dont want it rendering like that

dawn quiver
#

I can't say for sure

#

the best guess i have is that there is something wrong with the image format translation

coarse field
#

its a png, in RGB encoding

#

it renders as a solid color/ weird glitchy stuff

dawn quiver
#

yeah sorry idk

coarse field
#

oh

#

:L

dawn quiver
#

@coarse field ^^^

timid raft
vague wind
#

I'm having trouble in Pygame, wanted to know how I would index over my display surface to apply 1 tile over the whole screen?

#

`import pygame
from sys import exit
pygame.init()
screen = pygame.display.set_mode((800,400))
pygame.display.set_caption('Runner')
clock = pygame.time.Clock()

sky_surface = pygame.image.load('graphics/bg.png')

while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
exit()

screen.blit(sky_surface,(0,0))

pygame.display.update()
clock.tick(60)`

`

elder needle
#

How's pygame for simple 3d

vague wind
#

it can do wolfenstein and doom types

#

early wolfenstein and doom

#

beyond that I have no idea

restive wolf
#

idk if this is the right channel but, i am new to coding so i am still learning it. i made this little guessing game but why does it not work?

#

@spice mauve

spice mauve
#

hello, please don't ping random people for help

restive wolf
#

okay sorry

spice mauve
#

be patient, and someone may be able to help you in time

eternal vessel
# restive wolf

You need to indent the code, inside of the if statement on line 102/103 and 105

restive wolf
#

what does that mean?

eternal vessel
#

You know how on the if statement on the bottom you have a little space where it says print("YOU LOSE!") you need to add that space on those lines

#

so you can just press TAB on the lines (102/103/105)

restive wolf
#

oh wait

#

i see it now

#

ty it works now

eternal vessel
#

👍

steel elbow
#

hello i need some help with the 'zipfile' module, i am trying to make an osu! clone and to do so i need to extract a '.osu' file from a ".osz" file, the '.osz' file is just a renamed zip file so im trying to find a way to both extract the '.osz' file and then use a tk filedialogue to go into the path of the extracted folder and let the user pick which '.osu' files to pick

#

heres the code im using now

#

`root = tk.Tk()
root.withdraw()
osz_file = filedialog.askopenfilename(filetypes=[('osz files', '*.osz')])

zip_file = zipfile.ZipFile(osz_file, 'r')

osu_file = zip_file.extract('my_beatmap.osu')

zip_file.close()

with open('my_beatmap.osu', 'r') as f:

data = f.read()`
buoyant vessel
dawn quiver
dawn quiver
half sphinx
#

looks nice

coarse field
#

it is, its a mc remake (1.8 but you have to put the textures in it yourself)

#

going great so far

#

i can never do delta time adjustment tho smh

lilac pivot
#

Any opinions on game engines in python that render 3D virtual objects on a live video (augmented reality). Was planning on looking into opengl and opencv

steady charm
#

You need photoshop for textures right ?

hollow shuttle
#

hey is it possible to only load a certain part of an image with pygame?

dawn quiver
#

Draws a source Surface onto this Surface. The draw can be positioned with the dest argument. The dest argument can either be a pair of coordinates representing the position of the upper left corner of the blit or a Rect, where the upper left corner of the rectangle will be used as the position for the blit. The size of the destination rectangle does not effect the blit.

An optional area rectangle can be passed as well. This represents a smaller portion of the source Surface to draw.

#

blit(source, dest, area=None, special_flags=0) -> Rect

#

Hope this helps.

potent ice
frank fieldBOT
#

src_c/surface.c lines 520 to 531

if (PySequence_Check(size) && PySequence_Length(size) == 2) {
    if ((!pg_IntFromObjIndex(size, 0, &width)) ||
        (!pg_IntFromObjIndex(size, 1, &height))) {
        PyErr_SetString(PyExc_ValueError,
                        "size needs to be (number width, number height)");
        return -1;
    }
}
else {
    PyErr_SetString(PyExc_ValueError,
                    "size needs to be (number width, number height)");
    return -1;```
potent ice
#

Isn't it a lot faster to use the built in vector anyway?

#

It seems pygame do read them as ints anyway

#

So I guess your vector class must qualify as a sequence in python

half sphinx
placid lion
#

Is there any game Dev here?

tranquil girder
#

yes

versed aurora
dawn quiver
#

cool

graceful glade
#

Hello, is there anyone with a Twitter developer account here?
Signify so that I can message you 🥺🥺

versed charm
#

Hi guys, i need some help for my program, if you want my loop while have a little problem, she don't want to stop while one of the two decks of cards has no more cards is equal to 0, can someone check this and help me, I would be so grateful to you :))

versed charm
#

It's the first one on the first pic,

vagrant saddle
cold storm
#

has everyone seen 'blender as a py module' yet?

#

I was wondering if we could use this to do calculations on a thread and use shared mem space to pass the data to upbge (so geometry nodes can calculate without blocking main)

#

like spawn a thread from upbge that is a bpy worker.

crisp helm
#

Hey guys i am working on a online game using pygame and sockets.
Should i send to the server the player's x and y coordinates or should i send to the server the information if WASD is pressed?

cold storm
#

send player pos and linV and angV

#

@crisp helm

#

typically*

#

else you are inducing lag

#

however the server has a better 'ground truth' for cheating that way

crisp helm
#

There is a problem though.
When sending x and y if the server has delay the bytes stack up and they mess up the reading of coordinates

#

How can i fix that

cold storm
#

read this ^

#

you need to use a thread also I bet

crisp helm
#

I am using threading

median quail
#

this is definitely the dumbest question ever but I would like to know if i were to create a game what program would i use to create the code and run it visually? (with assets), the end goal is to post it to steam

vagrant saddle
rotund smelt
#

Hi everyone, I'm currently working on my bus game that I made with pygame ^^

#

here is the files of the game ⬆️ ⬆️

#

There are no many things that works, but the bus is moving and the sounds works and I am working to expand it ^^

crisp helm
#

hey guys, i want to make a ipv6 tcp socket in python and connect from different networks.How can i do that?

median quail
crisp helm
#

You can use a module named pygame

#

To create your game

#

And you can write it in a program called pycharm

#

Download the community version

#

Its free

median quail
#

so download both?

#

pycharm and pygame

rotund smelt
#

or only pygame

crisp helm
# median quail pycharm and pygame

You will have to install pycharm on the internet by typing something like pycharm download click the site and download the free community version.
To install pygame you will do it in the cmd (on windows)and type this command :
pip install pygame

#

I will send some tutorials too

median quail
#

like this?

crisp helm
#

Yes

#

Do you have python installed?

median quail
#

yea i have pycharm on my pc

crisp helm
#

Not pycharm.Python

#

Do you have it?

median quail
#

well seen as its not working i dont think so

#

ill download it

crisp helm
#

Ok just search python download

#

And download it

median quail
#

Yep its working now

#

so do you use pygame inside of the pycharm software?

crisp helm
#

Yes

#

Did you install pygame?

median quail
#

this came up

crisp helm
#

That's weird

#

Try again?

median quail
#

k

#

yea same thing

crisp helm
#

Sorry but i don't know what this error is

median quail
#

yea dont worry abt it

crisp helm
#

try typing this command instead

#

pip install pygame --pre

median quail
#

it worked :D

#

Now how do i access it?

crisp helm
#

I will sen a video

median quail
#

k

crisp helm
#

and after that you will have pygame in pycharm

median quail
#

and i can just start coding like that?

crisp helm
#

Yes

median quail
#

alright

#

do you know a good tutorial to start with, like wasd movement and importing assets

crisp helm
#

Yes

median quail
#

could you please send

crisp helm
#

Ye

median quail
#

whenever i hit run the window just instantly closes

crisp helm
#

It's supposed to happen.

#

Just follow the tutorial

#

And you will see how to not make it close instantly

median quail
#

oh ok

median quail
#
pygame.init()

win = pygame.display.set_mode((500,500))

pygame.display.set_caption("RPG")

x = 50
y = 50
width = 40
height = 60
vel = 5

run = True
while run:
    pygame.time.delay(100)

    for event in pygame.event.get():
        if event.type != pygame.QUIT:
            continue
        run = False

        keys = pygame.key.get_pressed()

        if keys[pygame.K_LEFT] :
            x -= vel
        if keys[pygame.K_RIGHT] :
            x += vel
        if keys[pygame.K_UP] :
            y -= vel
        if keys[pygame.K_DOWN] :
            y += vel

    pygame.draw.rect(win, (61, 110, 105), (x, y, width, height))
    pygame.display.update()

pygame.quit()``` this is my code but for some reason it wont let me move with the arrow keys
dawn quiver
#

I'm starting a project I wanted to ask if I were to create a game how should I structure the folder?

uneven tide
versed aurora
covert flame
#

i'm getting this error with pygame when I try to install it

#

it says the error isn't with pip...
Any ideas of how to process / what I should do?

median quail
#

pip install pygame --pre

covert flame
#

okie that works

#

thanks so much

covert flame
median quail
median quail
covert flame
#

Why does pygame always say red underlined thing?

#

do you know how to make it go away?

#

everytime I run the program it always says that "hi i'm pygame" message

median quail
#

i mean try switching to output

#

it shouldnt be there

covert flame
median quail
#

like the menu

#

try switching ot output instead of terminal

#

idk i may be wrong

covert flame
#

ive never done that

#

so where does the output go?

#

if not the terminal

median quail
#

ion know lets find out

eternal vessel
#

import os
os.system("cls")

vagrant saddle
covert flame
eternal vessel
#
shutup = "BE QUIET"```
fleet grove
# covert flame

Also when saving the file change the .py to .pyw for hiding the console when opening the game

pine plinth
#

Changing filename is not changing behaviour

#

.pyw files are regular python files

proper peak
#

it does change behaviour, though? it disables the console when opened (because they are opened with pythonw)

tepid oak
#
from sys import exit

w_screen = 800
h_screen = 400
pg.init()
screen = pg.display.set_mode((w_screen, h_screen))
pg.display.set_caption("Runner")
clock = pg.time.Clock()
test_font = pg.font.Font("font\\Pixeltype.ttf", 50)

sky_surface = pg.image.load("graphics\\Sky.png").convert()
ground_surface = pg.image.load("graphics\\ground.png").convert()
text_surface = test_font.render("My game", False, "black")

snail_surface = pg.image.load("graphics\\snail\\snail1.png").convert_alpha()
snail_x_pos = 600
snail_y_pos = 300
snail_rect = snail_surface.get_rect(midbottom = (snail_x_pos, snail_y_pos))

player_surface = pg.image.load("graphics\\Player\\player_walk_1.png").convert_alpha()
player_rect = player_surface.get_rect(bottomleft = (80, 300))

while True:
    for event in pg.event.get():
        if event.type == pg.QUIT:
            pg.quit()
            exit()
            
    screen.blit(sky_surface, (0, 0))
    screen.blit(ground_surface, (0, 300))
    screen.blit(text_surface, (300, 50))
    
    screen.blit(snail_surface, snail_rect)
    if snail_rect.right == 0:
        snail_rect.left = w_screen
    snail_rect.left -= 5
    
    screen.blit(player_surface, player_rect)
    if player_rect.left == w_screen:
        player_rect.right = 0
    player_rect.right += 5
    
    pg.display.update()
    clock.tick(60)```
#

Why my code works only once time and not happen next? :((((

#

It works well in first time but not second

versed aurora
#

the code is a mess but i screwed around and made this vortex thing

#
#by gloop#5445
import os,math,time
t = 0
w,h = 60,60
e="\x1b["
fgEsc = f"{e}38;5;"
reset = f"{e}0m"
os.system(f"mode con: cols={w} lines={h+2}")

def rotateCoords(pos,origin,t):
    oX,oY = origin
    x,y = pos
    c,s = math.cos(t),math.sin(t)
    x+=oX
    y+=oY
    x2 = (x*c) - (y * s)
    y2 = (x*s) + (y * c)
    return x2,y2
def colTrig(h,offset=(math.pi/4)):
    n = h * math.pi
    r = int(5*abs(math.sin(n-offset)))
    g = int(5*abs(math.sin(n)))
    b = int(5*abs(math.sin(n+offset)))
    return 16 + (36 * r) + (6 * g) + b
def getDist(pos1,pos2):
    x,y = pos1
    x2,y2 = pos2
    return math.sqrt((x2-x)**2 + (y2-y)**2)
while True:
    s = ""
    for y in range(h):
        print(s)
        s = ""
        for x in range(w):
            rSpeed = ((-t*2) + getDist( (x*4,y*4) ,(w*2,h*2) )/10)*-1
            x2,y2=rotateCoords((x,y),(-w/2,-h/2),rSpeed)
            
            x2 /= 1.3
            y2 /= 1.3
            n = 0
            n += math.sin(getDist( (x2,y2) ,(-w/2,-h/2) )/7)

            n/=3
            s+=f"{fgEsc}{colTrig(n,t/10)}m█{reset}"
    print(f"\u001b[0;0H")
    t+=0.1
crimson hound
#

Could someone suggest some resources about the Entity-Component-System architecture? I understand the "theory" behind it (or so it seems to me), but I struggle to understand how it would work in a real game. Are there some simple examples?

rose bane
versed aurora
#

thx

dawn quiver
#

Hey @versed aurora

#

I got no idea what to make.

versed aurora
#

idk just screw around

#

maybe try procedural texture generation or somehting

#

thats always fun

outer glacier
#

is terminal game allowed here?

dawn quiver
brisk ember
#

Hey guys!
Is there any way to create a transparent overlay over a game with python?
The overlay should only display a picture on a certain location on the screen, while I can fully control the game

stable lion
fallow agate
#

`import pygame
from pygame.locals import *

pygame.init()

clock = pygame.time.Clock()
fps = 60

screen_width = 864
screen_height = 936

screen = pygame.display.set_mode((screen_width, screen_height))
pygame.display.set_caption('Flappy Bird')

#define game variables
ground_scroll = 0
scroll_speed = 4

#load images
bg = pygame.image.load('FBJ/img/bg.png')
ground_img=pygame.image.load('FBJ/img/ground.png')
run = True
while run:

clock.tick(fps)

#drag background
screen.blit(bg, (0,0))

#draw and scroll the ground
screen.blit(ground_img, (ground_scroll,768))
ground_scroll -= scroll_speed
if abs(ground_scroll) > 35:
    ground_scroll = 0

for event in pygame.event.get():
    if event.type == pygame.QUIT:
        run = False
pygame.display.update()

pygame.quit()`

#

Code for a flappy bird scrolling background I made while following a yt tutorial

dawn quiver
#

oh nvm someone said that

crimson hound
#

What's everyone's favourite level editor for 2-dimensional games? I'd like something that's simple, supports export into JSON or some other popular format, is free/libre and runs on Linux.

#

Or is there no good general solution, and everyone just makes their own editor?

normal silo
# crimson hound Could someone suggest some resources about the Entity-Component-System architect...

I don't know of any simple examples, but: https://www.youtube.com/watch?v=zrIY0eIyqmI

In this 2017 GDC session, Blizzard's Timothy Ford explains how Overwatch uses the Entity Component System (ECS) architecture to create a rich variety of layered gameplay.

GDC talks cover a range of developmental topics including game design, programming, audio, visual arts, business management, production, online games, and much more. We post a...

▶ Play video
normal silo
crimson hound
#

Tiled seems to support that

#

does it have polygons though?

brisk ember
normal silo
#

You can save/load entities using Python's new support for TOML (can also edit the entities directly in a text editor then).

#

(Or JSON or whatever, I prefer TOML-like, the extra syntax in JSON is not that great for human readability / editing as a file format)

#

(I recommend detecting file changes and reloading entities, so you can edit the entity files while in-game and it will dynamically reload the entity, so you can edit entities and see the changes in real time without restarting, since you are using Python, you can also just use Python files as configs for the entities instead of TOML or JSON or whatever)

crimson hound
#

my frontend will be in the browser (via websockets) so it's not that bad

short wind
#

im trying to get some help with the hypxel api is this the best thread for it?

covert flame
#

For me, the while loop runs forever (pygame)

#

essentially I only want it to run as long as the mouse is pressed

#

but if the mouse is pressed even once, it runs forever

#

What is the issue, and how do I prevent this?

vagrant saddle
outer glacier
#
    if tree_health <= 0:
      coins += 500
      print("Congratulations! You have defeated the Walking Tree and got 500 coins! You now have "
        + str(coins) + " coins!\n")
      time.sleep(5)
      break
    elif lives <= 0:
      print("You have been defeated by the Walking Tree. You will respawn for 100 coins!\n")
      coins -= 100
      bullets += 2 - bullets
      respawn()
      continue```
So I am having an issue with this in my terminal game. When the player's life is zero, he doesn't respawn and his lives get negative and it exists the loop when the tree health is zero and continues on the next interaction.
#

anybody help

covert flame
dawn nacelle
#

In the game loop code that you showed, your first iterate through all bullets in the list and update them. (There is an odd thing here, but I'll get back to that). Then If the player has lives and can shoot, you move the player and call bullet_shoot(). But that last call also iterates through all the bullets and tells them to update again.

The names of your functions and methods are a little confusing, e.g., bullet_shoot does not shoot a bullet. The function move potentially shoots a bullet.

The odd thing I mentioned earlier, is that you typically want to do all movement (move the player, move all bullets, potentially add a bullet, etc.) before your draw anything. Once you are done with all movement, then it would be good to draw your player and loop through your bullets list and draw all bullets.

night shale
#

Hey does anyone know why cant I download pygame 2.1.2 to my pycharm?

#

i've been struggling with this for 1 hour now

#

I updated my pip

#

tried to use cmd and download it there

#

and also in pycharm

#

but every time I try to download it I get an error message

dawn nacelle
#

You're welcome. A couple of other comments if you don't mind:

#
  • I've built some games like this, and my structure is to build a bullet manager class that manages a list of bullet objects (that is, the list of bullets is an instance variable in the bullet manager). That way, you can tell the bullet manager to update, and it just iterates through all bullets to update each. That way, all bullet related (e.g. bullet_shoot) would be in the bullet manager, which instantiates a new bullet and adds it to it's own list.

  • In the code that you just showed, you are calling window.get_width() and bullet.get_height() for every bullet, and probably in every frame. Instead, you could/should call these once, in an __init__ method and save the results in a variable.

  • Finally, when you are considering removing a bullet, I would iterate backwards through the list. If you remove a bullet while going forward through a list, the list compacts, and one bullet will be skipped.

#
  • You can also have a single draw (or show) method in the bullet manager, and it would iterate through the list of bullets and tell each one to draw.
#

Thanks. Gotta go. Good luck.

gray rose
#

Hi, friends. I'm looking for a function for breakvector in Unreal Python. How do I approach using breakvector features in Unreal Python?

gray rose
verbal parrot
#

When I have an image with transparent and non-transparent parts, how can I make it so that only the non-transparent parts collide?

verbal parrot
#

Or do the transparent parts get removed automatically and therefor won't collide in the first place?

gentle bay
#

Hey, I'm planning on creating a text-based fantasy game using pydroid 3 ide for python 3 on Android phone. But in order to make it I need some help with a very important feature... the inventory. Does anyone know how to code a simple customizable inventory management system?

frank fieldBOT
#

Hey @versed cedar!

You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.

versed cedar
#

Hello, I apologize if I am interrupting your time, how to make a pause function in pygame and how can I increase the speed of the Tetris block every time the row clears? In advance thank you very much (I'd appreciate any help, so please don't criticize I'm a beginner, I'll work to improve my programming). Here is the code: https://paste.pythondiscord.com/imitolewaq.

normal silo
#

Since in a program nothing happens unless you make it happen.

#

Can still draw the scene though.

woven canopy
#

and how can I increase the speed of the Tetris block every time the row clears

Your fall speed is currently 0.27.
Make clear_rows() return a numeric value, perhaps one set by difficulty. But for the base game, have it return 0.001-0.004 depending on how many rows were cleared.
And then line 385 do fall_speed += clear_rows()
Each time you clear a row, game fall speed goes up by 0.001 (or so). Obviously you might want to tune this change a bit.

#

Another way would be to track your score, and just set the fall speed to be 0.27 + (score/constant)

solemn lynx
#

you guys are so good at this

olive basin
#

Hi, I'm trying to make a game like minicraft/minecraft with pygame, I'm having issues with perlin noise for the procedural generation. The library I'm currently using is perlin-noise but it's very slow in my use case no matter the value of world_size.

world_size = 10_000

noise = PerlinNoise(octaves=world_size / 4, seed=time.time())

for x_ in range(16):
  for y_ in range(16):
    noise_value = noise.noise(
      [
        ((x_ + x_factor) / 16) / world_size,
        ((y_ + y_factor) / 16) / world_size,
      ]
    )

x_factor and y_factor are the chunk's coordinates so it can be "infinite" and not just one chunk
This code works but it is very slow, around 8ms per chunk generation which causes stuttering whenever generating a chunk.
I'm thinking of two solutions:

  • multithreading (which I have tried but I have no idea how to implement correctly)
  • using another libray like https://github.com/pvigier/perlin-numpy which seems to be much faster but, and this is where i'm struggling, I don't know how to use the returned value of
noise = generate_fractal_noise_2d((16, 16), (8, 8), octaves=4)

which is

[[ 0.         -0.54870611  0.          0.30967884]
 [ 0.2529953   0.16744944  0.47473853  0.3220437 ]
 [ 0.          0.15587116  0.         -0.07502009]
 [-0.08627964 -0.32717748 -0.11410387  0.1899867 ]]

like I could use perlin-numpy Thanks 😄

cold storm
remote gulch
# cold storm

Activate Windows
Go to Settings to activate Windows.

woven canopy
# olive basin Hi, I'm trying to make a game like minicraft/minecraft with pygame, I'm having i...

Well, perlin-numpy definitely works faster than perlin-noise. Like a couple orders of magnitude. Perlin-noise takes a couple seconds to generate a 100x100 pixel image in my test. perlin-numpy does 1024x1024 in a few ms.

I can't get noise = generate_fractal_noise_2d((16, 16), (8, 8), octaves=4) to work, it gives me a valueerror (octaves 2 works though)

As far as how to use your output. When I run generate_fractal_noise_2d((8,8),(4,4), octaves=2) (smaller for easier output)

   0.00000000e+00 -9.90266145e-02  0.00000000e+00 -4.85768623e-01]
 [-7.96826441e-02 -1.94736867e-02 -6.96891970e-02  2.60103277e-01
   5.09306716e-01  6.12494906e-01  6.29273543e-01  3.61757575e-01]
 [ 0.00000000e+00 -4.65025035e-01  0.00000000e+00  4.95144291e-03
   0.00000000e+00  1.85436167e-01  0.00000000e+00  1.94486236e-02]
 [-3.41712618e-01 -2.12064186e-01  5.46994514e-01  2.33197741e-01
  -6.02469697e-01 -2.51291235e-01 -5.57936249e-02 -8.88269685e-02]
 [ 0.00000000e+00 -1.64385233e-01  0.00000000e+00  5.16919222e-01
   0.00000000e+00 -2.97553146e-02  0.00000000e+00  1.45771116e-01]
 [ 6.75543416e-01  4.30133722e-01 -5.55389256e-02  6.83214483e-02
   3.38468698e-01 -1.75810501e-02 -3.39947902e-01  2.49178849e-02]
 [ 0.00000000e+00  4.04648187e-01  0.00000000e+00 -6.63206098e-01
   0.00000000e+00 -3.92758142e-03  0.00000000e+00  7.46246842e-02]
 [ 1.93358185e-05  2.74986151e-01  1.95647270e-01 -4.30302584e-01
  -8.50271179e-03 -5.51606296e-02 -2.26404499e-01 -3.22204462e-01]]```

Which is just a 2d array of all the noise values.
#

So inside of your nested for loops... just do something like noise_value = noise[x_+x_factor][y_+y_factor], and whatever else you might need to grab the specific chunk you are looking for

tawny pollen
#

Whats a good pixel art size for newbies?

olive basin
olive basin
chilly mason
#

Am i able to make 3d game in pygame

olive basin
#

You could, but you'r going to get really really poor performances

eternal vessel
tawny pollen
eternal vessel
#

Yeah didn't know if you were doing it for making characters and would want the height to be 32x or something like that

#

but yeah I normally stick around 16x

cold storm
#

@remote gulch you deactivate yours 😛

woven canopy
midnight scarab
#

I want to make a android 3d mobile vr game that you can play with an Xbox controller
Anyone knows what packages I can use to do this?

midnight scarab
#

Lol
It sounded cool though
Most "mobile vr games"are absolutely horrible
Sadly I won't be able to track the controller though as they do not have a way to sense where they are

half epoch
#

So I was looking to make a game
And use pygame
But I cannot use pip
Even though I have python installed

#

And the only way I can think of is deleting python as a whole
But would I also have to delete any files from python aswell?

eternal vessel
#

but yeah just make sure when you install python, to also add pip. There are videos on it

dawn quiver
#

So you are inside an asteroid hurtling through space. There is no gravity so you maneuver by using the limited fuel in your jet pack and as well as your grappling hook to latch onto vegetation. Your view is constantly rotating slowly becuase of the asteroid rotation and you explore caves like these. @versed aurora

versed aurora
#

hm

dawn quiver
#

The caves are filled with precious metals and minerals, space monsters too

#

I like the gameplay mechanics

#

but i am still figuring out the main goal for the player

versed aurora
#

i guess just 'maximize points'

dawn quiver
#

Yeah i guess that could work

#

sort of like spelunky

#

I need to learn marching squares then if i want destructible terrain.

#

i probably want destructible terrain so that the player can progress in a noise generated cave system

#

that way i dont need to design a cave

#

maybe you will have limited oxygen

#

and have to find air pockets within the asteroid

half epoch
#

Ok thank you

proper peak
#

which aren't super intuitive, so it'd be a pretty unique experience

calm spear
#

I recently started to learn how to use Pygame and I've just discovered how to create collisions between objects. For this example I draw large amount of circles with a random position defined by the angle theta from the x axis and the speed (actually the norm of the position vector).

I have some little issues with this program: sometimes the circles overlap or somehow slide onto one another. I basically made a script to be able to click circles and turn them into static object. Therefore when a red circle is turned into a blue one, the collision isn't the same (only the red one will be deviated). I'm not exactly sure how to do this properly and I can't really find any understandable ressources online

mortal elk
#

how would I make a game using pygame that can accept new texture packs of different resolutions?

woven canopy
woven canopy
#

Line 74 might be a little suspect

#

if dist < p1.size + p2.size:

calm spear
#

basically sometimes they seem to stick to one another and when there is a fixed dot it's like slipping on it, either way the trajectories seem kinda off

calm spear
#

distance between the balls is smaller than the sum of the radius

woven canopy
#

Ok so you are intending for them to overlap then, as you also calculate the overlap

calm spear
#

well no I don't want them to overlap

#

I thought this bit of code could prevent the overlap

#

because then there is a risk of endless loop where the balls are stuck

#

but it wasn't working because the balls stuck to one another

#

also @woven canopy great chance I won't answer any of your message in the next 30min because I'm grabbing dinner soon

woven canopy
#

Alrighty

neon tinsel
#

hey all, what is the best approach for storing item data? like lets say I have 5 crops, each with their respective seeds, and I want to store all kinds of default data about each where I can easily access it with my code?

#

I'm currently using JSON files, but I have a separate JSON file for each time of item, and that brings up an issue that when I want to get information for whatever item is being processed, I need to know which JSON file it comes from and I can't retrieve the information systematically

calm spear
calm spear
neon tinsel
#

I mean storing default values

#

for example: each items sell value, formatted name, type, rarity, etc

woven canopy
#

However ```py
(p1.angle, p1.speed) = addVectors(p1.angle, p1.speed*(p1.mass-p2.mass)/total_mass, angle, 2p2.speedp2.mass/total_mass)
(p2.angle, p2.speed) = addVectors(p2.angle, p2.speed*(p2.mass-p1.mass)/total_mass, angle+math.pi, 2p1.speedp1.mass/total_mass)

#

Shouldn't both of the addVectors be using the p1/p2 angle and speed of the initial collision? As it is, you're setting a new p1 angle and speed, and then using that new speed in the second addVectors
Unless I'm reading it wrong

calm spear
#

honestly I have no idea

#

it was 00:30 when I wrote this

woven canopy
#

Actually 79/80 aren't even doing anything, can comment them out and the code works the same

calm spear
#

mmh

modest prism
#

Hey

#

Is python really a suitable language for game development?

calm spear
modest prism
#

due to the efficiency

calm spear
#

you can make great stuff in Python

woven canopy
#
            a1 = addVectors(p1.angle, p1.speed*(p1.mass-p2.mass)/total_mass, angle, 2*p2.speed*p2.mass/total_mass)
            a2 = addVectors(p2.angle, p2.speed*(p2.mass-p1.mass)/total_mass, angle+math.pi, 2*p1.speed*p1.mass/total_mass)
            # p1.speed *= elasticity
            # p2.speed *= elasticity
            (p1.angle, p1.speed), (p2.angle, p2.speed) = a1, a2

            
            p1.x += math.sin(p1.angle)#*overlap
            p1.y -= math.cos(p1.angle)#*overlap
            p2.x -= math.sin(p2.angle)#*overlap
            p2.y += math.cos(p2.angle)#*overlap

Did that and it gets fun results

modest prism
#

I've researched a bit and in Internet I found people complaining about the efficiency of code in python

calm spear
#

that's not new

woven canopy
#

Wanna make an MMORPG or a fast paced FPS, probably not the best language

modest prism
#

Is speed really a big problem?

woven canopy
#

"It depends"

calm spear
#

I got something similar once as well

#

we created roundabout basically

woven canopy
#

I've written myself a bunch of DM tools for TTRPGs in python, 1 of them is a World>Terrain/Resourrces>Population>Settlement generator

modest prism
#

alsoo

woven canopy
#

If I tell it to make me a land with 100,000 peeps, all with a stat list, names, and a little genome (52 char string) that's used to miix and match and make new pops. Takes a few seconds to run in Python.
When I originally made it in C++ years ago, it would do it a tiny bit faster

modest prism
#

is py good for embedded systems? IoT etc?

woven canopy
#

However, it took me weeks to make it in C++, whereas here in Snek language, was an afternoon porting it over

modest prism
#

Would you prefer c++ or python in general?

woven canopy
#

Python

modest prism
#

Why?

calm spear
#

more user friendly maybe?

modest prism
#

that's for beginners though

woven canopy
#

Because it's fast to write and work with. There's libraries for everything under the sun, and they're stupidly easy to use.

calm spear
#

I ain't no beginner and I still use Python because it's really enjoyable to use

woven canopy
#

And it runs more than fast enough for what I do. And if I ever come across a problem that is "too slow". Either A look at refactoring the code to run better from the getgo. Or then I move over to C#. But 95% of what I write is either Python or Javascript.

modest prism
#

hmm I see

#

Thanks a lot guys

woven canopy
#

Oh yeah, also in the addVectors. I think you need the absolute value for the lengths

#

p1.speed*(p1.mass-p2.mass)/total_mass

#

Because that bit there, of P2 is bigger will generate a negative speed

neon tinsel
#

Hey guys, what would be the best way to store default item values for a python project?

woven canopy
#

Like when difining a function?

neon tinsel
#

I'm currently using JSON files, but I have a separate JSON file for each time of item, and that brings up an issue that when I want to get information for whatever item is being processed, I need to know which JSON file it comes from and I can't retrieve the information systematically

woven canopy
#

So somewhere in your code you've got an `open('data.json') right? (replace data.json with whatever filename)

neon tinsel
#

Yeah, and I have the different types of items in different files

#

but that brings up issues

woven canopy
#

Ok so you've got like 3 different objects you're storign your 3 different .jsons in?

#

(hypothetically)

neon tinsel
#

For example, I have a crops.json file

#

with crops and seeds in it

#

and then i have a tools.json file

#

with various tools in it

woven canopy
#

Can you add the filename as a line within the json itsef

#

Then you can do crops.filename

neon tinsel
#

I suppose I could

#

The issue I'm finding is that lets say I have an inventory class that works with a database to add and remove items

#

If I want to access the item from the inventory's default values, I would have to know which file to choose from

midnight scarab
#

Is there support for Android on ursina
Like a unofficial Android additions package or something

woven canopy
#

So you want Inventory to have a crops and tools object created inside by default, that you can later load your jsons into?

#

II'm not quite understanding

neon tinsel
#

Well

#

One sec, let me finish valorant round

#

Okay, so pretty much, lets say I have these crops. I'm currently storing their buy price, what seed they grow from, the time it takes for them to grow, and the yield. I'm storing all of this in a JSON file, where there are multiple crops. When a user harvests the crop, I have to access this JSON file to get those values

woven canopy
#

k

neon tinsel
#

I also have tools that all have their respective stats in another JSON file

woven canopy
#

So the user is harvesting some corn, you need your code to know to check the crops.json for the corn stats, and the tools.json for the tool stats

neon tinsel
#

It would be better to store all the items in one JSON file so that I can look up any values I need just by their key, but that probably isn't a good practice

woven canopy
#

And your inventory system doesn't know that corn is a crop and not a tool?

neon tinsel
#

I mean each items key does have the type of item it is

#

for example, an items key might be "CROP_CORN"

woven canopy
#

So form the user's side, they're running something like Inventory.get_stats(corn) and you want it to return a structure with all of corn's stats

neon tinsel
#

or "TOOL_AXE"

#

Yeah something like that

woven canopy
#

Well then, 2 ideas

#

1 have a dictionary inside of your class, that stores the different inventory types, and has the filename of the associated JSON

neon tinsel
#

Yeah that's an idea

woven canopy
#

Other idea if you don't wnat to "hard code" all the filenames like that

neon tinsel
#

Is it good practice to store default values in a JSON file though?

#

For example:

#
  "SEED_LEMON": {
      "name": "lemon seeds",
      "description": "Grows into a lemon! :lemon:",
      "STAT_growth_odds": 10,
      "price": 80000,
      "rarity": "uncommon",
      "grows_into": "CROP_LEMON"
    }
woven canopy
#

default values?

#

Why not?

neon tinsel
#

I'm not sure, just wondering what the usual route is

woven canopy
#

Is what I do with stuff in my games, only I specifically use Excel to make the large inventory lists, save it as a CSV, and then turn the CSV into a JSON

neon tinsel
#

I see

woven canopy
#

Another thought would be. Have an extra JSON file that stores all the inventory types ("SEED_LEMON", "CROP_CORN", "TOOL_AXE"), and where to find them. (This also mirrors how a lot of people might do databases

#

So yoou've got 2-3 JSONs/Tables that have the stats of specific items. And another JSON/Table that tells you which table to go to to get the associated stats

neon tinsel
#

Okay, I'll try that

#

Thanks

woven canopy
#

Also makes it a tiny bit more scaleable. As once you've got the main inventory class working. if you want to add more items, jsut add them to their respective stats file, and a reference to them in your Reference file, and you shouldn't need to touch your code.
Can even end up, where if you wanted to add more tables, with SoilTypes, Vehicles, Animals. etc. Just make a file with their stats, and add them to the Reference.

neon tinsel
#

Perfect

#

I wish I could find a good example for good file structure / naming conventions etc

neon tinsel
#

@woven canopy another question if you don't mind, where should I open all of those JSON files? Currently, I'm opening them all at once in a file with some classes I use often, and then I just import it to other files from this one.

with open(f'{ROOT_DIRECTORY}\projfiles\game_entities\\ranks.json', 'r') as ranks_file:
    ranks = json.load(ranks_file)
with open(f'{ROOT_DIRECTORY}\projfiles\game_entities\\areas.json', 'r') as areas_file:
    areas = json.load(areas_file)
with open(f'{ROOT_DIRECTORY}\projfiles\game_entities\\pets.json', 'r') as pets_file:
    pets = json.load(pets_file)
with open(f'{ROOT_DIRECTORY}\projfiles\game_entities\\tools.json', 'r') as tools_file:
    tools = json.load(tools_file)
with open(f'{ROOT_DIRECTORY}\projfiles\game_entities\\materials.json', 'r') as materials_file:
    materials = json.load(materials_file)
with open(f'{ROOT_DIRECTORY}\projfiles\game_entities\\consumables.json', 'r') as consumables_file:
    consumables = json.load(consumables_file)
woven canopy
#

Looks good to me

#

might just want to put a bit of error handling in there incase 1 of the files is missing

serene urchin
#

Hey guys, experienced Python programmer here trying to get through https://www.rogueliketutorials.com/tutorials/tcod/v2/part-1/ this tutorial for TCOD. I seem to have a type issue with my code where isinstance is returning False for a object returned from my input handler class. I can print the type and see that the object is what I expect it to be however isinstance still fails which is really confusing... I pushed a repo with the code as it is https://github.com/Rhysyrhysrhys/roguelike/tree/main/src

GitHub

TCOD tutorial roguelike. Contribute to Rhysyrhysrhys/roguelike development by creating an account on GitHub.

#

I'm not sure if the gaming channel is the right one, because types are a general python thing of course, I've just never seen that sort of behaviour before..

from src.actions import EscapeAction, MovementAction

...

action = input_handler.dispatch(event)

print(isinstance(action, MovementAction)) # False
print(type(action)) # <class 'actions.MovementAction'>
#

Am I just missing something glaring or is TCOD doing something here??

#

AH

#

ok...

#
from src.actions import EscapeAction, MovementAction

...

print(isinstance(action, MovementAction)) # False
print(type(MovementAction(1,1))) # <class 'src.actions.MovementAction'>
print(type(action)) # <class 'actions.MovementAction'>
#

well, that took like an hour to figure out..... d'oh

woven canopy
#

What ended up being the problem?

torn jackal
#

can someone could tell me the error :
username_email = 'vicentedouardle'
query = ('''CREATE TABLE %(Username)s (Emails LONGTEXT, SKeys LONGTEXT)''')
data = {'Username' : username_email}
cur.execute(query, data)
cnx.commit()

serene urchin
# woven canopy ??

Though all the files were in the same directory together, one file had the action imported from src.actions, and the other just actions. Even though they are the same class the call to ‘type’ sees them differently

woven canopy
#

yep that would cause some head scratching. Well good on you figuring it out and good luck.

agile lichen
#

Hello I want to learn python which course will be best for learning Python

#

Hello

woven canopy
dawn quiver
#

Now i just need to do the interpolated version

versed aurora
eternal oracle
#

penis

versed aurora
#

real

opaque stone
wild trout
#

hey guys! i was wondering if you could advise me on choosing a computer vision library for python that can read dynamic objects from a game in real time at a decent fps

versed aurora
dawn quiver
#

interpolated marching squares

versed aurora
#

awesome

#

my snake rewrite is now fully functional, i just wanna make it look good now

#

it's as long as the original now

dawn quiver
#

nice

versed aurora
#

added a proper border, pause menu, and reset key

versed aurora
#

I think its pretty much done, i’ve spent the last several hours doing nothing except writing it pretty much

shadow gate
#

Cool

pine plinth
versed aurora
versed aurora
#

i wonder if there is a semicircle i can use

#

see i can double it up but that makes a lot of things really funky

#

like this works i guess, but its weird

dawn quiver
dawn quiver
versed aurora
#

just something i threw together as a test

dawn quiver
#

Oh

#

I wanna make a lil game

#

What software should I use

versed aurora
#

i literally just wrote it from scratch

#

pygame is pretty good though

#

im gonna try out nurses, it seems really good

woven canopy
#

nurses?

versed aurora
#

i really ought to make my own terminal thing at some point

#

would it be as good? no
but it would be mine

woven canopy
#

Huh, never heard of it, frankly I thought you were mistyping "curses"

versed aurora
#

honestly yeah i wanna write my own thing

woven canopy
versed aurora
#

i make terminal stuff but usually it's just from scratch each time

#

im pretty proud of the snake i did

woven canopy
#

Ya like roguelikes?

versed aurora
#

well , i play dwarf fortress so maybe i guess

woven canopy
#

There's a solid guide for making 1 with the library TCOD (the dungeon delver kind). Takes an evening to follow but gives you an idea of how a game like that goes together so you can just fart around and expand it

dawn quiver
wheat violet
#

@versed aurora hey bro can i have your game codes for my school project

formal dagger
#

I currently have a text-based game that works off of user input. Is there any way to make the game playable on an HTML page instead of having to have an IDE installed to play it??

proper peak
#

you don't need an IDE installed to run python programs, just, like, Python itself. Anyway, maybe try https://pyscript.net/. It's very alpha, but it mostly works.

jolly horizon
#

haven't seen an enemy wave centered game in a while

dawn quiver
dawn quiver
versed aurora
versed aurora
#

now that i know how to do proper mouse input i cna try doign some fun stuff

dawn quiver
versed aurora
silent drift
#

can anyone explain this

#

very new to python btw

#

why cant i import pygame in the right but i can in the left

#

they are both different projects

#

but why dont they both either work or not work

vagrant saddle
frank fieldBOT
#

Hey @dawn quiver!

It looks like you tried to attach file type(s) that we do not allow (.mkv). We currently allow the following file types: .gif, .jpg, .jpeg, .mov, .mp4, .mpg, .png, .mp3, .wav, .ogg, .webm, .webp, .flac, .m4a, .csv, .json.

Feel free to ask in #community-meta if you think this is a mistake.

dawn quiver
vagrant saddle
#

hmm so no, nothing yet but should be soon

blazing void
pallid cairn
dawn quiver
#

Are folks interested in more game engine options or does the ecosystem feel pretty full?

versed aurora
#

game dev challenge: make a game that only uses the title text of the window as a display

dawn quiver
#

wow I want to make game can u tech me how u did this

versed aurora
#

i forget what that is

dawn quiver
versed aurora
#

ah

#

like rogue i guess

#

honestly though i like doing text graphics prob cause of dwarf fortress (rendering text graphics is also slightly easier)

dawn quiver
#

I do want to make a DF clone tho.

versed aurora
#

of course df is sort of fake text graphics; it uses a spritesheet of characters

eternal vessel
#

could I make like custom font sprites for letters or no

versed aurora
#

i would say thats fine

eternal vessel
#

Dang what could I even name this game

versed aurora
#

no clue

eternal vessel
#

search history rn: words with every letter in alphabet

versed aurora
#

I personally don’t like using custom fonts since there’s no way to set it using code afaik but i think its fine

#

idk if setting a custom font changes the title though

eternal vessel
versed aurora
#

I might try doing the challenge sometime, maybe a sort of dino game thing using braille for the display

eternal vessel
#

Braille, thinking outside the box

versed aurora
#

Ive used it once or twice before

#

braille is somewhat annoying to work with, i’ll post a script i made that converts an image into braille when i get on

eternal vessel
#

neat

versed aurora
#

there are braille modules (drawille, for one) but i’m too prideful to not make stuff myself

eternal vessel
#

I mean making stuff like that yourself is good practice

versed aurora
#

i used pillow for that script but i really ought to finish that png decoder ngl

#

the name is a joke

#

oh right this is before i started using snake case

#

sorry about that

#

the important part is this

dotsMap = dict(zip(range(8),[64,128,4,32,2,16,1,8]))
indexMap = dict(zip(range(8),[6,7,4,5,2,3,0,1]))

def brailleFromBits(bits):
    if len(bits)<8:
        bits = [0]*(8-len(bits)) + bits
    ch = 0x2800
    bitsCopy = [bits[indexMap[idx]] for idx,_ in enumerate(bits)] 
    ch += sum([bit*dotsMap[idx] for idx,bit in enumerate(bitsCopy)])
    return chr(ch)
versed aurora
#

you mean just in general or in this specific thing

eternal vessel
frank fieldBOT
#
Print and Return

Here's a handy animation demonstrating how print and return differ in behavior.

See also: !tags return

frank fieldBOT
#

Hey @runic rivet!

You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.

dawn quiver
#
    def fire(self, dt):
        self.idle(dt)
        for i in range(self.bullets_per_shot - 3, -3, -1):
            delta_angle = i * 2
            dx = math.cos(-math.radians(self.angle + delta_angle))
            dy = math.sin(-math.radians(self.angle + delta_angle))

            self.create_bullet(dx, dy)
        self.anim_state = State.IDLE

Not trying to write good code this time, but basically the logic is that it goes over a negative to positive range of numbers and simply increments the intended angle in which the pellet is supposed to move in by it

proper peak
#

I'd do something like delta_angles = np.linspace(-spread, spread, d), where spread is half the angle of the blast, and d is the number of bullets. np.linspace can of course be written without numpy as something like

for i in range(d):
    delta_angle = -spread + (2*spread)/(d-1) * i

(note that it doesn't work for 1 bullet, but should work for any other count)

dawn quiver
#

Just trying to make the game work but thanks tho

dawn quiver
#

who do i fix this?

#

and it says i have it installed when i try to install it

full sapphire
dawn quiver
dawn quiver
#

i dont have one

full sapphire
#

i'm not familiar with that one. For PyCharm, I had to go to the project settings in the interpreter and install it that way

dawn quiver
#

i have idle

dawn quiver
#

should i get py charm then

#

well it fix the pygame problem then?

full sapphire
#

it's neither here nor there, it's just the environment you program in, doesn't change much about the program other than were stuff is located

dawn quiver
#

so how would i fix it?

full sapphire
#

so like where the interpreter settings will be in a different place on VSC vs pycharm, but once you find it you just follow the same steps i would assume?

#

research

dawn quiver
#

alright

full sapphire
#

i found mine by accident when i found a guide to install Pillow on pycharm

dawn quiver
#

i fixed it

full sapphire
# dawn quiver i fixed it

was just going to write you about 10 minutes after my last message then kids happened, glad to find you figured it out

mortal elk
#

Anyone got some good docker tutorials. I mostly get the ideas but the actual execution has gone straight iver my head so far lol 💀

versed aurora
frank fieldBOT
dawn quiver
#
import coincounter
from turtle import *
from random import randrange
from freegames import square, vector

food = vector(0, 0)
snake = [vector(10, 0)]
aim = vector(0, -10)

def change(x, y):
    "Change snake direction."
    aim.x = x
    aim.y = y

def inside(head):
    "Return True if head inside boundaries."
    return -200 < head.x < 190 and -200 < head.y < 190

def move():
    "Move snake forward one segment."
    head = snake[-1].copy()
    head.move(aim)

    if not inside(head) or head in snake:
        square(head.x, head.y, 9, 'red')
        update()
        return

    snake.append(head)

    if head == food:
        print('Snake:', len(snake))
        food.x = randrange(-15, 15) * 10
        food.y = randrange(-15, 15) * 10
    else:
        snake.pop(0)

    clear()

    for body in snake:
        square(body.x, body.y, 9, 'green')

    square(food.x, food.y, 9, 'red')
    update()
    ontimer(move, 100)


hideturtle()
tracer(False)
listen()
onkey(lambda: change(10, 0), 'Right')
onkey(lambda: change(-10, 0), 'Left')
onkey(lambda: change(0, 10), 'Up')
onkey(lambda: change(0, -10), 'Down')
move()
done()```


my game made in python

install these modules to play
pip install freegames
pip install coincounter
#

🐍

versed aurora
flat comet
#

hello

#

new around here, how is everyone doing?

flat comet
#

this is the monstrosity I am working on

dawn quiver
#

Got a health bar going

class Health:
    def __init__(self, entity_health, health_bar_width) -> None:
        self.entity_health = entity_health
        self.health_bar = HealthBar(entity_health, health_bar_width)
        self.messenger = Messenger()

        self.total_health = entity_health

    def take(self, value):
        self.entity_health += value
        self.health_bar.fade_in()

        color: str
        val_text: str
        if value > 0:
            val_text = f"+{value:.1f} health gained!"
            color = "green"
        elif value < 0:
            val_text = f"{abs(value):.1f} health lost!"
            color = "red"
        self.messenger.send(val_text, color)

    def update(self, pos, dt):
        self.health_bar.update(pos, self.entity_health, dt)
        self.messenger.update(pos, dt)

    def draw(self):
        self.health_bar.draw()
        self.messenger.draw()
blazing void
idle plank
#

hey

#

i don't understand what is the problem here

#

import pygame

blue = (0,0,255)
screen = pygame.display.set_mode((600, 600))

timer = pygame.time.Clock
fps = 60

running = True

while running:
timer.tick(60)

pygame.display.update()


screen.fill("light blue")
pygame.draw.circle(screen, blue, (300, 300), 30)

for event in pygame.event.get():
    if event.type == pygame.QUIT:
        running = False
pygame.display.flip()

pygame.quit()

severe vale
idle plank
#

thx

lost drift
#
    def hover(self):
        for ele in self.gridArray:
            if ele.collidepoint(pg.mouse.get_pos()):
                pg.draw.rect(screen, color["WHITE"], ele)
            
            else:
                pg.draw.rect(screen, color["WHITE"], ele, 1)
#

Wandering if there is a better way to loop over a grid array?

dawn quiver
# versed aurora

this is fun. The balls look like they are on some kind of grid.

versed aurora
#

that's just because i round their position when rendering

idle plank
#

hello

#

i got another problem

idle plank
# idle plank

this thing is supposed to be a blue ball not a blue line

#

import pygame
#Veriable

blue = (0,0,255)
fps = 60
circle_x = 300
circle_y = 300
circle_x_dire = 1
circle_y_dire = 1
#screen
screen = pygame.display.set_mode((600, 600))

timer = pygame.time.Clock()

def update_ball():
global circle_x
global circle_y
global circle_x_dire
global circle_y_dire
if circle_x_dire > 0:
if circle_x < 570:
circle_x += circle_x_dire
else:
circle_y += 1

#main def
def game():
running = True

while running:
    #screen

    timer.tick(60)
    update_ball()
    pygame.display.update()

    #ball
    pygame.draw.circle(screen, blue, (circle_x, circle_y), 30)
    update_ball()
    #exiting

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

game()
pygame.quit()

cloud laurel
#

Hello
I would like to ask a question. I have an app which records and simulates the keyboard and mouse action. It is doing the job perfectly but when I try to use it in a gameplay it will not simulates the recorded mouse movement. I am not able to figure the reason behind this. Is it something to do with game engine mouse translation or 2D plane or 3D environment issue or presence of crosshair in game????

vagrant saddle
elder needle
#

If I made a music game like guitar hero where the notes scroll and collisions with button press results is success and sound, how would you begin to think about implementing a feature to write simple midi beats to play into the game

#

Like imagine if you could take a guitar hero guitar and write a challenge song with 7 buttons and an octave and incidental keys

#

And writing would be like Ableton or fl studio etc where you just plug n play available sounds into a timeline that will be scrolled for the game

rapid yacht
#

Implementing a mini DAW is harder than it seems

dawn quiver
#

😆

#

I thought you said you wanted to make a game

pale sparrow
#

Need some help on a with the coding on this tic tac toe and im near the end

#

this is my out come so far

#

this is the code

#

anyone please help me here i have to hand it in by midnight and i aint got a clue

fallow finch
#

but you need help with what

pale sparrow
#

yes i need help with this

full sapphire
#

So I am making a blackjack game, however, I seem to be having a great deal of issue figuring out how to go about my split. Each hand Has a dictionary filled with a custom card class which contains data like the suit, face, value, etc. In the event of a split being possible(which doesn’t catch all splits and idk why not) I can move the card over to the new hand, but i can’t seem to remove it from the previous hand.

ancient hornet
#

I need assistance in installing PyGame on my MacOS!

woven canopy
#

What's the issue?

ancient hornet
#

I saw a cool video about making a Doom/Wolfenstein- like game by using PyGame in PyCharm.

woven canopy
#

k

ancient hornet
#

It keeps telling me that there is an error when I try to install it!

#

I have been looking for solutions for this for 4 hours now, and I don’t know what to do anymore.

woven canopy
#

Yes, and what exactly is the error?

#

Like are you just trying to install it with Pip, or do it manually?

ancient hornet
#

Pip

woven canopy
#

so pip3 install pygame gives you an error?

ancient hornet
#

pip3?

woven canopy
#

You have python 3 installed?

ancient hornet
#

Looks like it…
It has a terminal icon next to it and literally named 'python3'

woven canopy
#

ok so run pip3 install pygame and tell me what the error message you get is

ancient hornet
#

error: metadata-generation-failed

woven canopy
#

(or pip install pygame, without a number pip should grap the right packages for whatever version you have, but can sometimes get bugged if you have both python 2 and 3 installed

ancient hornet
#

I have python, python3, and python3.11

woven canopy
#

pip --version?

ancient hornet
#

Pip 22.3.1

woven canopy
#

I knwo I've run into odd issues with fresh installs that came with old versions of pip

#

but that's the latest, so huh

ancient hornet
#

Oh lordy

woven canopy
#

python3 -m pip install -U pygame --user works for me fine, even on an RPI that never had any updates so... hmmm

#

(that's the specific install line given on pygame's getting started)

#

Oh wait you've got 3.11, seems Pygame doesn't support that

ancient hornet
#

W h a t

woven canopy
#

do python --version

#

it 3.11?

ancient hornet
#

Y e s

ancient hornet
woven canopy
#

tells you what exact version of Python you have. If you're truly on 3.11, you might be able to do pip install pygame --pre to get the development version of pygame for python 3.11

#

Or you might have to downgrade your python to a 3.10 version

ancient hornet
#

Ima try —pre

#

IT FREAKING WORKED!

woven canopy
#

must have had 3.11 then

ancient hornet
#

I thank you Nikarus

#

You are a huge help!

tidal vigil
#

I'm making a map that is effectively 2^64 tiles squared. I'll be loading the map into much smaller chunks so they're more easily manageable and not memory intensive. I don't want to have to generate the entire noise map and keep it in memory or store it in a file, I'd like to be able to seamlessly generate noise from that initial seed that is a small subset of the overall map at runtime.
Will perlin or simplex allow me to take a seed and use an offset off of that noise generation so I can generate chunks as needed?

icy dawn
olive basin
#

Hey, anyone else getting huge frame drops when moving the cursor in pyray ? I have a basic game setup to test and whenever I move the cursor I go from 5 000fps to 300fps.
Is it inevitable or is there a way around?

olive basin
olive basin
# tidal vigil I'm making a map that is effectively 2^64 tiles squared. I'll be loading the map...

had the same problem as you, was using the perlin-noise library, it could generate and "infinite" amount of noise but it was really slow, about 8ms (on a ryzen 5 2600 and 24g on ram) to get a 16x16 chunk of value, 8ms is half the frame time required to run a smooth 60fps, just to generate a chunk.
Using the noise library resulted in much faster speeds tho you are limited to the size of the noise you generated, and it gets big in memory so I don't think you would want that.
Tho today I stumbled upon a video about "Cellular Automata" https://www.youtube.com/watch?v=slTEz6555Ts&t=795s
and another one by the same guy about "Diamond Square and procedural map generation" https://www.youtube.com/watch?v=4GuAV1PnurU&t=55s
Did not try to implement those yet but you might be able to get it to work for your project.
I don't know how minecraft does it, haven't looked through the code yet but it would be very insightful.

versed aurora
#

numpy lets you do perlin noise fairly easily

dawn quiver
#

is there open-simplex noise module?

vagrant saddle
frosty walrus
#

Hello, I have a question for file management. I'm creating my first object-oriented Python project with pygame I'm creating a board game for the moment I have segmented the work into 4 files Main.py Pion.py config.py map.py
I wonder if I should use main for looping display and interactions + the game engine or segmented again this?

lucid zenith
idle plank
#

hello

#

I got another problem

#

pygame.error: font not initialized

#

import pygame
#Veriable
black = (0,0,0)
white = (255,255,255)
blue = (0,0,255)
fps = 60
circle_x = 300
circle_y = 300
circle_x_dire = 5
circle_y_dire = 8
#screen
pygame.display.set_caption("Balls")
screen = pygame.display.set_mode((600, 600))

timer = pygame.time.Clock()
font = pygame.font.Font("freesansblod.ttf", 20 )
score = 0

def update_ball():
global circle_x
global circle_y
global circle_x_dire
global circle_y_dire
global score
if circle_x_dire > 0:
if circle_x < 570:
circle_x += circle_x_dire
else:
circle_x_dire *= -1
score += 1
elif circle_x_dire < 0:
if circle_x > 30:
circle_x += circle_x_dire
else:
circle_x_dire *= -1
score += 1
#y

if circle_y_dire > 0:
    if circle_y < 570:
        circle_y += circle_y_dire
    else:
        circle_y_dire *= -1
        score += 1
elif circle_y_dire < 0:
    if circle_y > 30:
        circle_y += circle_y_dire
    else:
        circle_y_dire *= -1
        score += 1

#main def
def game():
running = True

while running:
    #screen
    timer.tick(60)
    update_ball()


    screen.fill("light blue ")

    #ball
    pygame.draw.circle(screen, blue, (circle_x, circle_y), 30)
    update_ball()
    score_display = font.render("Score:"+ str(score),True, white, black)
    screen.blit(score_display,(10,10))
    pygame.display.flip()
    #exiting

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

game()
pygame.quit()

#

this one I don't understand I have copied the tutorial code but doesn't works

dapper heron
#

hi , im trying to make an arrow that points out from the player towards the mouse. ive achieved making it spin according to mouse position (kinda) but im struggling to make it smooth and whatnot. any help would be appreciated :)

#

`class arrow(p.sprite.Sprite):
def init(self, mpos, x, y, scale):
p.sprite.Sprite.init(self)
img = p.image.load("IMG/dasharrow.png")
self.image = p.transform.scale(img, (int(img.get_width() *scale), int(img.get_height() * scale)))
self.rect = self.image.get_rect()
self.rect.center = (x,y)

def draw(self):
    screen.blit(self.image, self.rect)

def point(self):
    self.x, self.y = self.rect.center
    mouse_x, mouse_y = p.mouse.get_pos()
    rel_x, rel_y = mouse_x - self.rect.x, mouse_y - self.rect.y
    angle = m.atan2(rel_y, rel_x)
    angle = (180 / m.pi) * -m.atan2(rel_y, rel_x)
    img = p.image.load("IMG/dasharrow.png")
    self.image = p.transform.rotate(img, int(angle))

dasharrow = arrow(0, 1000, 1000, 0.5)

run = True
while run:
dasharrow.draw()
dasharrow.point()`

dawn nacelle
# idle plank hello

There are two errors:

  1. If you are going to use a specific font, you have to initialize the font system. After the import pygame, add this line:

pygame.font.init()

  1. The name of the font in your statement that defines the font is spelled incorrectly. Instead of freesansblod.ttf, it should be freesansbold.ttf (switch the l and the o)
tawny heron
idle plank
#

thank you all for taking the time to check my code I appreciate it

cold storm
#

100% procedural

#

geometry nodes off ->

viral oracle
#

I need help in my help request, enemy car not spawning thanks

mortal elk
#

im making a thing with pygame and i want the program to cycle through the frames of a png with controll over how fast it completes going through the frames

so i have a counter that increases each frame and was trying to use the mod operator to figure out what number of frame it should be on each fps frame.
but im not sure what maths i should use to keep it within the number of frames without messing up the loop and with repeated frames.

its ment to cycle through all 8 frames within the one second (or 30 frames) but idk what maths makes this work (two seconds if the speed variable is 2)

#

import pygame
from sys import exit

pygame.init()

screenwidth = 1000
screenheight = 500
fps = 30
screen = pygame.display.set_mode((screenwidth,screenheight))
clock = pygame.time.Clock()

class sprite():
def init(self,position = (0,0),#top left
frames = 1,#1 to 8, maximum frame number to incriment to
finalsize = (100,100),
pngname="missing.png"):#missing texture is default texture
self.position = position
self.frames = frames
self.finalsize = finalsize
self.pngname = pngname

    self.immage = pygame.image.load(self.pngname)#loads with transparency
    self.immage = pygame.transform.scale(self.immage,self.finalsize)#scales immage to finalsize
    clear_surface = pygame.Surface(finalsize).convert_alpha()
    clear_surface.fill(0,0,0,0)#transparent surface made
    self.immage = clear_surface.blit(self.immage,(0,0),(0,0,finalsize[0],finalsize[1]))


def frame_incriment(self,speed= 1):
    #if speed 1 frames should cycle every 1 second.
    frame=animationcounter%(speed*fps)#doesnt work
            #1 % 30 = 1
            #2 % 30 = 2

            #1 % 60 = 1
    
    frame = (animationcounter % self.frames)+ 1#doesnt work as intended

activesprites = ["apple","banana"]
animationcounter = 0
animationloopreset_frames = fps*5#every 5 seconds the animation counter resets
while True:
clock.tick(fps)
animationcounter =+ 1
if animationcounter > animationloopreset_frames:
animationcounter = 1

for event in pygame.event.get():
    if event.type == pygame.QUIT:
        pygame.quit()#shuts pygame
        exit()#ends code
    #pygame events here, buttons change activesprites
        
#put things on screen, make list of things to show
screen.fill((255,255,255))
for item in activesprites:
    print("drawing sprite:" + item)

pygame.display.update()
#

the active sprites list will contain the sprite objects that are being rendered. this hasnt been implimented yet

#

so what line would I need in the frame_inciriment function to give a number within the 1 to self.frames range that completes a full cycle within the speed values number of seconds
which takes into account the fps variable

#

TLDR: i have these variables
animation_loop which increases every frame
self.frames which is how many frames the png immage contains
speed which is how many seconds it should take to loop through all frames in the immage
fps which is fps
and i need to use operands to get an output that cycles 1 to self.frames every speed seconds
SOLVED DONT BOTHER NOW

solution was

splicedframe_number = int((((animationcounter%fps)+1)/fps)*self.frame*speed)
        if splicedframe_number == 0:
            splicedframe_number = self.frame
marble jewel
#

Not sure if this is the correct place for this but here goes: Just made a youtube channel and uploaded a video introducing my game. Written in python using pygame. Would love some feedback and comments. Let me know what you think.
https://www.youtube.com/watch?v=uLrOdBrCHvU

This is a new game I'm developing code named Big Chungus. The game has been developed in Python using Pygame. Tell me what you like, don't like, what you want to see, etc. Thanks for watching.

▶ Play video
dawn quiver
#

Cool game :)

marble jewel
#

Thanks, still very much a work in progress, let me know if you have questions or comments and want to see something implemented

meager plover
#

have you try stuff of event on pygame that can place a quey to post it and monster was respawn with a.i you make

obtuse patrol
#

Anyone know how to combine scrolling and raycasting?
I am working on a game like among us , i have both algorithms working pretty well SEPERATELY.

marble jewel
meager plover
marble jewel
#

Thanks

viscid maple
#

Just wanted to share the first free open-source game of the Indie Python project. It is at an early stage of development, but you can already play a prototype.

Relevant links:
source - https://github.com/IndiePython/bionic-blue
website - https://bionicblue.indiepython.com
reddit announcement - https://www.reddit.com/r/Python/comments/10jbbik/bionic_blue_free_opensource_action_platformer_game/

GitHub

Action platformer game where a bionic boy protects humanity by fighting robots (by Kennedy Guerra) - GitHub - IndiePython/bionic-blue: Action platformer game where a bionic boy protects humanity by...

fossil sail
#

Hey, whats the best way to learn how to create games in python? I am required to create one for my school's final project and i want an A*

viscid maple
#

IMHO, the best way varies from person to person and it also depends on what you want to achieve as well.

Since you want to make a game for your school project it is best that you play safe and make a simple game. I recommend something like an endless runner like (Canabalt) or a star ship shoot'em up (like the R-Type game). It will probably be better if you start from a templates/example code and develop your game on top of it, little by little. Mr. Paul Craven has great example code. His platform examples should probably be a good fit to develop an endless runner on top (http://programarcadegames.com/index.php?&chapter=example_code_platformer).

As for learning resources, it also depends on how you learn. If you like texts/books and have time, Al Sweigart books have good reviews. If you don't have much time, an online tutorial might be a better start, like the ones in Real Python (https://www.google.com/search?q=real+python+pygame&oq=real+python+pygame)

I never learned pygame from videos, but today there's a lot of detailed videos on youtube as well, search youtube for "DaFluffyPotato pygame" and "clear code pygame".

lament vault
frozen arrow
#

does anyone know how to make a hitbox in pygame?

wispy sorrel
versed aurora
#

braille but i added color!!!!!1

raw falcon
#

how did you do this

versed aurora
#

ansi codes and braille

raw falcon
versed aurora
#

i wanna rewrite it first then sure

dawn quiver
#

I am working on a game and gonna switch to python. C has been painfull to use and this game should run fine as a python app

versed aurora
#

try to keep the images small or it freaks out

#

also you need to use a font that supports braille

#

not much i can do about it

true goblet
#

is there a way of having continuous click detection in pygame instead of the game checking for mouse input every frame, which is quite slow

vagrant saddle
#

human finger has a reaction time around 150 ms

#

normal frames are 16ms

true goblet
#

nevermind I found a solution

#
            if self.editMode:
                if event.type == pg.MOUSEBUTTONDOWN and pg.mouse.get_pressed()[0]:
                    self.isPlacingTiles = True

                elif event.type == pg.MOUSEBUTTONUP:
                    self.isPlacingTiles = False

                if self.isPlacingTiles:
                    mousePos = Vec(pg.mouse.get_pos())

                    mousePos /= SCALING_RATIO
                    mousePos //= TILE_SIZE

                    self.level.map[int(mousePos.y)][int(mousePos.x)] = self.editorTileIndex```
viscid maple
# true goblet ```py if self.editMode: if event.type == pg.MOUSEBUT...

Oh, I see what you're trying to do here. Just a small suggestion: I don't think pg.mouse.get_pressed is needed here, since the mouse button events already have info about which mouse button was pressed/release in its button attribute:

            if self.editMode:
                if event.type == pg.MOUSEBUTTONDOWN and event.button == 1:
                    self.isPlacingTiles = True

                elif event.type == pg.MOUSEBUTTONUP and event.button == 1:
                    self.isPlacingTiles = False

                ... # rest of the code
true goblet
true goblet
#

finally got my lil tile editor to work

#

it's now able to save levels

#

now I should probably add support for different tile layers

#

e.g. for trees, furniture, doors

upbeat whale
#

can anybody help with an issue in pygame?

fallow finch
#

ye

upbeat whale
#

needs help restarting the game code after the play again button is pressed

fallow finch
#

do you have states in your game

upbeat whale
#

its not mine i was helping

#

@placid kite

fallow finch
#

you should start implementing different states for main menu, pause, ingame, ...

upbeat whale
#

i think they did

placid kite
#

i do have states

fallow finch
#

mmh so your code isnt using classes

placid kite
#

not allowed classes or sprites

fallow finch
#

it's possible to do a game without the classes but i don't recommend this

placid kite
#

i didnt cover it in class

fallow finch
#

bruh

placid kite
#

thats what i said

fallow finch
#

you have to make something in pygame but you don't know classes ?

#

your teacher is bad i guess

placid kite
#

yeah

#

no they changed the curriculum

upbeat whale
#

i aint even got a coding class in my school

placid kite
#

yeah we have a JS python andjavaa

fallow finch
#

so, to make a game with different states, you need to test events differently depending on the state

#

pressing Esc during ingame or clicking a button to go back to menu when a level is finished should change the state to main menu

placid kite
#

i have that for right click

fallow finch
#

right click does what in which state ?

placid kite
#

it does it in all of them returns it to main menu

fallow finch
#

it should be Esc imo

placid kite
#

the problem is when i call the state in the play again it doesnt reset to how it was in the beginning

fallow finch
#

and don't do this for loading, branding, pause...

placid kite
#

the pipes, bird position etc basically all the functions

fallow finch
#

you have to reset the game when clicking play

placid kite
#

how

fallow finch
#

i mean start a new game

placid kite
#

thats what ive been trying to do

fallow finch
#

implementing handlers for each part with methods to reset/update things is easy but you need classes

#

you can do it without classes but code will be messy

placid kite
#

do you know how to do it without classes

fallow finch
#

you use global variables

#

which is bad

placid kite
#

i see

fallow finch
#

this is a solution for simple apps but for medium sized projects it's already too messy

placid kite
#

thats my problem its messy but its due tomorrow for me

fallow finch
#

like, imagine implementing in-game windows that can call other in-game windows

#

and the right code to revert the actions

placid kite
#

so what do i do about this

fallow finch
#

don't use too much states, that's all

#

until you know classes

placid kite
#

the teacher said we have to use states for the menu idk

fallow finch
#

yea but don't do branding, loading with a bar, pause menu, ...

placid kite
#

i dont have that im pre sure

lusty burrow
#

Could someone help me figure out how to use this tileset in Tiled?
https://opengameart.org/content/castle-platformer

#

I tried uploading it to Tiled's tile slicer with these settings but it didn't quite crop the tiles how I need them to be

raw falcon
#

maybe cut them out manually?

gleaming bobcat
merry arrow
sly quail
grand apex
#

https://replit.com:/@G1NGERN1NJA/A-Simple-Text-Based-Game?s=app

Finally finished this game. It was supposed to be a quick project to get better at using threads but it ended up taking hours lmao

G1NGERN1NJA

Run Python code live in your browser. Write and run code in 50+ languages online with Replit, a powerful IDE, compiler, & interpreter.

raw falcon
vagrant saddle
grand apex
mild forum
#

I wish I can learn pygame
It's so confusing

#

To me

mild forum
# marble jewel Not sure if this is the correct place for this but here goes: Just made a youtub...

Lol when I learn pygame
I am going to make a game that looks similiar to this
My idea is:
To make a game where everything is possible
An very advanced survival, fantasy, adventrue sandbox game
There is no rules
You create your own rules while you are surviving
When I said everything I really mean everything.
I will make an artificial intelligence.
You will have a notebook where you can write anything and whatever you write will happen, for example create a tree
Like chatGPT and these text to image a.i.
When you write create a tree a.i. will read it and draw a tree
Also the camera view is going to be same.
And it will be infinite open world.
There will be a multiplayer too with chat and voice chat too.
I will find a free cloud provider to host a server for multiplayer game.
Not copying your idea
I got this idea few months ago.
We just have some stuff in common with out games.

marble jewel
#

Great, get started and post your progress here

mild forum
#

Okay

#

I made just few pygame projects for practice 😭
I didn't use pygame for few weeks and I already forgot how to use it
I made fake dvd screensaver, snake game, pong game, dragging square with mouse, moving square with keys
And I forgot how to make it all again.
I need to practice more and again
The most confusing parts to me are surfaces and sprites
I was trying to understand it for MONTHS
I WAS SEARCHING WHOLE INTERNET
ASKED THIS SERVER, OTHER SERVERS AND EVEN PYGAME SERVER
and I never understood surfaces and sprites

grand apex
mild forum
#

I know

#

But I love doing stuff that sounds impossible to do
I already did many "impossible" stuff

raw falcon
#

artificial intelligence is unpredictable

#

@mild forum by the way, what you're making sounds exactly like scribblenauts

tiny talon
# mild forum Lol when I learn pygame I am going to make a game that looks similiar to this My...

idk if you have experience with programming before, but be prepared to spend at least 6months to 2 years on that.

you might wanna watch some dev logs like Equilinox's to get a better grasp of what it's like to develop games without a premade game engine (Eg. Unreal Engine, Godot, Unity, etc.)
https://www.youtube.com/@ThinMatrix/playlists
https://www.youtube.com/playlist?list=PLRIWtICgwaX1gcSZ8qj8Q473tz7PsNmpR

Try to look at walking simulators

dawn quiver
#

2 years 💀
I've been using pygame for over 2 years now and created over a dozen (mostly unfinished) games with it
No one I know, let alone myself, is even close to capable of building what you're describing

#

When you do finish creating this ping me

mild forum
#

I am just new to pygame

#

But pygame doesn't look too complicated

vagrant saddle
vagrant saddle
mild forum
#

I am tired of 3d

vagrant saddle
mild forum
#

LOL

#

That game is just going to be like very advanced 2d minecraft

#

First of all I will need to make a character and map
Map is going to be infinite and open world.

#

Then I will add that notebook thing (without any function, just writing)

#

Then I will make that a.i.

#

After that I am going to add game menu
And game tutorial

#

Then I will make a server for multiplayer game

#

Also chat and voice chat

#

Yeah my idea is very, very crazy

#

And I am crazy

#

But I love doing stuff that sounds impossible to do.

#

And I promise to myself
That I am gonna make that game

vagrant saddle
#
mild forum
#

What is that

vagrant saddle
mild forum
#

Interesting

#

Wanna know what inspired me?

#

@vagrant saddle

vagrant saddle
#

i can't know for sure until you say it

mild forum
#

Ok

#

So
Humans inspired me

#

Our imagination

#

Imagination is fantastic, isn't it?

#

Why can't we turn infinite imagination into 2d game?

vagrant saddle
#

sure but putting imagination - on the fly - into a computer with only a keyboard and mouse is not really user friendly ( unless you know how to code/design AND have imagination which is a lot )

#

just saying ...

mild forum
vagrant saddle
# mild forum User friendly?

you said "When you write create a tree a.i. will read it and draw a tree" => to me player will only get a random tree

#

people want the tree in their imagination : how do you solve that interface

#

"draw me a sheep" ( le petit prince , Antoine de Saint-Exupéry )

mild forum
#

Hmm
You are right

#

I should add and option

#

Use a.i. to draw items for you

#

Or draw it by yourself

#

@vagrant saddle you are a smart man

#

Thank you so much!

vagrant saddle
#

yw

mild forum
#

Everyone
Listen
If you think that I can't make that game, then shut up.
I can.
I will do it because that is my goal.
I never give up on my goals

idle plank
#

hello

#

I have a problem with my score system

#

so I have two scores one in the game:

#

def display_score():

score_time = int(pygame.time.get_ticks() / 100) - start_time
score_surface = font.render(f'Score: {score_time}', False, (64, 64, 64), )
score_rect = score_surface.get_rect(center=(400, 50))
screen.blit(score_surface, score_rect)
#

this how it look like:

#

and another one when you die

#

score = int(pygame.time.get_ticks()/100)

#

for some reason, the game over score is always 1

#

could someone spot the error?

#

#font game over
font2 = pygame.font.Font("font/Pixeltype.ttf", 100)
font_gameover = font.render('GameOver' + "YOUR SCORE:" + f' {score}', False, (64, 64, 64),)
restart_font = font.render('Press "R" To Restart The Game!' ,False, (64, 64, 64),)
game_font = font.render('The Sweaty Camel' ,False, ("brown"),)

idle plank
#

never mind i was just dump

dawn quiver
#

hey

#

help me pls?

#

@inner mirage

potent ice
marble jewel
raw falcon
#

also @mild forum have you seen scribblenauts

#

it's also 2d and has a notebook

#

where you can type anything you want

solemn fossil
# versed aurora braille but i added color!!!!!1

That's pretty wild, amazing how well it works! Would be a nice addition to some of the ascii terminal browsers out there, to improve how they display images.
Tho even after looking at your code, I have no idea how you manage to get the braille to line up along diagonal edges. 😮 Impressive! Makes me wanna figure out those braille unicode characters for projects of my own. 😉

solemn lynx
idle plank
orchid igloo
#

anyone here?

marble jewel
# idle plank cool how much time did it take?

I've been programming this off and on for a few months, most of the work has been me rewriting various pieces of the game as needed. There are a lot of systems that are at work that are not necessarily visible or a apparent in the videos. At some point I might do a more technical video but I'm still learning the screen recording and video editing aspects

ocean agate
#

does anyone have any
on simple code for a not so complex game

#

@marble jewel do you have a youtube or something where i can veiw

marble jewel
#

only 2 videos thus far, I'm going to try and put out a weekly update

golden quartz
#

depends on the game and what library you're using

dry cloak
#

quick question

is there a way to get the framerate the monitor is running at in pygame

i would like to cap the framerate to whatever the actual screen supports instead of just having no cap

i tried consulting google but all my results are 'how to show the current fps in pygame', not how to get the monitors maximum framerate

golden quartz
#

There should be, yes. Give me a moment to dig through my last PyGame projec

#

It appears that there is not a reasonable built-in way to do this, even in the latest version pygame. You might have to rely on external modules to determine the display's maximum framerate

dawn quiver
marble jewel
#

you might be able to call the C functions SDL_GetDisplayMode and SDL_GetCurrentDisplayMode to determine the refresh rate of the current display mode but I have no idea how to directly do this via pygame or if you would have to write your own wrapper

golden quartz
golden quartz
dawn quiver
warm sparrow
#

question: what game engines allow you to code in Python?

golden quartz
#

Not sure if this is what you mean, but Python has PyGame (best for 2D games), Pandas3D (difficult to learn. Supports 3D), and Ursina (really good for 3D games, supports 2D games quite well, easy to learn). lmk if you mean a game engine like Unity or something

sweet shard
#

There's also Arcade for 2D games

#

Which is very beginner friendly

golden quartz
idle plank
#

did you find one?

vagrant saddle
#

also did you mean soccer ? 😄

vagrant saddle
#

tuto/models/source

marble night
#

Any way to develop a game on mobile phone?

#

Like rpg maker for mobile

#

So i can do it while laying in my bed

vagrant saddle
marble night
#

Nice thx

summer plinth
#

Hi I am new to python. I'm 55 years young and looking at learning programming. I would like to convert a few of the old text based adventure games off the BBC Micro into python. Does anybody have and idea if there are any websites that could help me to write adventure games.

sweet shard
# summer plinth Hi I am new to python. I'm 55 years young and looking at learning programming. I...

Are you planning on the games still being text based games? If so https://docs.python.org/3/tutorial/index.html would be a great resource for learning programming

summer plinth
jaunty mulch
boreal wraith
#

Are there any capable engines with python support? I just saw this channel and didn't know of any.

sweet shard
#

Panda3d, Ursina, Pygame, RenPy, Evennia, and Arcade are all capable engines with Python support

#

I know someone is working on Python bindings for Godot 4 if having an editor is more of your thing but I'm not sure when they'll be finished

golden quartz