#game-development

1 messages · Page 27 of 1

raven kernel
#

but you can track all the events within a single event loop and pass that information on separately

#

or just pass the events and iterate over them each time

pine smelt
#

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

pine smelt
#

That gets messy with a lot of methods

raven kernel
#

thats why i use a module to store all my events and stuff

pine smelt
#

Oh fair enuf

#

Are they technically globals then

raven kernel
#

and then i access em like this

pine smelt
#

Ah OK ye

raven kernel
#

keeps every single update method clean

pine smelt
#

Got it makes sense

#

Ye

stuck spade
raven kernel
versed aurora
#

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

limber veldt
#

That's cool, mapping the sticks to the play area, one could use them for targeting or something

versed aurora
#

its super disorienting so i will probably not keep both that way

#

when you have them crossed so to speak its confusing

grave inlet
#

Python on android is pre epic

versed aurora
#

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

limber veldt
pine smelt
#

Cool r u going to use that in ur game

pine smelt
#

It looks rly cool

limber veldt
#

No, just a play around

pine smelt
#

Ah ok

limber veldt
#

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))```
limber veldt
limber veldt
#

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

pine smelt
#

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

limber veldt
#

I like that you implented dt for your frame_index

pine smelt
#

ye it's usually smoother

limber veldt
#

For sure

pine smelt
#

and framerate independence is never a bad thing

limber veldt
#

Right on, I usually use it everywhere and test by setting different rates

#

I got the idea from a tutorial, and have seen other implementations, but I'm always looking for them anyway

pine smelt
#

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}

limber veldt
#

That's good idea, even more flexabiity

pine smelt
#

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

pine smelt
limber veldt
#

Yeah even some path following

#

Usually iterating waypoints

pine smelt
#

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

limber veldt
#

I have so many little videos, really should sort them

#

I pretty much make a video for everything that works along the way, lol

limber veldt
#

Sometimes it's really interesting to go back and watch the early videos of projects, seeing how much has changed, usually improved

#

That game started as just a logic sim but once I had that, I turned it into robot odyssey, the old game

pine smelt
#

how did u code all the logic for that

#

i wouldnt even know how to get started

pine smelt
#

sounds silly but i usually don't have enough storage locally on my laptop to keep them all for a long time

limber veldt
#

The videos, they're really short but I have a 1tb storage drive I just slide em into

pine smelt
#

ah ok fair enough

limber veldt
#

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

limber veldt
#

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

limber veldt
#

And one of the many puzzles you encounter while escaping Robotropolis, tough puzzle, easy solution (I shouldn't show it)

limber veldt
#

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

limber veldt
#

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

limber veldt
#

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

limber veldt
#

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

limber veldt
#

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

silver furnace
#

Guys who likes to make a team for developing games

versed aurora
pine smelt
#

how?

#

ive heard of surfaces having palette methods but never dabbled in it

#

unless you used some sort of array changer

pine smelt
silver furnace
pine smelt
#

specifically?

#

top-down, platformer?

#

inspirations like old pokemon/zelda or the old metroidvania games?

#

specific art style??

#

gotta give more information man

silver furnace
#

I feel like 3D would be great but for a small team i think pixel art is better. Right?

pine smelt
#

pixel art is definitely better

grave inlet
#

yo

pine smelt
#

also have u used pygame before?

#

3d is practically impossible for a full complete game

pine smelt
grave inlet
#

ive come to realised my typing method sucks

pine smelt
#

bruh wut y

grave inlet
#

im legit capped at 130 wpm

pine smelt
#

thats pretty good

grave inlet
#

i use index to press space

pine smelt
#

the avg is 70 i swr

#

oh

grave inlet
#

my index is like going light speed

pine smelt
#

how the hell are u getting 130 with that

grave inlet
#

my index has like 50% of the keys memorized

pine smelt
#

bruh

grave inlet
#

i get avarage 100

#

now im relearning

#

using thumb for space lmao

pine smelt
#

ye i only get 145 without thumbs

pine smelt
grave inlet
#

need to press ctrl + v faster if im ganna code

#

anyways i downloaded pydroid and now i can code while in school

pine smelt
#

nice

grave inlet
#

keeping the grind at school

hollow gazelle
versed aurora
pine smelt
versed aurora
#

so rgb images have the red, green, blue values at each pixel right

pine smelt
#

right

versed aurora
#

indexed instead has a color palette and each pixel instead has a number for what index in the palette it is

pine smelt
#

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?

versed aurora
#

they're stored as rgb(a) tuples

#

or lists, i guess

pine smelt
#

oh cool

#

ye

versed aurora
#

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)
pine smelt
pine smelt
#

acc not sure

versed aurora
#

its an attribute of the bar

#

its jsut a list of the colors

pine smelt
#

that the bar could be?

versed aurora
#

yeah

pine smelt
#

right ok

versed aurora
#

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

pine smelt
#

oh ok

versed aurora
#

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

pine smelt
#

so just red and blue colours getting increasingly brighter

versed aurora
#

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

versed aurora
#

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

pine smelt
versed aurora
#

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)

pine smelt
#

oh fine ye

versed aurora
#

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

pine smelt
#

nah its pretty normal

#

i think its just more readable for newbies

versed aurora
#

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

pine smelt
#

???

#

wait what wdym

#

as in ascii-based stuff?

#

or literal graphics in the terminal

versed aurora
pine smelt
#

cuz the latter is literal insanity how would u do that

#

oh ok

versed aurora
#

i did make a gif player in terminal

pine smelt
#

bruh

versed aurora
#

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

pine smelt
#

how are u printing out pixels?

versed aurora
#

ansi codes

#

basically escape codes (like \n) but they let you control stuff of the terminal

pine smelt
#

i thought there was a set number of colours

versed aurora
#

depends

pine smelt
#

like the basic ones

#

oh

versed aurora
#

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'

pine smelt
#

oh ik what they are dont waste ur typing lol

#

Christian was working on a typewriter thing for a while wid em

versed aurora
#

lemme find the truecolor one

pine smelt
#

alr

versed aurora
#

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"
pine smelt
#

wuts the ansi_16_color thing

versed aurora
#

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

#

XXXXXXXX
XXXXXXXX
XXXXXXXX
XXXXXXXX
XXXXXXXX
XXXXXXXX
XXXXXXXX
XXXXXXXX
#

ill post a screenshot for mobile users

grave inlet
#

learning time

versed aurora
# versed aurora

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 )

pine smelt
#

oh thats cool

#

and im assuming truecolor is just every rgb value

versed aurora
#

yeah

#

values 0-255

pine smelt
#

ye

pine smelt
versed aurora
#

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

versed aurora
#

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

pine smelt
#

in effect, is that just an entirely more useless way to do os.system()

versed aurora
#

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

grave inlet
# pine smelt is that tkinter?

Yep, i decided that tkinter is probobly better for what i do since i kinda just do gui and the main gameplay being text

versed aurora
#

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

pine smelt
#

oh my god thanks

#

im gonna use that everywhere probably

pine smelt
#

idk u can still do pretty good guis in pygame, thats often an interesting thing to tackle

#

especially to make it look good

versed aurora
#

oh mfw pygame has a dedicated angle function

#

that would have helped earlier lmao

#

when atan2 was fucking up for me

pine smelt
#

wut y

#

as in the zerodivision error?

versed aurora
#

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

pine smelt
#

maybe it was a radians <-> degrees thing?

#

tho if it was just around -1, 1 i doubt that

limber veldt
#

This helped me understand the values I was getting from angle_to(), the 'without crossing -x' was the important bit

past thistle
#

guys

#

I'm swiching to C++

#

bye

left basin
#

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()
pine smelt
#

are there any notable differences between font and freetype

crude ember
#

I don't suppose anyone here knows how to install pygame-ce in Ubuntu

stuck spade
#

just use pip

crude ember
#

where

stuck spade
#

atleast thats what i did

crude ember
#

cause i keep getting this problem

stuck spade
crude ember
stuck spade
#

both works btw

#

but ce

#

As its more worked on

crude ember
stuck spade
#

which

crude ember
#

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

proper peak
#

use a venv

stuck spade
#

oh

#

i see

stuck spade
stuck spade
proper peak
#

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.

crude ember
#

no clue

stuck spade
#

if u don't wanna use that uh you can just use venv

stuck spade
stuck spade
crude ember
stuck spade
#

use a virtual environment

stuck spade
crude ember
#

no i need to reset ubuntu

stuck spade
#

you want to remove it?

crude ember
#

I got so fucked

#

It took me 2 hours to reinstall Ubuntu

proper peak
#

I think the lesson to learn from this is to use pyenv and not touch your system python at all

crude ember
limber veldt
#

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

pine smelt
#

no lol its exam season for me rn

#

i can prolly start building the 3d projection stuff

grave inlet
#

3d in pygame sound complicated

stuck spade
#

very

#

complicated

exotic niche
pine smelt
#

arent gradients meant to be pretty intensive

exotic niche
#

i'm using a different technique

pine smelt
#

care to give a hint?

quartz junco
#

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?

brisk yew
brisk yew
#

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

cosmic olive
#

That only solves 1 problem tho but creates more 😂

quartz junco
#

I'll try it to see what happens

cosmic olive
quartz junco
#

@cosmic olive it works great after a couple tweaks the player starts falling after they hit the block and evrything

#

thanks for the help

cosmic olive
quartz junco
#

Wait what

cosmic olive
#

Try hitting it from the side 💀

quartz junco
#

Oh yeah I never said it works perfectly

#

I'll fix it though

cosmic olive
#

Oh lmao

#

GL!

#

I'm also learning pygame

#

Have yet to make something

quartz junco
#

Yeah eventually I want to make a turn based rpg

cosmic olive
#

Well.. i did make something but I wouldn't called it a "game" 💀

quartz junco
#

Lol what'd you do

cosmic olive
#

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 😅

quartz junco
#

For coding on mobile that isn't bad

cosmic olive
#

It's also still incomplete but it works

quartz junco
#

How do you even code on mobile

cosmic olive
#

I could have made a d-pad but I wanted to be fancy

cosmic olive
quartz junco
#

Hm never heard of that

cosmic olive
#

Don't recommend. It's ass

#

But I learned to code with it so 🗿

quartz junco
#

Yeah I bought a laptop in March and it's doing pretty well

cosmic olive
quartz junco
#

I don't even know I think just the one that came with Python

cosmic olive
quartz junco
#

Lol

cosmic olive
pine smelt
pine smelt
#

I need to look into hsv more it seems more useful than rgb sometime

brisk yew
#

I just like that it can be rotated

sudden lotus
#

Hi

sterile pasture
#

for pygame do we always have to type

#

pygame.init()

#

to initialize it?

#

or not?

pine smelt
#

i mean y wouldnt u

#

its barely any slower

#

technically no tho

raven kernel
#

so its just more convenient than doing it separately

#

you dont have to do it if you just want to mess around with surfaces

sterile pasture
#

okay thank you very much

limber veldt
#

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

brisk yew
pine smelt
#

anyone know if theres an api for ms paint

#

or anyone to draw stuff to it, preferrably via python

#

id rather not use pyautogui

brisk yew
#

probably not? why do you need that?

pine smelt
#

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

brisk yew
#

that's honestly quite ingenious

pine plinth
#

ah, you said you dont want pyautogui 😔

pine smelt
#

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

pine smelt
#

its a bit funky but its a good start i think

burnt sail
#

Which library are u using for the tracking of the pencil?

#

looks pretty cool ajolote

pine smelt
#

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)
burnt sail
pine smelt
#

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

burnt sail
#

okie dokie

burnt sail
pine smelt
#

i havent commented the main file but hopefully its coherent enuf

#

the main tracking stuff is in scripts/camera.py

barren topaz
#

yoo

umbral hare
#

helo anyone have recommendation for learning pygame ?

pine smelt
#

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

limber veldt
pine smelt
#

really?

limber veldt
#

Yep

pine smelt
#

hasn't popped up in my recommended ill have to have a look soon

half flare
#

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 ?

green gate
#

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

hoary kettle
#

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)

pine smelt
half flare
pine smelt
#
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

pine smelt
half flare
pine smelt
#

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.

half flare
pine smelt
#

gl'

royal oar
#

hmmm yess, developing games 🧠

unique sky
#

guys i got a problem, where i get art ?

royal oar
#

wdym???

unique sky
#

my game art

#

aren't for selling like are for school

royal oar
#

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

unique sky
#

bro are like a gamejam

#

in the school.

royal oar
#

Oh cool!

#

What's it about?

#

any specific theme?

unique sky
#

buying btw are a option i just got yo15

unique sky
royal oar
#

You made your game yet?

unique sky
royal oar
#

What's the game about?

unique sky
#

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)

royal oar
#

What type of game is it? I'm interested now

unique sky
royal oar
#

Is it like a platformer?

unique sky
#

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

royal oar
#

So a fighting game?

unique sky
#

and thanks, u opened my mind, i didn't has thinekd about these things, so thanks <3

royal oar
#

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

unique sky
#

but maybe i use my 3 pixel art years (i didn't got everything good) but maybe ""maybe"" i can d o something

unique sky
royal oar
obtuse osprey
#

no

#

i am the grammar police

unique sky
obtuse osprey
#

neither is mine

unique sky
#

and i don't are using translator, are better writing wrong and don't using translator

obtuse osprey
#

im 14 and my national language is different from english

#

no excuses

unique sky
#

just going to ignore u, u are getting out of my goal

obtuse osprey
#

Don't you dare nerd react the grammar police

pine smelt
#

the top half is usable asw just dont want to show my hand

unique sky
royal oar
pine smelt
#

ye

royal oar
#

That's honestly so epic 🙏

pine smelt
#

thanks

royal oar
#

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?

pine smelt
#

i mean the bounds are limited by the camera on my phone

#

i scale it up to the window size

unique sky
#

i can't send images

pine smelt
#

if i had a wider fov then ye i could set my own bounds for the pencil

pine smelt
pine smelt
#

uh

#

what was the image

unique sky
#

a drawing

pine smelt
#

oh idk dont see y that would trigger anything

#

try resending or ask a mod

unique sky
#

nah i can't

#

ah ok, is because it's a jpeg

#

the bird is a fenix

unique sky
#

so what u think @royal oar ??

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

pine smelt
#

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

burnt sail
#

But I have been pretty busy lately

#

Nonetheless, wait for a pull request :D

solemn mist
#

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

limber veldt
#

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

solemn mist
limber veldt
#

np

limber veldt
#

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

solemn mist
limber veldt
#

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

solemn mist
#

oh ok gotcha, i have to be using pygame for my class

limber veldt
#

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

solemn mist
#

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

limber veldt
#

Nope, that should be it

limber veldt
solemn mist
#

alright i think the movement is kinda messing with it, but ill send the code

#

or actyally ill put it in a paste

limber veldt
#

Did you try running the code I shared (after changing the two occurrences of frect to rect)?

solemn mist
#

yeah im trying to implement it into my own code tho

limber veldt
#

Ok

#

Hmm, I have a feeling that it's running so fast that you might not see a rotation happening

solemn mist
#

oh ok ill try using the clock thing u did

limber veldt
#

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

solemn mist
#

yeah xd it is a little awkward but that show my teacher wants it

limber veldt
#

Ok

solemn mist
#

i tried implementing the clock thing and its not rotating 😔

limber veldt
#

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

solemn mist
#

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

pine smelt
#

Wut would the handytracking be for? Some sort of hand rig?

ocean temple
#

Are there some already assembled tools to make hud/menu for pygame?
Buttons, checkboxes, input fields, scrollbars.
Etc.

burnt sail
#

And also the color and eraser :b

#

But that might be complicated I'm kinda noob with mediapipe

#

But we can try :b

pine smelt
pine smelt
pine smelt
burnt sail
#

Humble AP Apple Pencil

#

Xd

vestal herald
#

why my question got locked in get-help

acoustic gale
limber veldt
#

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?

grave inlet
acoustic gale
#

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?

limber veldt
#

I've used pygame, I like it, recommend it, but haven't used others so I have no comparison

acoustic gale
limber veldt
#

And Clear Code has a tutorial using pygame that is basically the game you've described

grave inlet
#

making a game engine sounds unsuprisingly complicated

limber veldt
#

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

grave inlet
#

sheesh

#

looks pretty cool

limber veldt
#

I need it for a path, using them for waypoints...eventually

grave inlet
#

paths?

limber veldt
#

Yeah, for a sprite to follow

grave inlet
#

ohh, goodluck i guess

#

sounds complicated to make

#

for me atleast

#

i dont do much pygame myself

limber veldt
#

Just making effects for a card game, playing cards will follow these paths and I need a few of them in different shapes

grave inlet
#

ah, i see. sounds like a cool card game your making

limber veldt
#

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

grave inlet
#

i should try pygame again

#

i wanted to make like a copy of that one card game in final fantasy

limber veldt
#

Well, at least you have an idea for a project, perhaps motivation

vestal herald
limber veldt
#

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?

pine smelt
#

I've only seen bezier implementations for complex paths and splines and stuff

vestal herald
#

@limber veldt

pine smelt
#

Wuts the problem?

limber veldt
pine smelt
#

For bezier?

limber veldt
#

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

pine smelt
#

Nice

limber veldt
#

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

vestal herald
#

tadaaa

#

its better

#

but still

#

a lil bit

limber veldt
#

Yeah, still some artifacts there

vestal herald
#

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

limber veldt
#

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

raven kernel
pine smelt
#

im assuming its just a template for now lol

limber veldt
#

Yeah, that's a pretty nice tree

pine smelt
#

been using this thing for ages

#

just with a few extra shortcuts and doohickeys

limber veldt
#

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

regal willow
#

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

raven kernel
regal willow
#

i'll look into that, thanks

regal willow
#

something like this

raven kernel
regal willow
#

thanks 👍

vestal herald
vestal herald
limber veldt
#

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

vestal herald
#

except background

vestal herald
vestal herald
#

so i should remove em?

#

hold on

#

ahhhh

#

ye i got it

limber veldt
#

Those pixels should be fully transparent, not partially

vestal herald
#

ye

#

but what about the original problem

#

like

#

why was there a gray background

limber veldt
#

I don't know

vestal herald
vestal herald
#

its just beginning of development

pine smelt
#

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

vestal herald
#

a

pine smelt
#

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

vestal herald
#

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

vestal herald
pine smelt
#

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

vestal herald
#

u said "crank out" game, do u mean like u cant get good game with tiled?

pine smelt
#

Sry I meant

#

Quickly build a game

vestal herald
#

oh

#

alr

limber veldt
#

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

pine smelt
#

U DID THAT IN LISTS?

#

🙏

limber veldt
#

Yip, basically this times 430 or so

#

Of course, with variations, very few layouts are the same

vestal herald
limber veldt
#

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

limber veldt
vestal herald
limber veldt
#

But there's probably dozens of ways to describe a level. I could take all those values and make separate files per level for them. Like level1 folder with texts.py, rooms.py and so on, level2 folder the same, and so on

limber veldt
vestal herald
#

bro

#

how do i remove em now

limber veldt
#

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

vestal herald
#

sry bro installed gimp only rn

limber veldt
#

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

vestal herald
#

where is totally transparent button

limber veldt
#

Some where in the image where you don't see a color? Hopefully one of the pixels that is NOT partially transparent

vestal herald
#

oh

#

bruh

#

my brain

#

sry bro

limber veldt
#

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

vestal herald
#

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

limber veldt
#

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

regal willow
#

what's the point of using OOP in pygame

limber veldt
vestal herald
#

but

#

what do u think about photoshop

limber veldt
regal willow
#

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?

limber veldt
#

And those variables belong to the object, they're not all over the code, the live inside that object, organized as part of it

regal willow
#

yea but you're not gonna be doing something like

#

game.run()
game2.run()

limber veldt
#

Not really

regal willow
#

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

limber veldt
#

Usually with an if __name__ == '__main__': condition, so the file only runs if it's the main file and not being imported

regal willow
#

i see

#

i was more confused about why people overruse OOP in pygame

limber veldt
#

Assuming people overuse it. I like using it as much as makes sense

regal willow
#

that seems like the correct approach

#

thanks for the info 👍

limber veldt
#

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

regal willow
#

i guess it gets harder to maintain after it's like 1K+ lines without oop

pine smelt
limber veldt
#

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

limber veldt
#

It's a remake of an 80s game

dapper surge
#

thats coool

#

which game?

limber veldt
#

Robot Odyssey

#

From The Learning Company, 1985 or so

dapper surge
#

thats rlly cool

#

oh damn

limber veldt
#

And thank you

#

My biggest project yet...and still not really done but at least all the content is there

pine smelt
#

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

limber veldt
#

Like Star Trek?

pine smelt
#

possibly? havent seen it

limber veldt
#

Oh ok, it's TV show, they had teleporters

pine smelt
#

oh kinda like that ye

#

just saw it

#

just more pixelated obviously

limber veldt
#

Right, that's good idea

#

The teleporter sound effect in the game sounds a lot like that used in the show too

brisk yew
#

you're not really gaining much from it being a class

random quiver
#

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?

jolly rivet
#

Can anyone teach me game dev from scratch

#

?

#

I am new

vagrant saddle
pine smelt
pine smelt
#

adding some simple buttons

#

the last one will prolly be some sort of colour picker

raven kernel
pine smelt
#

easy way to add depth 👍

limber veldt
#

It was just a few days ago we talked about that and you have that already? Mindblown

pine smelt
#

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

cosmic olive
#

Check out a youtube channel named clear code

limber veldt
dawn quiver
#

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)

astral fulcrum
#

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

pine smelt
#

he has a couple, one for python in general and one for pygame

#

both very well made

#

not sure about any books

pine smelt
dawn quiver
# astral fulcrum I am a python beginner. I am learning python by myself to develop game. But I ha...

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)

  1. low level and maximalist game dev
  2. 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.

pine smelt
#

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

dawn quiver
#

So question then why not lua or js over python if you care simplicity most?

pine smelt
#

ok theres definitely an argument for lua

limber veldt
#

Game dev is as much about the concepts of animation and graphics as it is about the language. No matter the language

pine smelt
#

theres the logical side asw and actual problem solving

dawn quiver
astral fulcrum
#

So you mean I don`t need to learn that? I am not sure how to learn it yet.

