#game-development

1 messages · Page 40 of 1

cerulean nimbus
#

if you do range(0, n)
it will give you a "fixed" object that can be itterated over

#

but if you give it a object like a self.people it will work as a generator if im not wrong where everytime you make a new person it will be added as the next in line

#

!e

def gen():
    for i in range(10):
        yield i
for i in gen():
    print(i)
frank fieldBOT
cerulean nimbus
#

but lets say the range(10) is the len of peoples everytime you add one it gets increased so it yields further and further everytime

#

hence why your aplication is in infinite loops since you didnt define a maximum of when it should end

crystal robin
#

ohh so basically for each iteration its like the function is called meaning it continuously updates?

#

i see!

cerulean nimbus
cerulean nimbus
candid blaze
#

That is the Bevy library yeah!

cerulean nimbus
candid blaze
#

And who are familiar with it. I am a lead developer on a project, we are in a new hiring phase right now.

cerulean nimbus
candid blaze
cerulean nimbus
cerulean nimbus
candid blaze
spring zealot
#

How do you download like pygame? Powershell isn't recognising that I have python on my computer so I can't install shit

pine smelt
#

can you use pip

spring zealot
#

No

#

I can hop on my pc to show what's happening if you like

modern flint
#

py -m pip install pygame-ce
(assuming you want pygame-ce)

#

On windows you usually use py -m pip instead of pip or py instead of python

spring zealot
#

Yes but i can't get pip

#

Because my computer doesnt recognise my install of python

tired reef
#

I got two books on my game and Panda 3d!!!

cerulean nimbus
spring zealot
#

py worked

cerulean nimbus
#

then py -m pip install pygame-ce should work

#

send your error message

spring zealot
#

it dont matter yet its installing pygame

#

thx man

cerulean nimbus
#

nice no worries

spring zealot
#

i never tried using py

cerulean nimbus
#

can happen

#

if you need more questions dont be afraid to ask

tired reef
#

I got building video games with python a practical guide to my game arcade and Panda 3D and developing video games using pygame , arcade, Panda 3D

spring zealot
#

yo its not letting me using pygame in my script

cerulean nimbus
#

can you send a full screen of your IDE

#

is that pycharm or visual studio?

spring zealot
#

Visual studio

cerulean nimbus
#

dunno if it made a venv or not

#

could you send me your folder structure

spring zealot
#

Wdym

cerulean nimbus
#

for you its called solution explorer

spring zealot
#

Sorry for late reply

cerulean nimbus
spring zealot
#

myfault didnt see it

cerulean nimbus
#

right click on Python 3.9

#

i think there should be a add dependency button

#

or go to view and view terminal

#

and type

#

the install command there

spring zealot
#

nvm i got it lol

#

thanks tho man

frank fieldBOT
#

Please react with ✅ to upload your file(s) to our paste bin, which is more accessible for some users.

crystal robin
#

@steel thanks for your help earlier, heres how the simulation is currently looking! be glad to take any further suggestions or input

frank fieldBOT
cerulean nimbus
wicked trout
#

am i outdated

#

😅

spring zealot
#

Vs makes it too easy though

wicked trout
tranquil girder
cerulean nimbus
spring zealot
still jetty
#

hi, could anyone help me please ?
I have a state of my class Player which is self.state and I have a Animation class in a animation.py file, and I have a dictionnary "animations" which is not in the class Animation but just in the file, and I need the instance of player in it but I can't find how, please help me 🥲 .
PS : sorry if my english is bad and if I didn't explain well

hoary nova
tranquil girder
#

yes

hoary nova
#

very nice

#

i want to learn how to make this 3d games u made

#

i saw ur website

#

what libraries do u use?

tranquil girder
#

for this game, ursina

hoary nova
#

this ursina is what creates 3d games?

#

where do you get the samples? (houses, objects...)

tranquil girder
#

I make everything myself

hoary nova
#

this website has same games u have in ur portfolio, did u create ursina?

#

this is ur game engine

tranquil girder
#

yes

hoary nova
#

i see

#

what do you use to create the objects?

tranquil girder
#

the 3d models?
for the terrain and level design I use a voxel editor I made specifically for this game
for the rest of the models, like the character model and animations, I use blender

hoary nova
#

okok

#

and then u can use this samples in python

#

i dont have the time now but i will take a look at this ursina engine later

#

i've tried pygame, u can do nice things too, but im not that good with it

#

what other things do you create ? besides games

tranquil girder
#

It's mostly games, or tools for making games, like level editors, but I've also made other programs like a python-like programming language transpilable to javascript that can run in web browsers, a mobile game/software framework, drawing/painting software, text user interface for git, a python profiler that shows how much time each line of code takes, and a markdown inspired language to make websites. You can do a lot with Python

hoary nova
#

i see, very nice

spring zealot
#

Not in my mind atleast

cerulean nimbus
limber veldt
#

Tryna come up with a new protocol for defining logic circuits in a simulator. Currently using a dict to describe the wires connecting the devices, like so py {'flip': True, 'fromgate_index': 10, 'outport_index': 4, 'togate_index': 4, 'inport_index': 0 } Says gate at index 10 has a wire from its port 4 to the gate at index 4 and its port 0

#

This way works but it's tedious, and the same kind of method will be used to save and load circuits for game saves

#

I could lose the dict and decide on a proper format for those attributes

#

I suppose the trade off there is losing readability

#

In the game, some levels have circuits in them by default, like level 1 starts with all three robots pre-wired with circuits to solve the puzzles of that level. So the protocol needs to be used to initialize some levels and, when playing and creating your own circuits, to save them

limber veldt
still jetty
cerulean nimbus
cerulean nimbus
limber veldt
#

I'm open to any ideas, kind of reworking the game and will consider everything

#

It's a massive game, so reworking much of it will be quite an undertaking

#

I'm just not satisfied with some of it

#

All levels are composed of rooms, in all, the game has ~450 rooms

#

I need a better foundation, circuit descriptions being part of that, and how to save a level in progress, which means serializing everything

