#game-development
1 messages · Page 6 of 1
I've done some 3d stuff with it but I'm well out of my depth to make my own thing there
youd want to use opengl not vulkan
yeah most likely
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
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
Is pygame good
yeah, there's an example of that here: https://github.com/pokepetter/ursina/blob/master/samples/rubiks_cube.py
Any tutorials for pygame
I know nothing about python
I started with the freecodecamp beginners tutorial
Videos or websites
youtube video
Could you send me the link to it pls
does pygame support python 3.11.1 ?
yeah 3.12 git too
Interesting. My laptop throws an error that it cannot generate metadata when installing pygame
you should open an issue detailing what os etc ...
it's here https://github.com/pygame/pygame/issues/
maybe your 3.11.1 is the same as 3.11.0 issue https://github.com/pygame/pygame/issues/3522
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?
is there some sort of fork of pygame
Tq that's helpful
Do all online games store player data in memory? Or can it be stored in packets over the network as well?
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?
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
im having problems rendering textured quads
lemmie get code and put it into hastebin
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
@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
this looks like legacy opengl code
like what?
heres the screenshot
i dont want it rendering like that
I can't say for sure
the best guess i have is that there is something wrong with the image format translation
yeah sorry idk
https://replit.com/@PhoenixFinance/BlackJack-Text-Game#main.py
If anyone is mega bored feel free to critique my first attempt at a game.
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)`
`
How's pygame for simple 3d
it can do wolfenstein and doom types
early wolfenstein and doom
beyond that I have no idea
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
hello, please don't ping random people for help
okay sorry
be patient, and someone may be able to help you in time
You need to indent the code, inside of the if statement on line 102/103 and 105
what does that mean?
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)
👍
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()`
\
Pretty cool!
llol
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
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
You need photoshop for textures right ?
hey is it possible to only load a certain part of an image with pygame?
You can render a certain part of an image with The blit function from pygame docs says.
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.
It's from this check during surface creation I guess : https://github.com/pygame/pygame/blob/be3702014dec5db836c89f417a10390a1dc695e2/src_c/surface.c#L520-L531
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;```
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
I decided to do something dumb since I was doing nothing over this break and did something: https://replit.com/@TharunDhanabal/Dumb-Game?v=1
Is there any game Dev here?
yes
cool
Hello, is there anyone with a Twitter developer account here?
Signify so that I can message you 🥺🥺
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 :))
It's the first one on the first pic,
i guess you need a "and" instead of a "or" in the while condition if you want any empty deck to break the loop
Okay ty i will try
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.
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?
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
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
I am using threading
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
if you mean making games with python from inside a visual editor then upbge / harfand3d studio / various unfinished panda3D editors. but otherwise a simple text editor is usually enough to begin with any python game engine.
Hi everyone, I'm currently working on my bus game that I made with pygame ^^
here is the link : https://paste.pythondiscord.com/uvorebuden
the tkinter version : https://paste.pythondiscord.com/etawekesay
the files
here is the files of the game ⬆️ ⬆️
also I forget this one :
There are no many things that works, but the bus is moving and the sounds works and I am working to expand it ^^
hey guys, i want to make a ipv6 tcp socket in python and connect from different networks.How can i do that?
its going to be in 2d so which one would you reccommend
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
it can also be done with tkinter?
or only 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
like this?
yea i have pycharm on my pc
this came up
Sorry but i don't know what this error is
yea dont worry abt it
I will sen a video
k
and after that you will have pygame in pycharm
and i can just start coding like that?
Yes
alright
do you know a good tutorial to start with, like wasd movement and importing assets
Yes
could you please send
Ye
This is a new series on my channel where I am going to be going through the pygame module in python. Pygame is used to make games and is also useful for making software and other types of programs. In this first tutorial I show how to set up the screen and implement basic character movement.
⭐ Kite is a free AI-powered coding assistant for Pyth...
whenever i hit run the window just instantly closes
It's supposed to happen.
Just follow the tutorial
And you will see how to not make it close instantly
oh ok
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
I'm starting a project I wanted to ask if I were to create a game how should I structure the folder?
continue```
You're skipping every event except for "QUIT". You need to change run to False when you have the QUIT event, and process the keys otherwise
if event.type == pygame.QUIT:
run = False
continue
it still wont work
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?
try this
pip install pygame --pre
what does --pre mean?
nw
no idea stole it from this dude 💀
lmao
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
wdym? could you clarify
hmmm
ive never done that
so where does the output go?
if not the terminal
ion know lets find out
You can just clear the terminal at the start of the program if it bothers you
import os
os.system("cls")
the correct way is ```py
import os
os.environ["PYGAME_HIDE_SUPPORT_PROMPT"] = "quiet"
import pygame
gotchya thanks
lmao it is like telling Pygame to shutup
shutup = "BE QUIET"```
Also when saving the file change the .py to .pyw for hiding the console when opening the game
it does change behaviour, though? it disables the console when opened (because they are opened with pythonw)
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
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
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?
nice, that looks really cool
thx
idk just screw around
maybe try procedural texture generation or somehting
thats always fun
is terminal game allowed here?
yeah
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
You can use any transparent overlay png image and just blit on the surface
`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
you can just clear at the start of the program
oh nvm someone said that
Join my discord server : https://discord.gg/3qfQ8nQ6HB
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?
What kind of 2D game?
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...
If tile-based, https://www.mapeditor.org/ is standard.
An abstract top-down game with polygons, perhaps with some predefined props
Tiled seems to support that
does it have polygons though?
Do you have any link for a tutorial or sth? Never done this before
So you want to be able to place objects around? I would just make your own / make it built into the game itself. Editor/game as one thing, can switch modes (bring up the editor tools / GUI while in-game).
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)
yeah that might be the way
my frontend will be in the browser (via websockets) so it's not that bad
im trying to get some help with the hypxel api is this the best thread for it?
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?
you need to pump the events in the while(status) block
also maybe have a look here https://github.com/furas/python-examples/tree/master/pygame/drag-rectangles-circles
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
why is that?
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.
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
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.
No problem. If you want to see a preview of a game I'm working on in my spare time, check this out:
Thanks. Gotta go. Good luck.
Hi, friends. I'm looking for a function for breakvector in Unreal Python. How do I approach using breakvector features in Unreal Python?
It was solved by decomposing the components with float using the Unreal Math Library without using breakvector.
x_scale = unreal.MathLibrary.abs(world_scale.x)
y_scale = unreal.MathLibrary.abs(world_scale.y)
z_scale = unreal.MathLibrary.abs(world_scale.z)
When I have an image with transparent and non-transparent parts, how can I make it so that only the non-transparent parts collide?
Or do the transparent parts get removed automatically and therefor won't collide in the first place?
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?
Hey @versed cedar!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
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.
If paused, don't add anything to fall_time, and ignore user input to move the piece. In other words, just don't do anything.
Since in a program nothing happens unless you make it happen.
Can still draw the scene though.
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)
you guys are so good at this
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 😄
Activate Windows
Go to Settings to activate Windows.
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
Whats a good pixel art size for newbies?
Thank you very much!
Tho I think that I need a different approach with perlin-numpy cause it only can generates so much noise but with perlin-noise it's much less limited, I might just have to switch to c++ for the things I want to make in the future
it works! thanks again, now I have to scale it up 😄
Am i able to make 3d game in pygame
You could, but you'r going to get really really poor performances
16 to 32x
32x32 is great but challenging. x.x gonna stick with 16x16
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
Your welcome and good luck
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?
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
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?
nope
but yeah just make sure when you install python, to also add pip. There are videos on it
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
hm
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
i guess just 'maximize points'
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
ensurepip exists
Ok thank you
ooh, that looks like a very nice idea to me because it means you will make the player intimately familiar with centrifugal and coriolis forces (if you make the rotation rate noticable enough)
which aren't super intuitive, so it'd be a pretty unique experience
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
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
how would I make a game using pygame that can accept new texture packs of different resolutions?
Are you meaning the bit where they'll kinda stick to eachother? Using the code you linked, I am not seeing any overlap but they do seem to stick to eachother quite a bit.
yes yes
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
how so
distance between the balls is smaller than the sum of the radius
Ok so you are intending for them to overlap then, as you also calculate the overlap
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
https://www.petercollingridge.co.uk/tutorials/pygame-physics-simulation/collisions/ I've been following this link
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
Alrighty
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
JSON isn't a database structure, prefer SQL for instance
@neon tinsel #discord-bots message interesting insight
I'm back btw
I don't mean storing item data
I mean storing default values
for example: each items sell value, formatted name, type, rarity, etc
So am I, you mentioning dinner made me realize I ain't eaten in like 12 hours
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
Actually 79/80 aren't even doing anything, can comment them out and the code works the same
mmh
Why not?
I think most people uses C# but it doesn't mean you can't use python
due to the efficiency
you can make great stuff in Python
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
I've researched a bit and in Internet I found people complaining about the efficiency of code in python
that's not new
It depends on what you're going to be making
Wanna make an MMORPG or a fast paced FPS, probably not the best language
Is speed really a big problem?
"It depends"
LMAO
I got something similar once as well
we created roundabout basically
I've written myself a bunch of DM tools for TTRPGs in python, 1 of them is a World>Terrain/Resourrces>Population>Settlement generator
alsoo
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
is py good for embedded systems? IoT etc?
However, it took me weeks to make it in C++, whereas here in Snek language, was an afternoon porting it over
Would you prefer c++ or python in general?
Python
Why?
more user friendly maybe?
that's for beginners though
Because it's fast to write and work with. There's libraries for everything under the sun, and they're stupidly easy to use.
I ain't no beginner and I still use Python because it's really enjoyable to use
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.
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
Hey guys, what would be the best way to store default item values for a python project?
Like when difining a function?
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
So somewhere in your code you've got an `open('data.json') right? (replace data.json with whatever filename)
Yeah, and I have the different types of items in different files
but that brings up issues
Ok so you've got like 3 different objects you're storign your 3 different .jsons in?
(hypothetically)
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
Can you add the filename as a line within the json itsef
Then you can do crops.filename
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
Is there support for Android on ursina
Like a unofficial Android additions package or something
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
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
k
I also have tools that all have their respective stats in another JSON file
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
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
Exactly
And your inventory system doesn't know that corn is a crop and not a tool?
I mean each items key does have the type of item it is
for example, an items key might be "CROP_CORN"
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
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
Yeah that's an idea
Other idea if you don't wnat to "hard code" all the filenames like that
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"
}
I'm not sure, just wondering what the usual route is
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
I see
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
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.
Perfect
I wish I could find a good example for good file structure / naming conventions etc
@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)
Looks good to me
might just want to put a bit of error handling in there incase 1 of the files is missing
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
Welcome to part 1 of this tutorial! This series will help you create your very first roguelike game, written in Python!
This tutorial is largely based off the one found on Roguebasin. Many of the design decisions were mainly to keep this tutorial in lockstep with that one (at least in terms of chapter composition and general direction). This tut...
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
What ended up being the problem?
??
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()
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
aah
yep that would cause some head scratching. Well good on you figuring it out and good luck.
I mean, there's dozens online. I started with the Free code camp 6hr youtube video for intro to python.
penis
real
https://youtu.be/zTxvCBODCv4 my first devlog for my 3d game ported almost completly to godot 4.0 😄 subscribe
Here is my first quality devlog about my progress on godot 4.0 facing my challenges and restructuring code, come join me on my adventure and subscribe to my channel. Its about a sword fighter adventurer that fights enemies zelda/dark-souls type of game.
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
awesome
my snake rewrite is now fully functional, i just wanna make it look good now
it's as long as the original now
nice
I think its pretty much done, i’ve spent the last several hours doing nothing except writing it pretty much
Cool
Why cells are rectangular, not square? It looks ugly IMO
text graphics, i don’t really want to bother doubling everything up
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
Yeah I think so too. The game could work in 3D or 2D but I cannot envision good combat. If an enemy chases you then you will want to jetpack away from them. In 3d you would have no view of the enemy untill you turn around to face them. So making good controls and enemy design would be important aspect especially in 3D
Which game is this
just something i threw together as a test
i literally just wrote it from scratch
pygame is pretty good though
im gonna try out nurses, it seems really good
nurses?
i really ought to make my own terminal thing at some point
would it be as good? no
but it would be mine
Huh, never heard of it, frankly I thought you were mistyping "curses"
honestly yeah i wanna write my own thing
TBH making a few crappy terminal games has been one of the most personally rewarding things
i make terminal stuff but usually it's just from scratch each time
im pretty proud of the snake i did
Ya like roguelikes?
well , i play dwarf fortress so maybe i guess
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
making a topdown game
@versed aurora hey bro can i have your game codes for my school project
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??
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.
wow. That has some great potential
haven't seen an enemy wave centered game in a while
U made it from scratch?
Which language u made it and what software
yeah
now that i know how to do proper mouse input i cna try doign some fun stuff
Python & Pygame
Also its prob not easiest to do it this way, i’m just weird
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
maybe, do you use input() or do you read raw keyboard (like eg with msvcrt.getch() ) ?
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.
Polished up the slime a bit and added a shotgun
based msvcrt user
hmm so no, nothing yet but should be soon
https://discord.com/channels/267624335836053506/1064121200516804728
Does anyone know what I have forgotten?
wow
Are folks interested in more game engine options or does the ecosystem feel pretty full?
game dev challenge: make a game that only uses the title text of the window as a display
wow I want to make game can u tech me how u did this
Reinventing muds I see
i forget what that is
Basically like text based mmos/rpgs
ah
like rogue i guess
honestly though i like doing text graphics prob cause of dwarf fortress (rendering text graphics is also slightly easier)
Honestly I never was able to do ascii graphics, tile sets are where it’s at.
I do want to make a DF clone tho.
yeah i usually rock phoebus, though i can generally tell whats going on in ascii
of course df is sort of fake text graphics; it uses a spritesheet of characters
Sounds fun, though painful
could I make like custom font sprites for letters or no
i would say thats fine
Dang what could I even name this game
no clue
search history rn: words with every letter in alphabet
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
I'd probably just make each letter that I use an image, instead of a font system
I might try doing the challenge sometime, maybe a sort of dino game thing using braille for the display
Braille, thinking outside the box
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
neat
there are braille modules (drawille, for one) but i’m too prideful to not make stuff myself
I mean making stuff like that yourself is good practice
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)
what does return do?
you mean just in general or in this specific thing
!return-gif
Hey @runic rivet!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
Added a shotgun firing mechanism that I'm proud of
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
the hardcoded -3 means it won't work well for different numbers of bullets (the spray will be off-center), doesn't it?
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)
Def not trying to write good code here 💀
Just trying to make the game work but thanks tho
what IDE are you using?
vsc
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
i have idle
okay
should i get py charm then
well it fix the pygame problem then?
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
so how would i fix it?
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
alright
i found mine by accident when i found a guide to install Pillow on pycharm
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
thank you
Anyone got some good docker tutorials. I mostly get the ideas but the actual execution has gone straight iver my head so far lol 💀
i would make the bullets have slightly different speed and maybe delay
Hey @dawn quiver!
It looks like you tried to attach a Python file - please use a code-pasting service such as https://paste.pythondiscord.com
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
🐍
renamed my github since as self-deprecating as 'affronts to god' is, it might look bad
anyways, here's a simple script i threw together while i was bored
https://github.com/Sea-Pickle/gloop_scripts/blob/main/bouncy_balls.py
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()
https://discord.com/channels/267624335836053506/1064889977063878716 if someone have time to review
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()
it appears that Clock should be instantiated, like so: timer = pygame.time.Clock()
oh yeah that was the problem
thx
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?
this is fun. The balls look like they are on some kind of grid.
that's just because i round their position when rendering
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()
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????
you forgot to .fill() screen with a void about around your "#screen" comment, so previous drawing is left at each frame
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
Implementing a mini DAW is harder than it seems
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
but you need help with what
yes i need help with this
thank you worked
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.
I need assistance in installing PyGame on my MacOS!
What's the issue?
??
B r o
I saw a cool video about making a Doom/Wolfenstein- like game by using PyGame in PyCharm.
k
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.
Yes, and what exactly is the error?
Like are you just trying to install it with Pip, or do it manually?
Pip
so pip3 install pygame gives you an error?
pip3?
You have python 3 installed?
Looks like it…
It has a terminal icon next to it and literally named 'python3'
ok so run pip3 install pygame and tell me what the error message you get is
error: metadata-generation-failed
(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
I have python, python3, and python3.11
pip --version?
Pip 22.3.1
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
Oh lordy
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
W h a t
Y e s
What does one do?
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
must have had 3.11 then
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?
you are making a game?
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?
It does not redraw the entire frame but just the ball.
You just need to fill the screen surface with something.
Putting this before drawing anything should solve your problem
screen.fill(pygame.Color(0, 0, 0, 255))
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.
numpy lets you do perlin noise fairly easily
is there open-simplex noise module?
yes you should be able to, at least it's possible with nurses_2 eg textbox (you can type python to eval in it ): https://pygame-web.github.io/showroom/pythongit.html?-i#src/test_nurses2.py
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?
personally, i usually do 1 class = 1 file
when the project gets big, it becomes a mess if you have files that are 2000 lines long
the main loop (for display) should be in main.py, though the event handler could be in a separate file
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
hmmm ok 
i don't see the https://www.pygame.org/docs/ref/font.html#pygame.font.init maybe tutorial code was a bit off
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()`
There are two errors:
- 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()
- 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)
there is a spelling error in ur font name
worked (:
thank you all for taking the time to check my code I appreciate it
I need help in my help request, enemy car not spawning thanks
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
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.
Cool game :)
Thanks, still very much a work in progress, let me know if you have questions or comments and want to see something implemented
waw amazing cant belive it i was see that vid btw have you try to give some monster on that?
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
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.
I'm sorry I don't quite understand what you are asking. There are monsters / npcs that use a state machine to walk around and attack etc.
waw it great cant wait to see it . good work keep it up.
Thanks
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/
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...
Bionic Blue (by Kennedy Guerra): a bionic boy fights to protect humanity against dangerous robots in this action platformer.
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*
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".
Gonna try that out for sure😌
does anyone know how to make a hitbox in pygame?
Make an alternative sprite around your *character and than turn on collisions for that sprite. kinda like a hitbox
braille but i added color!!!!!1
ansi codes and braille
could you share the code
i wanna rewrite it first then sure
that is awesome
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
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
Thank you! I’ll try this
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
what would clicks beetween frames be used for ?
human finger has a reaction time around 150 ms
normal frames are 16ms
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```
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
oh alright, thanks. I didn't know that was possible
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
can anybody help with an issue in pygame?
ye
https://discord.com/channels/267624335836053506/1067926847536500816 we were getting nowhere
needs help restarting the game code after the play again button is pressed
do you have states in your game
you should start implementing different states for main menu, pause, ingame, ...
i do have states
mmh so your code isnt using classes
not allowed classes or sprites
it's possible to do a game without the classes but i don't recommend this
i didnt cover it in class
bruh
thats what i said
you have to make something in pygame but you don't know classes ?
your teacher is bad i guess
i aint even got a coding class in my school
yeah we have a JS python andjavaa
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
i have that for right click
right click does what in which state ?
it does it in all of them returns it to main menu
it should be Esc imo
the problem is when i call the state in the play again it doesnt reset to how it was in the beginning
and don't do this for loading, branding, pause...
what doesnt reset
the pipes, bird position etc basically all the functions
you have to reset the game when clicking play
how
i mean start a new game
thats what ive been trying to do
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
do you know how to do it without classes
i see
this is a solution for simple apps but for medium sized projects it's already too messy
thats my problem its messy but its due tomorrow for me
like, imagine implementing in-game windows that can call other in-game windows
and the right code to revert the actions
so what do i do about this
the teacher said we have to use states for the menu idk
yea but don't do branding, loading with a bar, pause menu, ...
i dont have that im pre sure
Could someone help me figure out how to use this tileset in Tiled?
https://opengameart.org/content/castle-platformer
Assets for a castlevania-like platformer I mocked up quite some time ago. Stiff and kinda crappy animation on the main character. Includes tiles, two parallax backgrounds, a main character, and a really badly-done bat. Colors on the exterior environment could use some love, but that was one of a whole bunch of things I didn't have the time to...
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
maybe cut them out manually?

Finally, the blind can read colored images
what does it read out?
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
nice but replit takes like 10 seconds to rerun
great, you could try that one to add some color https://github.com/salt-die/nurses_2 ( also work on web )
Ik but i only have a chromebook so i cant use any other ides, i tried to get it to loop back to the menu but i couldnt figure out how to close the thread
Thanks! Ill add some!
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.
Great, get started and post your progress here
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
Seems a little ambitious if you dont know the library ur working with
I know
But I love doing stuff that sounds impossible to do
I already did many "impossible" stuff
good luck with that
artificial intelligence is unpredictable
@mild forum by the way, what you're making sounds exactly like scribblenauts
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
Indie game developer and Youtuber, currently working on "Home Grown", a casual farming game.
I upload regular vlogs about my life as a full-time indie game developer and show the entire development process for my games, so that you can follow the project from the first concept all the way up to release! I released my first game "Equilinox" on S...
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
I am programming for 9 years
I am just new to pygame
But pygame doesn't look too complicated
i would use Panda3D and a contractor + the big pile of money matching for that
and yeah ping me too 🙂
Amazing
This is going to be 2d game btw
I am tired of 3d
but when you'll finish the game every body will have a VR helmet so you should anticipate
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
that remembers me of https://sourceforge.net/projects/mv3d/
Download MV3D for free. MV3D is an open source virtual world simulation framework written in Python. It was designed with scalability in mind and aims to be able to distribute a world across as many servers as needed while dynamically balancing the load.
What is that
something like you described, there's also https://github.com/worldforge/ember
i can't know for sure until you say it
Ok
So
Humans inspired me
Our imagination
Imagination is fantastic, isn't it?
Why can't we turn infinite imagination into 2d game?
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 ...
User friendly?
The only goal in that game I am working on
Is being creative
There is no rules
You create them
There you can create your own imagination and items and a lot more
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 )
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!
yw
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
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"),)
never mind i was just dump
Playing around with 2D normal mapping in Arcade https://cdn.discordapp.com/attachments/716020595439173663/1069381794681585734/normalmap.gif
New weekly update on my game check it out. New lighting system, new enemies, new critters. https://www.reddit.com/r/pygame/comments/10olx2b/second_devlog_for_my_game_big_chungus_introducing/
so since you were 4
also @mild forum have you seen scribblenauts
it's also 2d and has a notebook
where you can type anything you want
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. 😉
like me bro im trying to learn how
cool how much time did it take?
anyone here?
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
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
only 2 videos thus far, I'm going to try and put out a weekly update
depends on the game and what library you're using
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
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
take a look at the clock module
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
I actually looked at that. I don't see any way to access it through PyGame
You can't see the display's refresh rate using that
yeah i know now
question: what game engines allow you to code in Python?
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
hmm, might have to look into that one
did you find one?
one from before or after 1991 ? for before pygame pong with more paddles and ball passthrough would be quite the match, for after 1991 i guess Ralph from Panda3D/Ursina can play with his friends if you add some of them eg https://pmp-p.ddns.net/paste/panda/wsfun.webm
( roaming ralph is in panda3D default samples modifications + websockets adapted from https://github.com/anoriangit/NetRalph )
for pong look at source of page https://pygame-web.github.io/showroom/pygame-scripts/org.pygame.touchpong.html
also did you mean soccer ? 😄
Any way to develop a game on mobile phone?
Like rpg maker for mobile
So i can do it while laying in my bed
if you are lucky https://editor.godotengine.org/releases/latest/
Use the Godot Engine editor directly in your web browser, without having to install anything.
Nice thx
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.
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
Many thanks for that. Yes text based to begin with while I learn the language. Will look at adding graphics in the future.
that looks so good (and yes I am a week too late but still)
Are there any capable engines with python support? I just saw this channel and didn't know of any.
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
Oooh, I heard about that. I personally will stick with GDScript for the most part but I'm excited to see what they can pull off