dawn quiver
#

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%

astral fulcrum
#

And in the future, unity is more popular as 100%?

dawn quiver
#

But this is not fare

#

Unity is specificly designed for game development but i hope you get the point

limber veldt
#

You learn how to use objects instead of coding them yourself, sure you can code too

vagrant saddle
#

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

dawn quiver
#

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

astral fulcrum
#

Actually, I want to make PES. For that, unity is good?

dawn quiver
#

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

limber veldt
#

It just depends what one wants to do, better is subjective

dawn quiver
astral fulcrum
#

Yeah, I am a football fan. So I gonna make PES.

dawn quiver
#

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

astral fulcrum
#

I want to join the company in the future

#

For that, unity is not good. Am I right?

dawn quiver
#

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

astral fulcrum
#

I think unity is not popular in the company

#

only C#, JAVA, PYTHON is more useful

tranquil girder
young horizon
#

hello, how do you guys switch pages, from a button in a pygame file directing to def level() in main.py

pine smelt
#

wdym pages?

pine smelt
#

my only reason to not switch from python/pygame is im stubborn

limber veldt
#

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

cosmic olive
pine smelt
#

thought id share this lil colour picker thing

astral fulcrum
pine smelt
#

any suggestions or ideas to add?

limber veldt
#

Line size?

