#game-development

1 messages · Page 83 of 1

dawn quiver
#

i am a beginner

#

i want to get into game development

glass sonnet
frozen knoll
#

Also @dawn quiver . Might help get you started. Lots of examples and tutorials.

cloud nest
#

what do i need to study before i get to game dev?

dawn quiver
#

@cloud nest

  1. a programming language
  2. MATH!
cloud nest
dawn quiver
# cloud nest what do i need to study before i get to game dev?

@cloud nest
consider this example:

  1. I wish to create a basic Mario-styled platformer game! I need to study a programming language and its basics. Suppose i use Python to make it. First i need to master the basics of python. Then i learn a game library like Pygame (in Python for instance). I use resources on the internet to do that!

  2. finally, i need MATH. I need at least high school math for this. Math, is for making you character move, calculate his jumps, and calculate collisions with Objects, also much more, like calculating fireball throws.

  3. Optimizations! - You just cant publish a buggy game can you? You need to optimize it by getting to make it smoother. Optimizations may include increase in the device's processing power, or formatting your code better.

@cloud nest

restive lantern
#

The math depends on what tipe of mechanics you want in your game

dawn quiver
#

not really. you need math at every point in the game. even in drawing objects

#

You cant just go about drawing objects anywhere! you need to know about the cartesian coordinate plane!

restive lantern
dawn quiver
#

he needed detail

#

half knowledge is far deadlier than no knowledge

restive lantern
#

@cloud nest
Look bro just start with pygame or arcade. Do some simple stuff and then you can get into the mathematics one step at the time

restive lantern
#

Just dont get this guy discouraged with math. He can make it

cloud nest
#

for now, i think i just need to learn the basics

cloud nest
dawn quiver
#

therefore its better to ask @restive lantern

#

not everyone is bad at math i guess.

restive lantern
#

Look im awfull at math and im still making it

dawn quiver
#

nice.

#

you cant go too far with basic math, you see.

restive lantern
#

Usually the guys that are intrested in making games are gamers and i think that the gamer are usually the guys that dont care about maths but who knows

cloud nest
restive lantern
#

Ok

odd cypress
#

how do we get out of pygame infinite loop
whenever i click the pygame x button it says not responding

crisp junco
odd cypress
crisp junco
#

yeah

odd cypress
#

jus a min ill get back to u

crisp junco
#

👍

odd cypress
#

im actually doing a project

#

we are almost donr

#

done*

#

but this one is troubling

#

its a hobby project

crisp junco
#

what's the problem @odd cypress ?

odd cypress
#

basically to start the program running, we wait until the event is mousebuttondown

#

as soon as mousebuttondown is captured, i create a loop for checking the events eithin this

#

within*

crisp junco
odd cypress
#

hey wait some ideas are striking me rn

#

get back to u later after some time

crisp junco
#

alright

unreal river
#

k

#

@crisp junco did you solved your problem?

crisp junco
unreal river
#

the error on your code

crisp junco
#

What are you talking about?

#

@odd cypress was having a error in his code not me

unreal river
#

oh

#

wrong one HAHAHHA

crisp junco
#

I was helping him

unreal river
#

sry

crisp junco
#

lol

#

np

unreal river
#

@odd cypress can you give me the error?

odd cypress
#

basically when the game is running if im trying to click on close button it says not responding

unreal river
#

did you save it?

odd cypress
#

@crisp junco shall we have a discord screen share meet

crisp junco
odd cypress
#

i checked but there are some problems which im not able to explain

crisp junco
unreal river
#

just copy the error

odd cypress
# crisp junco What's your code?

while running:
for i in range(0, 3):
screen.blit(image, rect)
pygame.display.update()
pygame.time.delay(250)
screen.fill((255, 255, 255))
pygame.display.update()
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
elif event.type == pygame.MOUSEBUTTONDOWN:
mouseX, mouseY = pygame.mouse.get_pos()
print(mouseX, mouseY)
A1 = Ant(mouseX, mouseY, (0, 0, 0))
move(A1)
while event.type != pygame.QUIT:
showSteps(A1)
# modified the available screen area according to the counter frame
if A1.AntX in range(0, 251) and A1.AntY in range(0, 71):
break
elif A1.AntX < 799 and A1.AntY < 599:
move(A1)
else:
break
running = False
pygame.display.quit()
pygame.quit()
else:
pass

unreal river
#

kk

#

try break instead of running = False

odd cypress
#

please see my code

unreal river
#

is it supposed to be if you pressed your mouse then it dose all of the things? is it the indentation?

odd cypress
#

yes

unreal river
#

then the pygame quits?

odd cypress
#

yep if it does not satisfy any of the given conditions

#

@crisp junco are u there?

unreal river
#

try something like ```py
mouse_pressed = pygame.mouse.get_pressed()
if mouse_pressed[0]: # Checks if the mouse left button is pressed

codes here!

odd cypress
#

@unreal river ??

unreal river
#

sorry thinking

odd cypress
#

ive done same only right/....

unreal river
#

?? wdym

odd cypress
unreal river
#

oh i get the code

mortal herald
#

why it say the "running" is wrong?

unreal river
#

see your creating a while loop without ```py
for event in pygame.event.get():
if event.type == pygame.QUIT:
# CODE HERE

#

the second while loop

odd cypress
#

oh the same event is being tested

#

so how do i change it

unreal river
#
while running:
    events = pygame.event.get()

    for i in range(0, 3):
        screen.blit(image, rect)
        pygame.display.update()
        pygame.time.delay(250)
    screen.fill((255, 255, 255))
    pygame.display.update()
    for event in events:
        if event.type == pygame.QUIT:
            running = False
        elif event.type == pygame.MOUSEBUTTONDOWN:
            mouseX, mouseY = pygame.mouse.get_pos()
            print(mouseX, mouseY)
            A1 = Ant(mouseX, mouseY, (0, 0, 0))
            move(A1)
            while event.type != pygame.QUIT:
                events = pygame.event.get()
                showSteps(A1)
                # modified the available screen area according to the counter frame
                for event in events:
                    if event.type == pygame.QUIT:
                        #CODE HERE
                if A1.AntX in range(0, 251) and A1.AntY in range(0, 71):
                    break
                elif A1.AntX < 799 and A1.AntY < 599:
                    move(A1)
                else:
                    break
            running = False
            pygame.display.quit()
            pygame.quit()
        else:
            pass
#

set a variable that stored the pygame events

#

set the variable on the first loop and then do the same in the second

mortal herald
#

it says "NameError: name 'running' is not defined"again!

unreal river
#

you can set the running variable in a class and create an object that is part of the class and it will be defined

odd cypress
#

im not getting ur point

#

can you alter it further

unreal river
#
class Game():
  def __init__(self):
    self.running = True

game = Game()
while game.running:
  #CODE HERE
unreal river
# odd cypress im not getting ur point
while running:
  events = pygame.event.get()
  for event in events:
    if event.type == pygame.QUIT:
      pygame.quit()
    if event.type == pygame.MOUSEBUTTONDOWN:
      while True:
        events = pygame.event.get()
        for event in events:
          if event.type == pygame.QUIT:
            pygame.quit()
#

define the variable in the loop and store the pygame events in it

#

its like the for event in pygame.event.get()

#

except its in a variable

#