cerulean nimbus
#
{
    "flip": true,
    "gate": {
        "input": 10,
        "output": 4
    },
    "destination": {
        "input": 4,
        "output": 0
    }
}```
#

might seem dumb tho

cerulean nimbus
limber veldt
#

Yeah, and I'm describing all those with 2d lists

cerulean nimbus
limber veldt
#

They're all grid, well blocks (walls) on grids

#

Which can sometimes change, like walls move to open pathways

#

So saving game means saving that state too

cerulean nimbus
#

oh you mean like

[
[Cell(white), Cell(blue)]
]
limber veldt
#

Pretty much

cerulean nimbus
#

yeah

#

so you want to find an "readable" and optimal way to structurize this to the serialize and deserialize to save

limber veldt
#

Yeah, pretty much. My main struggle at this point has been saving robots (which have rooms inside them that can have other robots that have a room inside them and so on) and the recursion to deal with all that

cerulean nimbus
limber veldt
#

Like the level has 50 rooms + whatever robots are in the level

#

And they can all be nested

cerulean nimbus
#

i think you need to save the bots more like this

{
  "bot1": {
    "inside": "bot2",
    "states": {  }, 
  },
  "bot2": {
    "states": {}
  }

}
limber veldt
#

I'd even write a bytecode if I needed to, like the protocol doesn't really need to be readable but it has to be very well defined before building on it

cerulean nimbus
#

if that makes sense

limber veldt
#

Right, save the bots separately from level rooms

cerulean nimbus
#

you can have the nesting in python but then the linking in save

cerulean nimbus
cerulean nimbus
#

as a quick example for rooms

limber veldt
#

Yeah, makes sense, the devil is in the details

#

As usual lol

#

Like if a robot is inside another robot, the outer robot needs to be parsed before the inner one

cerulean nimbus
#

yes but you can store the once that have none linked than link them to the upper once

#

you should make a little load menu for this cause +-300 rooms and lets say like 50 bots can take a moment

limber veldt
#

It's such a good game and I'd really like to finish it. It's been backburnered for a few months but I want to release it eventually

limber veldt
#

Thanks, all digital logic, gates and stuff

#

It's basically a digital simulator wrapped in a game

#

Originally released by The Learning Company on Apple2e or so in like 1985, so mine is a remake in python

#

Robot Odyssey was the og name

#

Was rewritten by Thomas Foote in 2000 in Java for play on modern machines

cerulean nimbus
#
bots = [...]
unlinked = []
linked = {}
for i in bots:
  if i.get("inside", None) is None:
    linked[i.keys()[0]] = i
  else: unlinked.append(i)


# just for general idea need recursion here
for i in unlinked:
  if b:=linked.get(i["inside"]): 
      b["inner_bot"] = i
#

this might make some sense

limber veldt
#

I have the java version, still works!

limber veldt
#

It's one of those things that is so complex that I need to work through it piece by piece

modern flint
cerulean nimbus
limber veldt
#

And avoid the so-called painting myself into a corner

#

Write 200 lines of a bad idea before realizing its a bad idea

cerulean nimbus
#

XD

limber veldt
#

lol

cerulean nimbus
#

(had it multiple times happen)

limber veldt
#

Same

cerulean nimbus
#

im getting my head bunked like this with my package im trying to make

limber veldt
#

Been there so many times, all learning experiences though

cerulean nimbus
#

jup

#

i think i finally finalized my button 🥳

limber veldt
#

Nice, you did quite a lot for it

cerulean nimbus
#

folder struct atm

#

styles is fully functionall for current and future gui elements

#

tooltip i hope to make it work for everything aswell

limber veldt
#

Sliders too?

cerulean nimbus
#

rn working on sliders

limber veldt
#

Nice to have, espeically for tweaking or debugging

cerulean nimbus
cerulean nimbus
#

also want to make addaptations of my button

#

checkboxes, slider boxes,...

limber veldt
#

Just for the fun of it, this is a list of all items ['FLIPFLOP', 'ANDGate', 'NANDGate', 'ORGate', 'NORGate', 'XORGate', 'XNORGate', 'NOTGate', 'BUFFERGate', 'NODE', 'NODE90', 'NODE180', 'NODE3', 'SmallChip16', 'SmallChip', 'Prototype16', 'Prototype', 'Token', 'ExitTicket', 'WhiteKey', 'RedKey', 'BlueKey', 'GreenKey', 'OrangeKey', 'PurpleKey', 'YellowKey', 'WhiteGrabber', 'BlueGrabber', 'WhiteThruster', 'BlueThruster', 'WhiteBumper', 'BlueBumper', 'WhiteAntenna', 'RedAntenna', 'BlueAntenna', 'RedCrystal', 'BlueCrystal', 'BlackCrystal', 'WhiteCrystal', 'BlueSentry', 'WhiteSentry', 'AmpireBot', 'Ghost', 'SonicLock', 'BinaryKey', 'Polarizer', 'Train', 'Handle', 'StormCloud_NA', 'StormCloud', 'Triangle', 'WhiteTriangle', 'Square', 'WhiteSquare', 'Hexagon', 'WhiteHexagon', 'Form_F12', 'ElevatorKey', 'RedDisk', 'YellowDisk', 'WhiteDisk', 'GreenDisk', 'BlueDisk', 'StormShield', 'VentFan', 'Helpers', 'Helper', 'SpyCam', 'Turbine', 'PowerButton', 'VentGrill', 'ElevatorArrow', 'PlayerBlocker', 'Form12Trashcan', 'Buttons', 'Pen', 'menu_indicator_red', 'menu_indicator_grey', 'Player', 'skyway0', 'skyway1', 'skyway2', 'skyway3', 'skyway4', 'skyway5', 'skyway6', 'skyway7', 'trapped0', 'trapped1', 'trapped2', 'trash', 'Logo', 'junk', 'ChipTester', 'Recycle', 'Slider', 'Slider_BG', 'Button_Off', 'Button_On']

cerulean nimbus
#

slider boxes basically just a slider with steps

limber veldt
#

Well, everything with an image in my image dict, that is

limber veldt
#

Currently working on that dict

#

Moving all the images into image.load instead of drawing them

cerulean nimbus
limber veldt
#

Currently drawing them with pygame.draw calls

cerulean nimbus
#

how did you draw your images before 😭

limber veldt
#

Now drawing them, saving them, and going to load them

cerulean nimbus
#

aaah

limber veldt
#

Just to get rid of all this drawing

#

I have like a thousand lines of drawing shit

cerulean nimbus
#

yeah it might be easier and more optimized

#

also make sure to preload them

#

and not continues load

limber veldt
#

Oh yeah, that was lesson one long ago, but thanks

#

I've been pygaming for about 8 years so far

cerulean nimbus
limber veldt
#

My main class usually loads all them and passes them around to the objects

#

With this game, I have them all being drawn in a separate file and added to a dict that is then imported where needed, so any file can get access to any image

#

Like a global images dict, just needs imported

cerulean nimbus
hybrid yacht
#

if one were to make their own engine does gui framework used matter ? and if so, which to choose and why ?pithink

muted sand
#

Hey guys, I created a small module I wanted to share with you.

This module, using the render_text_to_surface() function, will automatically size and draw a piece of text to a surface, using a provided Surface, text, and PyGame's Font() arguments.

I created this because I didn't want to manually determine the font size needed when creating text. For example, if you were creating a menu and wanted to create a play button, instead of manually trying different font sizes until you find one that fits, this function will automatically calculate the optimal size and draw it for you.

Additionally, you can provide a margin, which will be used to keep the text a certain distance from the sides of the surface. You can also provide an alignment, which is centered by default.

Feel free to check it out! https://paste.pythondiscord.com/EENQ

bright frost
#

Hi, someone use unity hub and can help me ? I can't start new project..

ember remnant
rare ledge
ember remnant
wanton owl
#

Has anyone here tried procedural generation with Python?

#

It's pretty difficult.

pine smelt
#

its definitely possible

#

mine looked a bit jank theres better examples in the pygame server

slow copper
#

its so old and the code quality is so bad.. idk how it even manages to run

cerulean nimbus
#

its also not to hard

#

and it can be efficient if you code it the right way

late path
#

Hey where can i ask for help for my program

slow copper
#

Hello, so after taking @robust egret and @vagrant saddle suggestions, ive rewritten the game-state library to v2 and optimized many parts of it! Here is a working example of the library-

# Creating two screen where the first screen displays green
# and the second screen displays blue with a moveable player

import pygame

from game_state import State, StateManager


GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
speed = 100
pygame.init()
pygame.display.init()
pygame.display.set_caption("Game State Example")


class ScreenOne(State, state_name="FirstScreen"):
   def process_event(self, event: pygame.event.Event) -> None:
      if event.type == pygame.QUIT:
            self.manager.is_running = False

      if event.type == pygame.KEYDOWN and event.key == pygame.K_c:
            self.manager.change_state("SecondScreen")

   def process_update(self, dt: float) -> None:
      self.window.fill(GREEN)
      pygame.display.update()


class ScreenTwo(State, state_name="SecondScreen"):
   def on_setup(self) -> None:
      self.player_x = 250

   def process_event(self, event: pygame.event.Event) -> None:
      if event.type == pygame.QUIT:
            self.manager.is_running = False

      if event.type == pygame.KEYDOWN and event.key == pygame.K_c:
            self.manager.change_state("FirstScreen")

   def process_update(self, dt: float) -> None:
      self.window.fill(BLUE)
      pressed = pygame.key.get_pressed()
      if pressed[pygame.K_a]:
            self.player_x -= speed * dt

      if pressed[pygame.K_d]:
            self.player_x += speed * dt

      pygame.draw.rect(
            self.window,
            "red",
            (
               self.player_x,
               100,
               50,
               50,
            ),
      )

      pygame.display.update()
#
def main() -> None:
   screen = pygame.display.set_mode((500, 700))

   state_manager = StateManager(screen)
   state_manager.load_states(ScreenOne, ScreenTwo)
   state_manager.change_state("FirstScreen")

   clock = pygame.time.Clock()

   while state_manager.is_running:
      dt = clock.tick(60) / 1000

      for event in pygame.event.get():
            state_manager.current_state.process_event(event)

      state_manager.current_state.process_update(dt)

if __name__ == "__main__":
   main()
#

open to any suggestions

muted sand
#

You could also use this to store settings like framerate, colors, fullscreen toggle, and anything else.

slow copper
#

dont think id be adding any general utility stuff to the library tho

grim abyss
#

Prolly a longshot but do yall know/have any actual books targetting procedural generation (terrain, maps, textures even) using Python?

slow copper
muted sand
novel vale
#

hii, im loooking for some developers to create an application , need some help like alot , sorry i will not be able to offer pay as yet but it will definitely be a fun experience , Feel Free to message me for learners and expertise , if your up for the challenge!

cerulean nimbus
cerulean nimbus
#

they starting to look fancy

#

only 70 lines so far for this

tired reef
#

Is there anything in panda for generating a random environment? Panda3d

random estuary
#

U must be crazy

muted sand
#

AI is really useful for pretty much anything, including programming. I use it on a daily basis

vale socket
#

Hi All, I am new to game development. I am working on a checkers game and trying to make the AI smarter. I ran into a roadblock when adding : Piece value (kings are more valuable).
Board control.
Threats and vulnerabilities.
Distance of pieces to becoming kings. The game keeps crashing when it is the AI's turn at the start of the game. Any help would be appreciated.

burnt leaf
#

Do anyone know how to work imgui?

#

by chance

balmy pilot
#

I used it like once.. maybe? I vaguely remember the API

#

Which renderer do you want to use?

burnt leaf
#

Im trying to use imgui to try it but it always give me over 470 errors and i cant get pass it, ive been trying to set it up for 3 months now. i just want to have this on my pc

#

I have friends that know how to work imgui but there in collage and dont have time to help me

#

@balmy pilot could u help me?

balmy pilot
#

Sure, I can try. Let me try making a "Hello World" with this thing

burnt leaf
balmy pilot
#

Wow this library is not super freshly maintained

#

I'm having to use Python 3.9 to get pyimgui to work; it won't build for me against 3.12

#

Oh I see, there's a better binding, let me try that instead

#

Just make a new file in Visual Studio called 'hello.py' (or whatever_you_want.py) and paste that into it

spring zealot
#

pygame is so nice

#

i just used it for the first time in a basic scrip to learn

#

its so much simpler than turtle

#

turtle sucks

tired reef
#

How can I make a spawning radius in a specific area?

spring zealot
vale socket
# radiant rapids Is there an error message?

These are what I get.Traceback (most recent call last):
File "Checkers_v24.py", line 859, in <module>
game = Checkers()
File "Checkers_v24.py", line 49, in init
s.SetupBoard()
File "Checkers_v24.py", line 57, in SetupBoard
s.Play()
File "Checkers_v24.py", line 65, in Play
s.CompTurn()
File "Checkers_v24.py", line 132, in CompTurn
best_move = max(s.moves, key=lambda m: evaluateMove(s, m))
File "Checkers_v24.py", line 132, in <lambda>
best_move = max(s.moves, key=lambda m: evaluateMove(s, m))
NameError: global name 'evaluateMove' is not defined

spring zealot
#

Evaluate move isn't defined then

#

So define it

tired reef
# spring zealot Dude what

I wanted make a game with enemies now if I can figure out a way of making it so that the player has an inventory in places a key within a slot it's bonds five enemies for them to fight and that's how they get resources and I want it to spawn within a specific range so when does that randomly spawn on a different side of the map making it not give anything

spring zealot
#

So I'm super confused but I think you mean when key "4" (for example) pressed 5 enemies spawn in.. you want them to be in a random place but not too far from the player.. am I correct?

#

@tired reef

tired reef
#

Yes

#

Green= player
Blue= enemy spawning circle
Red = enemy's

spring zealot
#

Ahh so

#

import random

#player co ordinates can be switched to any spawn centre
playerCor = [0, 0]

#size of spawn area
a = 0
b = 20

#list of spawn locations for enemys
enemySpawn = [
[0, 0, 0, 0, 0],
[0, 0, 0, 0, 0]
]

#append to enemy list using spawn area rule
for i in range(5):
enemySpawn[0][i] = playerCor[0] + random.randint(a, b)
enemySpawn[1][i] = playerCor[1] + random.randint(a, b)

print(enemySpawn)

#

thats kinda what i would do.. this makes it so you can easily move the circle of spawn around and choose the size, i would re work it a little and slap it in a subroutine so u can make them wherever

balmy pilot
#

Choose a random distance and degree of rotation around the circle with the player in the center

#

Maybe another way to think about it

spring zealot
limber veldt
#

Create a vector with the length of circle radius, rotate it some random amount between 0 and 359 degrees, add it to the center

#

Or use polars

#

That is, create a random radius and angle (in radians) and convert to x/y with x = radius * cos(angle) and y = radius * sin(angle)

valid rapids
#

I Don't Understand this... Can someone explain??

limber veldt
#

?

#

Polar to cartesian conversions?

#

Quick demo, 1000 points at 50 to 100 pixels from the center and at random angles

dusky copper
#

can anyone look at my code in having alot of troubke with an onclick section

frank fieldBOT
#

Please react with ✅ to upload your file(s) to our paste bin, which is more accessible for some users.

spring zealot
#

Wait

#

Lemme double check sum

#

Nvm I got it

spring zealot
#

Dude why does the pygame origin have to be top left

#

Now I have to adjust it

final geyser
#

I want to make a Roblox TikTok edit script

spring zealot
#

😭

final geyser
#

Yeah man

#

I love dogs

#

For real

spring zealot
#

a " Roblox TikTok edit script"

#

what does that even mean bru

balmy pilot
#

I had to ask an LLM but now I get it haha

#

apparently a "TikTok edit" is a short clip with visual effects

vernal ginkgo
#

hello

#

is there anybody on?

spring zealot
#

<@&831776746206265384> isn't this against the rules?

final geyser
#

Guys...

#

I need someones ass to fart inside

vernal ginkgo
#

why its against the rules? <@&831776746206265384>

idle yacht
frank fieldBOT
#

9. Do not offer or ask for paid work of any kind.

vernal ginkgo
#

hmm

#

allr , my bad @idle yacht

#

i just need some help with the script

#

if y all can help for free , thats fine by me

spring zealot
#

You'd have to send the message again mate

#

Just without the money part

vernal ginkgo
#

allr thnx

orchid breach
#

i need somebody to help me- im a minecraft bedrock player who's making a client (check bio) and im having trouble coding, so it would be a great help if you could join our dev team

orchid breach
dawn quiver
raven kernel
#

oh, that thumbnail is AI generated

spring zealot
orchid breach
spring zealot
orchid breach
#

im new

#

kinda

orchid breach
#

nvm

spring zealot
#

its not too hard man you kinda just fuck with the code until you get the menus to work

#

hardly need a dev team for that

spring zealot
#

anyone know what the best way of detecting collision is? I'm using pygame and the collision doesn't work all the time, specifically when velocity is too high and also how to detect what side the player is hitting, currently im using raycasting sorta

dawn quiver
slow copper
dawn quiver
limber veldt
#

Hey Jiggly, ended up just doing this, forget the strings and the cross referencing, just link the index to the class ```py
def handle_toolkit(self):
pressed = pygame.mouse.get_pressed()
if any(pressed):
if self.toolkit.rect.collidepoint(pygame.mouse.get_pos()):
self.selection_index = self.toolkit.click(pygame.mouse.get_pos())
if self.selection_index is not None and not self.active_selection:
self.add_gate(self.selection_index)

