#game-development
1 messages · Page 27 of 1
Idk maybe I'm just stubborn but I prefer being able to just access it on command rather than passing it through various different update methods
Especially if they go to other nested functions
me too
That gets messy with a lot of methods
thats why i use a module to store all my events and stuff
and then i access em like this
Ah OK ye
indeed, they're part of a global mutable state
keeps every single update method clean
Bro drop the theme
Catppuccin Mocha - https://github.com/catppuccin/vscode
im not sure if anything will come of it but here's a little video recorded of what i have rn
the bars on the left and right are bound to left and right trigger and the circles are bound to the joysticks
one problem i can immediately forsee is that idk a way to really use the bars except with a joystick since there arent really "analog" inputs on a keyboard
oh and maybe i can change the color of the bar depending on its state
might try making something like a top down shooter with this code tbh
changing the colors works, i did a simple test and yeah
That's cool, mapping the sticks to the play area, one could use them for targeting or something
its super disorienting so i will probably not keep both that way
when you have them crossed so to speak its confusing
Python on android is pre epic
i actually like how this looks
how i do it is when i update the bar's state, if it's above a threshold i increment a value called time_held, and once it's above a certain amount i make it start shaking and flashing
So I made fireballs
Cool r u going to use that in ur game
How did u handle that brightness thing, just blit a surface with an alpha value?
It looks rly cool
No, just a play around
Ah ok
I experimented with both those angle finding ideas I shared recently
These two lines do pretty much the same thing ```py
angle = self.direction.angle_to(Vector2(0, -1))
atanangle = math.degrees(math.atan2(direction.x, direction.y) - math.atan2(0, -1))```
Brightness? I didn't do anything with that, but here's the code: https://paste.pythondiscord.com/DTBA and here are the images
That's my basic sprite code structure, an init method, update and a couple of helper methods
I sometimes use a state machine for sprites with behaviors
Still one of my biggest struggles, coding NPC behaviors
And I'm really appreciating frect, no more casting to floats since frect can use them directly
i think i have a similar thing, just that i contain my animation stuff in its own class
only downside i can't really handle different timings between frames in an animation but i haven't really had an issue with it yet
I like that you implented dt for your frame_index
ye it's usually smoother
For sure
and framerate independence is never a bad thing
Right on, I usually use it everywhere and test by setting different rates
This is a really basic implementation of my state machine, I wonder if you have one you might share? https://paste.pythondiscord.com/NF6A
I got the idea from a tutorial, and have seen other implementations, but I'm always looking for them anyway
sry no ive used an almost identical implementation
the only difference would be
when you define the states in
self.states = {'left': self.left,
'right': self.right,
'down': self.down,
'up': self.up
}
i had an optional duration value and "next_target" value
like
self.states = {'left': {"func": self.left, "duration": None or a int or a float, "next_target": self.right}
That's good idea, even more flexabiity
ye
for npc movement especially in top-down rpgs, i prolly even tend to just make the npc move within a specific range and just pick a random location within it
directly a to b or some path-finding algorithm if there are objects in the way
and just having some sort of delay when it gets to that spot
for more complicated movements or in 2d platformers i stick with this ye
oh ye that works
it might become a bit repetitive if they're just moving in a circle but i guess u can shuffle the waypoints
I have so many little videos, really should sort them
I pretty much make a video for everything that works along the way, lol
Sometimes it's really interesting to go back and watch the early videos of projects, seeing how much has changed, usually improved
Making a simple circuit
That game started as just a logic sim but once I had that, I turned it into robot odyssey, the old game
A little more complicated circuit, a 4-bit counter
where do u store them, ive tried to do it but
sounds silly but i usually don't have enough storage locally on my laptop to keep them all for a long time
The videos, they're really short but I have a 1tb storage drive I just slide em into
ah ok fair enough
The game also has the chip burner, where you can burn circuits into chips. I made a wallhugger chip (wired inside a robot, the robot does just that, follows walls) This is the json save of that chip https://paste.pythondiscord.com/NOGQ
Parsing all that into and out of a dict, quite a task
And a dict that is just logic, burned chips behave just like the prototype they were burned from, but have no images, so all that logic had to be worked out too
All logic gates are subclassed from Device, this is the AND gate https://paste.pythondiscord.com/3TZA
And all Device's are subclassed from Item, where they get all their interaction behaviors
Mouse grabbing, wiring, things like this
And all Items are finally subclassed from pygame.sprite.Sprite
A lot of subclassing, my devices.py is still huge though, cause there are so many devices
This project was my first really deep dive into subclassing
There were others but nothing like the MROs here
Burning a chip
And one of the many puzzles you encounter while escaping Robotropolis, tough puzzle, easy solution (I shouldn't show it)
Just making one thing work at a time. I started with making a logic gate, not even sure what kind, and wiring it up with mouse and then circuit evaluation when the sim is started and running
A little Clear Code tutorial experience too
The toolbox having all the gates selectable, the way it pops up and closes and all that, Clear Code
Quite a lot of that, really, he's a good tutor
I started working out levels in Tiled but came across a few complications, part of why the game remains unfinished and unreleased
Along with those damn save/load games
I have all the levels in raw list already though, so Tiled is kind of extra at this point
It'll be open source eventually though
This is the room_display() and eval5() methods. room_display is on a timer ,it gets reactivated every time it runs. The duration of that timer is controlled by the slider in the game's menubar. eval5() does all the heavy lifting during evaluation https://paste.pythondiscord.com/VASQ
Both are working but maybe not final
Just to tie in what those methods in the AND gate are doing and where they're called, that pretty much explains the logic
I have many places to refactor though. Like using getattr() instead of my is_device() method, other ideas too
I could give all those gates the attributes to query quite easily
Yeah, it's a really wonderful game, I hope to release it some day
Just a hobbyist, I started with an intro to python course over at coursera about 10+ years ago
hbu?
Right on, stick with it. I suppose it's easier for me since I'm just a hobbyist, I can do whatever whenever
I still get high when something really hard works, like yes!
And that's why I keep doing it, not constantly, I have other hobbies too, especially in summer, but I always come back to it
Changed the color palette
how?
ive heard of surfaces having palette methods but never dabbled in it
unless you used some sort of array changer
im assuming in pygame? also what sort of games
RPG
specifically?
top-down, platformer?
inspirations like old pokemon/zelda or the old metroidvania games?
specific art style??
gotta give more information man
I feel like 3D would be great but for a small team i think pixel art is better. Right?
pixel art is definitely better
yo
also have u used pygame before?
3d is practically impossible for a full complete game
ello
ive come to realised my typing method sucks
bruh wut y
im legit capped at 130 wpm
thats pretty good
i use index to press space
my index is like going light speed
how the hell are u getting 130 with that
my index has like 50% of the keys memorized
bruh
ye i only get 145 without thumbs
🙏
need to press ctrl + v faster if im ganna code
anyways i downloaded pydroid and now i can code while in school
nice
keeping the grind at school
TIL that PyGame got a serious fork
Most of Pygame's developers forked Pygame to create Pygame-CE after some unfortunate administrative events. All of my games were deleted from pygame.org and I was blocked by the Pygame Twitter account. This is a brief introduction to Pygame-CE and its history.
Pygame CE (GitHub, Website, Discord)
https://github.com/pygame-community/pygame-ce/re...
If its an indexed image you can change its palette by giving it a list of colors
wdym by indexed image
its been like the biggest development since like 2.0 lol
so rgb images have the red, green, blue values at each pixel right
right
indexed instead has a color palette and each pixel instead has a number for what index in the palette it is
oh right ok
and if u just change one of the numbers or colours in the palette
it dynamically swaps them?
also what are the colours in the palette stored as
rgb or int or smthn?
i think pygame also has a color class
the code is kinda jank but here's what i did
new_palette = [(0,0,0)]
for i in self.colors[1:]:
new_color = i+color_func(c*BAR_COLOR_CHANGE_SPEED).floor()
new_color = new_color.clamp(vec3(0),vec3(255))
new_palette.append(new_color)
self.middle.set_palette(new_palette)
i swr the only thing it adds is a lerp function
is self.colors just
acc not sure
that the bar could be?
yeah
right ok
the reason i do self.colors [1:] is that i use (0,0,0) as transparency and lightening and darkening that would screw it up
oh ok
for the bars i used [(138,41,49),(190,51,51),(248,109,85)] for the left bar and [(48,78,128),(0,125,188),(0,198,206)] for the right one
and in my initializer it adds 0,0,0 automatically
so just red and blue colours getting increasingly brighter
its a sine wave
color_func is just a temporary function i use that just has a sine wave vector functionally
also the vectors in that code are my own, i just use them for convenience, but pygame has its own vectors i think
can u send that please?
its dead simple
its using my own vectors so it wouldnt be super useful to you but i can just recreate it using lists
1 sec
nah its fine cant be that different
its just that my own vectors have stuff for automatically creating it from a single number
so like if i do vec3(1) it'll make vec3(1,1,1)
oh fine ye
its basically just this
import math
def color_func(t,mag=50):
return [int(math.sin(t)*mag)]*3
i originally had it do offset sine waves to do a rainbow just to test, but that doesnt look very good when the bars already have color
for changing color there's some more intelligent ways to do it btw
for one you can change what color system you're in and then modify that
so for instance you can do a hueshift simply by converting to HSV, changing the hue a bit , then converting back
oh wait i forgot, mine floors the value
there
also real talk, is importing pygame as pg not normal? i always do that but whenever i see examples of code they always just import it as normal
even if it wasnt i think i'd still do it
ngl i should use pygame more
ive mostly just done stuff from scratch in terminal but pyg has a lot of useful features
yeah
well with enough characters..
i did make a gif player in terminal
bruh
its actually not that complicated
it just processes each frame into characters, adds it to a list, then iterates through and plays each frame, and repeat
it does take a while to load longer gifs tho
and its bottlenecked by the actual speed of the terminal
it can go pretty fast in the right circumstances tho
how are u printing out pixels?
ansi codes
basically escape codes (like \n) but they let you control stuff of the terminal
i thought there was a set number of colours
depends
some terminals only support some color modes but all modern ones ive used support full 24 bit color
there's multiple color codes, but basically all ANSI codes use the character '\x1b'
oh ik what they are dont waste ur typing lol
Christian was working on a typewriter thing for a while wid em
lemme find the truecolor one
alr
its \x1b[MODE;2;R;G;Bm" where MODE is either 38 for foreground or 48 for background, and R,G,and B are integers 0-255
oh right i made a whole example script
from itertools import chain
fg_color_palette = list(chain(range(30,38),range(90,98)))
bg_color_palette = list(chain(range(40,48),range(100,108)))
modes = {"fg":38,"bg":48} #for 8-bit / 24-bit color ANSI
reset = "\x1b[0m"
def ansi_16_color(n,mode="fg"): #palette index 0-15
if mode == "fg":
return f"\x1b[{fg_color_palette[n]}m"
elif mode == "bg":
return f"\x1b[{bg_color_palette[n]}m"
def ansi_216_color(r,g,b,mode="fg"): #RGB values 0-5
packed_color = 16 + 36*r + 6*g + b
return f"\x1b[{modes[mode]};5;{packed_color}m"
def ansi_grayscale_24_color(n,mode="fg"): #Grayscale value 0-23
return f"\x1b[{modes[mode]};5;{232+n}m"
def ansi_truecolor(r,g,b,mode="fg"): #RGB values 0-255
return f"\x1b[{modes[mode]};2;{r};{g};{b}m"
wuts the ansi_16_color thing
that's the simplest one
basically it uses a fixed color palette
discord actually supports it but it uses its own color palette, and only supports 8 out of 16
[30m[40mX[31m[40mX[32m[40mX[33m[40mX[34m[40mX[35m[40mX[36m[40mX[37m[40mX
[30m[41mX[31m[41mX[32m[41mX[33m[41mX[34m[41mX[35m[41mX[36m[41mX[37m[41mX
[30m[42mX[31m[42mX[32m[42mX[33m[42mX[34m[42mX[35m[42mX[36m[42mX[37m[42mX
[30m[43mX[31m[43mX[32m[43mX[33m[43mX[34m[43mX[35m[43mX[36m[43mX[37m[43mX
[30m[44mX[31m[44mX[32m[44mX[33m[44mX[34m[44mX[35m[44mX[36m[44mX[37m[44mX
[30m[45mX[31m[45mX[32m[45mX[33m[45mX[34m[45mX[35m[45mX[36m[45mX[37m[45mX
[30m[46mX[31m[46mX[32m[46mX[33m[46mX[34m[46mX[35m[46mX[36m[46mX[37m[46mX
[30m[47mX[31m[47mX[32m[47mX[33m[47mX[34m[47mX[35m[47mX[36m[47mX[37m[47mX
ill post a screenshot for mobile users
learning time
btw the actual colors depend on the terminal but here's what it looks like by default in cmd, as well as the full 16 color version ( i split it into 4 quadrants to distinguish between the two sets of colors )
ye
is that tkinter?
if you're wondering why 216 color has that many colors, it's because the 16 color, 216 color, and 24 color grayscale are all technically part of a single 256-color mode
https://en.wikipedia.org/wiki/ANSI_escape_code#Colors
wikipedia has a whole thing about it
also as one last thing about this, you need a specific terminal flag enabled for them to work (at least on windows, idk about other OSes) but some terminals already have them enabled
easiest way to do so is just to call os.system() because doing so incidentally enables that flag
ANSI escape sequences are a standard for in-band signaling to control cursor location, color, font styling, and other options on video text terminals and terminal emulators. Certain sequences of bytes, most starting with an ASCII escape character and a bracket character, are embedded into text. The terminal interprets these sequences as command...
i learned this completely by accident and just kept using it for a long time before actually checking the source code to confirm
if you want to be fancy, at least for windows you can call SetConsoleMode() using the low level api but it's honestly way too much work for just enabling ansi
in effect, is that just an entirely more useless way to do os.system()
for an empty call? kinda
you'd still want to use it if you are doing anything specific but for just ansi codes its just a lot easier to do an empty call
the specific flag is ENABLE_VIRTUAL_TERMINAL_PROCESSING (0x200) i believe
oh wait wrong value
it's 0x4
i was looking at the value for ENABLE_VIRTUAL_TERMINAL_INPUT
i specify the value because flags at the low level are generally just numbers (usually it's a number with one bit set at some location) and then to set multiple you just bitwise OR them
Yep, i decided that tkinter is probobly better for what i do since i kinda just do gui and the main gameplay being text
oh btw @pine smelt im still kinda nooby at pygame but here's an example of the color palette thing
you can also set an index individually too but i figured if you're doing all of them, may as well just do it all at once
import math
import pygame as pg
#========#
IMAGE_PATH = "img.png"
IMAGE_SCALE = 8
COLOR_PALETTE_SIZE = 8
COLOR_MAG = 200
TIME_INC = 0.05
#========#
pg.init()
img = pg.image.load(IMAGE_PATH)
img = pg.transform.scale_by(img,IMAGE_SCALE)
win_size = img.get_size()
screen = pg.display.set_mode(win_size)
clock = pg.time.Clock()
def color_func(t,mag=255):
n = (math.pi)/3
return [
abs(int(math.sin(t-n)*mag)),
abs(int(math.sin(t)*mag)),
abs(int(math.sin(t+n)*mag))
]
t = 0
running = True
while running:
for event in pg.event.get():
if event.type == pg.QUIT: running = False
new_palette = []
for i in range(COLOR_PALETTE_SIZE):
n = i/COLOR_PALETTE_SIZE
new_palette.append(color_func(n+t,mag=COLOR_MAG))
img.set_palette(new_palette)
screen.blit(img,(0,0))
pg.display.flip()
clock.tick(60)
t+=TIME_INC
it also requires this image in the same folder
oh wait i fucked up the exit thing
lemme fix that
here's a recording of the result
oh ok
idk u can still do pretty good guis in pygame, thats often an interesting thing to tackle
especially to make it look good
np
oh mfw pygame has a dedicated angle function
that would have helped earlier lmao
when atan2 was fucking up for me
nah
It wasn’t giving the right angles, kept changing super fast around -1,-1, and slow elsewhere, i fixed it by changing when i calculated the angle, maybe i had it offset or smth
maybe it was a radians <-> degrees thing?
tho if it was just around -1, 1 i doubt that
Interesting, thanks for sharing
This helped me understand the values I was getting from angle_to(), the 'without crossing -x' was the important bit
hi there, I am quite new to pygame, I have been using pygame.Font for rendering text in my game, I recently discovered pygame.freetype and want to use that instead, but there are quite a few difference in both the syntax and the output surface that my display is messed up quite a bit, is there any easy way to get the same result as pygame.Font using pygame.freetype?
My example code
import pygame
import pygame.freetype
from game_constants import CAVIARDREAMS_FONT, BLACK, LIGHT_SKY_BLUE
window = pygame.display.set_mode((1536, 864))
f1 = pygame.font.Font(CAVIARDREAMS_FONT, 40)
f2 = pygame.freetype.Font(CAVIARDREAMS_FONT, 40)
t1 = f1.render("The quick brown fox jumps over the lazy dog FONT", True, BLACK, LIGHT_SKY_BLUE)
t2 = f2.render("The quick brown fox jumps over the lazy dog FREETYPE", BLACK, LIGHT_SKY_BLUE)[0]
while True:
window.fill((255, 255, 255))
window.blit(t1, (15, 15))
window.blit(t2, (15, 100))
pygame.display.update()
https://www.pygame.org/docs/ref/freetype.html#pygame.freetype.Font.pad
looks like this does the job for me
are there any notable differences between font and freetype
I don't suppose anyone here knows how to install pygame-ce in Ubuntu
um pip
just use pip
where
atleast thats what i did
cause i keep getting this problem
in terminal? Press Ctrl+Alt+T
btw pygame or pygame ce
bruh i get this message
which
error: externally-managed-environment
× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.
If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.
If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.
See /usr/share/doc/python3.11/README.venv for more information.
note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
ever got that before
use a venv
you can use venv or pass
pip install pygame-ce --break-system-packages
by any chance are you on proot distro with termux?
i'd suggest never using break-system-packages since, uhh, there's a reason it's called that. installing pygame itself won't hurt anything, but the possibly changing versions of the packages it depends on can. and if something goes wrong, it may break your system.
no clue
if u don't wanna use that uh you can just use venv
i personally don't care about using it since I'm on a vnc anyway
this error only exists in newer versions tho u won't find it in jammy and below
so what do you suggest to help me
it's as he said
use a virtual environment
sudo apt install python3-venv
python3 -m venv my-project-name (do this after opening terminal in a seperate folder)
source my-project-env/bin/activate (folder path then /bin/activate)
no i need to reset ubuntu
you want to remove it?
Yk I learned doing sudo apt remove python3 is not the best idea
I got so fucked
It took me 2 hours to reinstall Ubuntu
I think the lesson to learn from this is to use pyenv and not touch your system python at all
what does this do
yh
Making any progress on that idea? I wouldn't even know where to start with that one
In Blender, I made an armature, just the 'bones' of the cube and parented the meshes of each cube segment, or cubelet, to those and the armature is animated, keeping all sides together as they rotate
3d in pygame sound complicated
Made in Pygame!!!
Join me On Discord for Gamedev, physics, simulations, pygame and programming stuff !!!
Discord
https://discord.gg/rGuseq6HpX
Twitter
https://twitter.com/QuantumHg
Get all of my games here :-
https://quantum-hg.itch.io/
#mathematics
#gradient
#calculus
#derivative
#pygame
#python
#computergraphics
#simulation
#physics ...
how are u getting such high fps
arent gradients meant to be pretty intensive
i'm using a different technique
care to give a hint?
im tyring to get collision to work with the player and a block above them and i had it working until i implemented movement where the player would always jump like they were under the block. Now the player won't hit the block just teleport inside when it touches it. Could anyone help out?
for one, could just prerender the entire thing and then just uncover it over time
for example
import math
import pygame
WIDTH, HEIGHT = 640, 360
FPS = 60
pygame.init()
screen = pygame.display.set_mode((WIDTH, HEIGHT))
clock = pygame.Clock()
gradient_surface = pygame.Surface((WIDTH, 50), flags=pygame.SRCALPHA)
for x in range(gradient_surface.get_width()):
color = pygame.Color.from_hsva(x % 360, 100, 100, 100)
pygame.draw.rect(gradient_surface, color, [x, 0, 1, gradient_surface.get_height()])
mask_surface = pygame.Surface((WIDTH, 50), flags=pygame.SRCALPHA)
x_values = range(WIDTH)
y_values = map(lambda x_value: math.sin(x_value / (WIDTH / (21 * math.pi))) * 25 + 25, x_values)
pygame.draw.polygon(mask_surface, "white",[*zip(x_values, y_values), (WIDTH, 25)])
combined_surface = gradient_surface.copy()
combined_surface.blit(mask_surface, (0, 0), special_flags=pygame.BLEND_RGBA_MULT)
sliding_rect_1 = pygame.Rect(0, 180, WIDTH, 50)
sliding_rect_2 = pygame.Rect(0, 240, WIDTH, 50)
running = True
while running:
dt = clock.tick(FPS) / 1000
screen.fill("black")
events = pygame.event.get()
for event in events:
if event.type == pygame.QUIT:
running = False
sliding_rect_1.x = (pygame.time.get_ticks() / 10) % (WIDTH * 2) - WIDTH
sliding_rect_2.x = -((pygame.time.get_ticks() / 10) % (WIDTH * 2)) + WIDTH
screen.blit(gradient_surface, (0, 0))
screen.blit(mask_surface, (0, 60))
screen.blit(combined_surface, (0, 120))
screen.blit(combined_surface, (0, 180))
pygame.draw.rect(screen, "black", sliding_rect_1)
screen.blit(combined_surface, (0, 240))
pygame.draw.rect(screen, "black", sliding_rect_2)
pygame.display.flip()
that's some EPIC quality
anyway, you get the point, you can run the code yourself anyway
Why not just do this?
if player_rect.colliderect(question_rect):
if player_rect.top < question_rect.bottom:
velocity = 0
velocity += gravity
That only solves 1 problem tho but creates more 😂
I'll try it to see what happens
How's it looking
@cosmic olive it works great after a couple tweaks the player starts falling after they hit the block and evrything
thanks for the help
You didn't run into the other problem? 💀
Wait what
Try hitting it from the side 💀
Yeah eventually I want to make a turn based rpg
Well.. i did make something but I wouldn't called it a "game" 💀
Lol what'd you do
Wellllllll
I made an onscreen joystick cuz I code on mobile without a physical keyboard 🗿 (yes I'm broke)
Basically making my own input interactions 😅
For coding on mobile that isn't bad
It's also still incomplete but it works
How do you even code on mobile
I could have made a d-pad but I wanted to be fancy
There's a ide for Android called pydriod 3
Hm never heard of that
Yeah I bought a laptop in March and it's doing pretty well
Nice. Which ide do you use
I don't even know I think just the one that came with Python
I see. Not too knowledgeable on pc ides anyways for obvious reason 💀
Lol
Check DMs
Isn't that practically just a terminal
Ooo that's nice
I need to look into hsv more it seems more useful than rgb sometime
I just like that it can be rotated
Hi
for pygame do we always have to type
pygame.init()
to initialize it?
or not?
yes if you plan to open a window, that also initializes other modules like pygame.font, pygame.mixer etc though
so its just more convenient than doing it separately
you dont have to do it if you just want to mess around with surfaces
okay thank you very much
I had a recent short project where I init'ed pygame font and took out the pygame.init(), so yeah, just depends on what parts of pygame one needs to use
set_mode and Window initialize the display module implicitly
anyone know if theres an api for ms paint
or anyone to draw stuff to it, preferrably via python
id rather not use pyautogui
probably not? why do you need that?
working on this thing to make explaining stuff to my mates a bit easier, especially drawing stuff
got this blue knob at the end a pencil im finding the x and y coordinate of
and make it into a "stylus" to draw stuff on
dont have the money to get my own trackpad or drawing pad so this my crappy diy solution, also inspired by michael reeves lol
the plan was to send the (x, y) values to paint or some drawing software
im assuming im gonna have to make my own tho in pygame or smthn
that's honestly quite ingenious
you can manipulate your mouse cursor using library like pyautogui
so you get x,y from camera, translate them to pixel coordinates on the screen, then move mouse there
ah, you said you dont want pyautogui 😔
last time i used it all hell went loose after i switched tabs
it somehow disabled the failsafe
ended up having to just restart the entire computer
im just broke lol
its a bit funky but its a good start i think
Uuh, that's quite cool
Which library are u using for the tracking of the pencil?
looks pretty cool 
opencv, this is basically the code for the pencil tracking
rgb_color = np.uint8([[[6, 45, 122]]])
hsv_color = cv2.cvtColor(rgb_color, cv2.COLOR_RGB2HSV)
h, s, v = hsv_color[0][0]
lower_color = np.array([h-10, 100, 100]) # lower bound of the blue color in HSV
upper_color = np.array([h+10, 255, 255]) # upper bound of the blue color in HSV
kernel = np.ones((5, 5), np.uint8)
...
def foo(...):
ret, frame = self.cap.read() #actual camera footage
if not ret:
return "Nothing"
#rotating and converting to a hsv colour map
frame = cv2.rotate(frame, cv2.ROTATE_90_COUNTERCLOCKWISE)
hsv_frame = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
#create a mask of the colour i want within a range and clean it up a bit
mask = cv2.inRange(hsv_frame, lower_color, upper_color)
mask = cv2.erode(mask, kernel, iterations=1)
mask = cv2.dilate(mask, kernel, iterations=1)
contours, _ = cv2.findContours(mask, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
#if there are any blue stuff on screen
if contours:
largest_contour = max(contours, key=cv2.contourArea) #find the largest blue area
((x, y), radius) = cv2.minEnclosingCircle(largest_contour) #find is coordinates and rough radius
if radius > 5:
cv2.circle(frame, (int(x), int(y)), int(radius), (0, 255, 0), 2)
Make it a GitHub repo, I would like to help :b
im not very experienced with github repos
in terms of pull requests and stuff but here
the requirements would be pygame-ce and opencv-python
im pretty busy so prolly won't be working on it for a while so have a field day
okie dokie
gonna take a look
i havent commented the main file but hopefully its coherent enuf
the main tracking stuff is in scripts/camera.py
yoo
helo anyone have recommendation for learning pygame ?
theres plenty of tutorials to get u started on youtube, Clear Code being a notable one
ultimately just get some starter "boilerplate" code in and just start messing around to learn as u go
start with a smaller project like pong or space invaders and work ur way up
And he just released another today, another long one that has a few projects
really?
Yep
hasn't popped up in my recommended ill have to have a look soon
hellu. so recently i tried using ursina and then making my models along with their textures in blender. When i import my .obj file into ursina it's just a black void. How do I load textures ? Cause the objects have applied materials and textures generated with nodes for Cycles. So why doesn't it have a texture ? Do I have to do something to bake it in ? Extract the texture somehow or what ?
def acUpdate(deltaT):
global a,display,fr
a = ac.getCarState(0, acsys.CS.TyreDirtyLevel)
display = round(float(a[0]), 1)
ac.setText(Body, "DATA={}".format(display))
hello im getting a syntax error in the last line ac.settext
that is for displaying but how do i fix it
do anyone know how to add a time that when you type the text to stop you??
Code:
import time
first = 'The story of technology is the story of human civilization. From the invention of the wheel to the advent of the internet, technological advancements have shaped and reshaped the way we live, work, and interact with the world around us. As we stand on the brink of the fourth industrial revolution, it is worth reflecting on the profound impact that technology has had on society, the changes it has wrought, and the future it portends.'
second = 'The first major technological revolution came with the Agricultural Revolution around 10,000 BC. This period marked the transition from nomadic hunter-gatherer societies to settled agricultural communities. The development of farming tools, such as plows and irrigation systems, allowed humans to produce surplus food, leading to population growth and the rise of civilizations. This revolution laid the foundation for future technological progress, enabling the creation of cities, writing systems, and complex societal structures.'
third = 'The next significant leap occurred during the Industrial Revolution in the 18th and 19th centuries. This era was characterized by the transition from manual labor and artisanal crafts to mechanized production. Innovations such as the steam engine, spinning jenny, and power loom revolutionized industries, increasing productivity and driving economic growth. The Industrial Revolution also brought about significant social changes, including urbanization, the rise of a factory-based economy, and shifts in labor practices. It fundamentally transformed daily life and set the stage for modern industrial society.'
def game1():
print("Starting..")
time.sleep(2)
number = input("Select a number between 1-3\nSelect:")
print("LOADING...")
time.sleep(1)
# wra = input("Please select how much time you want to have\n[1|60 Seconds]\n[2|30 Seconds]\n[3|10 Seconds]")
# if wra == "1":
# enalepto()
# elif wra == "2":
# misolepto()
# elif wra == "3":
# dekadeutera()
if number == "1":
print('======================================================')
print(first) # To keimeno
print('======================================================')
first1 = input("Please type that text:\nType:")
score = len(first1.replace("", ""))
if first1 not in first:
print("You made an error in the Text, Please try again..")
time.sleep(10)
else:
print("Your score was", score, "/674")
time.sleep(10)
elif number == "2":
print('======================================================')
print(second) # To keimeno
print('======================================================')
first1 = input("Please type that text:\nType:")
score = len(first1.replace("", ""))
if first1 not in first:
print("You made an error in the Text, Please try again..")
time.sleep(10)
else:
print("Your score was", score, "/507")
time.sleep(10)
elif number == "3":
print('======================================================')
print(third) # To keimeno
print('======================================================')
first1 = input("Please type that text:\nType:")
score = len(first1.replace("", ""))
if first1 not in first:
print("You made an error in the Text, Please try again..")
time.sleep(10)
else:
print("Your score was", score, "/507")
time.sleep(10)
does the normal model loading not work
It do. Just no textures.
model_entity = Entity(
model='path/model.obj',
texture='path/texture.png'
)
that
i cant really help with more than that not experienced with ursina or blender
afaik u should get the model and texture seperately from blender tho
prolly just an indent error
def acUpdate(deltaT):
global a,display,fr
a = ac.getCarState(0, acsys.CS.TyreDirtyLevel)
display = round(float(a[0]), 1)
ac.setText(Body, "DATA={}".format(display))
im confused what u want
I'm also confused
but how ? I can't export a texture.png and I've looked everywhere on the web.
chatgpt'd
Bake Textures in Blender:
Open your Blender project and select your model.
Switch to the "Shading" workspace to view the material nodes.
Create a new image in the UV/Image Editor to bake your textures into. Go to UV Editing workspace, select your object, and unwrap your model (if you haven't already).
In the Shader Editor, add an "Image Texture" node and select the new image you created.
With your object selected, go to Render Properties and find the Bake section.
Choose the appropriate bake type (e.g., "Diffuse", "Combined") based on what you need and click Bake. Blender will bake the textures from the material nodes into the image you specified.
Save the baked texture image.
Export the Model:
After baking, make sure the baked texture is correctly assigned to your model in Blender.
Go to File > Export > Wavefront (.obj).
In the export settings, ensure "Include UVs" and "Write Materials" options are checked.
I see my texture is just black. I'll sort that out, but now it makes more sense. Thank you 🙂 I really appreciate the help
gl'
hmmm yess, developing games 🧠
guys i got a problem, where i get art ?
wdym???
make it, buy it, or find free bundles online
if it's for school you can probably just make them
it shouldn't be too hard
buying btw are a option i just got yo15
do something that works and are cool, and maybe that u can explain what u did
You made your game yet?
just the c ontrols and the hitbox
What's the game about?
the main idea is like
4 greek gods or all(and u choose 1) and u got about 10 levels, and u fight like random mobs, getting harder, maybe getting with chat gpt(top 20 greek monsters from 1 to 20)
What type of game is it? I'm interested now
good question i don't know, i didn't thinked on this just think in my mind, i playing and like 🔥 🐐
Is it like a platformer?
ah i understond it now
something like: hero, monsters monters, they attack, u use skills dash do jumps, and maybe a ultimate
dang this message got some wrong
like "hero (in the left) and mobs spawning in the right(maybe this change) got some limit of monster spawning or not, and in each level, they become others monster, and maybee, in lvl 5 and 10 getting bosses o.o
So a fighting game?
basically
and thanks, u opened my mind, i didn't has thinekd about these things, so thanks <3
no problem!
I think its important to go the whole 'writing up your game before you make it' thing so that you have an idea of what you want to do
but maybe i use my 3 pixel art years (i didn't got everything good) but maybe ""maybe"" i can d o something
ye, u got my mind to think about this rn, and not about the whole code first
sloppy english ⚠️
shush.
bro aren't my main language so
neither is mine
and i don't are using translator, are better writing wrong and don't using translator
just going to ignore u, u are getting out of my goal
i mean i can fully understand what you mean, but it's very sloppy, but you were correct here
Don't you dare nerd react the grammar police
thought i'd send a progress update on my broke man's drawing pad thing
the top half is usable asw just dont want to show my hand
got something, i aren't a god like artist btw so
Are you tracking the tip of the pencil???
ye
That's honestly so epic 🙏
thanks
Can you set certain bounds on the camera where it can detect your pencil?
Like if it goes outside a set box then it wont be detected?
i mean the bounds are limited by the camera on my phone
i scale it up to the window size
i can't send images
if i had a wider fov then ye i could set my own bounds for the pencil
u should be able to how many were u trying to send
a drawing
so what u think @royal oar ??
👍
I think that a fighting game would be really cool like that!
I'm guessing you're going to have different abilities for each character you play as
you could try doing Pixel art for it if you wanted
And then you could use Software to animate it, instead of having to make every single frame
ive done pretty much all my art using https://pixilart.com/ if that helps
in terms of pixel art software its mid as hell but has animation and most good tools like palettes and stuff for free
ms paint, while limited is also usable
ive made most of my tilemaps in there
Hmm, I have an idea for a color selector and an eraser function using mediapipe for hand tracking 0.o
But I have been pretty busy lately
Nonetheless, wait for a pull request :D
could anyone help me with figuring out how to make a sprite rotate in a loop without getting messed up
i've tried googling it but it isn't really working for me
The issue with rotating a surface is needing a fresh copy of the original image each time it rotates so that you're not making copies of copies of copies and so on. Here's how I did it for this sample sprite https://paste.pythondiscord.com/ZXVQ
Oh and also getting a new rect each time and placing at the center of the old rect
As an image rotates, its surface changes size, so a new rect is usually necessary and placing it at the same position as the old rect will keep it stationary
Gotcha thank u that makes sense, I’ll try that out in a bit
np
And I had some extra imports in that file, I actually hijacked an old demo to make that one, forgot about losing a couple of imports that are no longer used
hey sorry, what is get_frect()?
It's essentially the same as get_rect(), you familiar with that?
It's a feature of pygame-ce, so if you're using regular pygame, you can use get_rect() instead, but I suggest updating to pygame-ce anyway
If you do decide to update to pygame-ce, be sure to uninstall the old pygame first
oh ok gotcha, i have to be using pygame for my class
The pygame-ce is the community edition since the original pygame is kinda outdated and no longer being updated. Your school might consider changing to pygame-ce, too, but no biggie. pygame-ce has some nice features
So you're right, stick with whatever the school is using
oh ok thanks, would there be anything else i would have to change or am i probably just doing it wrong? i can't get it to rotate
Nope, that should be it
You'd need to share what you have for me to have any chance of knowing what's wrong
alright i think the movement is kinda messing with it, but ill send the code
or actyally ill put it in a paste
Did you try running the code I shared (after changing the two occurrences of frect to rect)?
Ok
Hmm, I have a feeling that it's running so fast that you might not see a rotation happening
oh ok ill try using the clock thing u did
With animation, we at least need a consistent clock speed or frames per second, even if not implementing deltatime
And I'm not sure with your code structure there, it's kinda weird to start your while loop there
yeah xd it is a little awkward but that show my teacher wants it
Ok
i tried implementing the clock thing and its not rotating 😔
Sorry man, maybe your teacher knows, cause I don't really see all of the code here or know why some of it is the way it is
allg thanks for trying i did learn a lot from it anyways
ill prolly give up on it cause i was trying to add something extra so i don't need it
O cool
Wut would the handytracking be for? Some sort of hand rig?
Are there some already assembled tools to make hud/menu for pygame?
Buttons, checkboxes, input fields, scrollbars.
Etc.
yeah you can checkout pygame_gui
https://pygame-gui.readthedocs.io/en/latest/
Right know I saw that you have to press the Space key to let the computer know that you want to draw, but I want to be able to enable and disable that just by tracking the way you hold the pencil
And also the color and eraser :b
But that might be complicated I'm kinda noob with mediapipe
But we can try :b
Oh ye I changed that to E and R for drawing or erasing, but that would definitely be better
I have a bit of experience I can help a bit if needed
Just realised I could put a different coloured knob on the other end of the pencil if needed for the rubber lol
Hehe, that's cool!
We can work together on it owo
Humble AP Apple Pencil
Xd
why my question got locked in get-help
probably cause of inactivity
Maybe from inactivity. I found the question and that's really weird. All I can think of is maybe checking the images, are they 8-bit RGB or RGBA?
it gets locked after a set amount of time
I wanna make a pokemon like rpg game but im still on step 0 of just having the idea. what would be the best way to go about it? rn im thinking abt using a bare bones library like pygame or arcade and a imgui lib for development since it has no built in gui, but is there a different library I should use? if not would you say I should use some form of pygame or just use arcade?
I've used pygame, I like it, recommend it, but haven't used others so I have no comparison
also building my own engine ontop of it***
And Clear Code has a tutorial using pygame that is basically the game you've described
making a game engine sounds unsuprisingly complicated
I was just playing with plotting a spiral and came up with two ways to produce the same thing ```py
radius = 200
center = Vector2(400, 400)
for angle in range(0, 1080, 10):
x = radius * math.cos(math.radians(angle)) + center.x
y = radius * math.sin(math.radians(angle)) + center.y
radius -= 2
Spot((x, y), 'green', self.spots)
radius = 210
rotating_point = Vector2(1, 0)
for angle in range(0, 1080, 10):
point = rotating_point * radius + center
Spot((point.x, point.y), 'red', self.spots)
rotating_point.rotate_ip(10)
radius -= 2```
I made one radius slightly larger so we can see them both
I need it for a path, using them for waypoints...eventually
paths?
Yeah, for a sprite to follow
ohh, goodluck i guess
sounds complicated to make
for me atleast
i dont do much pygame myself
Just making effects for a card game, playing cards will follow these paths and I need a few of them in different shapes
ah, i see. sounds like a cool card game your making
I'd like to learn more ways of animating path following but the only way I know is iterating waypoints
Basically seek a point, when within some distance, get the next point, repeat
i should try pygame again
i wanted to make like a copy of that one card game in final fantasy
Well, at least you have an idea for a project, perhaps motivation
idk man i exported em from aseprite, every tile works expect those trees
Maybe someone will come along and have some suggestion because I just don't know
Can you share one of the images here and I can test it?
O rly that's cool
I've only seen bezier implementations for complex paths and splines and stuff
@limber veldt
Wuts the problem?
I made an experiment for that too https://paste.pythondiscord.com/FZEA
For bezier?
Yeah
I've since switched to just using Blender for making paths with a little export script, but that was good insight on how to make them
Nice
I've tested the image by blit'ing it onto a screen and I don't see those artifacts here, so I still don't know
I exported it from gimp with 0 compression to get this image, you can try it if you'd like
I saved your image, loaded to gimp, exported as png and the export is 10x larger filesize, but I don't really know why. Maybe aesprite used some compression on the export
Yeah, still some artifacts there
i thought the problem was with code
ig its the image
will try to do something and if i have questions i ll come back to u
Ok, there are some nearly transparent pixels in the image
We can see them here with this selection
And that seems to be the issue, those pixels I found look directly related to those showing white in your screenshot
the trees are so much more detailed than the tiles lol
im assuming its just a template for now lol
Yeah, that's a pretty nice tree
also did u also remake fluffy's editor??
been using this thing for ages
just with a few extra shortcuts and doohickeys
That looks so good, the atmosphere. Some day I'll make a big platformer, so many projects
My Robot Odyssey is kind of a platformer but not really, more like adventure
isn't drawing something on the screen every frame very unoptimized
or is it just how it is
i've read this comment section and it made me think
sure, in this case you could be saving that rectangle as a surface instead
i'll look into that, thanks
you blit them afterwards, right?
something like this
yep
thanks 👍
its not mine LMAO. free sample, i just made it little and made to match with my pallete
YEAH
The original Galaga had a glitch where if you could waited long enough, the enemies would run out of bullets because the game could only reuse so many and from then on, the enemies no longer shoot, even after clearing the level
everything stayed the same lmao
except background
so its good lvl editor? did u make full games w it? i want to use tiled or something else
oh
so i should remove em?
hold on
ahhhh
ye i got it
Those pixels should be fully transparent, not partially
I don't know
if we wont know ig i will just remove these spaces and thats it
chill bro
its just beginning of development
uhh
idk i just like having the freedom of having my own custom editor for a specific game
rather than building around smthn built in Tiled
Tiled is prolly easier and has more functions though if u just want to crank out a game
a
oh also i dont have any tiled experience, but a little thing
u can have fancy lil QoL effects in a custom editor
i have particles and shortcuts, floodfills, have made palettes and sound effects and all sorts to make the actual level building less boring
making maps for full stages or games can be REALLY monotonous so it can help to break the repetitiveness of it
ye the thing is im new to pygame and for the beginning just want to deal with programming the game not editor
so the ready product for level editing would be great
im surprised there is nothing like that for pygame
big opensource editor with fancy ui and other stuff
Ye most ppl just use tiled
Since it integrates well into python and pygame with its own library
I hav4nt seen a ful blown pygame editor yet
u said "crank out" game, do u mean like u cant get good game with tiled?
I should have made one for robot game, in the end, I'm sure it would have taken less time than making all the lists
Yip, basically this times 430 or so
Of course, with variations, very few layouts are the same
I'm using this kind of dict to describe them (so far), this is a small level, and still a work in progress https://paste.pythondiscord.com/LOVQ
ayyyo
Which kind of shows one of the problems I have with Tiled not supporting list or array custom properties. That 'links' entry describes each room's right, down, left and up room
Hi
hi
And I suppose that could be easily worked around, too. Use a 4-digit string instead and parse it for instance
I would do a select by color with some threshold and select the transparent area, it should get those that are within threshold of the color you select, then delete the selection, being sure to keep all of the tree pixels
I would do a select by color with some threshold and select the transparent area, it should get those that are within threshold of the color you select, then delete the selection, being sure to keep all of the tree pixels
Leave it at composite but maybe adjust threshold
Confirmed, that works. I set the threshold to like 14 or so, clicked a totally transparent spot then deleted the selection (Delete key)
To confirm, slide the threshold back to 0 and select the same area again, it will get all of the transparent pixels
Gimp is kind of awkward to use maybe, but it's really powerful image editing tool
I'm not very good with it but can get usually things done
where is totally transparent button
Some where in the image where you don't see a color? Hopefully one of the pixels that is NOT partially transparent
You have a few thousand of those and only a few that are partially transparent, selecting a transparent one shouldn't be too much trouble
If you want, you can also select each of those bad pixels and delete them one by one, but I mean, that's kinda not learning how to use the tools available to you
thank u for ur efforts bro
i appreciate it
i found online website that deletes transparent background
and IT WORKED
YESSSIR
THANK U BRO
I WAS WITH THIS THING FOR 2 DAYS
finally can move on
I totally get it, bruh, especially with new software like Gimp, it's kind of complicated, but I feel like if one is going to make games, one needs to learn tools
what's the point of using OOP in pygame
Easier organization of code
ye i will have to learn it ye
but
what do u think about photoshop
Excellent software, too pricey for me
i'm watching this youtube tutorial about OOP and the entire purpose that i'm seeing here is, if you have a lot of variables to define, you use OOP
is it really only for code organization?
And those variables belong to the object, they're not all over the code, the live inside that object, organized as part of it
Not really
i have this OOP right here and i'm only calling it once
so i'm gonna guess that it's optional
i meant class but you get the idea
Usually with an if __name__ == '__main__': condition, so the file only runs if it's the main file and not being imported
Assuming people overuse it. I like using it as much as makes sense
np
And there are other logical reasons to use oop too. Like some of the things I've done would be much harder with functional code
Not impossible, but not for me
i guess it gets harder to maintain after it's like 1K+ lines without oop
im assuming u havent started working with actual objects yet then
The level data I shared up there ^ is this one. It's not supposed to have the keys in it and you didn't see that secret passage to the right, ok?
And I skipped putting all the keys into locks and took the shortcut to the portal
And the level that teleporter leads to probably took me months to get through when I played it the first time
I came up with a method to instance objects from a string, which at least makes editing those files pretty easy. If I don't want the keys, just take them out of that items list for that room
I think I need a simple teleporting animation
Or animate the teleporter image, something
Maybe dematerialize and rematerialize the player in the new level
Or...maybe just do like Mario in some games, shrinking black circle on the way out and expanding on the way in
fire !
gives me 80s vibes
It's a remake of an 80s game
And thank you
My biggest project yet...and still not really done but at least all the content is there
i forgot what game but there was this one reset death animation
where the player sorta turns into pixels and floats up like current or data packets thru a wire
changed screens then reformed back in the new position
Like Star Trek?
possibly? havent seen it
Oh ok, it's TV show, they had teleporters
Right, that's good idea
The teleporter sound effect in the game sounds a lot like that used in the show too
yeah, this is generally overuse IMO
you're not really gaining much from it being a class
Can I ues python let the arduino development board recognize the QR code and trigger specific actions based on different QR codes, such as controlling the switch and brightness of the light?
yes learn about telemetrix / firmata and python<-rpc->arduino interactions, also that channel is more appropriate https://discord.com/channels/267624335836053506/545603026732318730 . Telemetrix-aio can also work from a web page written in pygame-web when using esp based boards programmed with arduino
In what library
i like the subtle shadows
easy way to add depth 👍
It was just a few days ago we talked about that and you have that already? Mindblown
thx, ive had to spend quite a bit of time on it, i was planning to use it to help explain/teach stuff to my mates
i find it easier to do with drawings and diagrams
we hve exams and stuff coming up soon so had to quickly make at least something
i might work on it as a bigger project tho it seems like a cool idea i havent really seen before

Guys. What do you think? If indie game (which is new IP and made by new developer) potentially will sell more copies of his/her game if made game both purchased and free(depends on user chooice)
I am a python beginner. I am learning python by myself to develop game. But I haven`t good guide. Please give me some advice about that. The book would be better for me
Thanks
as with most things, Clear Code on youtube is a good start for tutorials
he has a couple, one for python in general and one for pygame
both very well made
not sure about any books
depends on how good the game is and ur marketing strategy
If you just wanna understand and learn game development but not serious thing then python acceptable but if you wanna make career on this then python is the worst language to get started to game development.even javascript has much much better ecosystem for game dev than python.
In generally there is two path to get into game dev
(Btw these are my own therminalogy)
- low level and maximalist game dev
- high level and more generic game dev
95% game dev people are categorized in second category.they basicly choose a game engine then starts game dev and making games.for this purpose the programming language is depends on game engine and even sometimes gameengine has its own very specific scripting language.but mostly c# is way to go in this case
The first category is pretty older fashion way to create games but still valid and still this kinda guys making money.in this path there is no way other than c++(sometimes c and java) and it is much harder way to develop.you need to learn game dev and also creating game engines and very good math skills.you basicly will create game from basic window to 3d or 2d game you imagine.this kinda guys are rare in today industry but they are needed because most of AAA game studios uses they in house game engine which is specific for their company.
i disagree with python being the worst language completely, it is more difficult and less optimised in the grand context of programming languages but it will defintely get you into gamedev
plus u'll get the actual concepts and ideas done with easier syntax
which can be translated over to other languages if u choose to learn them
So question then why not lua or js over python if you care simplicity most?
ok theres definitely an argument for lua
Game dev is as much about the concepts of animation and graphics as it is about the language. No matter the language
theres the logical side asw and actual problem solving
Probably you mean lua has little case to translate lua skill to other fields but js is much much used in industry than python
So you mean I don`t need to learn that? I am not sure how to learn it yet.
If you jusy flexing then python ok.but if you are serious in this path then do not waste your time in python.python is great but not for game dev.it is something like crime for me to be honest
As i said even js(which worst thing in IT) has much much much better ecosystem and libraries
If you wanna simple and big community go with godot if you wanna money as fast as possible then unity
I do not know what is current situation of godot in commercial game industry.i do not know companies hires godot dev or not.but it will be in the future i am sure 100%
You mean unity is better than python for game dev?
And in the future, unity is more popular as 100%?
Unity is game engine and it uses c#.for gamedev carieer of course unity is much better than using python to make game
But this is not fare
Unity is specificly designed for game development but i hope you get the point
You learn how to use objects instead of coding them yourself, sure you can code too
whatever lang you use at work, you should know python to save time whenever you can
and there's obviously a confusion beetween assets pipeline work and game logic somewhere
No doubt python is great
But for people which beginner and specificly wants to enter game development world then it is the worst for me
Actually, I want to make PES. For that, unity is good?
Maybe this can be changed if godot embraces python instead of their own gdscript.idk why they choose custom language path but i think it is because porting to other platforms
It just depends what one wants to do, better is subjective
You mean the game series PES?
Yeah, I am a football fan. So I gonna make PES.
:)) short story it is impossible.once you get stared to game dev you will realise why.but you can work at similar work of course
In any company with lots of game devs
I want to join the company in the future
For that, unity is not good. Am I right?
You can create any game with unity game engine
Most of game engines are generic purpose game engines so you can create any type of game with game engines
As a professional gamedev for 12 years, I disagree. Any game you make is good for your portfolio, regardless of language. And if you're not aiming for a job in a studio, but working on your own, it's also good.
hello, how do you guys switch pages, from a button in a pygame file directing to def level() in main.py
wdym pages?
wut are the advantages of it if ur just working on ur own as a hobby or smthn
my only reason to not switch from python/pygame is im stubborn
I enjoy being in the code myself...kinda. I mean even using pygame is using quite a library of stuff that I didn't write
But it's much faster and works better than anything I could write
Mainly the display and the event loop, some of the C stuff too, beyond my skills
And even much of the python really, there's some cool stuff in there cause I've looked at some of it
What is PES
football game
Line size?
right now its controlled by how far away it is from the camera
tho i suppose a slider would be more accurate and just better
no no i ill be adding ur suggestion thx
this sorta just happened by itself with my tracking code
and i just hadn't changed it since
Oh okay
just an idea
reactable / reacTIVision
ive tried looking around but i just dont have a large piece of glass or a glass table for that matter anywhere for some reason
i find that maintaining a pen in air like that is probably very taxing, also you seem to be holding it from the other tip
i know using opencv and a blue dot seems like a nice idea, but couldnt you look into something like what older generation rolling ball mouse used, or even just something that detects motion and in what direction and sends in back to your computer?
oh no, i can hold it like a normal pencil
i just dont want my hand in the recording lol
ye ill look into the rolling ball thing though
yeah maybe a rolling blue ball
id like my pen to stroke something rather than the air
thats fair enough ye
but still, a motion sensor would be optimal
i wouldnt have bothered with any of this if i had one of those lol
is that blue tac?
if you have 2 cameras and know their positions, then you can calculate ball position in 3d space
and you can interpret different pen positions differently:
- if it is close to the table - draw a line, otherwise - dont draw
- if it is in some selected region in space, it can trigger an event. For example: 6 positions in space correspond to 6 colors, and when pen enters one of them, a color is selected. You can put a piece of paper under these positions to make it simpler for you. So it is UI, but in real space 🤯
Do you have version control?
And what do you mean by break, do you get a traceback?
im trying to implement the jumping physics for flappy bird and i wonder is 0,0003 gravity is a normal number
absolutely not, are you using delta time?
yea i figure out, i was using delta time but in seconds xD
i just recently started using delta time
It broke as in it no longer runs, errorless
And it wouldn't be a problem, if I knew what it was
Any of y'all know Godot and can help me with tilemaps?
Empty window simulator™️
whats a good lib to develop games in py
pygame ?
ye pygame's the most well known and probably well documented one
theres quite a few tho like pyglet, ursina and kivy
Can anybody give the cheatcode
Wym
What do you mean?
It's up, A, right, A, down, A, left, A, Start. /s
No. It's right-click, scroll down, delete
why does pygame.key.get_pressed() get updated only once a second?
nvm i got it
pygame.event.get() is a required call before it
and i was calling it in a main thread once a second
Updated Official Isometria Trailer - https://youtu.be/5rfL3drmEGE - Made with Python and Pygame-CE
Fight.
Build.
Craft.
Explore.
Wishlist today: https://store.steampowered.com/app/2596940/Isometria/
Join the discord:
https://discord.gg/fq3z2ENQAD
wooo! congrats
can anyone help me with my flappy bird game collision code 😔 ive been trying to debug for hours
What's the problem
some reason when i run my game it doesnt recognize when the bird is literally going through the pole and i swear my collision code is correct and im going crazy 😭
Let's see the code
okay i have 3 classes but ill just show yuo my player class rn since thatss my collision code
i apply it in my actual playingGame class if u want to see that after
import py5
from py5 import *
from Obstacle import Obstacle
class Player:
def draw(self):
self.update()
image(self.img, self.x, self.top, 60, 60)
def __init__(self, img, top = py5.height, acc = 0):
self.top = top
self.x = 80
self.acc = acc
self.vel = 0
self.g = 0.007
self.img = img
self.collision = False
self.score = 0
def get_y(self):
return self.top
def update(self):
self.acc += self.g
self.vel += self.acc
self.top += self.vel
def check_collision(self, obstacle):
player_left = self.x
player_right = self.x + 60
player_top = self.get_y()
player_bottom = self.get_y() + 60
obstacle_left = obstacle.x
obstacle_right = obstacle.x + 100
obstacle_top = obstacle.y
obstacle_bottom = py5.height - (obstacle.bottom_size - 20)
print("Player:", player_left, player_right, player_top, player_bottom)
print("Obstacle:", obstacle_left, obstacle_right, obstacle_top, obstacle_bottom)
isAbove = player_bottom < obstacle_top
isBelow = player_top > obstacle_bottom
isLeft = player_right < obstacle_left
isRight = player_left > obstacle_right
collision = not(isAbove or isBelow or isLeft or isRight)
print("Collision:", collision)
self.collision = collision
return collision
def update_score(self, obstacle):
if self.x > obstacle.x + 100 and not obstacle.passed:
self.score += 1
obstacle.passed = True
Not sure about how your not(isAbove...) is supposed to work but maybe try this?
collision = not any((isAbove, isBelow, isLeft, isRight))
@jolly holly
Oops any is lowercase
i tried making it so that i defined where the player is and if it's not in any of those specified places then it should be a collision
i also just tried your implementation but i got an error saying that bool item isn't iterable :(
Where are you checking collision?
here's the relevant code in my draw function
for x in obstacles:
x.update()
x.draw(colerm_normal, colerm_down)
player.check_collision(x)
player.update_score(x)
if player.collision == True:
deathScreen = True
playingGame = False
i also globaled all of it though i didnt think it was necessary to do that for draw
What is the full traceback
Which bool are they talking about
You didn't write it exactly as mine
oh the double parantheses?
omg apologies
let me retry
it's running now but it still doesn't reckognize the collision 😭
it says all of the collisions are false even though i go through them........
like my greater than or less than things?
Yeah the isAbove etc they all need to be False to make collision True
I don't exactly know how you're doing that
You basically need to be inside
yeah i tried to do the inverse of that by using not(...and...and... etc)
I can try doing it the more normal way 😭
Which library are you even using?
Seems like you're trying to reinvent collisions
okay i replaced it with this:
collision = player_left > obstacle_left and player_right < obstacle_right and player_top > obstacle_top and player_bottom < obstacle_bottom
and its still not recognizing it AAHHHH
HAHA yeah i basically am at this point but im using the py5 library?
Is there a particular reason as to why you're not using pygame?
Because pygame has built-in collision detection
omg wait 😭 this was just the library given to me by my teacher
that would be so much easier
I DONT UNDERSTAND WHY ITS NOT WORKING i dont understand 😭
Were you required to use it?
yeah unfortunately :(
Your teacher is evil that's all imma say
its okay i really appreciate your help i think im going to try just using if statements and if that doesnt work ill try to talk to him....
HAHA yeah i have to hardcode all the collisions 😭
I got it to work
Rect to rect collision isn't super complicated but pygame would sure make this a lot easier
I'm actually surprised it was this easy
I'm just poking at my pathfinder sandbox code, working out another a* implementation
@jolly holly
right = player.right >= obstacle.left
left = player.left <= obstacle.right
top = player.top <= obstacle.bottom
bottom = player.bottom >= obstacle.top
collision = all((right, left, top, bottom))
I don't have it properly updating the costs but like so
Don't ask me why this works, it was my first attempt and it literally works cuz I tested it
I didn't think my first attempt would work
That's cool, but I have to look at a diagram to really see how it works
That looks like snake game periodic table edition
Did you test it?
Haven't tested it myself but just going through the logic in my head
With a diagram
I see
It's trippy
I went through the logic step by step but eventually I lost myself
But it still works
I'm too lazy to go through the logic again lol
Working through one axis reveals the logic for both, just turned sideways for the other