pine smelt
#

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

limber veldt
#

Oh I see, you've already implemented something

#

Nvm me then

pine smelt
#

no no i ill be adding ur suggestion thx

pine smelt
#

and i just hadn't changed it since

cosmic olive
pine plinth
vagrant saddle
pine smelt
# pine plinth just an idea

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

raven kernel
# pine smelt any suggestions or ideas to add?

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?

pine smelt
#

i just dont want my hand in the recording lol

raven kernel
#

ahh okay

#

then that makes it better

pine smelt
#

ye ill look into the rolling ball thing though

raven kernel
#

yeah maybe a rolling blue ball

#

id like my pen to stroke something rather than the air

pine smelt
#

thats fair enough ye

raven kernel
#

but still, a motion sensor would be optimal

pine smelt
#

i wouldnt have bothered with any of this if i had one of those lol

raven kernel
#

is that blue tac?

pine plinth
#

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 🤯
random sonnet
#

i messed up...
by fixing the linting errors, i somehow managed to break my tetris

balmy aurora
#

And what do you mean by break, do you get a traceback?

vestal iron
#

im trying to implement the jumping physics for flappy bird and i wonder is 0,0003 gravity is a normal number

stray stream
vestal iron
#

yea i figure out, i was using delta time but in seconds xD

#