def add_gate(self, selection_index):
    idx_to_class = {
        0: devices.ANDGate, 1: devices.NANDGate, 2: devices.ORGate,  3: devices.NORGate,
        4: devices.XORGate, 5: devices.XNORGate, 6: devices.NOTGate, 7: devices.BUFFERGate,
        8: devices.NODE90,  9: devices.NODE3,   10: devices.NODE,   11: devices.NODE180,
        12: devices.IOSwitch, 13: devices.FLIPFLOP, 14: devices.Receiver
        }

    if selection_index not in idx_to_class.keys():
        print('selection_index out of range')
        return

    gate_class = idx_to_class[selection_index]
    gate = gate_class((0, 0), self.current_room)```
#

That's messy in discord

balmy pilot
dawn quiver
quick cliff
#

Hello team,
I'm not sure if I'm on the right channel, but I'm reaching out to you regarding game development in Python. I've been getting into it for 3 years and have made a few personal projects using Pygame. However, I recently heard about Ren'Py, which seems to be mainly for Visual Novels. Is there a more advanced library than Pygame? I've heard of Pyglet and Arcade, but I haven’t tried them yet. Your experiences on this topic would be really helpful! Thanks

arctic zenith
#

Hello. I’m a beginner in python (I started yesterday). I used ChatGPT to create a game and it’s still early and ugly in graphics. Right now I would like to know how to make 2D characters turn around their front, like how GTA Chinatown Wars does.

dawn quiver
#

u can use sprites

#

and if u made a game already you probably know how to get pressed keys

#

to move

#

sorry bad english

#

and

dawn quiver
#

for character to change its sprite direction u better firstly set a attribute in his class

#

and then like

#

when u press key it changes

#

and if it changes u gotta use pygame.transform.flip

#

to flip the image

#

sorry i’m bad at explaining

dawn quiver
dawn quiver
#

my english is kinda bad and i’m also a newbie so sorry if i explain badly

#

oh and the main thing that chatgpt don’t use most of the time is that you better make classes for everything in the game

#

like the player

#

game class

#

and such

dawn quiver
#

yeah sure

arctic zenith
frank fieldBOT
dawn quiver
arctic zenith
dawn quiver
#

i’d recommend you to start to code on your own

arctic zenith
#

So, what do you think?

dawn quiver
#

u can watch tutorials on utube

arctic zenith
dawn quiver
arctic zenith
dawn quiver
arctic zenith
#

You don’t understand. I’m motivated to do this

dawn quiver
#

i could’ve tell you how to code a game like this properly but i don’t have much time rn because of exams

dawn quiver
#

use classes at every thing in the game

#

almost

balmy pilot
#

Oh man, globals are not where to start.

#

I am angry at this code, that’s probably not healthy

limber veldt
#

More confirmation that gpt can't code

balmy pilot
#

“Mutation is expensive” maybe needs to be the first prompt? Jesus.

pale thicket
#

whats the most beginner friendly engine that uses python?

cosmic olive
#

Wait pygame isn't an engine

pale thicket
#

does godot or game maker use them

balmy pilot
cosmic olive
#

It looks like python

pale thicket
#

oh ok i heard renpy is really good idk

dawn quiver
#

-# me using pygame to code my little mario game

balmy pilot
#

What kind of game? If you want 3D the list is quite a bit shorter than for 2D

dawn quiver
#

pygame >>> 2D

pale thicket
#

2d im still learning but wanted to use what i learned to maybe make a start toward a career and maybe make a game in my spare time

cosmic olive
#

I feel like pygame would help you learn a lot because you need a lot of manual implementations which betters your understanding of what happens under the hood ┐('~`;)┌