@odd cypress ```py
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
elif event.type == pygame.MOUSEBUTTONDOWN:
while True: # Cant get to the if statement below because this keeps looping

untold moat
#

Just wondering

#

Is functions highly useful for game dev

crisp junco
#

super useful

crisp junco
odd cypress
#

can you please explain y u have told to do that way or ewhat is wrong with my approach? @unreal river

odd cypress
#

what

#

i still get it

#

did'nt

#

its the same

unreal river
#

bro your second while loop doesnt check if you click the X button on the top right

odd cypress
#

can you edit in the main code that i have sent here

#

@unreal river

unreal river
odd cypress
#

ok bro

dawn quiver
#

@odd cypress

#

pygame.quit() simply quits the pygame window if the X button is pressed. pygame.QUIT is the event for pressing the X button.

odd cypress
#

does anyone know how to increase pixel size in pygame?

odd cypress
#

anyboddy??

cloud nest
worldly flare
#

hey! i am trying to make a boss ai if anyone has created one then plz guide me

#

also the game I am making is a dungeon crawler so I want to make random maps with procedural generation IDK hw to archieve that so please help me with that.

odd cypress
#

if we ask in correct group, u ppl wont reply
if we ask in multiple grps , u ppl call it spamming

olive parcel
#

Maybe you should ask your question more clearly. I have no idea what "increasing pixel size" is supposed to mean.

torpid silo
worldly flare
#

I suffered from this

olive parcel
#

If people in the correct channel don't know the answer to your question, what makes you think that people in an entirely unrelated channel will know it?

#

It's like if you entered your local hairdresser shop and told them "My greengrocer doesn't have any carrots, do you have any?"

worldly flare
#

but I am asking for the right stuff in the right channel!

blissful folio
olive parcel
#

I was addressing @odd cypress

worldly flare
#

So I am asking my hairdresser for cloths not for some fricking carrots

worldly flare
#

to whoever u said

olive parcel
#

So confusing when people change their nickname mid-conversation…

blissful folio
#

Well first thing number of askers would always be greater than the number of persons who answer. So maybe just ask in one channel then try to bump the question rather than just type the whole question everywhere all the time.

odd cypress
#

sample code*

#

or the way u write that

torpid silo
#

pygame.display.set_mode((640, 480), FULLSCREEN | SCALED)

#

will make a fullscreen program with everything scaled up

#

so you draw to the screen as if it was 640x480, even though it's however big your monitor is

odd cypress
#

scaled not defined

torpid silo
#

pygame>=2.0.0

#

right?

odd cypress
#

im actually inverting pixel colors

#

im on pycharm

#

how to checj version

#

check*

#

of pygame

torpid silo
#

I've never used pycharm

#

do you use pip?

odd cypress
#

yes

#

pycharm --version?

torpid silo
#

just do pip install -U pygame

odd cypress
#

oh kk

torpid silo
odd cypress
#

thank u doing it, pls dont leave ill get back to u if i have problems'

#

i was unable to terminate the program in this mode

#

and the pixels are not enlarged

#

only the screen is enlarged

#

please help me with pixel enlarging @torpid silo

#

guys ayone pls help me, i hope im asking in the right grocery shop

blissful folio
ionic tundra
#

you could do pygame.transform.scale and pass in the sources surface, the pixel size u want the display to be enlarged to, and the destination surface as arguments

#

That should do the trick ig lemon_thinking

elfin frost
#

Is turn game over network complicated?

plain axle
#

I want to make a fighting game. Where do I start?

true basin
#

from random import randint
win_tracker = []
#create a list of play options
t = ["Rock", "Paper", "Scissors"]

#assign a random play to the computer
computer = t[randint(0,2)]

#set player to False
player = False

while player == False:
#set player to True
for i in range (3):
player = input("Rock, Paper, Scissors?")
if player == computer:
print("Tie!")
elif player == "Rock":
if computer == "Paper":
print("You lose!", computer, "covers", player)
t.append("loss")
else:
print("You win!", player, "smashes", computer)
t.append("win")
elif player == "Paper":
if computer == "Scissors":
print("You lose!", computer, "cut", player)
t.append("loss")
else:
print("You win!", player, "covers", computer)
t.append("win")
elif player == "Scissors":
if computer == "Rock":
print("You lose...", computer, "smashes", player)
t.append("loss")
else:
print("You win!", player, "cut", computer)
t.append("win")
else:
print("That's not a valid play. Check your spelling!")
#player was set to True, but we want it to be False so the loop continues
def result():
if int(t.count("win")) >= 2:
print (" YOU DID IT! YOU WON!")
else:
print("YOU LOST!")

result()

this is my code where can i put in a parameter

true basin
#

nah like where can I add one into there

gilded grove
true basin
#

sorta

gilded grove
#

what is it then?

true basin
#

i think issa variable sorta idrk

gilded grove
#
def list(a_list):
  for val in a_list:
    print(val)


print(list([1,2,3]))
#

what do you think happens when that code is run

true basin
#

not sure

gilded grove
#

well it prints 1, 2, 3, then None

#

and a_list

#

is a list

#

that is a parameter

true basin
#

ah

gilded grove
#

have you read automate the boring stuff

true basin
#

nah im new to coding im taking a this class in hs

#

I havent read it

gilded grove
#

!resources

frank fieldBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

gilded grove
#

well

#

it's a free e book

#

and it also explains stuff better than I can

true basin
#

I see

gilded grove
#

it will make learning the basics much easier

#

and it gives concrete examples too

true basin
#

Ill check it out

#

Do you think you could give me an example real quick tho of how i could use a parameter in the rock paper scissors tho

gilded grove
#

you could have a function that takes strings from both players

#

and then just put a shit ton of if elif conditions

true basin
#

aight thanks bro

gilded grove
#

if this player chose rock and this player chose scissor

#

then the player that chose rock won

true basin
#

bet

supple cedar
#

in a game where you drive a car around like gta 5 how does the game know that when your on a hill and that the car should go upwards also?

blissful folio
odd cypress
#

as im using mouse click to begin

#

i wanted the coordinates not to be disturbed

#

at the same time be able to view in bigger version

dawn quiver
#

import math

def ballPath(startx, starty, power, ang, time):
angle = ang
velx = math.cos(angle) * power
vely = math.sin(angle) * power

distX = velx * time
distY = (vely * time) + ((-9.8 * (time ** 2)) / 2)

newx = round(distX + startx)
newy = round(starty - distY)

return (newx, newy)

def findPower(power, angle, time):
velx = math.cos(angle) * power
vely = math.sin(angle) * power

vfy = vely + (-9.8 * time)
vf = math.sqrt((vfy**2) + (velx**2))

return vf

def findAngle(power, angle):
vely = math.sin(angle) * power
velx = math.cos(angle) * power

ang = math.atan(abs(vely) / abs(velx))

return ang

def maxTime(power, angle):
vely = math.sin(angle) * power
time = ((power * -1) - (math.sqrt(power**2))) / -9.8

return time / 2
dawn quiver
dawn quiver
dawn quiver
proud bough
#

what is best(most optimised) in pygame to code a game like pokemon ?? i thinking to use tiled to make the map and import it as csv and blit it onto a Xscreen ,and some sort of camera that will crop the Xscreen and display it on the displayscreen depend upon the player position ................ Any suggestions will be appreciated

iron jasper
#

Hey

#

.mtl depends of texture or of .obj?

#

Material data

boreal gyro
#

Does anyone know a way to share games made with pyxel with android users?

true dagger
#

what is the rect for ?

shrewd copper
#

It's the way pygame identifies rectangular objects

odd cypress
#

while running:
for i in range(0, 3):
screen.blit(image, rect)
pygame.display.update()
pygame.time.delay(250)
screen.fill((255, 255, 255))
pygame.display.update()
events = pygame.event.get()
for event in events:
if event.type == pygame.QUIT:
running = False
elif event.type == pygame.MOUSEBUTTONDOWN:
mouseX, mouseY = pygame.mouse.get_pos()
print(mouseX, mouseY)
A1 = Ant(mouseX, mouseY, (0, 0, 0))
move(A1)
while event.type != pygame.QUIT:
events = pygame.event.get()
for event in events:
if event.type == pygame.QUIT:
break

            showSteps(A1)
            # modified the available screen area according to the counter frame
            if A1.AntX in range(0, 251) and A1.AntY in range(0, 71):
                break
            elif A1.AntX < 799 and A1.AntY < 599:
                move(A1)
            else:
                break
        running = False
        pygame.display.quit()
        pygame.quit()
    else:
        pass
#

guys in this the second while loop has a for loop to check if user quits in between the game or not

#

it works fine

#

but i have a doubt

#

if we click on quit button
doesn't it break out of for loop and continue with while loop statements

#

please clarify this guys

blissful folio
#

But it doesn't because you are setting running = False whent the event == pygame.QUIT

minor sundial
#

im new to python but i wanna start making games. Where do I start?

deep gust
dawn quiver
bold knot
#

Hi all, why would people choose to use pygame over game engines?

cyan furnace
#

pygame has great librarys and makes it easy to define screen, sound, and button imputs

minor sundial
dawn quiver
#

try reading some books

#

on pygame

dusk swift
#

!resources

frank fieldBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

mystic lodge
#

is there anyway to use pypy to compile python programs and if so can it compile with modules such as pygame?

gusty wave
#

does anyone know a documentation on pygame ui?

restive estuary
#

Yes

gusty wave
#

or a tutorial

gusty wave
restive estuary
#

Basically we may need to build pygame in tkinter or pygui

gusty wave
#

tkinter

#

is there a tutorial?

#

pls

restive estuary
#

https://youtu.be/wMrdLvWSl_o

You can make a game only with tkinter

Tkinter is a Python binding to the Tk GUI toolkit. It is the standard Python interface to the Tk GUI toolkit and is Python's de-facto standard GUI. Tkinter is included with standard Linux, Microsoft Windows and Mac OS X installs of Python. The name Tkinter comes from the Tk interface.

For this game, I used the Tkinter module instead of using th...

▶ Play video
#

No need of pygame

gusty wave
#

ok

#

I am using pygame rn

#

I need a ui that can display a message

#

with pygame

#

if it can be imported into a pygame script

#

then I will use it

#

@restive estuary

restive estuary
gusty wave
#

does it work with pygame?

restive estuary
#

S

gusty wave
restive estuary
#

Short form of yes

gusty wave
#

ok

restive estuary
#

Bye

gusty wave
#

is there a tutorial on yt?

normal silo
gusty wave
normal silo
gusty wave
#

like making gui

#

with just pygame

#

no like pygame_gui

#

or anything like that

normal silo
#

If you want to make it with just pygame, then just do that.

gusty wave
#

yeah

#

IDK how to do it

normal silo
#

Do you know how to do collision detection between a point and a rectangle?

gusty wave
#

no

#

I just need text

#

thats all

normal silo
#

Just text? Then just render text, pygame has that.

gusty wave
#

YES

#

IDK HOW TO DO THAT

normal silo
#

It's the first search result on google for "pygame text"

gusty wave
#

ok

#

ty

#

uh

restive lantern
#

Where it says none in the first line you have to put a font file

gusty wave
#

what font should I use?

restive lantern
#

You can put something like "Arial.ttf"

#

Ttf extention is a font file

gusty wave
#

ok

#

what about this

restive lantern
#

The 24 is the size of the text

gusty wave
#

yes

#

ik

restive lantern
#

In the second line 'hello' is the text to be rendered

gusty wave
#

ik

#

but the Blue and Screen

#

appear to be an error

normal silo
#

Using None will load the default system font.

restive lantern
#

Blue is a color and the way pygame handles color is using a tuple like
Blue = (0,0,255)

gusty wave
restive lantern
#

The color is in rgb (red,green,blue) and in the tuple you have to choose a value between 0 amd 255 for each color

gusty wave
#

ok

#

ik

restive lantern
#

The screen in the last line is the surface where you want to display the text img

gusty wave
#

BRO

#

can you just help me

#

like

#

show an example

#

how how the code should look like

#
    font = pygame.font.SysFont("Arial.ttf", 24)
    img = font.render('hello', True, BLUE))
    screen.blit(img, (20, 20))
#

the blue var

#

is some where else

#

in my code

#
BLACK = (0, 0, 0)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
GRAY = (200, 200, 200)
restive lantern
#

is above the text piece of code

gusty wave
#

wdym

restive lantern
#

just wait and i will make you an example

gusty wave
#

screw it
BLACK = (0, 0, 0)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
GRAY = (200, 200, 200)

font = pygame.font.SysFont("Arial.ttf", 24)
img = font.render('hello', True, BLUE))
screen.blit(img, (20, 20))
restive lantern
#

yea like that

gusty wave
#

you can now make an example of how the working version of the code should look like

restive lantern
#

screen = pygame.display.set_mode((700,400))

blue = (0,0,255)

font = pygame.font.SysFont("Arial.ttf", 24)
img = font.render('hello', True, blue))
screen.blit(img, (20, 20))

#

EZPZ

gusty wave
#

no ezpz

restive lantern
#

what is wrong?

gusty wave
#

are you blind?

#

the blue is an error

#

the font is an error

#

img = font.render('hello', True, blue))
^
SyntaxError: unmatched ')'

restive lantern
#

there is an extra parenthesis right after the blue

#

in the img line

gusty wave
#

wdym

restive lantern
#

img = font.render('hello', True, blue)<--)

gusty wave
#

oh

#

display.blit(img, (20, 20))
AttributeError: 'tuple' object has no attribute 'blit'

restive lantern
#

let me look up

#

display variable is being treated as a tuple

#

not a surface

gusty wave
#

then uh

#

how 2 fix

#
    pygame.init()
    display = (1200,900)
    pygame.display.set_mode(display, DOUBLEBUF|OPENGL)
restive lantern
#

it should look like this
display = pygame.display.set_mode((1200,900), DOUBLEBUF|OPENGL)

#

this line returns a surface

gusty wave
#

gluPerspective(45, (display[0]/display[1]), 0.1, 50.0)
TypeError: 'pygame.Surface' object is not subscriptable

restive lantern
#

but you are defining display as a tuple

#

send text

gusty wave
#
    gluPerspective(45, (display[0]/display[1]), 0.1, 50.0)
TypeError: 'pygame.Surface' object is not subscriptable
#
    pygame.init()
    display = pygame.display.set_mode((1200, 900), DOUBLEBUF | OPENGL)

    icon = pygame.image.load("assets/icons/logo.png")
    pygame.display.set_icon(icon)

    gluPerspective(45, (display[0]/display[1]), 0.1, 50.0)

    glTranslatef(0,0, -10)

    glRotatef(25, 2, 1, 0)
restive lantern
#

in display[0] and display[1]

#

you cant do that

#

you only do that for list or tuples

#

and display is not a tuple

gusty wave
#

???????????????????????????????????

#

I am confused

restive lantern
#

gluPerspective(45, (---->display[0]/display[1]), 0.1, 50.0)

#

just use 1200 and 900

#

or put those two in a variable

gusty wave
#

confused a lot lot m

restive lantern
#

gluPerspective(45, (1200/900), 0.1, 50.0)

#

like that

gusty wave
#

pygame.display.update()
pygame.error: Cannot update an OPENGL display

restive lantern
#

i cant help you with that since i dont use openGL on my stuff

#

let me see

#

display = pygame.display.set_mode((1200, 900), DOUBLEBUF | OPENGL) <--change this line for:
display = pygame.display.set_mode((1200, 900))

gusty wave
#

can you just give me a stupid tutorial?

restive lantern
#

do you know about indexes in lists and that stuff?

gusty wave
#

omg

restive lantern
#

tell me do you know?

gusty wave
#

idk

restive lantern
#

looks like you need to learn a little bit more than just pygame

stark meadow
#

is it ok if i talk game design here?

dawn quiver
teal ember
#

what would be the best way to fit the tile image on the whole window?

#

should i resize or draw multiple tiles from a loop

sacred trout
#

Depends what you are using, but assuming it is pygame, a for loop seems to be the best
nice rounded corners btw ! what wm is this ?

teal ember
#

i3 gaps

#

used picom (git version) for the rounded corners

#

so ye a for loop works thanks, thought it would have performance issues but i dont seem to have any

shrewd copper
#

Has anyone noticed an issue of their sprites getting slightly distorted while moving diagonally in pygame?

#

or is that just me

#

I wonder if it's due to the fact that it's moving quicker diagonally.

gusty wave
#

does pygame have cross-platform support?(mobile, console)

half pasture
foggy iris
#

Can anyone help me with pyarcade gui

#

I’m having problems with button interactions

green relic
#

Can anyone help? My self.kill() is not working in pygame

noble void
#

@green relic Did you figure it out?

severe igloo
#

I am using arcade. When I try to load a sprite like this: self.player = arcade.Sprite("prisoner.png", 2, 600, 400) I get Exception: Error: Attempt to draw a sprite without a texture set.. The first part of the traceback printed is saying it can't locate the sprite. Please help.

worldly flare
restive lantern
fathom thunder
#

anyone have a reccomendation on how to start game development for python? I want to start off fresh and want to know everything about python and game development, and would be nice if you could send me a playlist on youtube or a video on everything about python

prisma cypress
#

each software isn't easier or harder, it's a different can of worms

dreamy holly
#

hello everyonehello everyone
how can i create perspective view custom in the game ?

#

in every 3d games

#

inject py file to games and making custom camera ...

serene kettle
#

I am new , what game should I make first

worldly flare
#

what is hardware accelerated rendering

worldly flare
#

?

worldly flare
#

and the art is amazing

gusty wave
#

they both have support(but hard to add and use)

#

I wouldn't use python for game/engine development

#

I would most likely use something like C/C++ or Java

#

maybe even C#

left skiff
#

and if you want to use python, try Kivy, Pygame, Panda3D, Arcade, Pyglet, Cocos2D, Pyxel, Wasabi 2D, Ursina, PursuedPyBear

dawn quiver
#

python is not suitable for large game development right??

olive parcel
#

It is

#

@dawn quiver some large games like EVE Online, Toontown, Pirates of the Caribbean Online, and several others have been made using Python.

#

I think Civilization IV also is made with a lot of Python.

dawn quiver
#

not Assassin's creed or Death stranding or Red dead redemption, these aaa titles are far too complex for python only

#

but majority of it is made using c# c+ right?

olive parcel
#

The underlying engine for those games will be written in something like C/C++, but the higher level game logic and scripting can be done in Python

#

I'm reading here Battlefield 2 uses Python as well

dawn quiver
#

hmm, intresting

olive parcel
#

A good approach is to start prototyping and writing the game in Python, and if parts of it become slow, you can rewrite the slow parts in C/C++

#

Or to pull in a C extension from PyPI to speed up those tasks

fair panther
#

can someone tell me a good book to learn pygame?

next estuary
#

I'm working on a platformer with snow elements, I don't have a good idea for gameplay though. See vid for gameplay.

prisma cypress
#

i might be kinda stupid but i'm new to this in general, how would you load an image file on python, where do you store it?

next estuary
#
import PIL
image=PIL.Image.Open("file_path")
#

the lowercase image now holds the loaded image

prisma cypress
#

ok, thank you!

#

where can i find the download for the PIL module though?

severe saffron
#

you would install it with pip

#

either PIL or pillow, pillow being the more modern and almost always better version

prisma cypress
#

ok, i couldn't find PIL to install using the standard: py -m pip install (name)

tawny sky
next estuary
#

Yeah pygame and numpy for the snow :)

stoic swan
#

Never done it before but I know it's possible

frozen knoll
#

Arcade 2.5.6 is out. Fixes an issue with PyInstaller making it easier to turn an app into a .exe. https://arcade.academy

manic seal
#

i am trying to import some old game's animation into blender but i can't get them to work since i don't know how to manipulate quaternions

#

( image 0 are the values i believe to be the quaternion rotation of one of the leg bones )
( image 1 is what the armature looks like when applying these rotations to the leg bones )
( image 2 is legs and arms )
( in image 3 we can see that clearly something is inverted, the left and right arms have 'switched places' )
( image 4 is the armature with most* bones rotated, note that the character is now facing the opposite direction )

#

i don't know if the problem is with the quaternion value or with the armature itself since it was imported using a blender addon

#

i also don't know how to correctly manipulate the quaternion to fix it if it is at fault

near widget
#

@normal silo Why Ursina?

normal silo
#

It just has everything setup for you. And Ursina already has an entity system making things very convenient.

#

I also want to be able to add shaders as I please, which it lets me do.

near widget
#

I know processing and funnily it was not my introduction to graphics - that was Python, when I was making the rendering engine with this guide - https://github.com/ssloy/tinyrenderer/wiki. Good times, it was slow as hell 😄

normal silo
#

I just throw the slow parts into numba.

near widget
#

I found that later too! I still think that it is an awesome project!

#

I wanted to rewrite everything to CUDA then 😄

normal silo
#

My first software renderer was in C, I actually could not be bothered to deal with the OS windowing (annoying, though I know it now more than I want to), so I just rendered it in the terminal (ascii).

near widget
#

I must go, it's really late here (GMT+2), but I will probably be here tomorrow, see ya!

next estuary
#

I got multi-layer parallax working in numpy / pygame 🙂

iron sierra
#

Guys can i make a game like fortnite or minecraft with its graphics by pygame or no???

teal ember
#

i dont think pygame would do much good when it comes to 3d

#

check out panda3d or ursina

iron sierra
#

ok can panda3d or ursina make a game like fortnite??

#

or i need to use game engine like unity??

teal ember
#

also, other languages and game engines are better for 3d game development, but python would be almost ok i think

#

fortnite is a pretty big game

iron sierra
#

do u mean python is for small game

teal ember
#

tbh, i have not done any 3d game dev in python so i am not sure if it is possible, but its sure gonna be harder than using some game engine which has a lot of more features

teal ember
#

but its not the best choice when it comes to 3d

iron sierra
#

ok ty so much

teal ember
#

you still can try out panda3d, there are a good amount of 3d games made in python

iron sierra
#

ok

near widget
#

Well, EVE Online is written in a variant of Python, so I really wouldn't worry myself about the language that much.

#

I don't want to preach the Nike ideology, but starting and doing seems to be the best languages, at least for me.

potent ice
#

It requires a lot of commitment to learn 3D properly. It's a very complex area. If you can start playing with that using higher level tools.. good!

normal silo
#

The best option for a large 3D game with python is using Godot with python support.

#

You can then also use C++ if needed.

#

But you can get decently far with panda3D / Ursina and something like numba or cython.

#

You can make something like minecraft, but you will have to do many parts in cython or numba like terrain mesh generation.

#

And enemy AI (path finding).

#

Godot will have many things already implemented in C++ (there are modules made by others that you can download for stuff), so you can just script some of the game logic in python on top of that and in that case python's speed won't matter much.

elfin frost
#

is ursina still good for 3d game? 3d building

proven kayak
#

So does pygame have professional-level potential? Like, are there any big games out there that use it?

eager umbra
#

can someone help mepls

#

I keep on getting this error

#

i am trying to make a rectangle, for the collision in a game

#

and i get this error:

Traceback (most recent call last):
  File "C:\Users\askhu\AppData\Local\Programs\Python\Python39\Scripts\Blaviken, Dawn of the Elves\RPG.py", line 25, in <module>
    player_rect = pygame.rect(player_location[0],player_location[1],player_image.get_width(),player_image.get_height())
TypeError: 'module' object is not callable
>>> 
#

and i have done everything right sooo

#

i dont know where i am going wrong

potent ice
eager umbra
#

ye i fixed it, thx tho

potent ice
#

pygame.rect is a module as the error states

eager umbra
#

mhm, syntax is reaaaallly important in python lmao

potent ice
#

That goes for any language 😉

#

You get used to the naming rules. Classes usually start with a capital letter at the very least.

eager umbra
#

hey i have a problem again,

#

i have this piece of code

frank fieldBOT
eager umbra
#

and for some reason it comes out as a syntax error but idk what im doing wrong

last moon
eager umbra
#

oh wait

#

ther is no way that s it

#

OH MY GOD

#

thank you sooooooooooooo much

last moon
#

np, id suggest including the traceback next time tho

#

or at least the line it's occurring on

somber condor
#

Hi! What 3d game engines are based on python that I can use for free? I am a beginner.

olive parcel
#

@elementFire#5071 2D: Arcade, 3D: Panda3D, Ursina

upbeat veldt
#

Hello I need help with a task, can someone help me?

olive parcel
#

How can we know whether we can help you if we don't know the problem?

upbeat veldt
clear crane
#

So if I want to build a game using python where can I go to test it

severe saffron
#

Where can you go?

#

What do you mean by go @clear crane

earnest hinge
#

If panda3d is derived from C++, does that make it fast enough to make large games?

tranquil girder
#

Yes

olive parcel
#

@earnest hinge It's been used for some commercial large games, so I'd say yes

dusky jetty
#

has anyone made a fps in python

tacit lion
#

Yes probably, but trust me that wouldn't be a great idea

#

If you mean by using python as a scripting and such backend then use most games probably do, but a game purely written in python isn't exactly a great idea

tranquil girder
#

yes, I made one for last pyweek where you shoot arrows
it's more like a prototype though, not a full game

viscid path
#

How do i add a Python background color for my game

ruby flame
#

color_name = (r,g,b)

dawn quiver
#

cause i was planning to use python

#

to create some game

#

s

last moon
#

you can use python for sure, most* libraries use either opengl or sdk hooks (tkinter might be an exception to that?)

#

but c#/unity and godot are pretty popular for starting out

tacit lion
#

c# + unity, blueprints + unreal

shut sand
sleek pawn
#

Is anybody experienced with the Panda3D game engine here?

dawn quiver
normal silo
# shut sand no game engine???

You don't need a game engine to make a game, or another way of thinking about it is that you make a very small engine specific to the game being made.

chrome oyster
#

you might wanna join the Panda3D discord for anything about that

midnight girder
#

how can i make a game using python please help me

#

?

#

pleaseeee

dawn quiver
#

check the pins

worldly flare
#

can games made in pygame runs on android?

blissful depot
#

Is there a community for Pygame Zero?

frozen knoll
blissful depot
worldly flare
proper coral
#

how does panda3d / ursina compare to unity/unreal engine?

olive parcel
#

The first two are open-source Python software libraries, the last two are massive commercial engines for C#, they don't compare in the slightest

tranquil girder
#

I guess ursina is slightly inspired by Unity, with the Entity/GameObject similarities, automatic update function, Mesh class and some functions like invoke(). That's about it though

distant wind
#

how can you put a rect on top of a rect in pygame?

normal silo
#

draw an image of what you mean by "on top" @distant wind

distant wind
normal silo
#

Do you have the y position of the bottom rect?

#

top_rect_y = bottom_rect_y - top_rect_height

mystic lodge
#

im getting a problem in my raycasting function

#
def ray_casting(player, textures):
    walls = []
    texture_v, texture_h = 1, 1
    ox, oy = player.pos
    xm, ym = mapping(ox, oy)
    cur_angle = player.angle - HALF_FOV
    for ray in range(NUM_RAYS):
        sin_a = math.sin(cur_angle)
        cos_a = math.cos(cur_angle)
        sin_a = sin_a if sin_a else 0.000001
        cos_a = cos_a if cos_a else 0.000001

        # verticals
        x, dx = (xm + TILE, 1) if cos_a >= 0 else (xm, -1)
        for i in range(0, WIDTH, TILE):
            depth_v = (x - ox) / cos_a
            yv = oy + depth_v * sin_a
            tile_v = mapping(x + dx, yv)
            if tile_v in world_map:
                texture_v = world_map[tile_v]
                break
            x += dx * TILE

        # horizontals
        y, dy = (ym + TILE, 1) if sin_a >= 0 else (ym, -1)
        for i in range(0, HEIGHT, TILE):
            depth_h = (y - oy) / sin_a
            xh = ox + depth_h * cos_a
            tile_h = mapping(xh, y + dy)
            if tile_h in world_map:
                texture_h = world_map[tile_h]
                break
            y += dy * TILE

        # projection
        depth, offset, texture = (depth_v, yv, texture_v) if depth_v < depth_h else (depth_h, xh, texture_h)
        offset = int(offset) % TILE
        depth *= math.cos(player.angle - cur_angle)
        depth = max(depth, 0.00001)
        proj_height = min(int(PROJ_COEFF / depth), 2 * HEIGHT)

        print(depth, offset, texture)

        wall_column = textures[texture].subsurface(offset * TEXTURE_SCALE, 0, TEXTURE_SCALE, TEXTURE_HEIGHT)
        wall_column = pygame.transform.scale(wall_column, (SCALE, proj_height))
        wall_pos = (ray * SCALE, HALF_HEIGHT - proj_height // 2)

        walls.append((depth, wall_column, wall_pos))
        cur_angle += DELTA_ANGLE
    return walls
#

it gives me this error wall_column = textures[texture].subsurface(offset * TEXTURE_SCALE, 0, TEXTURE_SCALE, TEXTURE_HEIGHT) KeyError: 1

#

nvm i fixzed it

fiery nexus
#

i dunno where to put this so ill put it here

#

can png's store more than just pixel data

#

i had a HGT height map (satellite data height map) turned into a png and my python PIL png reader is somehow reading the actual height of what each pixel is representing rather than the coulour of the pixel. (its a grey scale image for visualisation so i got no clue how this happened)

#

im not sure if its a bug or if this is some magic

dawn quiver
#

hey someone can tell me which programs i can use for game development?

frosty shard
#

So I'm making a 2d top-down battle game, basically you move your little knight around fighting baddies lol. What is the best way to detect if a bad guy is hit when the knight attacks?

My idea of doing this is just by creating a loop that goes through a list of all the baddies (lol) and checks if anyone of their coords are in front of the knight to get hit by the sword. But I feel like this will be slow and there is probably a better and faster way to do this... any advice?

#

Also, I'm doing this with pygame

analog barn
analog barn
dawn quiver
dawn quiver
fiery nexus
#

@analog barn yea im getting numbers from 0 , 7 digits

#

and theres no RGB array either

#

PIL is reading each pixel as a int

balmy wharf
#

what would be the best way to implement a dialog-box in pygame

#

the way i want it to work is if you are near an interactive object and press e everything freezes the dialog-box shows up and then text is displayed everything remains paused until the user presses e again

dawn quiver
#

create a boolean called dialog_open and set it to True if it is open. now , when checking for keypresses, just add an if statement checking whether dialog_open is False, or not. Freezing everything becomes quite simple then. if the player moves, by pressing keys, then if the keys wont respond, the game doesnt move on.

balmy wharf
#

@dawn quiver thank you so much, this makes so much more sense to me now 👍

#

I will try to have the program stop listening to events in the main loop but create a separate loop to wait for the second e press

#

my only concern is that pygame will process everything so quickly that the one e press will constitute the dialog box opening and then immediately closing

dawn quiver
#

not really. for instance:
for event in pygame.event.get(): if event.type == pygame.KEYDOWN: if event.key == pygame.K_e: # check dialog box open status if dialog_open == True: # skip the current dialog contents # just an example: dialog_box.clear() # write new contents: dialog_box.write("new contents) if dialog_open == False: # check for player interactions if . .. .. .. ... .. .. else: pass

#

that wont happen until you include pygame.keys.get_pressed(), which might cause unexpected bugs.

#

and if you want the dialogues to in some sort of order,
you can create a new variable that keeps on incrementing when you press e, when interacting with something.

#

and use that index to access contents to be displayed in a dialog box, that may be stored in an array of some sorts.

iron trail
#

im trying to load sprites into a dictionary like this

import pygame
import os

WIDTH, HEIGHT = 900, 900
sprites = {}
for filename in os.listdir("client/resources/sprites"):
    sprites[filename[:-4]] = pygame.image.load(f"client/resources/sprites/{filename}")
pygame.init()
screen = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption("Battle Ship")
pygame.display.set_icon(sprites["YouWin"])


# Game Loop

running = True
while running:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False

but get this error

#

will i have to load the sprites one by one, or is there a better way?

silk tartan
#

anyone knows about pygame objects' textures

tender dagger
#

what do you want to know?

silk tartan
#

how to use them

#

and how to then animate them and all

#

like if wanna have a moving ant

#

maybe not animate

#

that might be too hard

#

but at least a texture

#

@tender dagger do u know how to do it

tender dagger
#

I don't know pygame obj, but I know other texture file types
jpeg, png, targa
you can make a sprite for a 2d animated ant, but it depends on what you are doing to make the game element and how you set it up

#

I know more 3d than 2d

silk tartan
#

well i need specifically with pygame

#

i just wanna basically use an image and be able to rotate it instead of having like a square

tender dagger
#

but for 2d anim i would recommend using sprites or a sprite sheet, not sure on pygame able to use transparency

sharp cedar
#
    def on_update(self, delta_time: float):
        # ignore from this line
        self.enemy.change_y = 0
        self.player.change_y = 0

        if self.up_pressed and not self.down_pressed:
            self.enemy.change_y = 5
        elif self.down_pressed and not self.up_pressed:
            self.enemy.change_y = -5

        if self.w_pressed and not self.s_pressed:
            self.player.change_y = 5
        elif self.s_pressed and not self.w_pressed:
            self.player.change_y = -5
        # ignore to this line
      
        if self.ball.left < 0:
            self.player.add_score()
            print(self.player.get_score())
            self.setup()    # focus on this
        elif self.ball.right > SCREEN_WIDTH:
            self.enemy.add_score()
            print(self.enemy.get_score())
            self.setup()    # focus on this

is there a better way of doing the self.setup() part that conforms to arcade conventions?

last moon
sharp cedar
#
    def setup(self):
        """ Set up the game here """
        self.player.center_x = 5
        self.player.center_y = SCREEN_HEIGHT/2

        self.enemy.center_x = SCREEN_WIDTH - 5
        self.enemy.center_y = SCREEN_HEIGHT/2

        self.ball.center_x = SCREEN_WIDTH/2
        self.ball.center_y = SCREEN_HEIGHT/2

        dir = uniform(0, 1) * 360
        print(dir)

        self.ball.change_y = BALL_VELOCITY * math.sin(dir)
        self.ball.change_x = BALL_VELOCITY * math.cos(dir)

this is what setup looks like btw

last moon
#
class Player:
  def __init__(self, starting_position: Vector):
    self.starting_position = starting_position

  def reset(self):
    self.position = self.starting_position```
