#game-development

1 messages · Page 22 of 1

woven glacier
#

yeah

vital saddle
#

then your adding 1 to it

woven glacier
#

yes

vital saddle
#

ofc it will increase

#

and it wont stop till the loop breaks

woven glacier
#

to clarify, my problem is the rate at which my game updates is increased for no reason when I run the game

vital saddle
#
gameticks = 0

while True:
  gameticks += 1

this is your gameticks code

vital saddle
woven glacier
#

fps

vital saddle
#

ohhh

#

sorry i thought you ment the variable

woven glacier
#

it's alright, should have clarified more

vital saddle
#

but how do you know that the fps increases?

woven glacier
#

the ball that I have moving on the screen starts moving really fast

#

and the rate at which the variable is added to increases

#

(I hope that works)

vital saddle
#

From what i see (i tested it), after some bounces it goes fast, after some it goes slow

#

so it isnt a pygame tick issue

woven glacier
#

ah

vital saddle
#

you know why maybe? Because if it bounces on the left wall and imediatly at the wall next to it, it speeds up

woven glacier
#

do have any idea of why that's happening?

vital saddle
#

well im testing it out right now, but no i dont

woven glacier
#

alright

vital saddle
#

AHH MAN YK WHY?

#

Because you take a random int

#

so it moves with different speeds everytime

#

you use rantint

#

You take the speed, and look for a random number between 1 and speed variable, and move it with that speed

#

thats why its so weird with the speeds

#

because every time its random

woven glacier
#

but it's limited between 1 and 5, it shouldn't move as fast as it is

vital saddle
#

Well dont forget that you arent limiting the FPS

#

SO if you limit that

#

it will go slower

#

because now the speed it effected by the FPS and the randint

woven glacier
#

I didn't realize I had to

vital saddle
#

well its up to you if you want to, but it looks a lot slower if i limit it so something like 60 fps

tranquil girder
#

I'd be angry if I bought a game and it's locked to 60 fps on my 100hz monitor. It's better to multiply in delta time instead, to make it consistent at different framerates

limber veldt
#

Anything that simulates movement should have a frame limiter, else one could never really know how fast anything is actually going to move

woven glacier
#

@vital saddle wooo it worked

vital saddle
#

its kinda up to the developer how he wants his program to function

#

but deltatime would be the best option yes

limber veldt
#

I learned how to dt a year or two ago, along with a limiter, it keeps things moving at the right speeds

round obsidian
rancid peak
leaden bane
#

/j

vital saddle
#

lmao

copper bison
#

would anyone like to try to make an rpg with me?

#

like, a sort of zombie thing

limber veldt
#

Player shouldn't be able to lose items by dropping them offscreen, I got it. If the room has another room on that side, the dropped item is moved to that room. If not, as is the case with robots who have no up, down,left or right rooms, it just automoves the item back onscreen

#

This should prevent losing any items by dropping out of bounds

#

Games I've done before were arcade-ish kind of games, where moving and shooting and things are the challenge. This game is all logic, the movements are basic, so basic that I'm not even using vectors for it here. A totally different kind of challenge

#

I always use a vector for positions but all these items just move in ints

#

Each direction moves independently. Meaning things moving on two axes move slightly faster

vital saddle
#

That looks good!!

grand gyro
#

hello

#

im trying to make snake in pygame

#

as intuitively as possible

#

just double checking the bottlenecks or issues i could run into if

#

i made a Snake class to store a list of the coordinates of the snake body

vital saddle
grand gyro
#

just checking

brisk yew
vital saddle
#

It would be fast enough

vital saddle
stable hollow
woven glacier
#

would someone be willing to help me debug a basic pygame physics sim?
I'm getting a bug where I can't move the physics objects past a certain height and I can't figure out why
https://paste.pythondiscord.com/345A

sterile nest
limber veldt
#

Scissors and?

sterile nest
#

hm?

limber veldt
#

What are the images?

sterile nest
#

rock, paper, scissors

#

rly bad images lol

woven glacier
#

no they're perfect

limber veldt
#

Oh so they're rocks. Just small images

sterile nest
#

Yeah, I can only sim 300 entities at a time tho...sad

#

need to optimize

#

All the detection cones ☠️

#

cant draw without my fps dropping to 5

#

Also made thsi heat transfer, but its so slowwwww. Thats why Im learning C++
Cooler sims

dawn quiver
#

hi

limber veldt
#

The puzzle is hard, the solution is easy

#

Or one of the solutions, there has to be others but probably not as simple

#

Working on inheritance for a few. I have many objects subclassed from a single object. Like all my gates subclass from Device() and most are rotatable. So I put the rotate() method in Device() and for a couple of devices that cannot be rotated, I override by giving them an empty rotate() method, just return from it

#

But now I've given the Device().rotate() method a condition if self.rotatable: and all the subclassed devices can have a bool for that attribute. Now those few devices that don't rotate just have to set that attribute to False while the others default to Device() attribute, which is True

#

So the override is now of the attribute instead of the method

brisk yew
limber veldt
#

Classes can go f themselves! No classes?

odd venture
#

Hello Guys, i'm trying to create a Pong game in Python for learning. I already created the game but I've some issue with collision thru pads and ball. I'm not able to undestand what's wrong with the code, beucase sometimes the ball hits one of the two pad in anomalous way, the ball hit 10 times the same pad and assign 10 point. It looks like if the ball is locked in the pad and score many points at time. Can anyone help me ?

full depot
#

I'm doing some pygame coding using pgzero and pgzhelper but anyways, I was tryna make a pokemon game, and once you beat the first gym leader you can advance to the next gym leader. but when you do, for some reason the move button isn't working and I tried printing to lmk what screen I'm on the problem is showing that it's not switching screen to "play8" (screen names)

https://paste.pythondiscord.com/FDKA

pine plinth
#

everything is a dict

#

lua moment

brisk yew
#

lua uses tables
(they are totally nothing like dicts)

dawn quiver
#

Sup. Im using pygame to make a really simple game as a test, but for some reason Im getting a trackback error that I cant make sense of?

Program Output:

pygame 2.5.2 (SDL 2.28.3, Python 3.12.0)
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
  File "E:\Python\mow_lawns_game\main.py", line 138, in <module>
    Game().run()
  File "E:\Python\mow_lawns_game\main.py", line 133, in run
    self.move()
  File "E:\Python\mow_lawns_game\main.py", line 73, in move
    self.pos[1] = self.y
    ~~~~~~~~^^^
TypeError: 'tuple' object does not support item assignment

Process finished with exit code 1

Code:
https://paste.pythondiscord.com/MDLA

leaden bane
dawn quiver
leaden bane
#

theres no self.pos[1] = self.y in the code

dawn quiver
dawn quiver
# dawn quiver i renamed the variables, but its there. heres is the code with the updated varia...

updated error, still the same

Traceback (most recent call last):
  File "E:\Python\mow_lawns_game\main.py", line 138, in <module>
    Game().run()
  File "E:\Python\mow_lawns_game\main.py", line 133, in run
    self.move()
  File "E:\Python\mow_lawns_game\main.py", line 73, in move
    self.player_position[1] = self.player_position_y
    ~~~~~~~~~~~~~~~~~~~~^^^
TypeError: 'tuple' object does not support item assignment
leaden bane
#

because player_position is a tuple

dawn quiver
leaden bane
#

it's a tuple.

#

somewhere in the code it's changing from one to the other

dawn quiver
#

im defining it as a list?

#

in init

self.player_position = [0, 0]
leaden bane
#

somewhere in the code you're changing it to a tuple.

dawn quiver
#

i guess ill try some debug prints

#

well i have no idea where im type casting it into a tuple, but type casting it back into a list works i guess

leaden bane
limber veldt
#

That data test results

#

It populated the room

#

Eventually leading to level initialization being the same for loaded levels as for new instanced levels

#

I'll have a method to read that data and a method to write it the same way

surreal furnace
#

is there a reason you aren't using pickle?

limber veldt
#