balmy pilot
#

Yeah, start with PyGame given what you just said IMO

pale thicket
#

ok

balmy pilot
#

But definitely dabble in the others once you get more comfortable. Panda3D seems good if you want to expand to 3D.

lucid folio
#

arcade is fun too

dawn coral
#

i like pygame :)

#

im trying to learn how to use it

#

its hard sadly

spring zealot
#

Pygame isn't that difficult

#

I found a really good video and learned most of it in one day

#

You mainly just need to know how it functions and then you can look up the rest

#

I'd watch his follow up videos too if you find it difficult

spring zealot
raven kernel
# spring zealot You don't necessarily get "engines" for python because python isn't really used ...

Sorry for the nitpick, but it's not "unoptimized". It is optimized to the best of what it can be almost, but the language is fundamentally designed in a way that needs to allow for certain possibilities, which cannot be made that much faster. Also it is an interpreted language

However its speed isn't the reason that Python is not used for more commercial games, it is simply its popularity for that purpose

spring zealot
#

Especially 3D game development if you want to move past boxes

vagrant saddle
#

( bonus added simple games can run on web same as pygame-ce )

spring zealot
#

Isn't panda 3D made with c++ backend

vagrant saddle
#

it is a full integration with cpython c-api with a 1:1 c++ match so you can compile your prototype to market

spring zealot
#

It uses c++ for physics and rendering no?

vagrant saddle
spring zealot
#

So what's the point in bringing that up to say python is good for game development

raven kernel
#

game development isnt about directly interacting with graphics APIs

vagrant saddle
#

because an essential part of game dev is prototpying not coding the final product

raven kernel
#

thats maybe, engine development

spring zealot
#

We are talking about python as a tool for game development not what makes up game development

#

Using panda 3d to say python is good for game dev is such a non point

raven kernel
#

right, and game development is about building games. not tinkering with graphics APIs
you dont need the C++ part of panda3d to shape your game

#

that's part of the engine development process

spring zealot
#

C++ literally powers panda 3d

raven kernel
#

godot uses a scripting language called GDScript, the backend of GDScript calls are all C++, but we use GDScript and Godot's UI to make the actual game

spring zealot
#

If it didn't use it panda 3d wouldn't work

raven kernel
#

game development is more than just the engine/framework

vagrant saddle
spring zealot
#
  1. Graphics Rendering
    Handles DirectX, OpenGL, or Vulkan rendering.

Manages shaders, textures, geometry, scene graph traversal, etc.

Optimized in C++ for performance.

  1. Scene Graph Management
    Maintains and updates the 3D scene graph (a hierarchical structure of all objects in the scene).

Efficiently determines what should be rendered each frame.

  1. Collision and Physics
    Includes a built-in collision detection system.

Interfaces with optional physics engines (like Bullet).

  1. Audio
    Manages 3D spatial sound through backends like FMOD or OpenAL.

  2. Input Handling
    Captures mouse, keyboard, gamepad input.

  3. Memory and Resource Management
    Handles efficient loading, caching, and management of models, textures, animations, etc.

  4. Multithreading and Performance Optimization
    Implements threading models for culling, rendering, and other tasks to optimize performance.

#

Ahh yes just the engine

raven kernel
#

...those are all things that constitute the engine

spring zealot
#

Yes also all the things it needs because python alone can't do it

raven kernel
#

those dont implement anything specific for your game, when you want to make your game you can write the source in python

vagrant saddle
#

python (statically typed) could do it but it appeared than async engine of cpython is not a match for game engine use

spring zealot
spring zealot
#

Dk why ur coming up with theoreticals when the point I'd python as it is could not do panda 3d

#

Is*

vagrant saddle
#

it could i just pinpointed the problem

spring zealot
#

Keyword could

#

But doesnt

vagrant saddle
#

fyi i'm a bit into games engineS and cpython compilation

spring zealot
#

What??

vagrant saddle
#

python is a very versatile language, cpython is a general purpose implementation that try to satisfy the big nunbers, but nothing forbids you to make a python implementation dedicated to game dev

#

except maybe find some funding 😄

hearty tapir
vagrant saddle
#

a bit slower ( becxause integer range checking has a cost ) so i would try to use most of mypyc compiler

#

since the point would be to use python for game dev there would be no point trying to slap some python on a c/rust lib ( does not mean they should not be used later to make it more efficient )

wanton owl
#

Hey chaps

#

I'm doing a dungeon generator, visualizing in the console

#

This is an example output - with rooms and corridors and 's' for the entrance

#

What do you think? I dived into procedural generation

balmy pilot
#

'r's are what, doors?

wanton owl
#

the blue squares of 'r' represent rooms

#

the dots are corridors

balmy pilot
#

Gotcha. Looks good to me; it's all contiguous etc. Cool.

wanton owl
spring zealot
wanton owl
#

The best thing about this is that every layout is unique