#

ei keeping the original position in the objects instance

sharp cedar
#

that does look neater

last moon
#

also it's a personal opinion but having a vector class is super useful especially for readability

#

even something as basic as

class Vector:
  x: float
  y: float```
#

so instead of having 2 different variables .._x and .._y, you can access it by it's methods pos.x, pos.y

#
  • if you want to get real funky, you have operator overloading available if you need it
sharp cedar
#

yeah that's an excellent idea

#

thanks

last moon
#

np

sharp cedar
#

i need some direction in how i would go about doing this. basically, i am polishing my pong game and i want to have some sort of timer before the ball moves when a round starts. A round starts when 1) when the game starts 2) when someone scores (when ball touches left or right edge of the screen). I am using arcade btw.

normal silo
#

@olive parcel Hey, how do I change the target frame-rate for Panda3D in python, and how can I uncap the fps (run as fast as possible) for a Task. I tried setting vsync to false, no difference.

olive parcel
#

@normal silo The setting is "sync-video false". Note that some drivers ignore it, in which case you need to look for driver settings or driver-specific environment variables like __GL_SYNC_TO_VBLANK

#

To limit FPS, you can set clock-mode to limited and clock-frame-rate to the desired FPS.

normal silo
#
self.vsync = ConfigVariableString("sync-video")
self.vsync.setValue("false")
#

Is how i'm trying to change the settings, maybe i'm doing it wrong

olive parcel
#

Well that's going to produce a warning that you're changing the type of a ConfigVariableBool

#

You also need to make sure it's set before you initialize ShowBase.

normal silo
#
vsync = ConfigVariableString("sync-video")

vsync.setValue("false")
app = MyApp()
app.run()
#

So before, but also ConfigVariableBool, not String

#

I actually don't get any warning from this.

olive parcel
#

The typical way to do it is loadPrcFileData("", "sync-video false")

#

That func is imported from panda3d.core

#

See above though, some drivers don't obey Panda's requests.

normal silo
#

Yeah it's probably my drivers then, there seems to be no effect.

olive parcel
#

There are other ways to override this, depending on the vendor

#

They're not Panda-specific.

normal silo
#

Should clock-frame-rate always work?

#

Well I guess only if vsync does.

olive parcel
#

It does

#

But it only limits, never increases.

#

So it can't undo the effects of vsync.

normal silo
#

Yeah

olive parcel
#

There are other clock modes that do increase frame rate, but only by lengthening the definition of "second", eg. for video recordings

normal silo
#

I guess I will have to try setting the environment variable.

olive parcel
#

Going to bed, afk

restive lantern
#

What should i learn first? Ursina or panda3d?

rich coral
#

I am hosting a Game Jam, is this a good channel for putting it in?

covert yoke
rich coral
#

ok thank

obsidian nimbus
#

.

#

.

#

.

#

hi

dawn quiver
#

first of all, it is not true it is True for python.

secondly, it is set_mode() not set_mod()

third, replace your code with mine:
import pygame pygame.init() display = pygame.display.set_mode((800, 600)) pygame.display.update() open = True while open: for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() pygame.display.flip()

zinc cypress
#

how to start learning pygame

ashen condor
#

i dont know if there is the right place, but i'm working on a simple ant colony simulator, i'm trying how to create a smooth random movement
does anyone have a good solution?

iron trail
#

is pygame okay with asyncio tasks?

ashen condor
#

nop, i'm using ursina engine

iron trail
#

i tried making pong online, tasks just never run

last moon
#

did you use sockets?

iron trail
#

im using websockets

last moon
#

either way you shouldn't be using async for sockets, it doesn't actually run on separate threads

iron trail
#
async def move_enemy(ws:websockets.WebSocketClientProtocol, enemy, lobby, host):
    print("moving enemy")
    package = {
        "reqtype" : "getCoords",
        "host" : host,
        "lobby" : lobby
    }
    await ws.send(json.dumps(package))
    resp = json.loads(await ws.recv())
    enemy.y = resp

async def update_coords(ws:websockets.WebSocketClientProtocol, player:Player, lobby, host):
    print("posting Coords")
    packet = {
        "reqtype" : "postCoords",
        "host" : host,
        "lobby" : lobby,
        "ypsos" : player.y
    }
    await ws.send(packet)

async def main():
    lobby, host, ws = await setup()
    player = Player(300)
    enemy = Enemy(300)
    run = True
    win = pygame.display.set_mode((WIDTH, HEIGHT))
    clock = pygame.time.Clock()

    while run:
        asyncio.create_task(move_enemy(ws, enemy, lobby, host))
        keys = pygame.key.get_pressed()
        clock.tick(30)
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                run = False
        if keys[pygame.K_w]:
            player.moveup()
        if keys[pygame.K_s]:
            player.movedown()
        refresh(win, player, enemy)
        asyncio.create_task(update_coords(ws, player, lobby, host))

    pygame.quit()
    quit()
if __name__ == "__main__":
    asyncio.get_event_loop().run_until_complete(main())
    asyncio.get_event_loop().run_forever()
#

never updates player coords or enemy coords, shame

last moon
iron trail
#

so do i create threads where i update player and enemy pos every x amount of time?

last moon
#

that should be controlled by your main thread, but you need to create others for sending + receiving the data / what's been updated

iron trail
#

do i need to switch from websockets to sockets?

#

ive heard that async doesnt behave well with threading

last moon
iron trail
#

i think i got it

#
async def move_enemy(ws:websockets.WebSocketClientProtocol, enemy, lobby, host):
    print("moving enemy")
    package = {
        "reqtype" : "getCoords",
        "host" : host,
        "lobby" : lobby
    }
    await ws.send(json.dumps(package))
    resp = json.loads(await ws.recv())
    enemy.y = resp

async def update_coords(ws:websockets.WebSocketClientProtocol, player:Player, lobby, host):
    print("posting Coords")
    packet = {
        "reqtype" : "postCoords",
        "host" : host,
        "lobby" : lobby,
        "ypsos" : player.y
    }
    await ws.send(packet)

async def main():
    lobby, host, ws = await setup()
    player = Player(300)
    enemy = Enemy(300)
    run = True
    win = pygame.display.set_mode((WIDTH, HEIGHT))
    clock = pygame.time.Clock()

    _thread1 = threading.Thread(target=between_post, args=(ws, player, lobby, host))
    _thread2 = threading.Thread(target=between_move, args=(ws, enemy, lobby, host))
    _thread1.start()
    _thread2.start()

    while run:
        asyncio.create_task(move_enemy(ws, enemy, lobby, host))
        keys = pygame.key.get_pressed()
        clock.tick(30)
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                run = False
        if keys[pygame.K_w]:
            player.moveup()
        if keys[pygame.K_s]:
            player.movedown()
        refresh(win, player, enemy)
        asyncio.create_task(update_coords(ws, player, lobby, host))
    pygame.quit()
    quit()

def between_post(ws, player, lobby, host):
    loop = asyncio.new_event_loop()
    asyncio.set_event_loop(loop)
    loop.run_until_complete(update_coords(ws, player, lobby, host))
    loop.run_forever()

def between_move(ws, enemy, lobby, host):
    loopx = asyncio.new_event_loop()
    asyncio.set_event_loop(loopx)
    loopx.run_until_complete(move_enemy(ws, enemy, lobby, host))
    loopx.run_forever()
zinc cypress
#

.png image not accepted in pygame sus

fathom helm
#

yeah cant do that either so I can't make my game :(

zinc cypress
#

yes;(

iron trail
#

can anybody tell me why my game is very jumpy, but only one way?

dawn quiver
#

hello

#

i have a problem

#

so if i have an arrow and its facing upwards, to move it i would decrease y

#

if its facing right, i would increase x

#

and etc

#

my question would be, how would i know how much x/y should i change by if the angle is unknown

#

for example if the object is facing upwards the angle is 0

#

if right then 90

#

and etc

#

but if the angle is for example 233, how would i then know by how much should i change x/y if i want to move it upwards

normal silo
#

@olive parcel In Panda3D where does taskMgr come from? I don't see it imported in the docs.

olive parcel
#

You can import it from direct.task.TaskManagerGlobal

#

For historical reasons it gets written to the builtins scope of the Python interpreter

normal silo
#

ok, what exactly is direct? Why is it called direct? Would something like this not be in core normally?

olive parcel
#

@normal silo direct is a Python library on top of the core Panda engine, which is c++. They used to be separate things when they were being developed at Disney: PANDA stood for Platform Agnostic Networked Display Architecture, and DIRECT stood for Disney's Interactive Real-time Environment Construction Tools.

restive lantern
#

That works really well

dawn quiver
#

i already solved that

#

now i have a solely pygame problem

#

i need help on how can i recreate the last example of rotation in the first gui's response

#

this one

#

@restive lantern

restive lantern
#

Look you have to rotate the image then make a rect of the rotated image and then set the center of that rectanlge to a single point

dawn quiver
#

but idk how to do it

#

and all that code that guy put there is too difficult for me

restive lantern
#

You have to look into the pygame documents

#

There are functions for rotating and for making a rect out of an image

dawn quiver
#

no no

#

that guy in the stack overflow made his own functions

#

cuz the original pygame.tranform.rotate is complete shit if im being honest

#

if u look at that stack overflow post i linked that guy shows how he did it how i want

#

but its very difficult

#

so i need help figuring it out

restive lantern
#

But at the end of the day he is still using the pygame transform and get_rect

#

Its the exact same thing but this guy makes a function that also rotates it around a diferent point

#

And to be honest he did some things wrong

dawn quiver
#

can i screenshare to u

#

i want to show my current problem

#

@restive lantern

restive lantern
#

I cant right now

dawn quiver
#

k

digital gorge
#

hey

#

hey anyone good programming for computer graphics?

versed iris
dawn quiver
last moon
#

I think I finally know how to properly word what I was trying to ask here, altho it might be more of a system architecture question. How does the vertex buffer actually get loaded into vram from ram? (im assuming it'd get loaded into ram first?)

last moon
#

can you get any more specific?

normal silo
#

The gpu driver controls the hardware which opens data lines between the RAM and the GPU.

last moon
#

what's the hardware?

normal silo
#

The computer hardware. The physical device.

last moon
#

do you know what the actual hardware is?

normal silo
#

Depends on the device

#

for something like a mobile phone, the cpu, gpu, etc are integrated aka SoC.

#

In that case it's some unknown silicon that the data travels through.

#

Only the manufacturer knows and a few hackers.

#

For something like a PC, it goes through the motherboard.

last moon
#

so it'd be just some data bus?

normal silo
#

PCI, AGP, or PCIe, etc.

last moon
#

ok thanks that actually clears up a lot for me

normal silo
#

it's a bit more advanced than a normal bus

#

it acts a lot like networking

#

(because of the large number of required features added over time, e.g. more than one gpu)

last moon
#

ill have to look into it more, it's really hard to find anything tho if you don't know what to search for

#

at least for this sort of stuff

normal silo
#

There is probably a discord and a subreddit for it if I had to guess.

shut sand
#

hmm

#

idk sry

dawn quiver
#

How can I create a variable?

dawn quiver
crisp junco
#

have you named your file pygame.py?

dawn quiver
#

no

dawn quiver
dawn quiver
pine marlin
dawn quiver
olive parcel
#

Yes, you can't name your python file in a way that conflicts with existing module names

crisp junco
#

👍

sleek pawn
chrome oyster
sleek pawn
chrome oyster
olive parcel
sonic belfry
#

does anyone know a super easy way to make a infinitly generated world, one that a idiot like myself would understand, if so DM me pls

olive parcel
#

@sonic belfry yes, spawn a copy of the world in 8 times around your current world, and when the player enters one of the surrounding copies, you position them back in the same position in the original copy

worldly flare
#

wanna generate a 2d map in pygame

#

how to do that?

quasi valley
#

ok can someone help me with this?
split() returns a list of strings right
so x = line.split() should be able to be indexed like this: print(x[0])
so why does it give me an IndexError: list index out of range?

    def GetScores(self):
        scores = dict()
        with open(self.directory + "/highscore.txt", "r") as score_file:
            for line in score_file.readlines():
                x = line.split()
                print(x[0], x[2])

        return scores
olive parcel
#

@quasi valley presumably there is a line that does not contain at least 3 elements

#

There might be an empty line at the end, or something

#

You could skip empty lines

quasi valley
#

ah

#

but my file just looks like this:

#
Apr-02-2021-00 - 450
Apr-06-2021-00 - 19770```
grim cave
#