i just recently started using delta time

random sonnet
#

And it wouldn't be a problem, if I knew what it was

royal oar
#

Any of y'all know Godot and can help me with tilemaps?

random sonnet
dusk flame
#

whats a good lib to develop games in py

cosmic olive
pine smelt
#

ye pygame's the most well known and probably well documented one

#

theres quite a few tho like pyglet, ursina and kivy

sterile flax
#

Can anybody give the cheatcode

cosmic olive
burnt sail
limber veldt
#

It's up, A, right, A, down, A, left, A, Start. /s

cosmic olive
mild wing
#

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

marble jewel
pine smelt
#

wooo! congrats

jolly holly
#

can anyone help me with my flappy bird game collision code 😔 ive been trying to debug for hours

jolly holly
# cosmic olive 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 😭

jolly holly
#

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
cosmic olive
#

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

jolly holly
cosmic olive
jolly holly
#

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

cosmic olive
#

Which bool are they talking about

jolly holly
cosmic olive
#

You didn't write it exactly as mine

jolly holly
#

oh the double parantheses?

cosmic olive
#

And no "or"s

#

Commas

jolly holly
#

omg apologies

#

let me retry

#

it's running now but it still doesn't reckognize the collision 😭

cosmic olive
#

See which bool is True

#

I feel like your checking system is a bit weird

jolly holly
jolly holly
cosmic olive
#

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

jolly holly
#

yeah i tried to do the inverse of that by using not(...and...and... etc)

#

I can try doing it the more normal way 😭

cosmic olive
jolly holly
#

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

jolly holly
cosmic olive
#

Because pygame has built-in collision detection

jolly holly
#

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 😭

cosmic olive
jolly holly
#

yeah unfortunately :(

cosmic olive
#

Your teacher is evil that's all imma say

jolly holly
#

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

jolly holly
cosmic olive
limber veldt
#

Rect to rect collision isn't super complicated but pygame would sure make this a lot easier

cosmic olive
#

I'm actually surprised it was this easy

limber veldt
#

I'm just poking at my pathfinder sandbox code, working out another a* implementation

cosmic olive
#

@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))
limber veldt
#

I don't have it properly updating the costs but like so

cosmic olive
#

I didn't think my first attempt would work

limber veldt
cosmic olive
limber veldt
#

Haven't tested it myself but just going through the logic in my head

#

With a diagram

cosmic olive
#

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

limber veldt
#

Working through one axis reveals the logic for both, just turned sideways for the other