wanton owl
spring zealot
#

Oh okay makes sense

wanton owl
#

I imagined them that way

#

I can send some other layout if you guys are curious

#

it's just a script for now, lol

#

However, not every generation is good or perfect like these

spring zealot
#

How are you gonna actually implement it so you can read what rooms are next to the current ?

wanton owl
#

You mean how I've done the spacing between rooms?

#

ensuring that no rooms spawn on top of each other or next to each other - is this what you mean or?

modern flint
wanton owl
balmy pilot
# wanton owl https://github.com/anton-mirazchiyski/Procedural-Generation This is the reposit...

Cool. The only thing that really caught my eye is 'position_is_available'.. the list of locations to check feels a little brittle. What do you think about this?

def position_is_available(row, col, dungeon):
    for row_delta in range(-1, 3):    # rows from row-1 to row+2 inclusive
        for col_delta in range(-1, 3):  # cols from col-1 to col+2 inclusive
            current_row, current_col = row + row_delta, col + col_delta
            if dungeon[current_row][current_col] != '#':
                return False
    return True
#

That way you can change the 'radius' of the check easily without having to update that list

wanton owl
spring zealot
wanton owl
spring zealot
#

How would you do it though, I'm assuming a dictionary of some sort

wicked trout
spring zealot
#

Win11

gloomy ledge
raven kernel
#

and some other things

wicked trout
onyx iris
#

Hello, I'm trying to have fun coding a rpg type game but I'm struggling with something. I'm learning so it's not well coded but I need someone's help pls (should not take long)

#

Sorry some names are in writen in french

proper shoal
#

lets MAKE THE GAMESS!!

onyx iris
#

It doesn't remove the item from the inventory

proper shoal
balmy aurora
proper shoal
#

I don't see a remove function though

#

only equip and pickup

onyx iris
#

The message is too long

#

self._inventory=[i for i in self._inventory if i != item]

proper shoal
#

only the remove item part sir

onyx iris
#

I used this

#

ok

#

def equip(self,item):
if item in self._inventory:
self._inventory=[i for i in self._inventory if i != item]
olditem=self._equipement[str(item._kind)]
self._equipement[str(item._kind)]=item
self._inventory.append(olditem)
self.activate()
self._fakeinventory=[i._name for i in self._inventory]

proper shoal
#

see thats the problem

#

you are using equip not unequip as separate functions

onyx iris
#

does it change something ?

proper shoal
#

your doing too much

#

nvm

onyx iris
#

So I should write an unequip fonction then an equip ? I can do this but I don't see how that would change something

proper shoal
#

I think you are unequiping but moving to your inventory

onyx iris
#

I'm trying to 1 unequip the item 2 take the last equipped item 3 equipe the new item 4 put the old item in the inventory

proper shoal
#

im so confused you are removing the item from inventory then adding olditem

onyx iris
#

self._equipement[str(item._kind)] is the item which were equiped

proper shoal
#

yeah i would break that one function into more so that it's more clear

onyx iris
#

I'll try this

proper shoal
#
def unequip(self,item):
  if self.itemInInventory(item):
    self.removeFromInventory(item)
    self.moveToInventory(item)
    self.activateInventory()
onyx iris
#

I'll try this

proper shoal
#

as you can see if i group your code into functions it makes no sense

#

because your removing then adding it back in

onyx iris
#

OK

#

IT WORKS

#

Yours didn't but it's not your fault, without all the code you couldn't use the rights attributs etc..

#

But

#

I tried to separate equip and unequip

#

and it works

#

Tx bro

balmy aurora
frank fieldBOT
#
Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

spring zealot
#

anyone know how to delete class object within a subroutine within the class

balmy pilot
#

'delete' in what sense exactly?

#

One way is to just set the class attribute holding the object to None and let the garbage collector handle it

#

Python has a del keyword you can use but I suspect it's not what you want here given that sentence

spring zealot
#

the del doesnt work within the class

spring zealot
#

how to explain

robust egret
spring zealot
#

flappy bird pipes

#

hit other side of screen

#

boom delted

#

i dont want to make 50000 objects

#

class pipes():
def init(self):
self.y = random.randint(100, 500)
self.x = 700

def drawPipe(self, Y):  
    pygame.draw.rect(window, (0, 255, 0), (200+ self.x, 200 + Y, 50, 500))

def pipeLogic(self):
    #speed of pipes 
    self.x -= 4

    if not self.x < -100:
        self.drawPipe(self.y)
        self.drttawPipe(self.y - 700)
#

ive got it to just not draw them atm

robust egret
# spring zealot flappy bird pipes

I am gonna assume that the pipes are an array of pipe objects, checking if the pipe is out of the window you could pop till from the list

#

and done it should not draw the pipe again

robust egret
#

!paste you could paste the code here

frank fieldBOT
#
Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

balmy pilot
#

@spring zealot You need to keep a handle on the rectangles you're drawing, IMO, so that you can clean them up, but maybe I'm missing something

#

I guess you're just moving the viewport and letting pygame clean up things that are off-screen? Sorry not a pygame expert

spring zealot
robust egret
spring zealot
#

idk but it works so idc lol

#

im not the best at making my code propper if ykwim

robust egret
balmy pilot
#

When you delete a Pipe you just need to do the reverse of self.__class__.container.append(self)

robust egret
frank fieldBOT
#
I'm sorry Dave, I'm afraid I can't do that.

No documentation found for the requested symbol.

balmy pilot
#

self.__class__.container.remove(self)

robust egret
spring zealot
#

alr thxx

balmy pilot
#

it will then get garbage-collected by the runtime

robust egret
#

python bot doesn't have list documentation for some reason

cerulean nimbus
spring zealot
balmy pilot
#

In this case you don't really want del because it's an entry in a list you want to remove, IMO

robust egret
spring zealot
#

i tried lol

robust egret
#

!e

cookies = 14
name = "tommy"
del cookies
print(cookies)
print(name)
cerulean nimbus
frank fieldBOT
spring zealot
#

they scroll ofscreen anyway

#

point is i dont want a super long ting

#

not that it matters cause its flappy bird but whatever

#

and i need to create lest i have only one on at a time

cerulean nimbus
spring zealot
#

lol that like doing

#

print("1")

#

print("2")

#

print("3")

#

instead of

#

for i in range(3):

#

print(i)

cerulean nimbus
#

? its not

spring zealot
#

im saying its more effort than its worth to make 16 pipes and move them

#

takes like 4 lines to just make them

robust egret
#

okay that's enough, we already found a solution and we should remember that everyone has their own creative solutions

spring zealot
cerulean nimbus
grim abyss
#
cerulean nimbus
grim abyss
#

triple AAA game studios are going to be extinct in 10 years when AI can generate a game from a prompt

cerulean nimbus
robust egret
grim abyss
#

i've had the idea in my head for 2 years now and Microsoft has implemented it. kinda flattering...

grim abyss
#

quake 2 like

grim abyss
#

i wanna work on it but just don't have the time....

robust egret
grim abyss
#

triple AAA game studios will not exist soon!

cerulean nimbus
robust egret
grim abyss
#

only indie devs will be profitable

#

triple AAA is done! 😂 micro-transact that!

grim abyss
grim abyss
limber veldt
#

Everyone's just going to be using AI to cheat in games

#

Some estimates are that up to 30% of online players are using cheats of some kind, just going to get worse as ai gets better

spring zealot
grim abyss
grim abyss
#

per my observation ?

slow copper
#

ts pmo icl

spring zealot
spring zealot
#

That's a very good guess I'm ngl

exotic parcel
#

yo guys

#

look at this physics engine test for my new ( in development) python package

spring zealot
#

Could you not have just sent the video 😭

robust egret
#

there is a lot of online websites you could use to post a big video

grim abyss
exotic parcel
#

tell me

#

cuz i dont know any other

exotic parcel
#

discord limit

exotic parcel
limber veldt
exotic parcel
#

next tim i will

exotic parcel
slow copper
#

Cool

astral widget
spring zealot
exotic parcel
#

😭

turbid needle
native frost
#