you could add a try and except block

#

just in case

quasi valley
#

Yeah i tried that

#

I fixed it tho

grim cave
#

also it splits due to whitespaces

grim cave
#

peace

quasi valley
#

turns out one of my files that i didnt check had a messed up line lmao

grim cave
#

F

#

lol

quasi valley
#

had thought i checked them all xD

grim cave
#

happens

quasi valley
#

yep

grim cave
#

no wonder debugging is easy in python XD

neon ferry
grim cave
#

true

deft locust
#

does anyone know why the images wont load even though I have them saved?

pine marlin
deft locust
quasi valley
#

are the images in a subdirectory like images/racecar.png

#

or in the same dir as your game file

#

@deft locust

deft locust
#

Wait im using a web IDL

#

*Idle

thorny oak
#

hey im trying to make a egg game but its not detecting collison

short wing
#

hey can anyone help me to figure out why my bullet is not firing when i press Space bar

frank fieldBOT
#

Hey @short wing!

Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:

• If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)

• If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:

https://paste.pythondiscord.com

short wing
#

it is there

dawn quiver
dawn quiver
dawn quiver
#

I have collision for the bottom edge, but I can't seem to get it for the top edge. Any ideas?

grim cave
meager fox
#

can u help me i dont understand plz

short wing
#

btw I've completed the project. Thanks