Saved game files will be large-ish, maybe a 100kb or so. I wonder if pickling that data will be necessary

surreal furnace
#

I personally find pickling a Save class easier to work with than json

limber veldt
#

Oh yeah, once I get the data structure worked out, I can toss it in an attribute and pickle the object with it

surreal furnace
#

like

#

pickling is pretty fast

#

unless you had a different concern

limber veldt
#

Yeah, I have a method to pickle data already

surreal furnace
#

ah ok

limber veldt
#

Just not yet implemented with this testing

surreal furnace
#

got it

#

what is the game actually

#

it looks interesting

limber veldt
#

Originally called Robot Odyssey (1984 The Learning Company) ported to Java as Droidquest (1998 or so, Thomas Foote, github)

#

And now ported to Python, sst

surreal furnace
#

oh nice

limber veldt
#

The only downside to pickle is the security issues but with user generated save data in a pickle, they'd be secure. Just wouldn't trust sharing those objects with others, maybe

surreal furnace
#

oh true I'd forgotten about those

#

my game uses json to define default level states and pickle to save them so I'll hopefully still be able to have custom level sharing with that system

limber veldt
#

And that's just a small three-room level, some of my levels are 60+ rooms

#

So the data is quite large

surreal furnace
#

the other issue with pickle is that if you have a lot of visual effects when you save you're just wasting space

surreal furnace
limber veldt
#

440 rooms total

#

So saved games will be level based, just save the level, not all of them

surreal furnace
#

wouldn't it be more storage efficient to only save the modified rooms?

#

I mean it's negligible anyway

limber veldt
#

It'd be really difficult to track modified from unmodified when the room_items['layout'] can be mutated

surreal furnace
#

oh that's fair

#

out of curiosity

#

are your gates classes?

limber veldt
#

But that is a good suggestion...pondering how I would implement it

#

Yeah

surreal furnace
#

how come you're accessing them from a dictionary?

#

in the level data

limber veldt
#

They're all subclassed from Item()

#

Well, Device is subclassed from Item() and gates are subclassed from Device()

#

I have a parser that reads those item IDs and instances the object

surreal furnace
#

are the ids ints or enums or smth?

#

rightt

#

hold on

limber veldt
#

IDs are ints

#

Which are stored in a dict...

surreal furnace
#
def str_to_class(class_name):
    if type(class_name) == list:
        return getattr(sys.modules[class_name[0]], class_name[1])
    return getattr(sys.modules[__name__], class_name)