Is it possible to create a path of an actor with python script in the unreal engine sequencer ?

exotic parcel
turbid needle
exotic parcel
#

it is in real time'

#

🙂

turbid needle
exotic parcel
#

oh

#

nah

#

i think the video is corrupt

#

the video is playing a bit faster

turbid needle
turbid needle
exotic parcel
#

the looping is

#

the rest is not

turbid needle
#

becuase is really cool

exotic parcel
#

its in python and cpp

#

buts it still has some issues

#

😭

#

like ur phasing through the walls

turbid needle
#

it's really really cool

exotic parcel
#

i have to fix the charecter and position calculations

turbid needle
#

i love 3d things
but i hate math

exotic parcel
turbid needle
#

do you use glsl for this?

#

glsl is really greate thing for this

#

with nice shaders too

exotic parcel
#

lol

#

no

#

i dont

turbid needle
#

what you use?

exotic parcel
#

its built from scratch

#

from 0

#

im planning to use external libs tho

#

other than standard libs

#

😭

#

i gtg now

turbid needle
exotic parcel
#

😭

novel crest
#

Python is a good choice for game development right?

#

Any major limitations?

balmy pilot
#

It's many many orders of magnitude slower than a GPU, so there are many tasks you'll need to offload.

#

But that's true of all languages that run on the CPU at the moment so it's just a matter of degree.

novel crest
balmy pilot
#

Yeah; the hard part of game design is the design, IMO, not using a language/engine

raven kernel
#

but if you only want to target the desktop, it's a solid choice. the limitation becomes your asset, team, design etc. as with any other game

#

you can checkout pandas3d, pyglet or pygame depending on the type of game you're making

#

also note, pyglet does offload the rendering the GPU

#

and same for pandas3d and its derivatives (ursina, etc.)

#

pygame normally doesnt, but you can apply post processing with moderngl. check out dafluffypotato on youtube to get a sense of what you can do with pygame

novel crest
muted sand
uneven folio
#

What are my options for graphics I can export to web? I've only really seen pyxel which is really nice but I'd like something more general. I would love to use raylib actually

#

What's the status of python raylib wasm? I checked in last year and there was something

#

In particular I found that you can run the main loop in separate thread in a python repl and you can keep using the repl while the game is running

#

Wrap everything in a try catch you can resume and it works fairly well, have to flesh it out

#

But I really want web export. I want to build a showcase of algorithms and whatnot on my website

#

Just found this

vagrant saddle
#

sound may glitch when switching/closing tab, resizing window can be funky. it's alpha stage

#

pygame-ce web is robust, Panda3D web close enough to beta

uneven folio
#

Ok I'll check it out, thank you

limber veldt
#

Your Timer reactivating itself is a nice functionality, I may borrow that idea

#

I usually reactivate mine at the end of the func being called if I want a repeat

vagrant saddle
#

not mine just looked into it to port on web for a pyray test

limber veldt
#

Yeah, I noticed, thanks for sharing anyway

pearl elk
#

guys how do i escape tutorial hell help meee

raven kernel
pearl elk
#

well i cant

#

i dont know anything

barren topaz
#

@pine smelt

pine smelt
#

hello?

limber veldt
#

This is a bumper that goes inside robots and has a collision 'bumper' outside the robot. When the outer bumper touches a detectable wall, the internal bumper's port turns True (red to indicate it's on)

#

I'll have to change a couple of things since I'm just testing it without a robot yet

#

The tiles it iterates will have to change to those of the room that the robot is in, instead of the room it is in

wicked trout
#

can anyone give me a game idea to make in py

limber veldt
#

Tic tac toe, pong, space invaders

balmy pilot
#

Space Pirate Trainer, if you want to be more ambitious

potent pebble
#

is even good for write comments inside code while coding ???

pine smelt
#

not to the point where there's more comments than code but it is good practice for larger blocks of code

#

especially if u need to quickly understand it when u look at it again weeks or months later

potent pebble
#

U mean like for complexed places in my code for write mini comments whats that function doing or line ?

pine smelt
#

yeah

potent pebble
#

oh i got it , thank you SH !

slow copper
#

you can follow either numpy or google docstring standards

muted sand
wicked trout
muted sand
#

Hey

brave laurel
#

I created a chess board with chess pieces in pygame. I could use some help on the math of calculating possible moves given a type and position of a selected piece. Thanks

limber veldt
#