dawn quiver
short wing
#

@dawn quiver thanks anyway lol

worldly flare
quasi valley
bold tulip
#

Nevermind, just used another keyboard and it worked

fallow mason
#

I am currently making a game called Hog under an archive of UC Berkeley's CS61A Summer of 2020 class. Can someone explain to me why 2 0
5
4 3
13
6 9
21

#

is the expected outcome of this

#

please

quasi valley
#

I think you need to call echo like echo()

fallow mason
#

so what this is is a test in which I need to unlock in order to proceed writing code for the Hog game. What one would do is roll the dice and it will cycle through make_test_dice(2, 3). always_rolls(1) rolls the dice (cycles through it) once. So 1 dice roll goes to 2. Another goes to 3. The above file shows some rules of the game that may apply. What I'm confused about is the relationship between total() and echo(). Every odd numbered line in the list of numbers I provided are Player 1 and 2's scores. The even numbered lines are the total after each turn I think.

thorny oak
#

hi i made a class but im having trouble implementing it into my main code

dawn quiver
#

can someone explain this pls?

tulip barn
#

So i am making this rpg thing and i want to implement a fighting system. I want it to be based on the player's health, armor, strength, and his opponents health & strength. How do i do that?

#

Like how do i decide if the player missed his hit or no and how much health he lost and if the armor protected him