``` this is what I've been using
#

I just store the class name as a string

limber veldt
#

That is very interesting, can you explain it?

#

Because I'm all for exploring other ways to get objects from strings instead of ints

surreal furnace
#

it takes in a string or list of strings and converts it into a path to the desired class

#

so for example I used ["engine", "Sprite"] as an argument in one of my levels which would be the same as engine.Sprite

limber veldt
#

Do those modules need to be in the same file?

surreal furnace
#

that's what the list check is for

#

if you pass a string rather than a list then it only checks the local module

#

which is passed as a string through __name__

#

wait

limber veldt
#

Right

#

Hmm

#

Let me try implementing something like that...

surreal furnace
#

otherwise you need to state the module

limber veldt
#

Just as a placeholder test first...

surreal furnace
#

i might switch it to use .split instead of a list as well

#

it wouldn't simplify the function at all but it would make writing the level data easier

grand gyro
#

ngl i might go back to this

limber veldt
#

Hey! That worked!

limber veldt
grand gyro
#

does anyone know pygame?

limber veldt
#

Lots of people know pygame, do you have an actual question?

limber veldt
#

My new populate

#

No more ifs!

#

I'll need to rename it, since this one will only work with devices, but so good

#

I'll have a populate_items() and a populate_devices()

limber veldt
#

Not that it works, but that it will work for all levels

#

And all items and all wires

delicate sedge
#

Is Metal by Apple hard to learn?

limber veldt
#

@surreal furnace Thank you again for showing me how to instance objects from strings, that's so cool

vital saddle
dim yew
#

Hello!

surreal furnace
#

but like

#

bigger

surreal furnace
grand gyro
#

its me but more zoomed in

surreal furnace
#

this town ain't big enough for the two of us

#

also

#

it has a post process screen shader for (currently only) colour correction

#

the grass is really laggy though, if anyone has any suggestions on how to improve performance I'd love to hear them

#
class RotationSpring:
    def __init__(self, rotation, target_rotation, strength=1.0, dampening=1.0):
        self.rotation = rotation
        self.target_rotation = target_rotation
        self.angular_velocity = 0

        self.strength = strength
        self.dampening = dampening

    def update(self):
        self.angular_velocity += (self.target_rotation - self.rotation) * engine.delta() * self.strength
        self.angular_velocity = engine.math.lerp(self.angular_velocity, 0, self.dampening * engine.delta())

        self.rotation += self.angular_velocity


class GrassPatch(engine.TickableEntity):
    def __init__(self, pos, width):
        self.pos = Vector2(pos)
        self.width = width

        self.interval = 3 if engine.settings.getConfig().getboolean("graphics", "fancy_grass") else 4

        self.grass = []

    def generateGrass(self):
        self.grass = [Grass(self.pos + (x * self.interval, 0)) for x in range(int(self.width / self.interval))]
        random.shuffle(self.grass)

    def serialize(self):
        self.grass = []

    def update(self, *args):
        if engine.settings.getConfig().getboolean("graphics", "grass"):
            if not self.grass:
                self.generateGrass()
            for g in self.grass:
                g.update(*args)

#
class Grass(engine.TickableEntity):
    def __init__(self, pos):
        self.pos = Vector2(pos)
        self.pos.x += random.randint(-1, 1)

        self.influence = Vector2(
            random.uniform(0.05, 0.09),
            random.uniform(0.1, 0.3)
        )
        self.wind_strength = random.randint(7, 12)

        self.width = random.randint(1, 2)
        self.height = random.randint(5, 20)
        self.trigger_rect = pygame.Rect(0, 0, self.width, self.height)
        self.trigger_rect.midbottom = self.pos

        self.damp = random.uniform(0.7, 1.5)
        self.strength = random.uniform(0.7, 1.5)

        self.rot_spring = RotationSpring(0, 0, self.strength, self.damp)

        self.colour = random.choice((
            (25, 60, 62),
            (38, 92, 66),
            (62, 137, 72)
        ))
limber veldt
surreal furnace
#

glad I could help!

limber veldt
#

It's changed slightly from what it was a couple of hours ago, as some objects need different args, but conditions for them is easy

surreal furnace
#

yeah I just have the args as a list usually

#

you could probably do smth to make them a dict if you wanna have default values though

limber veldt
#

All of this stufff is being added using a couple of methods

#

And that blue robot is wired with an 8-pin chip loaded and connected to its thrusters/bumpers

surreal furnace
#

nice!

limber veldt
#

All the items/devices in that room

surreal furnace
#

damn that's pretty compact

#

I should make a level editor probably

limber veldt
#

So easy to add more

surreal furnace
#

my game doesn't use tiles it uses sized platforms

#

so it's a bit of a pain to add things manually

surreal furnace
limber veldt
#

I was thinking the same thing, level editor

#

But in my case, I'd pretty much just need to make the tile editor and add a item menu to exissting code

#

Cause my game is already an editor

#

Just doesn't have a menu to choose items to add, it does have one for devices though

#

Items are everything in the game, keys, robots, gates, everything. Devices are a subclass of Item and is everything that has a port to which wires can be connected and logic to carry electricity (signals) to other devices. Robots are subclasses of items and have special devices inside

#

I should have thought about a level editor before I hardcoded 2d grids layouts for 400+ room, lol

surreal furnace
#

I might switch to a tile system tbh

#

so I'll have tiles and entities

limber veldt
#

I have this item/device adding to levels so far abstracted now so that part of adding items and things is no longer a pain in the ass

surreal furnace
#

entities work how my stuff does now but the tiles system would probably use indexing

limber veldt
#

I'm only using tiles for the walls

surreal furnace
limber veldt
#

Everything else is just a plain old sprite

surreal furnace
#

oh what

#

why did it put that at the beginning

#

oh well

brisk yew
surreal furnace
surreal furnace
#

god why is batching such a pain

#

I'm trying to switch to a tile system and make tiles merge into rects where possible and I'm slowly going insane

vague shell
# surreal furnace here's what I've been working on

nice ^^
I dont know if it's much of a suggestion as I personally don't understand a thing that's happening in this vid (that im linking, not yours) and on top of that it's not even python. However I think it explains the concept pretty well. Maybe it's useful to you. if not, interesting watch in any case 🙂
https://www.youtube.com/watch?v=5zlfJW2VGLM&ab_channel=Vercidium

The source code and demos are available here: https://patreon.com/vercidium

I spent the past 6 years creating a game engine, and I've been shocked at the things that can make or break performance.

I put together 3 simple optimisations that you can use to make your game run up to 10 times quicker.

Music is Orbit, Saturation, Abberations and Ch...

▶ Play video
nocturne plaza
#

It is an good idea if i make an IA for the left paddle for an ping pong game?

surreal furnace
limber veldt
#

Pretty much all interactive items/devices in one room

#

The red rect being drawn on that blue robot is just debug showing the robot's portal rect, that which collides with walls and enables/disables robot entry

nocturne plaza
surreal furnace
#

ohhh i didn't realise you'd misspelt AI

nocturne plaza
#

Oh my bad sorry

surreal furnace
#

I thought it meant input axis or smth

#

wdym by glitched?

nocturne plaza
#

Well look at the player lives

#

it reached 0 but i can still playing lol

#

i didn't add an gameover screen for now

surreal furnace
#

are you lerping the ai position?

#

I've found that makes it more natural looking when I implemented it

nocturne plaza
#

No for now i made so the ai paddle just follow the ball

surreal furnace
#

ah alright

#

well good luck!

nocturne plaza
#

Thank you i appreciate it :')

#

ehm, i tried to make so if the ball goes fast it have fire particles, heres the result :(

surreal furnace
#

that's quite a lot of particles

#

I'd personally be worried about visual clarity

#

maybe try rendering the ball in front of the particles and keeping it white?

#

or at least a distinct colour

nocturne plaza
#

I know, its not supposed to happend

surreal furnace
#

ahhh ok

#

sorry 😁

nocturne plaza
#

It should only show small particles smaller than the ball

#

but for some reasons there all that

surreal furnace
#

can I see your code?

nocturne plaza
#

sure

#

!paste

surreal furnace
#

hmm

#

that is odd

#

it seems to me in the picture actually that the particles are the right size

#

and its just the ball that's been set to the particle colour

nocturne plaza
#

No the ball being yellow its normal, its to show the ball the is on fire

surreal furnace
#

I don't quite understand what the problem is then tbh

nocturne plaza
#

just try to play the game, you will understand, i don't want the particles to be that much

limber veldt
#

Another quick and easy refactor, 14 ifs replaced by a couple of lines

#

I can keep going too

#

lol

#

This is the toolbox selection method

nocturne plaza
#

Nice keep going, your doing great work pithink

woven glacier
limber veldt
#

Yeah

woven glacier
#

cool

limber veldt
#

A game full of logic puzzles using robots to solve them

woven glacier
#

ah, very cool

limber veldt
#

The robots have thrusters, bumpers, antenna, and grabbers. each with ports where one can connect wires to logic gates to have them perform tasks

woven glacier
#

beep boop

limber veldt
#

Yip

woven glacier
#

would you happen to know how to make a square and then move it around the screen in pygame?
I've tried and the square shrinks and grows with the movement

limber veldt
#

What do you mean by move it around the screen, like with the keyboard, the mouse, or by itself, like a ball bouncing around?

woven glacier
#

with the keyboard

limber veldt
#

And some bounds checking

woven glacier
#

aight

limber veldt
#

But just make a sprite, give it an event handler to handle the keyboard input, and adjust the sprite's rect per the keys

woven glacier
#

alright

limber veldt
limber veldt
#

That was quick demo for someone else a few weeks ago, how to do a sprite and a group, adding simple movement with the keys or whatever is easy enough

surreal furnace
#

oh I meant more the phrasing before the link

limber veldt
#

pygame.Sprite() is awesome, jus sayin, I love those things

#

And vectors, learning how to use those opened a whole new world of game motion mechanics for me

surreal furnace
#

it took me ages to figure out that .elementwise() existed though and I thought I was going insane 😭

limber veldt
#

Delta time, inheritance, vectors, all things I've learned over the past couple of years that I wish I'd learned waaaaaay sooner

#

I just redid those last night, much nicer than they were

surreal furnace
#

ooh very nice

#

anyone got any ideas on how I could combine rects vertically?

#

they're initially tiles on a grid and then they get batched horizontally

#

but I havent been able to batch vertically as well

#

(the bottom platform does have a collider you just can't see it because the grass is covering it (which I should probably fix) )

limber veldt
#

Combine vertically? I'm not sure I know what that means

#

You mean those on the left and right become one large rect?

surreal furnace
#

yep

#

so the wide one at the top was also initially a bunch of tiles

#
def unpack_level_layout(level):
    batches = []

    for y, row in enumerate(level):
        temp_batches = [Batch(None, (0, 0), (0, 0))]
        for x, tile in enumerate(row):
            tile_type = LEVEL_IDS[tile]
            if temp_batches[-1].type != tile_type:
                temp_batches.append(Batch(tile_type, (x, y), (1, 1)))
            else:
                temp_batches[-1].size.x += 1

        for batch in temp_batches:
            if batch.type is None:
                continue
            batches.append(batch)

    objects = {}
    for i, batch in enumerate(batches):
        objects[f"batch_{i}"] = batch.convert()

    return objects
#

I'm using this at the moment

limber veldt
#

I can only think of the probably naive approach, iterate them, checking for collisions and compiling a new rect from the results

surreal furnace
#
class Batch:
    def __init__(self, batch_type, pos, size):
        self.type = batch_type
        self.pos = Vector2(pos)
        self.size = Vector2(size)

    def __str__(self):
        return f"type: {self.type.__name__}, pos: {self.pos}, size:{self.size}"

    def convert(self):
        result = self.type(self.pos.elementwise() * TILE_SIZE, self.size.elementwise() * TILE_SIZE)
        return result
surreal furnace
#

hold on

#

this is what im worried about

limber veldt
#

If they're all the same size, you could use rect.centery as a condition for those vertically, you probably know this already

surreal furnace
#

that's a good idea

#

however

#

it generates the levels when the player enters them from a json file

#

and I'm worried about stuttering or flickering when that happens

#

atm the function takes < 1ms but idk if checking for that many collisions would be an issue

#

also I'd rather keep it all in the first function

dry cloak
surreal furnace
#

why is that?

#

I could implement a chunk system for it but it would require changing quite a lot of the framework I already have

dry cloak
#

aslong as you are only checking collisions with tiles on the screen, only merging them on one axis gives you more than enough performance

in alot of cases merging both ways wont reduce the rect count

im unable to illustrate why because im on 1 bar of signal 💀, but unless the level is very boxy i personally wouldnt try to merge both ways (e.g. you have floating squares of land instead of trying to make them in interesting shapes)

surreal furnace
#

ah alright

#

I'll move my focus to something different then

simple summit
dry cloak
simple summit
surreal furnace
dry cloak
surreal furnace
#

that's fair

#

ig I'll just add it if it ends up being an issue

latent mauve
#

👋 all ! I'm getting started using Arcade but not Python. I am a backend software engineer and I've been using Python for 6+ years.
I would like to start working on a side open source game and I would like to not go at it alone. I would love to find one or more people that would like to help me out and try to build a nice little game.

What is the game I'd like to make ? Well a ski resort tycoon of course ⛷️ ! Tis' but the season of course ! My goal would be to have the game be 3D but let's start small and have 2D start 😉

If you'd like to know more, or are interested, hit me up ! I'd love to chat !

vagrant saddle
#

@latent mauve, maybe you should go on Panda3D for 2D/3D easy transition

round obsidian
#

and it's also seen in some circles as begging for labor

#

if you start by building something on your own, even if it's very small, that sends a signal that you know how to do the work. And that provides a base upon which other people can start helping out, should they feel inclined

latent mauve
#

Yeah that makes sense

#

I am working on it

#

I just have nothing to show for it yet 🙂

round obsidian
#

in programming of any kind, having work to show is how you establish your intentions.

#

if you say "I have this great idea, I just need other people to help me build it" people will be like "why not just build the parts of it you can first, and then talk to us?"

latent mauve
#

Yes ofc

limber veldt
#

What's cool is that I can eventually parse all the items in a level into a similar dict, write that dict, then load it as a loaded game

#

No other levels will have pre-wired devices in them, only level 1 starts with them wired to accomplish that level's puzzles, but each room will have a wire_dict for saving wires

odd venture
#

Hello Guys, can anyone help me with this issue ? The ball has this strange behavior when hit a pad corner

The code is this one:

    if left_pad.colliderect(ball_rect) and left_pad.right > ball_rect.left or right_pad.colliderect(ball_rect) and right_pad.left > ball_rect.left:
        print("COLLISION !")
        ball_speed_x = -ball_speed_x
        score = update_score(score, +1)
limber veldt
#

You need some collision response. When you flip the ball_speed_x, also try ball_rect.left = left_pad.right This way you move the ball out of collision

#

And the opposite on the other side, for the right_pad

odd venture
#

@limber veldt, thank you for reply ! I tried in this way, but the issue occurred again

ball_speed_x = -ball_speed_x
ball_rect.left = left_pad.right
score = update_score(score, +1)

tranquil frigate
#

Hey

#

Is there anyone here?

limber veldt
#

I just tested something....I made my level2_data.py, it's just one big dict describing the level like I posted above, then I assigned that as a variable in a class then pickled the class. Then, instead of importing the data and sending it to the level, I loaded it from the pickled object, assigned it to a variable and passed it, it worked!

#

The level2_data.py is 75kb, the level2_data.lvl (the pickled object) is 1kb

limber veldt
#

Hmm, maybe it didn't work...issues

surreal furnace
#

the springs I'm using for the water and vines are causing quite a bit of lag though

#

I've managed to optimise them a little (about +20fps from first implementation) but they're still quite unperformant

#

I was considering rendering them in a shader instead of using pygame's draw features but the main problem is actually (and surprisingly) the spring calculations rather than the rendering

limber veldt
#

I got my save data working. I pickled the attribute itself instead of the class having it

#

So I'm considering how the level gets this data. Perhaps it should load each level's data at level start. Like, player hits a portal, it loads the data, sends it to the level constructor and spawns the player after construction

#

I was importing the data into each level's class, now loading it from a pickle and sending it as an arg to the constructor

#

Testing this with level 2, this is it now, and the populate_level2() method will be moved to BaseLevel() soon, basically just a couple of attributes and a call to populate https://paste.pythondiscord.com/AE7Q

#

The data has the Train and, unless I make a special condition for it in the item parsing, it ends up in the room_items (the group that is drawn and interactive) when it shouldn't be until the button to call it is pressed

#

So I just remove it after the populator

#

And in the button to call it touched_by_item() method, it iterates the items to find it, so no reference needs to be sent to the button

#

And I have two groups that each item goes into, level_items, and room_items. level_items is basically just a reference to every item in a level, room_items are drawn and interative

surreal furnace
limber veldt
#

Good idea, using a set

surreal furnace
#

it works pretty well

#

level loading shouldn't take very long tbh

limber veldt
#

Sort of on-the-fly data loading?

surreal furnace
#

for me interpreting and loading the json file takes usually <1 ms

surreal furnace
limber veldt
#

Yeah, it seems plenty fast, any SSD should load it in milliseconds

surreal furnace
#

I'll get a video of the level switching hold on

#

the only reason it's flickering is because the foliage is buffered

#

which it has to be to appear in front of everything else

limber veldt
#

So I wonder...A few versions ago, I was just importing all the levels at game init and instancing them as necessary. Then I moved to importing the levels at level transitions, thinking there was no reason to have all levels imported and in memory all the time, and just reassigning the self.level attribute after importing. But that doesn't sever all references to old levels and they remain in sys.modules. Is it even worth any effort to 'unload' levels?

surreal furnace
#

probably not, but I personally wouldn't be defining levels in python at all

#

using json files will keep it much more compact

limber veldt
#

Yeah, for sure, and python would just be used to create the json?

surreal furnace
#

or to load it yeah

limber veldt
#

I cna do that now that I have a parser that can parse an entire dict of a level

surreal furnace
#

the file name is NOT 😠 a face it's the level coordinates

limber veldt
#

Oh neat, that's kinda the same idea

#

Lists of dicts

surreal furnace
#

yep

#

I have 4 lists actually

#

1 for normal objects and 1 for physics objects

#

and then a variant of them both for objects that need to be loaded after the player is

#

here's a shorter one so you can actually see the end of it

limber veldt
#

So I'll just need to complete the conversion of all my level datas into jsonable dicts, just one orr two levels are done so far

#

I wonder if one should make those json files read-only?

tranquil frigate
#

Hello

#

I made my dream come true and bought GTA 5 Source code

tranquil frigate
surreal furnace
#

just open them in read only mode

surreal furnace
tranquil frigate
limber veldt
#

Well, for this game, it will be able to save levels and I would want to prevent the default levels being written over

tranquil frigate
surreal furnace
#

I save levels in a different folder as pickle classes

limber veldt
#

Hmm, that's an idea...

#

Lemme ponder that

tranquil frigate
#

excellent

simple summit
#

oh btw the thing that says "currently has 118 mods" is wrong lol

limber veldt
#

I should probably add a try/except condition to them, just in case they can't find the files

#

And that method is just a debug method, not a feature

#

Just taking all the data that's in variables and dict-ifying it, time consuming but worth it, really like the json idea

#

If I implemented the save_game() method how I want to, I could just start a level and save it, it would do the json conversion for me

surreal furnace
#

why are you using a different class for each level?

limber veldt
#

I'm not too sure yet

#

Once I get all the levels aligned, that will be changing too

#

With json, that is, and the new parser

#

But the game's levels are totally not related, there's no reason to have them all in one class

#

Or in one file even

#

The only thing common between the levels is anything the player carries with them to the next level

#

So just an inventory transfer

#

And when the levels were 1200 lines of data and logic, it made total sense to have them each in their own class...that is changing though as I redo these things

surreal furnace
#

wouldn't it be better to have a more abstract level class

limber veldt
#

Most are, yes, but many have slight differences

#

Of the seven or so levels I've turned into json so far, only one of them has totally default setup

#

Like level 1 has a couple of items it randomizes on init, level 5 has a one-way room link setup after the normal links are made, and so on

#

In level 2, I go ahead and add the Train() object in the json but remove it from the room right after populate_level()

#

Another way to manage it would be to make a dummy room to store it in, then shift it from one room to another when triggered

#

I did that in level 4, there's a button that only appears periodically, during the time that it's gone, it's actually been moved to an inaccessible room

#

It's the easiest way to take something out of a room so the player can't interact with it, move it to another room...or even off screen

limber veldt
#

Level isn't really the right name for them, as they were always more like level populators, defining all the objects within a level. I do have a more abstract level, BaseLevel(), where all the methods to deal with levels lives. populate_level() now lives there, link_rooms in a few versions is there, parsing the 2d arrays into tiles is there

#

I have 173 total instances of 51 various tiles, still not sure how I want to better handle those

#

And that's just tiles with behaviors, plain colored tiles are all base tiles

dawn quiver
#

Hey everyone, coming from Rust, WGPU was a big deal. Does wgpu-py get a lot of usage in the python community?

round obsidian
#

I haven't touched it yet - I mostly work with things that wrap OpenGL, like Pyglet

limber veldt
#

Dang

limber veldt
limber veldt
#

Just working out the data and method for parsing items with internal rooms inside other items with internal rooms

#

That was from a dict of portal items

surreal furnace
dawn quiver
#

I want to know start up of gaming

#

Can anybody send me code for starting a new gaming app means as a idea

vital saddle
wary plank
#

who wants to learn me everysingle line of code in existiance (python ofc)

#

or try

#

pls dm me

limber veldt
#

I have game saving to pickle kinda working, progress

wise saddle
#

Hi! I would like to create a little educational game... The idea is simple: there should be a geoboard (something like this: https://www.visnos.com/demos/polygon-explorer) where the user can create it's polygon and on the bottom I'd like to show the area and the perimeter of that polygon. I know it's a really dull game, but I can't put my mind up on how to actually create the board! Could anybody give me some ideas or link some similar projects? Thank you in advance

limber veldt
#

I've done similar with mouse draggable points using pygame and python to draw bezier curves

#

Drawing a polygon using the points would be rudimentary

young frost
#

I want to learn python for Game Development for free?

limber veldt
#

Youtube tutorials are free

young frost
#

Anyone who can guide me to which sites or tutorials to use

#

Bro there are million of Tutorials on Youtube. How to know which one to choose

limber veldt
#

Clear Code, Russ, Nick, among the best pygame youtubers

young frost
#

Can you guide me

limber veldt
#

No

#

If you need help using youtube, I can't help you

young frost
#

Ok Thanks for Guiding me out

limber veldt
#

Helping someone learn programming is no small undertaking. One must know how to find and implement information and ideas, especially for free

wise saddle
#

I'd like to ask you one last thing

limber veldt
#

I don't know if it's much use to anyone, but just an idea of how I made mousable points. That file was for making assets for another game, so really not a game idea, but maybe one can learn a little from it

wise saddle
#

For the background, (I'd like to build something like this: https://apps.mathlearningcenter.org/geoboard/) would you suggest using an image with the dots (and saving their positions) or to create them as objects on a plain background?

limber veldt
#

I would probably make a 2d grid and put dot sprites at each intersection

wise saddle
wise saddle
limber veldt
#

I don't know which is heavier, blitting a large image with dots on it or blitting a few thousand dots

wise saddle
#

ahahah

#

20 dots is not that bad I think

limber veldt
#

True that

unreal river
limber veldt
#

I think there has to be a point of diminishing returns, probably relative to image size and number of dots

near canyon
#

is someone a pro with python pygame?

#

that can help me with my game

limber veldt
near canyon
#

well i have a problem in my game
i have a problem with placing of blocks
the only way how i can place a block is this

#

but it must be like this

near canyon
near canyon
# near canyon

but if i put a block like this then it works but that is not the intention how it should be

vagrant saddle
#

yours really ?

near canyon
near canyon
near canyon
main minnow
#

I'm not really following with the problem, what's happening?

dawn quiver
#

How well does python fare when being embedded into e.g. Rust for game dev?

#

Hey send me code of that game of block 🥺

vagrant saddle
pine plinth
#

wow, pocketpy is interesting

stuck remnant
#

hey guys i wanna develop an adventure game with graphics but idk how to start

round obsidian
stuck remnant
#

maybe something like the og gta

#

or a texted based adventure game with some graphics

#

so it doesnt look plain with you just playing in terminal

round obsidian
#

I'm mucking about with creating a roguelike adventure, which is relatively easy

#

the graphics are simple, so it's less of a hurdle to implement them, and you don't have to worry about FPS because it's turn-based

stuck remnant
#

cheers

round obsidian
#

sample screenshot (the graphics are all placeholders - this isn't for release yet; when that happens they'll be replaced with proper assets)

stuck remnant
#

nice bro

round obsidian
#

the focus right now is on game mechanics, the underlying state mgmt

stuck remnant
#

want me to send you my game once i finish quite a bit?

round obsidian
#

a good way to do that would be to set up a free itch.io account and post it there

stuck remnant
#

so making graphics is quite easy?

#

do you need like pygame?

round obsidian
#

you can start with "canned" graphics

#

stuff from itch.io's free asset section, for instance - use those to get started

#

you can use Pygame or a number of other frameworks (I'm using Pyglet)

stuck remnant
#

whats the best in your opinion

round obsidian
#

Pygame has the broadest use and may be the easiest to get up to speed with for starters

dawn quiver
#

@round obsidian I wish I could come up with a game idea and make something. I could definitely code it. Trying to look for people that want a programmer.

round obsidian
sterile nest
#

it now considers multiple vectors

#

I am going to add obsticale vector evasion also so it avoids trapping itself

#

My sprites did not work as you can see

gritty rapids
#

hey i have a problem. so im using a tutorial to do a platformer game, and wanted to use another sprite. but when i imported the sprite and played it. the animation looks weird. could anyone help?

wary plank
#

how do i make games with pygame

vital saddle
wary plank
#

okay then

stuck remnant
#

yo guys i got a game idea who wanna make it with me

dawn quiver
#

@stuck remnant what is the idea?

stuck remnant
#

GAME IDEA:

You're a citizen in the UK in the year 2042 and the UK has been invaded by India and now you must fight with your neighbours and soliders to end the invasion the game will have similar mechanics to GTA 1 GTA 2 and GTA London but you can buy weapons of mass destruction or craft them on your own once youve reached a high enough status and theres not one single entire match instead theres levels set in each majour UK city/town the games also in multiplayer

dawn quiver
#

I'm not interested sorry.

marble jewel
#

Isometria Devlog 39 - New Minimap, Map Generation, Discord, Next Fest! https://youtu.be/VTwaFfYhC1o

Wishlist and play the Isometria demo here: https://store.steampowered.com/app/2596940/Isometria

https://bigwhoopgames.itch.io/isometria-demo

In this week's dev log I will show you the brand new minimap which is much more performant than the old one. I also discuss biome and map generation improvements, the new discord I've setup, and Isometria...

▶ Play video
stuck remnant
#

thats in pygame?

#

@marble jewel

vagrant saddle
stuck remnant
#

whats pygame-ce

vagrant saddle
stuck remnant
#

cool

vagrant saddle
#

( works on web too )

stuck remnant
#

wym works on web?

#

ohh

#

got it

vagrant saddle
#

you don't have to change much your code to run as a html5 game

#

and it still runs on desktop and android if done well

marble jewel
stuck remnant
#

cool

#

how much optomization did you need to do cause im planning on making a game

marble jewel
#

mostly just caching is important

stuck remnant
#

can you link me to any tutorials?

marble jewel
#

like if you rotate an image, save the rotation insetad of rerotating it

#

there are a few on my youtube

stuck remnant
#

cool

#

want me to share you my game idea?

#

GAME IDEA:

You're a citizen in the UK in the year 2042 and the UK has been invaded by India and now you must fight with your neighbours and soliders to end the invasion the game will have similar mechanics to GTA 1 GTA 2 and GTA London but you can buy weapons of mass destruction or craft them on your own once youve reached a high enough status and theres not one single entire match instead theres levels set in each majour UK city/town the games also in multiplayer

marble jewel
#

doable with pygame if you used pixel art

#

you should consider spritestacking, would look cool for a gta1/2 type game

stuck remnant
#

thanks

marble jewel
#

I'm an open book if you have questions

#

you should join the pygame discord as well if you need help

stuck remnant
#

cheers

#

could the game be doable for me to code even with my little experiance

#

like the only thing ive actually coded in python is a text based adventure game

marble jewel
#

so my recommendation is start small

#

do one thing at a time

#

like make a map with a player that can walk around

#

then slowly add things like a car or a building

#

multiplayer might be tough at first

#

dafluffypotato has some great videos on youtube which you could follow as well

stuck remnant
#

thanks

#

btw im having a slight problem installing pygame

#

its not letting me install pygame for some reason

bright plover
#

It's not letting you install user

stuck remnant
#

ohh

#

mb i was following off a tutorial

bright plover
#

There's not supposed to be a space between -- and user

#

Also I think that has to go before the name of the package

bright plover
stuck remnant
#

uh

marble jewel
#

try

pip install pygame-ce
#

but first

#
pip uninstall pygame
round obsidian
#

make sure you're installing pygame into the same instance of Python you're using to run your code. If you're using PyCharm, PyCharm does funny things with venvs in projects, so you have to use their own way to install libraries

#

(this is one of the reasons we as a community don't always recommend PyCharm to beginners, because it means they have trouble following tutorials due to issues like this)

round obsidian
stuck remnant
#

no

#

im using thonny

round obsidian
#

what editor/IDE are you using?

stuck remnant
round obsidian
stuck remnant
#

thx

round obsidian
#

Thonny also has its own package management stuff

stuck remnant
#

yeah i just use thonny cause its easy for me to use and it is the one we use in computing science

#

i much prefer it over visual studio code

#

that was terrible to use

round obsidian
#

it's much simpler, yes

#

VS Code is a more general editor that can be turned into an IDE for many languages

#

I use VS Code because I do work in a lot of different things, not just Python

limber veldt
#

I've used pycharm and vscode, both work fine, they seem pretty similar

gritty rapids
#

anyone?*

limber veldt
#

Seems you need to compare the original source image to the new one, are they the same size? If using a sheet, are they the same position in the image?

#

Your animated player image might be a sheet, in that case, you'll need to make a new sheet with the appropriate images, or edit the code to work with a different sized image

gritty rapids
#

but the animation is weird like that

#

its like slowly transitioning to the next image

#

instead of directly going to it

#

and how do i solve this error??

its not even part of my code

unreal river
limber veldt
cinder hollow
#

I'm trying to install pygame but it just goes syntax error

#

I have a macbook

thorn cove
#

Idk why the pygame is installed but the VSCode cant find it even though its right there

cinder hollow
#

Same issue

vital saddle
molten cipher
#

Made my first game and used aesprite to help implement sprites into my game. If anyone wants the repo link theres a release

pine plinth
#

I experienced an interesting bug/feature today:
if you execute pygame.display.set_caption millions of times per second, it will most likely cause Windows WM to hang and the system to become unresponsive

I basically had pygame.display.set_caption in a tight loop and it was causing Windows to hang
it was not fun to debug :)

dawn quiver
#

@pine plinth what game are you making?

pine plinth
#

not a game, just pygame visualization

dawn quiver
#

@pine plinth visualizing algorithms?

dawn quiver
#

Anyone here have a game idea they want to try out?

swift dock
#

Hey folks, I am taking Harvard's CS50 Python rn and for the final project wanted to make something like original mario bros. Which would be the best library to use?

vagrant saddle
#

probably pygame+pytmx+pyscroll

swift dock
#

@vagrant saddle thanks

vagrant saddle
#

if you want help material get on pygame discord this one does not allow for dropping tmx and stuff, which seems a bit weird for a game dev channel

woven glacier
#

how would I make a basic player following ai in pygame?

dawn quiver
#

@woven glacier what kind of game.

woven glacier
#

just an "avoid the enemies" game

dawn quiver
#

2d 3d platformer what?

woven glacier
#

2d

#

it's just a buch of circles on a black background, top-down

dawn quiver
#

It requires a bit of math.

#

You have the players position and the enemies position.

#

You'd get the difference in x and difference in y from the enemy to the player.

woven glacier
#

alright

dawn quiver
#

So if you had a triangle the components would be the differences.

woven glacier
#

what do you mean by "components"?

dawn quiver
#

The x and y difference between your play and enemy.

woven glacier
#

ah

dawn quiver
#

This pair of numbers can be called a vector.

#

So we have the right direction

#

Now we need the right magnitude.

#

Basically the speed which your enemy moves.

#

If you divide each component of the vector by the length of the vector you will get a vector with a length of one pointing in the same direction.

#

Are you following?

woven glacier
#

maybe

#

one sec

#

like so?

epdiffX = []
epdiffY = []
def diffupdate():
    global epdiff
    epdiff.clear()
    for i in range(enemies):
        epdX = playerX - enemyX[i]
        epdiffX.append(epdX)
        epdY = playerY - enemyY[i]
        epdiffY.append(epdY)
dawn quiver
#

The steps are get the x and y difference between your two entities. Calculate the distance between them. Divide each component by the distance. Then multiply each component by a speed value.

woven glacier
#

I'm not sure I get the "divide each component by the distance" part

dawn quiver
#

Like how or why

woven glacier
#

how

dawn quiver
#

You know how to get the distance between two points?

#

It's very similar to Pythagoras theorem.

woven glacier
#

ah

limber veldt
#

One more level to convert to json, phew, what a grind

#

In short, and both positions need to be Vector2()

#

Or look up seek behaviors

#

They can get much more complex

#

While I suggest working through the long way to understand how it works, the short way is using pygame's Vector2() methods

#

The Coding Train on youtube has a series, The Nature of Code, recommended even if it's not python

#

Also Freya Holmer goes deep

digital junco
marble jewel
distant cedar
#

Hello everyone I am new here and I am still beginning to use python. I was hoping to get some thoughts from all of you on what simple projects should I start if my end game is to create a game using pygame? Thank you

limber veldt
#

Simple projects? Pong, Space Invaders, TicTacToe

#

Digital/analog clock

dawn quiver
#

Breakout is cool.

#

Hangman

limber veldt
#

Game saved, closed, reopened, saved files parsed and portals added to main level leading to saved game

#

And saving as pickles, too, awesome

#

I can change that 'Nothing yet' to 'Saved games'

dawn quiver
#

Cool. What info do you save?

limber veldt
#

Everything

#

The room layouts, the texts, the objects, rotations, positions, wires in every room, everything

#

Yeah

#

I'm sstill working out the methods but pretty much just building a dict of lists and dicts for every item in the game and saving it

#

This is an example o flevel data as python, it's just one dict. My save_game() method builds a similar dict and saves it as a pickle, the that loaded data is sent to the level init instead of the default data when the game is loaded https://paste.pythondiscord.com/HJBA

#

Dicts and lists are python types, array kind of objects

#

Get started on some tutorials, just takes practice

#

Everything worth doing is kinda hard

#

That's why you have to keep practicing

#

It's fine if you don't keep practicing, it gets pretty hard, but you still have to keep trying, looking for better tutorials or whatever

#

I'm certainly no pro but we all gotta start somewhere

unreal river
#

Hello, I just wanted to share a new project that I've been working on this month. It's a Python library for OpenGL context/window management. The purpose of this is to be a lightweight yet a high-level wrapper for GLFW, and hopefully be used in game dev. It's currently in development, but I think I can finish it this weekend.

dawn quiver
#

@unreal river have you made anything in opengl.

unreal river
#

yes

dawn quiver
#

@unreal river cool. I made something that allows you to attach shader by name.

#

It uses gperf.

#

I'm interested in making games with opengl but I think it's a dead end path because most use a game engine.

unreal river
unreal river
dawn quiver
#

I can show you the code I wrote a lil bit later. I think it's pretty neat.

unreal river
#

sure

limber veldt
#

Now I can take Load out of the file menu

#

Cause all loading will be through those portals

dawn quiver
#

It's cool how level selection are just game objects which you can save and load.

limber veldt
#

Thanks, I'm really satisfied with how this is coming together, so much effort

#

17 levels altogether and only 5 of them are default setups, the rest need some setup after populating all the objects, rooms, everything else

#

So that's why they need to be separate objects, working out the logic to initialize each level otherwise would be a pain

#

It has six game levels and eleven tutorial levels

dawn quiver
#

So this is a logic gate puzzle game?

limber veldt
#

Yeah, you have robots with bumpers, thrusters, antenna, and grabbers, and use them to solve puzzles by building circuits inside them using logic gates connected their various devices

dawn quiver
#

Neat

limber veldt
#

You've fallen into the underground city of Robotropolis and encounter about 30 puzzles of increasing difficulty through six levels

#

On your way out

#

It's a remake of an original game named Robot Odyssey from The Learning Company in about 1985

dawn quiver
#

I enjoyed playing human resource machine. Got very close to beating it but it's basically assembly.

limber veldt
#

Each of the first five levels has a secret which, if all gathered, and clues followed, will lead to the super secret sixth level, previewed in that short vid

dawn quiver
#

I love sercrets

limber veldt
#

I'll be publishing to github eventually. I don't know how well I've written it or how well it will run on others' machines (mine is just an i5 laptop with a 1650)

#

And it's not scalable, so those playing with scaled desktops will need to set it to 1080 100%

dawn quiver
#

Well I imagine it will do pretty well. It's a 2d game in python.

#

I'll be interested in playing it when it's posted.

limber veldt
#

I have the clock set to 60 fps, it's not a fast action game, but I never see dt go above the 16.7ms it should be

#

Only the room being shown is being drawn, so nothing is drawn in the background

#

So it runs pretty tight

#

Things in other rooms can be animating though, that doesn't draw them

dawn quiver
#

You track it with time.

#

A delta time.

limber veldt
#

Yeah, the evalutation tick rate is on a timer

#

So it can be controlled with that slider in the menubar

#

I use dt but things move based on that timer

dawn quiver
#

It would be cool if you can program a robot and a controller to control it remotely.

limber veldt
limber veldt
#

And given the complexity of circuits one can make using those gates, they can me made to do just about anything

#

The robots of level 1 come pre-wired to complete the tasks of level 1, in the subsequent levels, you're on your own

#

The chip inside that blue robot was burned in the lab, it consists of about 12 other chips nested inside it, each with circuits in them

#

The wallhugger chip

#

I even made a special device for listening to robot antennas, makes it so the antenna only 'hears' the robot that matches its color, so robots can have private conversations

#

or public

#

The room shown with all the objects at the start of that video shows all the logic devices and sensors

#

Well, the dict of all the datas

#

So, if you start a level from the previous level, it will be loading the level data from a json file of a similar dict, but if you start one from a saved game portal, it will load pickle data and start the level with that instead of the json data

#

This way original levels can't be overwritten by saved levels, they're different filetypes

dawn quiver
#

My brother had a great idea for a puzzle game.

#

He is really good at scratch. Gonna try and convince him to switch to python or C.

dawn quiver
#

@limber veldt we are going to be making a puzzle game as well

#

It will have lazers.

#

Many other things. Just don't want to give it away.

limber veldt
#

Everyone wants lasers, be sure to share your progress

limber veldt
#

Tour of the main hub level, the portals to levels 2-6 won't be in the final, only there for debug atm (they work)

#

I'm thinking if one beats all six levels, it'll expose those portals

#

There are also a few other little cheats I can implements

#

Like quick room navigation using shift + arrow keys

#

Instantly move the player from one room to the next

#

Spy cam for all levels, one can just view the rooms without moving to them

#

It's actually a feature of level 4. There is a library computer into which you can drop a disk that grants access to the level's security cameras, necessary for some of that level's puzzles

#

It also has a pathfinder, so if one wants to, they can just double click on a portal and the player will automove to it (or anywhere on screen, for that matter)

outer hedge
#

Good morning, playing the gama

limber veldt
#

Hi

#

I borrowed and implemented my own A* pathfinder based on pypi pathfinding

dawn quiver
#

can i make games on python

limber veldt
#

So, I had a few conditions for saving device references, But since all these devices are subclasses of Device(), I gave it a write_ref() method where it writes the default params for itself (name, position, rotation). Then for the devices that need more than those params saved, I gave them an override write_ref() where they call super().write_ref() then append their params to it an return it

#

No more condition for devices, they take care of themselves

#

And that's bound to be refactored too, since all devices are subclasses of Item(). So the base write_ref() will likely end up there with overrides in devices

#

Devices are a subclass of Item() and only devices can be rotated, so base item will just do name and position, device will add rotation and specific devices will append their specific attributes

#

Is there a particular name for an override method that calls super(), cause it's not really an override, is it?

woven canopy
# dawn quiver can i make games on python

No reason you can't. If you try and do some massive scale graphically intensive FPS or such you may eventually run into issues, but theres plenty to learn in Python for game dev.

woven canopy
limber veldt
#

Thanks and not really, other than my frequent ramblings here

limber veldt
woeful plume
#

does this channel care about the language?

limber veldt
stuck remnant
#

i was making a joke cause the teleportation system from room to room you have kind of reminds me of the atari 2600 game

limber veldt
#

Oh yeah, I guess you're right, I should make a little distorted fade effect

stuck remnant
#

btw are you good with pixel art?

limber veldt
#

I need some kind of transition though

#

Not really good at pixel art but I try

stuck remnant
#

im wanting to find someone who wants to make a game with me and is good at pixel art

limber veldt
#

I suppose you'd need to pitch your game idea to any potential artist, some might be alright with some subjects, others maybe not

ruby eagle
#

So, I don't know what channel would be the right one, if it would be in a help channel or not, but I am trying to make a text adventure game, I figured it would be a great way to learn python. I've been stuck on some of the functions for like 2 weeks. Or at least actually calling to functions is where I'm struggling

limber veldt
#

What's the issue, you send arguments to functions or methods and they return something...usually

ruby eagle
#

So, basically what I'm trying to do is make a series of menus and then call them as needed to the game, i.e. I want to have the start menu that would ask if the player wants to begin and then have different menus based off of where they are and so on, I know how to make the menus but then I don't know how to actually use them. I am making them with the def function. I apologize for not really understanding it, I am still learning python and have only been working with it for a couple months total

limber veldt
#

I'm not sure how I'd handle that kind of thing, never thought about making a text adventure game, surely others here have some ideas though

ruby eagle
#

My original one worked really good but as I started learning new functions the old ones kind of got pushed out of my head so now I'm just trying to get back to the basics because it made alot more sense then

limber veldt
#

Maybe I'd make a bunch of objects that link together and have attributes for the prompt and valid responses, just thinking a little though, still not sure

ruby eagle
#

I guess more of what my problem is that I have one that I had followed and made successfully but now I don't know how to take what I have and make another one but with an entirely different type of content

#

Or understanding what I made and utilizing it

vagrant saddle
ruby eagle
tame drum
#

can i get help with someone familiar with buildozer

vagrant saddle
#

@pastel current i don't know exactly how roles work on this discord, but is there somehow a way to announce / assign people recently enlisted as experts for python-emscripten community support ( and remind at the same time that Pygame-ce/Panda3D do web publishing baed on that support 🙂 )

vagrant saddle
#

( experimental web publishing of course)

mystic quarry
#

They have this channel as well? Oh!

pastel current
dawn quiver
#

Helper duck helping people in need

#

Helper duck!

acoustic herald
#

Hey, i would love to find someone to start a python game project using pygame. I dont have any ideas of what kind of game it will be so we can plan everything

acoustic herald
dawn quiver
#

I am making puzzle game with lasers.

acoustic herald
#

are you like inviting me to do it with you maybe ooor?

acoustic herald
dawn quiver
#

Sorry no. It's just me and my brother.

acoustic herald
#

ah okay, yeah no problem

limber veldt
#

Tryna decide if I want to change from 2d lists defining my room grids to some kind of data objects with .x, .y, .image attributes, maybe more, like pytmx

#

The parsing would be a lot easier with objects

#

Maybe I implement it in a test level and see what happens

limber veldt
#

Also, the top method doesn't populate the .room_array or .layout, both referenced in collision and some animations. So making that work for everything is probably not worth the hassle

#

In the populate_room() method, I if val == all the values in the 2d list and instance tiles based on those conditions. If that method was to work for all tiles in all levels, it would need maybe 150 conditions

#

So I'm just exploring other ideas for handling populate_room()

dense tundra
#

can someone

#

help me

#

build soft aim

tacit swallow
#

Is there a library or a game engine to develop 3d games in python?!?

unreal river
tacit swallow
#

Where do we get models and their texture packs

#

I suck at blender

unreal river
unreal river
tacit swallow
#

Okayy thankss

meager plover
meager plover
tacit swallow
#

Im not doing a project

#

I was just curious

#

I am make a terminal based game tho

meager plover
tacit swallow
#

I will likly convert it to 2d or something

#

Or maybe implement iton a discord bot

meager plover
#

ohk so you was design it, iam not suggest you to using 3D becouse it will alot understanding. but if you like 3d you can going with 3d game engine, there was new option like UPBGE, it was 3d game engine.

#

i never try discord game bot, but it good option for

#

create game based for newbie

meager plover
#

just follow on, simple tutorial game for pygame

normal silo
tacit swallow
#

Okayyy

unreal river
#

Hey, just a quick update regarding the Python library I've been working on. I have refined the purpose to be a library incorporating OpenGL, OpenAL, GLAD, and GLFW with some other features typically for game development

vital saddle
limber veldt
#

Any cubers here? I love the feel of the F perm, it just flows so smoothly

dawn quiver
#

@limber veldt cubers? F perm?

limber veldt
#

Rubik's, and one of the algorithms

mystic quarry
#

Bro this is gamedev channel

#

Like video game development

#

Or similar

opal thorn
acoustic herald
vital saddle
scarlet trout
sinful night
limber veldt
#

I tried practicing Ja as an inverted Jb, doesn't quite feel as good, at least to me, but you right, Jb and T feel really smooth too

#

On game updates, I'm working out a new data format for my game that will better handle items with internal rooms, it's slow going but I think it'll work better

#

Instead of defining those internal rooms separately from 'regular' rooms, I'm parsing all items into a list and saving indices into that list if an item has an internal room

#

So all rooms will be handled the same

#

Internal or not

leaden bane
#

but not a speedcuber

#

I like solving different cubes rather than speed

signal elk
#

We talkin abt cubing on python discord

#

Noice

limber veldt
#

The floor is yours, mini mod...oh wait, you have nothing game related to add...sorry

spare yew
#

so what is panda3d like 3d rendering engine or what

unreal river
vagrant saddle
#

also usefull for applying shaders to 2D games but a bit overkill for just doing that of course, sidenote can export to web like pygame-ce

exotic oasis
#

What is the good way to make game in kivy? Is using standard game loop (init, update)? which seems like not goes well in kivy.

#

Is KivEnt still use for game dev?

dawn nacelle
#

Managing Multiple Scenes in Pygame

I have just published a new video on YouTube that shows a solution to a common problem facing pygame developers. I often see questions here about how to implement a program with multiple scenes (where the layout and user interface is very different from any other).

The video shows how to use a package that I've built called "pyghelpers" to do this. The basic idea is that the package contains a "Scene Manager" that runs the standard pygame main loop, and each scene that you want to have has to be built as a class (OOP). Each scene must have a few methods with predefined names that the Scene Manager calls each time through the main loop - but you can make your scenes as simple or complicated as you wish. Switching scenes is done with a single line of code.

The video shows how to install the pyghelpers package. The code of the pyghelpers package (and my pygwidgets package) are freely downloadable from GitHub. The description below the video has links to the sample code used in the video and more.

The video can be found here: https://youtu.be/Z_Y1aBwbmrY

I hope you find it helpful.

This is a video on how you can use object-oriented programming
to build a Python program with multiple scenes in pygame.

Links to relevent material mentioned in the video:

How to install pyghelpers and pygwidgets:

>python3 -m pip install -U pip --user
>python3 -m pip install -U pyghelpers --user

>python3 -m pip install -U pygh...
▶ Play video
unreal river
#

interesting..

vital saddle
#

interesting..

marble jewel
#

Isometria Devlog 40 - Beach Biome, World Gen, New Items, Better Load Times! https://youtu.be/9ORi6miB_wY Written in python using pygame-ce

Wishlist and play the Isometria demo here: https://store.steampowered.com/app/2596940/Isometria

https://bigwhoopgames.itch.io/isometria-demo

In this week's dev log I give you the first look at the beach biome. I will also discuss the current iteration of world generation. The new clay grenade is introduced. Game load times have also been reduc...

▶ Play video
dawn quiver
#

wow that looks amazing

#

Should i use panda3d for a 3d game or another library? I'm planning on creating a game for my project at school.

marble jewel
#

if you want to go 3D I would probably recommend godot, I have not used 3D in python so I'm not the person to ask

dawn quiver
#

godot has python implementation right?

marble jewel
#

no I think c# and c++

#

do you need to use python

dawn quiver
#

oh

#

no, but i don't know c# and c++ so it would be a lot easier.

marble jewel
#

check on youtube for 3D python stuff, you'll get a better understanding of what you should look into

dawn quiver
#

alright👍

#

good luck with your game!

marble jewel
#

thanks you too

limber veldt
#

Godot is really close to python, but not quite the same

limber veldt
marble jewel
#

which tutorial did you want?

limber veldt
#

Just how to do that whole game

#

Clear has another tut on the way, looking forward to it

marble jewel
#

the whole game? It would take me months to put that together

#

I would consider doing a "long form" tutorial but probably not the whole game

limber veldt
#

Yeah, I was just teasing, been watching your devlogs all along, it's massive

marble jewel
#

I will consider doing an isometric long form devlog in the future

#

but it would take some time to make and I have to concentrate on completing the game first

dawn quiver
#

Godot uses its own scripting language. You can use c and therefore any language but most documentation is in Godot scripting language.

limber veldt
inland marsh
#

my google maps needs this update

#

👌🏼

limber veldt
#

Stepping every 100ms

meager thicket
limber veldt
#

Astar

#

With diagonals always and Manhattan heuristic

meager thicket
#

okk

limber veldt
proper peak
hollow shuttle
#

it only renders one animation frame from the 4 i have

limber veldt
limber veldt
limber veldt
fervent rune
#

Is python a good language for game development

#

I heard that python is not the right language for making games

little galleon
#

I have this question too

radiant sage
#

you wouldnt use it in industry i dont think

#

unity or unreal are much more extensive and responsive

#

if you google it apparently some games are “in python” whatever that means - they could be referring to backend but who knows

radiant sage
bleak sierra
#

Python has been used quite a bit in the industry. Usually as a scripting language. Even pygame is only a python layer of course.
You would leave the heavy work to C/C++

#

Disney used it for the Panda3D engine, there is the Ren'Py engine for visual novels, Eve Online used stackless python for a lot of the game code

#

Games encompass a lot of things. For some of them using a python framework makes sense.
Others can benefit from it as a glue or scripting language and then there are projects where it's actually the wrong choice.

crimson phoenix
#

Anyone have a good idea for a game to make with just python text (no python graphics). Also pip install doesn't work for my device (if that matters)

lunar venture
lunar venture
fervent rune
lunar venture
#

Yep and maybe Godot for a few

#

This dev is more comfortable using PyGame than anything since he started with it

limber veldt
#

I'd say the biggest limitation in python game dev is the dev's skill, next is the speed but that can be worked around too

fervent rune
fervent rune
limber veldt
#

Look at BigWhoop, ClearCode, Fluffy, among others, they all get awesome results

#

Speaking of Clear, he just dropped another loooong tutorial, I've already started watching it

#

And of course, I don't mean the next CoD kind of games, AAA games are well beyond the skill levels of most anyway, but pygame and a few other libraries are plenty capable of making good games

tough python
#

If one wishes to start game development, is it the most privileged choice in their range to start on Python or C languages?

#

A further question of mine I present, could the art of game development be entangled with software development? Could I learn one and master the other with just additional in-sights?

proper peak
#

If one wishes to start game development, is it the most privileged choice in their range to start on Python or C languages?
Neither Python nor C are common in game development - common choices are C# and C++. There's a long road from learning programming to being able to make games, though, and Python is a good first language.
A further question of mine I present, could the art of game development be entangled with software development? Could I learn one and master the other with just additional in-sights?
I don't think so. You can make good games without knowing anything about software development (e.g. board games are a thing, after all), or be a professional software engineer and yet know nothing about how to design games.