I've done that before but it is difficult to explain. Each piece has a list of directions it can move as x and y pairs. Like for bishops, they move in angles so all four directions can be represented like so ```py

    self.directions = [
        {'x': 1, 'y': 1},
        {'x': 1, 'y': -1},
        {'x': -1, 'y': 1},
        {'x': -1, 'y': -1}]```
#

Finds all safe squares for all pieces of the current player in one method

#

It's not a simple matter

uneven folio
#

Is it possible to get something like either raylib or pygame to run from the REPL in a way that doesn't block it? What I'm looking for is the ability to make edits to a game live without having to restart

#

And have the REPL available both to send commands but also run anything I need

#

I tried starting the whole thing in a separate thread but not having a lot of luck

#

Ok, I got something working actually

#

This isn't bad

dawn quiver
#

is it possible to use dearpygui + pygame?

crimson belfry
limber veldt
#

My big refactor/rewrite is going great, sometimes I wonder wtf I was thinking when I originally wrote some of the old code

#

A lot of it has been total rewrite while referring to the old code

limber veldt
#

Got my antenna working fine. These are devices inside robots that have two ports, an input and an output. When the input is hot, the robot broadcasts a signal that can be 'heard' by all antennas. When any antenna hears a signal, it's output becomes hot. So one robot can send signals to all robots

#

I've made 5 channels. With four robots each broadcasting on its own channel plus the fifth, a global channel

#

And made receivers that can tune into any of the channels

#

So like one robot can be made to listen to only one other specific robot

brave laurel
#

hey guys how can I get some beginner help on desiging my chess game?
I've already coded about five or six files and a few hundred lines of code.
However, in order to add functionality, I'm going crazy trying to fit it all in my head.
I'd like to find a resource on what graphs I can draw to model my program and also how I can rubber-ducky more effectively and get out of the mind-blank I'm drawing on my chess game.

limber veldt
brave laurel
#

no I didn't, what's up?

limber veldt
#

Well, I have done what you're trying to do but I'd struggle a lot trying to explain it without using my code as an example, so I shared a video a couple of days ago of a tutorial using Javascript.

brave laurel
#

nice

#

can I get that video, please?

balmy pilot
limber veldt
#

And I think for anyone kind familar with python and the concepts we use, js is pretty close, at least the logic explained in the tutorial is excellent

brave laurel
#

definitely! I have ZERO tests

#

I don't even have experience writing tests

balmy pilot
#

There's a standard syntax for chess moves, you could consider accepting that on STDIN so that your game can 'play' an existing match

#

or support like mychessgame -f ./some_chess_moves.txt

#

Then you could write tests that ran chess games and you could assert that they came out the way they should

brave laurel
#

right, I was tweaking the syntax because I wasn't sure my data structure was gonna work with the notation

limber veldt
#

https://www.youtube.com/watch?v=fJIsqZmQVZQ This is it, if I had one that in depth but in python, I'd gladly share it too

Learn how to code a chess game that can be played against another person or a computer, using the Stockfish API. The tutorial uses JavaScript and Angular, but you can follow along if you don't know Angular.

💻 Code: https://github.com/awsomeCStutorials/chess-game

Stockfish API: https://stockfish.online/

✏️ Course created by @RobertsTech...

▶ Play video
balmy pilot
#

Glad to help getting started with testing if that sounds interesting

limber veldt
#

The method he uses to find all safe squares is amazing

brave laurel
#

yes, defiler, I appreciate the general direction but I was just about to ask for some more invovled help

limber veldt
#

I would have never thought of how he did it

balmy pilot
brave laurel
#

let's do it, sst, let me watch this soon

limber veldt
#

It's long, and complicated, but worth it, you seem quite motivated

brave laurel
#

thanks, sst, that makes me feel good!

#

I heard about some javascript apis like "chessjs" or something, but I was writing Python, not javascript

limber veldt
#

I could just share code with you but that kind goes against my own policy, I got great satisfaction of writing it in python myself

brave laurel
#

also, I knew it would be a challenge to jump right into a fully written library and try to grasp it

#

so I wrote some python from scratch that draws a chess board and no more

limber veldt
#

I implemented Stockfish for the CPU opponent, he's really good

#

Or for both players, in fact, so stockfish can play stockfish

brave laurel
#

Stockfish sounds really advanced 🙂

limber veldt
#

Implementing it wasn't terribly difficult

#

But yeah, it's a whole project to get allat working

balmy pilot
brave laurel
#

definitely @balmy pilot I should be free the rest of this afternoon

limber veldt
#

My chess project stalled at mass-undoing and redoing moves but everything else is working ok

#

Quick video of robot antenna. Orange robot gets its bumper output connected to its antenna so when it touches a wall, it's antenna sends signal. Blue robot gets antenna output connected to left thruster and moves to the right when the orange robot hits the wall

#

I meant white robot instead of blue, but we get the point, antennas working fine

#

That's so fun, I like writing the code as much as playing with it

brave laurel
#

that friggin cool, @limber veldt

limber veldt
#

Thanks, remake of an old game, so not my idea, just me writing it in pygame

#

That's just a little test level, a few items added to it, some locks (they work too)

#

My little periscope working fine too

#

Next code is for the robot grabber, so they can pick up items, making them even better bots

#

The game will also have blue sentries, indicating they can smart block meaning one cannot sneak past them in a robot, the sentry pins any robot with a player inside. Or even any robot with a robot with a player inside...recursively

#

The blue tile is a portal to level 2, the red crystally shapped tile is a crystal recharger. Because robots have a charge that gets drained as they use their thrusters and crystals can charge them, so I need something to charge crystals too

#

And the locks have two modes, can either be wide or narrow. Wide means the key only has to touch the lock to open it, narrow means the key must be places really close to the key shape in the tile

brave laurel
#

nice

#

dude this looks like an awesome puzzle game

limber veldt
#

It is, it's basically a digital simulator wrapped in a puzzle game. The game has six levels of puzzles to solve

#

And some of them are over the top difficult

#

Has all the basic logic gates and the not versions of them, some flip flops, switches, all kinds of fun stuff

#

In fact, the sixth level is entirely secret, so forget I mentioned it, lol

#

Can only be reached by finding the secrets in each of the previous levels

#

Which is where all those colored keys come in, each level has one of them hidden in it somwhere

#

The original game was called Robot Odyssey published by The Learning Company in ~1985 for Apple2e. In 1999-2000, a guy named Thomas Foote rewrote the game in Java for play on (then) modern machines, which still works today, but I'm rewriting it in python just for the fun of it. The original game had only five levels, Foote added the sixth and I like to call that level "Robot Odyssey's revenge", that's how hard it is

#

I've completed Foote's version, that takes dedication

#

lol

#

Foote was crafty, his source code is on github

round obsidian
limber veldt
#

Yeah man, before everything exploded, the internet and all

#

The company had another title called Rocky's Boots, it was the predecessor to RO

round obsidian
#

yes! I remember that one

limber veldt
#

Some said they were the hardest games of all time at the time, I don't think that's still even close to true

balmy pilot
#

Pinball Construction Kit blew me away at the time. I remember coming home from the store with it.
Stuff that had been static in every game so far was suddenly under my control.

limber veldt
#

But I dunno, Foote's level six is still incredibly hard

#

Yeah man, I was just learning how to code in those days, writing basic and some assembly

balmy pilot
#

Actually I should try building my own version of it

limber veldt
#

Then of course adulthood took over and my hobby remained just a hobby and still is

#

I don't know if I'm any good at it but it's a fun hobby

limber veldt
#

Old games are a never ending source of project ideas

round obsidian
#

Many of my own game projects were either recreations or inspired by

balmy pilot
#

I should also do one for the excellent game Particle Mace. The developer passed away I believe, it's just been abandoned on Steam for years.

limber veldt
#

Have you done many games?

balmy pilot
#

(Super clever game design though)

#

Not really; I did right in the beginning, as it's what made me want to learn to program.. but I then have lived a whole life without really doing it as part of my career or etc

tired reef
#

How should I implement some type of recasting for my game

limber veldt
#

Right on, same here, I worked in mass transit for years

balmy pilot
#

I've built media players and plenty of other GUI things but it's been years since I tried making a complete game

#

Yeah I will do this

limber veldt
round obsidian
#

My main limitations are time and attention; I have many other things going on that prevent me from really devoting myself :D

limber veldt
#

Yeah, time is not so much a problem for me as much as attention

round obsidian
#

The big thing I'm working on now is sorta game related, it's basically a mini-Discord but it's intended for use as a RPG chat system

limber veldt
#

Plus it's good to take breaks after some of the marathon sessions I get started on

#

It's been about a year since I "finished" this game but I wasn't happy with some of it

#

So consider the first one a test run, lol

#

Which is kind of nice that I don't have to work out every little piece of logic again but all of it is getting re-thought

balmy pilot
#

"Oids" was amazing too, since I'm remembering old games tonight.

limber veldt
#

I don't remember that one

balmy pilot
#

Vaguely a descendant of Lunar Lander you could argue, but it ventures pretty far from those roots

#

I guess it's more like a more-degrees-of-freedom Choplifter.

tired reef
#

How do I make a map using pygame

balmy pilot
#

I mean, I'm definitely not an expert, but one way is to make something with https://www.dungeonscrawl.com/ and then just import it into pygame as the background image for a view

civic walrus
dawn quiver
#

but the problem is that dearpygui already has its own window system

#

and whenever I try to put dearpygui inside the pygame window, it doesn't work

crimson belfry
#

you could try writing a class for the mathematical stuff

#

because you don’t need to do everything with one library

#

but like i said sometimes it depends in how and what you want to do

dawn quiver
#

I want to make a game on my cell phone, I can?

balmy pilot
#

Sure. Do you want to use Python, or do you not care?

brave laurel
#

hey defiler, I'm back to ask for some help 🙂

#

@balmy pilot and other viewing eyes, please review my updated classes, now with defiler's advice taken and restructured and all that.
https://github.com/DustinWestGlow/Dustin-chess-game/blob/main/definitions.py
Please also review the tiny project as a whole because I refactored a ton to make it cleaner and with better practices like descriptive variable names.

GitHub

Contribute to DustinWestGlow/Dustin-chess-game development by creating an account on GitHub.

#

Now, I'm asking for some help implementing the functionality. Currently, the game only displays a chess board. I want to be able to do two things.

  1. Play a chess game without an AI, just by clicking a bunch.
  2. Use a special "replay" mode where moves are made or rewind by using arrow keys.
    Both of these features were partially implemented before the refactor.
balmy pilot
#

Sure, let me take a look.

brave laurel
#

I would love to write another markdown file with these goals in mind and get some basic advice on how to plan on these features.
My main problem is my brain is blanking on how I would do this.
I also don't want to look at a pre-made chess engine code yet because I want to figure this out from scratch. Thanks.

balmy pilot
#

OK so I would make a separate directory for the code to live in, commonly named src or the same name as your project, e.g. chess or radproject.. Your goal is to organize things into 'modules', where each module has a single responsibility that's easy to explain.

#

The main things I'd focus on are move validation and game state management.
By the first one I mean stuff like computing the valid moves for a piece, and checking that a move you're attempting is one of them.
By the second I mean stuff like remembering which player's turn it is, detecting check and checkmate..

#

Also I'd add a README.md to help organize your ideas/plans/status

brave laurel
#

you didn't like the /docs .mds?

balmy pilot
#

That's cool, but there should be a README at the top level too

brave laurel
#

okay, for move validation, let's say I know the piece's soldier (king's bishop or pawn) and it's position on the board (3, 5). That should be enough to know whether I can make a move to a destination position (x, y). Because I can check that I'm not being blocked by my own pieces and may even take an enemy piece.

balmy pilot
#

Here's kinda the TODO list that comes to mind..

[] Handle mouse clicks to select (first click) and then move (second click) pieces.
[] Validate moves either yourself or using a library like python-chess
[] Update the board after each valid move
[] Alternate turns between players
[] Remember a history of moves
[] Add a replay mode that can step through the history
balmy pilot
brave laurel
#

cool, I didn't know if there was a hidden hang up

balmy pilot
#

The more interesting question comes later when you're building your AI player; how do you take that definition and use it to get a list of all possible moves for a piece etc

brave laurel
#

well a "list of all possible moves for a piece", that should be easy, right? A queen might have a lot and a pawn a few so a single piece would probably be real easy to implement.

#

Is it that you want to state->action->state->action into the future to test multiple possible consecutive moves?

balmy pilot
#

The more moves ahead you want your AI to be able to plan, the more possible positions you have to think about.

#

But you can save that problem for later, certainly

tired reef
#

I got two books and python game development as I'm whenever used a book by Jade L. rhodes

brave laurel
#

@tired reef are you talking to me? I love books!

tired reef
#

Just in general

brave laurel
tired reef
#

No the book cover is cyan

#

What files are good for panda 3d?

brave laurel
#

gotta take a little break from making this game

#

phew, just been concentrating for too long

brave laurel
#

move validation is kinda fun so far

#

I can just write validation for one type of piece at a time and that way I can test my pygame every few minutes

south minnow
#

Hello everyone

#

Please who got access to this book "Pygame 4000 Book"?

muted sand
#

I have that book

limber veldt
#

Just testing some things, player blocker walls that block player and robots if player is inside

#

Might as well grab that key while I'm at it

#

And of course, it's recursive so even if player is inside a robot inside another robot, it will still block

#

And, while the sentry is redundant in a room that blocks player from even entering, it works too, it pins player and robots with player inside

#

Need to move him to a room where he can do his job

limber veldt
#

And Item just has interface behaviors, like picking up, dragging

balmy pilot
#

Fun

limber veldt
#

Almost everything is subclassed from Item, even the player and robots. I thought about just extending the Item or Device classes with classmethods but the inheritance is convenient

limber veldt
#

I wish I could come up with a better way to make sprites with several components. One way is to draw those things on the sprite image like I do with the stems on gates. Another is create smaller sprites and update them at offsets from the main sprite

balmy pilot
#

Do you have a "sprite group" sort of abstraction?

limber veldt
#

The robots update their external devices, those bumpers, antenna, grabber, as they move or are carried

#

Oh yeah, it's all I use, I rarely blit things manually

#

Groups make everything easier to manage

limber veldt
balmy pilot
#

OK, so isn't a sprite with several components just a group?

limber veldt
#

I could make a custom group for them...I think

#

Pygame has .sprite.Group()s and they're easy to subclass too

#

With the version I have now, I'm in a good place to change anything without breaking everything

spring zealot
mystic prairie
#

How*

mystic prairie
mystic prairie
limber veldt
# mystic prairie U did u make drag n drop feature?

All items have this update method py def update(self, dt): if self.carried_by: self.rect.center = self.carried_by.rect.center + self.offset if self.selected: self.rect.center = Vector2(pygame.mouse.get_pos()) And I control that .selected attribute in the main game

#

So an item can be carried by the player or dragged by the mouse

#

When player presses space, he checks the current room for items within 100 pixels and picks up the closest one, assigning an .offset to the item and setting its .carried_by flag to self (the player)

#

This way, when something is carried, it remains in the same position relative to the player as he moves around

#

In main, when right clicking, it checks the current room for .grabbable items (most things are .grabbable = True) under the cursor. If it find one, it sets the item's .selected to True

#

Actually, all items have a grabbable and a mousable flag that can handle these interactions

#

Grabbable means player can pick up, mousable means mouse can pick up. Picking up wit mouse is a game hack, and probably won't be in the final version for any items

#

Too easy to cheat with it, but fact is, I don't really care if anyone cheats

#

Like, one could just edit the code to change anything they want

#

So how much effort should be spent on anti-cheating...not much

#

I could just turn it off for items and leave it on for devices to keep circuit editing and building easy

#

But things like keys wouldn't be mousable

#

The cool thing about carrying vs mousing items is that even if you mouse a key onto a lock, the lock won't open. All items only interact with the world when carried by something and that something is moving

#

Every time player moves (and robots) they check the room for collision with tiles (walls) and if they're carrying something, that gets checked too. This way carried items can affect walls

#

As for dropping, in main I have a .active_selection attribute that gets set True when an item is picked up with right click. When left clicking, I check for active selection, if there is one, set its .selected flag back to False so it no longer follows the mouse

#

What's convenient about this way is that the mouse can carry multiple items at the same time. Like hover, right click, hover another, right click, and both items will stick to the cursor. Which is handy for recycling old circuits, just mouse all of the devices and drop em in the trash

#

Called from my left click event ```py
def drop_active_selection(self):
if self.active_selection:
room = self.level.current_viewer.room
items = room.room_items.sprites() + room.room_devices.sprites()
for item in items:
if item.selected:
self.handle_mouse_drop(item)