#

And all that math boring stuff

proper peak
#

well, if you're thinking of it as "boring math stuff", copy the mechanics of some existing rpg or something

tulip barn
#

I dont dont like it

#

I quite actually enjoy making it but i kinda suck at it?

last moon
#

id start with trying to figure out the base dmg, how the prot will work, crits, etc, etc

#

after that start working on conditional randomness

tulip barn
last moon
#

I've got a bit, it's not great but it's the basic concept

tulip barn
#

Can i have a look?

last moon
#

ya lemme find it

proper peak
tulip barn
#

Aight ty

last moon
tulip barn
#

Its alr i aint that professional of a programmer either lmao

#

Just the fact that u use the math module makes u better than me alr

#

😂

last moon
tulip barn
#

What are the directions for btw?

last moon
#

that one line took me + a friend like 6hrs to figure out

tulip barn
#

Is that like a 2d game on the console?

last moon
#

user would type in a direction -> player goes in that direction -> encounter logic is done ...

#

it was just a console game

#

I wouldn't even call it 2d

tulip barn
#

Like text based or 2d?

tulip barn
#

Ok i am confuzed alr this is complex i am trying to make something simple 😅

last moon
#

if you look past the shitty signal handling it actually is pretty simple

tulip barn
#

I just need to know how to calculate the damage