def handle_mouse_drop(self, item):
    if self.trash_can.sprite.rect.collidepoint(pygame.mouse.get_pos()):
        if item.can_be_recycled():
            item.recycle()

            item.selected = False
            self.active_selection = None
    else:
        item.selected = False
        self.active_selection = None```
#

Suit case cannot be recycled

#

Nor can crystals

#

Only devices, those things from the toolbox

#

The suit case has a room inside it that the player can enter. So it's a basic inventory system. Since player can only carry one item at a time, if he puts items inside the suit case and carries it, problem solved

#

So in this way, one can carry many things at once, even to a different level (from level one to two here)

#

The level progression here is linear, in the game, one cannot teleport to previous levels, but I can for testing things

limber veldt
#

Well, I'm to the point now where I can start rethinking how to save and load levels

#

Mostly how to deal with robots inside robots

#

I think I'll parse all the rooms of a level first, saving the attributes of any robots found in those rooms (robot type, position, room number that it's in) and these will be the roots of recursion to populate their rooms

robust egret
limber veldt
#

I played the year 2000 version, but it was orginally made in 1985 or so

tired reef
#
import direct.directbase.DirectStart

#load model

panda_model = loader.loadModel("models/panda") # loads panda model

panda_model.reparentTo(render) #render model to the scene

#spins camra around model

panda_model.hprInterval(5, (360, 0, 0)).loop()

#set camra positions
base.camera.setPos(100,-50,0)

#points camra to model
base.camera.lookAt(panda_model)

run()#runs game
#

how do i make the model smaller?

tired reef
#

Because the camera is inside the model if you run the code in the basic python IDE

balmy pilot
#

Just bumped into this again after years, still very good https://www.youtube.com/watch?v=Fy0aCDmgnxg

Try the game here: http://grapefrukt.com/f/games/juicy-breakout/ (ESC for menu)
Fork us on github: https://github.com/grapefrukt/juicy-breakout

"A juicy game feels alive and responds to everything you do
tons of cascading action and response for minimal user input. "

Big thanks to Niklas Ström for making music and sound effects for us and to ...

▶ Play video
tender kraken
#

Can someone please link me to an explanation or explain to me how game engines utilize the gpu? I know there cuda and RockM and stuff like that, but game engines work with almost anything, meaning I can run a game with my Inter/AMD iGPU or any other GPU. How is it done exactly? I’m asking here because this is the only programming server I’m familiar with lol

normal silo
#

Some are specific to a certain operating system, others are meant to be cross platform. And APIs like CUDA are tied to specific hardware.

#

There are also some things like OpenCL, which can be used to do GPGPU, but can also run on the CPU or other hardware (e.g. FPGA).

#

Game engines also are like this, they internally use various APIs depending on which platform they are on / what is available.

#

Some may use bgfx.

#

This is also why game engines often have their own custom shading languages, they want the user to be able to write shader code without having to worry about which specific underlying APIs are used.