#

And how to determine how much health is lost

last moon
#

dmg_done = base_dmg + crit * crit_chance - block * block_chance[optional], with: crit_chance, block_chance = random(0, total_chance) is in range

last moon
tulip barn
#

I could just do
damage = random.randint(0, strength)
But that'd be boring wouldn't it? :joy:

last moon
#

you're also leaving almost all of it to chance

#

rpg doesn't stand for randomly played game 😄

tulip barn
#

Do i make critical hits? Like i aint making my rpg that complex

last moon
tulip barn
#

For me it'd be human fighting monsters so that eliminates blocking right?

#

Cuz monster r dumb

last moon
#

but different monsters might have different weaknesses?

tulip barn
#

ok see that'd gettin complex

#

I want it simple

last moon
#

it just adds a layer of complexity to the game so it's not just pressing the attack button over and over

#

even with the one I sent, the combat is literally just pressing '1', there's no point in blocking

tulip barn
#

Its text based to their aint even buttons

#

And also it'll be auto fighting i just want to tell the guy if he won or no

#

Player*

last moon
#

ah

tulip barn
#

I am making a discord bot if u haven't relized yet 😅

#
dmg_done = base_dmg + crit * crit_chance - block * block_chance[optional], with: crit_chance, block_chance = random(0, total_chance) is in range
#

The problem with this is that all this is variables

last moon
#

(also not python btw)

tulip barn
#

Like how do i determine the base damage or critical damge or chance

tulip barn
last moon
#

but if you wanted just base stats then you'd probably want them based on player/enemy level

tulip barn
#

Aha

#

Alr

#

Imma work my mind a bit to figure stuff out

#

Ty

last moon
#

also just a massive heads up, signal processing when your game is solely text based gets complex very quickly

#

I fully refactored this project ~3 times to try to fix it and was working on a 4th before giving up

tulip barn
#

so ur project doesn't work?

last moon
#

last time I checked no

tulip barn
#

ya done all that and gave up?

#

damn why

last moon
#

haha ya it just got really complex, trying to display inventories + properly type everything + dealing with i/o just got extremely convoluted

#

I think ill try to rewrite it but using arcade or some sort of gui over the summer

tulip barn
#

gl

#

would you like to see how far i am with my rpg discord bot?

last moon
#

ping me in a couple hours if you're still around im working on a school project atm

tulip barn
#

just dm me when ya can

tulip barn
#

actually if you remove the "ThisShouldntShowUp" thingy it all works

#

Best of the worst sulotions!

#

better than givin up

last moon
#

it shouldn't
actually I don't think I pushed the most recent rework it's just on my other laptop

cursive cliff
#

panda 3d vs. pyopengl

heady pine
#

Hi guys, i need help on figuring out how to make a unity Slerp() function like, in python (im using Panda3d/ursina)

short wing
coarse perch
#

Hey guys how do I make an object in pygame move around in ellipse? And I also want one more object to move in an arc shape, like the banana kick in football.

restive lantern
#

Im not really sure about the elipse but for the arc you are gonna need a parabola equation

versed turret
#

anyone got some examples for games

rigid brook
#

Hello

I was working with pygame and pyopenGL
I am making an app and i need to blit some things which is Not possible with openGL
I have tried blitting onto another surface and then converting that surface to openGL textures but that didnt work

can anyone tell me a way to set a surface for openGL, such that i can use Pygame normally like i would in non openGL projects and for openGL part, I can blit on the surface and then blit that surface on the main surface

thanks in advance :)

dawn quiver
#

some one explain me this pls

rigid brook
dawn quiver
#

i know but how can i fix it?

rigid brook
#

is the image (spaceship_yellow.png) in Assets folder?

#

i dont use VS code so am not sure

#

but i think it is not in Assets

dawn quiver
#

weird isnt it?

rigid brook
#

got the error

dawn quiver
#

wait

rigid brook
#

the main.py file is not in the PygameForBeginners folder, so there is no Assets folder in its directory

dawn quiver
#

should i send you the code in private message then you try it out

#

i use python 3.8

rigid brook
#

its Not about the code

#

its directory structure

dawn quiver
#

and what is supposed to get fixed?

rigid brook
#

move the main.py file in PygameForBeginners folder

dawn quiver
#

ok

#

i did now but it still says

#

the no directory fail

rigid brook
#

then idk

#

😦

dawn quiver
#

because when i run the game

#

it opens the programm but its broken graphic

#

wait i am making a screenshot

rigid brook
#

ok

dawn quiver
#

it should be a 2d space game

rigid brook
#

the image might be curropted

#

or the position of blitting would be incorrect

dawn quiver
rigid brook
#

is it working when opening in VScode?

dawn quiver
#

yes

#

is it about the ide?

rigid brook
#

wierd

#

no

#

not about the IDE

#

can u send the code ?

#

the part where you blit the image

dawn quiver
#

what do you mean

#

the main code?

#

to run the programm wait

frank fieldBOT
#

Hey @dawn quiver!

Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:

• If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)

• If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:

https://paste.pythondiscord.com

#

Hey @dawn quiver!

Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:

• If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)

• If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:

https://paste.pythondiscord.com

coarse perch
dawn quiver
#

@full otter can you help?

#

do you even have pygame installed @dawn quiver

dawn quiver
#

woher weißt du das ich deutsch kann haha

#

enes

#

das ist aber türkisch xD

#

egal

#

ich habs installiert aber das sagt immer was anderes

#

zeig mal den ganzen output

#

das bild ist aber schon noch am gleichen path oder

#

egal warte hab das code geloscht i habe noch ein spiel da sind glaube ich aber auch fehler drinne

#

can someone fix this?

#

@pale schooner can you fix this?

tranquil girder
#

You either didn't install it, or you have multiple python installations and you installed to the wrong one

dawn quiver
#

i have ursina installed

#

already

#

wait i chose the wrong interpreter

#

now it works

#

but its corrupted i think

#

@tranquil girder the game works but how do i leave it i think i forgot to add a panel

manic moth
#

Hello, I'm making an online multiplayer Pong game using pygame and sockets. I have a client.py and server.py. The way I'm communicating between client and server is using pickles library. I'm sending and receiving player and ball objects continuously b/w client and server and server is keeping track of the positions of players and ball. I wanted to know that when I pickle an object and send it from server to client, it's actually sending a copy of the object to the client, right?

severe saffron
#

are you asking whether changing the object on the client will also change it on the server?

#

also be aware that this way of doing it allows the client and the server to run any code they want on each others' computers

manic moth
manic moth
severe saffron
#

sure no problem

severe saffron
#

pickle does not automatically synchronise changes to objects over the network

manic moth
severe saffron
#

yes, although there are much simpler and more efficient ways of doing this