#game-development
1 messages ยท Page 35 of 1
wait
ok it work again
ok something weird happened
i try to move an object but instead of just moving its just keep adding more object to the screen
why is this happened i thought i know how to do this
you use pygame.display.update() to solve this issue right
You use that once per frame to redraw the entire screen, not to update moving things
By changing where you draw them
More specifically and also more generally, by moving the rect where you are drawing it
oh
Like: Clear screen, update positions of moving things, draw everything, update the display
If using a background image, draw that instead of clear screen
My main loop in the chess game ```py
def run(self):
while True:
dt = CLOCK.tick(FPS) * 0.001
pygame.display.set_caption(f'{dt}')
self.get_events()
self.draw()
self.update(dt)```
There's a lot happening in each of those methods but that's the flow, get events, draw, update
Now maybe I implement arrow snapping using these new arrows, they'll just need an update method along with their __init__() methods
Nice, kinda cludgy code atm but it is working
Do you guys recomend me Roblox to earn money?
Cuz people say Roblox is good to earn money, innit?
Oh much cleaner code than I had ```py
def drawing_arrows(self, dt): # state
if self.init_state:
print(f'entered {self.state}')
self.init_state = False
pos = pygame.mouse.get_pos()
from_spot = self.get_clicked_spot()
if from_spot:
print(from_spot.filerank)
self.from_spot = from_spot
self.arrow = None
buttons = pygame.mouse.get_pressed()
if not buttons[2]:
self.set_state(self.last_state)
for arrow in self.arrow_group:
if arrow is not self.arrow:
if arrow.from_spot is self.arrow.from_spot and arrow.to_spot is self.arrow.to_spot:
arrow.kill()
self.arrow.kill()
return
to_spot = self.get_clicked_spot()
if to_spot is not self.from_spot and not self.arrow:
self.arrow = Arrow(self.board, ui_images['arrow90'], ui_images['arrow'], self.arrow_color, self.from_spot, to_spot, self.arrow_group)
yoooo
nice!
Seems like you were able to implement my idea!
Pretty nice yeah, I can usually implement most things I see, lol
Didn't need to change my arrows too much, just put the arrow making in an update() method, so they can be redrawn in realtime
Along with a little logic, but nothing too difficult
ahh, i see
All three of your ideas, but the first one was kind of already done, the pieces shown lately are my originals
I have two sets, maybe more eventually
Really cool how there's a way to fill a different color on an image, changing my green arrows to any color
It's possible but it ain't easy
You'll have to compete against millions of other games and developers and try bring unique among them. And even if you manage to do all that there is no guarantee it'll work out (If you don't promote and be active in public to gain some attention)
Honestly you can say the same to game dev outside Roblox too
i just wanna 1000 euros bruv๐ญ
well no career is easy unless you have passion for it and dont do programming in general just for the money
I love programing, but not in Lua
i know, Lua is cofusing
lua is pretty similar to python
but it does have some wierd stuff tho
like array index starting from 1
funny stuff
roblox is a bad way to earn money, ill tell you that
you have to be pretty skilled at making games, and if you are good at making games you should rather work for someone making a proper game
Now not only restores the rgb to the blend mode but also the h, s and v, updating the color wheel dots and triangle too
colorsys! To the rescue, but at least I have the math anyway ```py
# hi = floor(self.color_wheel.angle / 60) % 6
# f = self.color_wheel.angle / 60 - floor(self.color_wheel.angle / 60)
# p = (self.val * (1 - self.sat))
# q = (self.val * (1 - f * self.sat))
# t = (self.val * (1 - (1 - f) * self.sat))
# if hi == 0:
# r = self.val
# g = t
# b = p
# if hi == 1:
# r = q
# g = self.val
# b = p
# if hi == 2:
# r = p
# g = self.val
# b = t
# if hi == 3:
# r = p
# g = q
# b = self.val
# if hi == 4:
# r = t
# g = p
# b = self.val
# if hi == 5:
# r = self.val
# g = p
# b = q
# self.r = round(r * 255)
# self.g = round(g * 255)
# self.b = round(b * 255)
h = self.color_wheel.angle / 360
color = colorsys.hsv_to_rgb(h, self.sat, self.val)
self.r = color[0]*255
self.g = color[1]*255
self.b = color[2]*255```
where can i host my game server for free?
maybe https://www.pythonanywhere.com or host it yourself
Host, run, and code Python in the cloud: PythonAnywhere
i tried that but without success
import socket
import pickle
import threading
players = {}
def player_thread(connection, player):
print("Neuer Player verbunden", player)
players[player] = {"x": 0, "y": 0, "z": 0}
while True:
try:
data = connection.recv(2048)
if not data:
break
data = pickle.loads(data)
players[player] = data
connection.sendall(pickle.dumps(players))
except:
pass
del players[player]
connection.close()
def start_server():
server = socket.socket()
server.bind(("0.0.0.0", 9999))
server.listen()
print("Server gestartet. Warte auf Spieler ...")
while True:
connection, player = server.accept()
thread = threading.Thread(target=player_thread, args=(connection, player))
thread.start()
if __name__ == "__main__":
start_server()```
how many players and what game type ?
is just a 3d world with ursina and no player limits
https://py.space is pretty cool
you will have a player limit unless you go UDP or serverless, and most vps hosting will kick you out for TCP
a part from that don't use pickle, it is unsecure
maybe, just want to make a online 3d realtime multiplayer world yk
realtime ? that is not possible on internet because of network latency.
yk what i mean
also here's some material about networking/panda3d/ursina https://discourse.panda3d.org/t/distributed-networking-astron-and-owner-view/27232
I came up with an idea for a game that requires multiplayer capabilities. Iโve read through the Distributed Networking in the docs and itโs stated that owner view is like an ai but instead of running in the server side, it is meant to run in the client. Q1: Can you provide some example situations that this could be used for? Q2: Can this be im...
roblox can be good
I know a few people who have made millions I used to know the owner of gpo way back way and more games the only thing I could say is that they were passionate and took their time.
don't do it for the cash because then u will make cash grabs and those suck do it cuz u enjoy it ahd u will make alot of money
uhum
https://youtu.be/_gXlauRB1EQ sorry its not good
With Roblox Corporation now being valued at more than $45 billion, we ask whether the kids making the vast majority of its content are being taken advantage of?
Support us on Patreon: https://www.patreon.com/PeopleMakeGames
Written and presented by Quintin Smith:
https://twitter.com/Quinns108
Design and art direction by Anni Sayers:
https://t...
there are a couple games that made millions, but id rather play the lottery instead of trying to make a roblox game
tldr the house always wins, and roblox would not get that sucessful if many devs were making profits
class BasicSpriteGroup(pygame.sprite.Group):
def __init__(self):
super().__init__()
self.display_surface = pygame.display.get_surface()
self.offset = Vector2()
def draw(self, player):
target_position = player.rect.center
self.offset.x = -(target_position[0] - SCREEN_WIDTH / 2)
self.offset.y = -(target_position[1] - SCREEN_HEIGHT / 2)
# does not work
# self.sprites().sort(key=lambda e: e.rect.centery)
# for sprite in self.sprites():
for sprite in sorted(self, key=lambda e: e.rect.centery):
self.display_surface.blit(sprite.image, sprite.rect.topleft + self.offset)
why does in-place sorting the sprites not work as opposed to sorting a copy?
Gotta be something to do with the AbstractGroup() handling of its self.sprites()
I've just been refactoring. I have this panel/menu that I was sending all these buttons to from main so it can handle their behaviors. I just moved all the buttons into the panel's menu opener button and pass them from there to the panel. Maybe I should go ahead and move all of that code into the panel itself
As the panel slides, all those button rects need to update their positions, that's why the panel needs the buttons. Plus, they kinda categorically fit there
It's a settings panel, it might as well have all its own buttons and handle them. The buttons themselves have an action that is just a method in main(), so main really doesn't need to know anything about them
My 3d python based open source game engine is finished ,source code had been updated with the latest update:(new version 5.5.6 had been released)
https://github.com/hamedsheygh/supePY
Nice, I put a blend on the labels too, so they change color with the color wheel
Fifteen different buttons in 145 lines https://paste.pythondiscord.com/OSJA
Or something like that
Actually only 11 buttons
But not bad
lol, nice๐๐ป
can i play it?
Almost time to publish
tell me when you done!
Will do

holy damn you even added colorpicker and stuff damn
Yeah, I never made one before and thought it would be appropriate for this game. Anyone with any kind of color issue can make the board almost any color they wish
im stuck rewritinging my deprectated folder. mostly stuck because i rewrite 1 part and add 3-5 features to it ๐ญ
your chess has grown lots over the last couple off weeks
like for example the gui.py has now become a whole python package
will add more to it tho but i wanna finish rewriting my base of the deprecated stuff
Colorpicker in its current form if anyone's interested and there's not a lot that's depending on my project in it https://paste.pythondiscord.com/F4GQ
The images it uses:
looks very nice
Since I have it on a sliding panel (it's animated), it needs the align_rects() method, but if not moving it around, no need for the method
Thanks
I worked a bit on getting the color from the bars, they have an update() method but currently just returning from it, but they can set the rgb too. The idea worked but I'm overriding it for now, it is just a chess game, not a graphics art program
The only call I'm making to the picker is to its get_rgb_hsv() method and only to save those values and from it to set_label_color(), the method in my main() class that changes the color of labels
:incoming_envelope: :ok_hand: applied timeout to @swift cave until <t:1728078008:f> (10 minutes) (reason: attachments spam - sent 7 attachments).
The <@&831776746206265384> have been alerted for review.
And don't even ask me to explain the math in both update_sv() and update_triangle_dot() I googled that part
not really I KNOW multiple devs who have made millions. And I know more we do commision based things such as models, animations, ui and one of my friends brought a 100k m3 comp
off pure comissions and is 20 living in a 3k penthouse like bro if u like something stick to it.
if you think you can't make a game you can do commision based things and make lots of money. ROBLOX developers r the most paid developers and it takes a google search to prove that
yeah you trolling for sure
i'm trolling?
don't discredit his dreams and its a very viable option to make real money on. it isn't easy but it defintely isnt the fucking lottery
that is if you are working at roblox dumbass
I used to do u.i and ive paid 600 dollars to 1.2k
earned*
off single uis
I was 14 with 3k bro
but I was working 24/7 after school to make the money
working at roblox as being employed at the roblox fucking company

believe what u wanna believe all im saying is that making money off roblox is much easier than making money off steam. you probably won't make a lot of money and will be forced to make projects but you do earn moeny and it is not a bad part time job.
it scales with exprience and connections. it can also be luck ; the owner of gpo makes millions but yet in 2016 when he made the discord nobody supported him for those same reasons
it took him years to release the game and he built a following off it . U work hard you get paid ANYWHERE in life bro
okay let me take apart your arguments one by one
first of all, steam takes less of a cut of profits than roblox, the odds are stacked against you either way as a solo dev on both platforms but atleast steam takes just a 30% cut compared to roblox with an over 50% cut
not gonna sit here and debate, but u get way more traction on roblox for some of these games. More people are on roblox for free than steam. So you get more people willing to play your game for free.
there are single roblox games that clear entire steam charts
yeah that can be applied for games outside roblox, making this argument invalid
๐ whats the connections on the outside? the owner of dark souls ๐ .
yeah those games are free, but then most of the people will not pay for your game
so you dont earn anything except for those few who buy cosmetics and shit
you make money almost always by getting people to play for free. All you do is monetize and make cosmetics or sell cheap gamepasses and roll in money.
I know a man who is a genius at monetizing his game clears at maybe 2k players daily but he makes more money then u can imagine. Because his smart and monetizes his game excellently
You get people to join for free and make them stay that is the power of roblox games and thats why they clear steam any day.
you put your previous employment in a resume
I know the person who built for this game.
at most this game cleared maybe 2.5k players in its prime. It won a couple bloxy awards; overall it was a passion project but it has made millions
one of the most recognized games in all of roblox while having little amount of players.
It makes easily almost a mill now in this state. This is MONETIZATION
you like throwing around "but i know someone" dont you
I'm speaking off exprience and knowledge ur speaking off emotion
His name was Rookie_ethnic but he was outed for some stuff so he doesn't work there anymore buit he made real money when helped make that game
okay then provide some proof if you speak off knowledge
provide proof you actually know the person
Not really friends with him anymore
bc you know I don't like those type of people but he made moeny and the people who owned that game made millions and still make millions
don't discredit somebody for having dreams bc of ur lack of knowledge
He wants to make roblox games you give him postives and negatives. It is much harder to make it as a steam developer than a roblox developer. It is just a simple fact. Now you could said become a game developer but their underpaid. Become a software engineer its hard but pays well.
i mean anyone can accept friend requests from anyone
He deleted discord bc he wsa outed for being a pedophile so i don't talk to him
anywhere in life u can make it by working hard and being passionate
not true
what about the blue collar workers toiling their asses off for minimum wage
they aint lazy
some people r content; a lot of those guys have the potential to make real money.
some people have parents who have done that work and they branch out take a loan start a company and work hard building it.
they make maybe 300k-600k doing that
but we call that a low skill job
no if they can't afford to try change their job
exactly
they arent lazy but thats the position they put themselves in
some are truly unfortunate like immigrants and what not others just made bad choices but eitheir way. some people use that to make real money
no it's not the position they put themselves in, it's the position they end up in
but there are ways out
such as lets say
truck drivers can easly clear 100k and you only need less than ayear of schooling
it comes to a total of 3k.
3-10k and there is monthly payments of like an extra 300
thats just because their parents are sucessful, and their grandparents and so on
so basically they are only sucessful because their dynasty was sucessful
there is always a way out
there's not
no you did not understand a single thing i've said
you are implying everyone can be a multimillionare entrepreneur
I know classmates whos parents were construction workers and busted their ass in a bad
I think you don't understand a single thing you said
work enviornment
they branched out and started their own company
@quasi hamlet THERE IS ALWAYS a way out
if money was really a measure of work, then Bill Gates would've manually moved every single drop of the entire pacific ocean using a glass
its the mentality.
apparently if i work my ass off and start a company im guaranteed to become a millionare
never did I say that I just said people who bust their ass off make money
doesnt have to be a company
it can be a 9-5
it can be a blue collar job
no it's not, it's the circunstances you're in, the family from which you come and the kind of things you believe off the internet
a trade
u name it
yes it is man I came from nothing
my uncle cam from nothing
we were homeless and my uncle was working a bum ass job and he got a cdl now he makes a 100k
he was barely survivng but he paid an extra 300 by taking loans out
he got his cdl and made more money if u give up thats you. if you were born in a 1st world country with both parents and ur a construction worker thats on you and nobody else.
you didnt work hard to live a good life you made bad choices , prison, drugs, dropping out of school. whatever it may be thats on u
if there werent any low-paid people there would not be any profit either and therefore no economy, as such, low-paid are a necesity and a circunstance, a status which you either get out or fall deeper in, and it's usually not someone's fault. By taking loans you can indebt yourself even more than what you were originally.
theres an element of luck to it
but you dont work hard earlier in life you work hard for somebody else or work hard for less
Woa, hold'up, that's crazy racist from you
thats just how this country works
true if its like buisness
but it isnt rlly luck for trades of cdls
but like I wanna be a software engineer and im black ik that its gonna be harder for me to get a job
but thats fine
true on everything, if you are born on africa you tell me what kind of "entrepeneur multibillionare business" are you making
yes
or do you life on a comfortable city
thats africa though
I came from kenya
and Im not gonna say its easy its dam near impossible there
but I MEAN america
in AMERICA
okay im asking you a question, if you put in the work and be passionate about it, will you become a multimillionare
you have a choice from a early age USUALLY. some people get played bad cards. Some people get sex trafficked when their kids and wound up in a differnet state 10 years. No highschool, nO GED, no education. thats a bad card. some people had to drop out fcus their parents are dying and they have to take care of them.
yes that is my mentality and hopefully I make it
but also there are sure fire ways to become a millionaire such a roth ira but thats when u about to retire
u put in 3k in a roth ira and put a 1k a year by the time ur like 50 u have millions
if u do that when ur 18 tho
but I do think its very hard and it is entirely luck to make millions when you're young
but u can build and make those millions later in life
how easy or hard it is depends on the circunstances, and since the circunstances change not only because of you but also because of everything that affects you, there's a clear element to it. We can agree then, that you were lucky to get out of there, because no matter how hard they try, a selled child, 10 years old, married, can't get out of her misery
that's if you have 3k
well
you dont have to put 3k
its easy to open one up
you can do a 1k a year when u get tax returns and it will make a similiar amount in the end
but by the 50 u have 1-3 million EASILY
but I also accept and know that its hard to live and thrive in america without support. For some people they will start later but when you have parents , AND BOTH parents. A support system and other things a child needs. Then you end up flipping burgers it is entirely you.
how can you say "exactly" so proudly? Do you not understand not everyone can get money easily? or at all?
ending up flipping burgers is a matter of circumstance and not being a hard working honest person
no it is you
you come from a good family, that can pay for ur education , can pay for your trade. And you fuck around thats just you
a lot of people come from less and make more
rich people are often rich just because they are born with a silver spoon up their ass
dude their are kids in south africa that have less then you
and they wake up everyday
go to school
bedcome a doctor
make monmey
and immigrate ive seen it and thats work ethic
Oh, so you argument is because comparing how hard life is on america and on africa, all problems are your own fault. What is missing there is the fact that people don't understand the situation they're in, if someone doesnt understand, and doesnt fathom how hard it is to actually get a job and work, let alone create a company, they'll think it's easy, even more if they are born around people that think it's easy, it's not entirely someones fault but the people's ignorance of their circunstance's fault to not understand how doomed they are, even when they are born in such favorable circunstances
which, looking at it again, has nothing to do with being hard-working
what you can't be is something that doesnt attend his responsabilities, but from there to a hard-working person there's a far shot
I guess . I'm jsut saying that if you got dealt good cards and you fumble thats just you. Other people get dealth much worse cards and make it into an empire.
yes u are right but their are lots of self made millionaires
not really, comparing how many people are born middle-class and how many of them become successful, there's a far greater number than how many people are born poor and become successful, the diference is the fact that for the second group, it always makes a lot of noise
and then they're 9-5 millionaires. Like if you run a department in a place like nvidia u make millions
if you are the head of innovation of their graphic cards u make like 1-2 m
so because you know more poor people that became rich doesnt mean there's more poor people that become rich than middle-class people that become rich
let alone rich people that become even richer
compared to what
so it is a meteor falls into the earth tomorrow
his saying that their are lots of millionaires that come from millionaires. but their are also self made millionaires from middle class or lower class . Or even below the poverty line.
this is a fire conversation to have on the game-dev channel lol
yea
(srry people reading this, got carried out)
my brother in law is the exact definiton of work hard and hustle he was making 30k a year and immigrated as a child came from nothing and now he runs his own buisness and his first year he cleared 100k+ and he clears more and more every year.
There are, as well as there are lots of millionaires that ended up being poor, and it isnt necesarily their fault
he woke up and said fkc this bro I got kids and a wife to take care of and that's the real definition of a man yk.
@quasi hamlet true
thats just life
then how are you arguing that if someone is not a millionaire it's their fault?
fine, then how are you arguing that if someone ends up flipping burgers it's their fault?
I'm arguing that in america you can do better for yourself. Being a millionaire can be luck.
bc thats just lazy and no planning man
at least if u come from a good background
your father is a doctor and mother does whatever and also makes money but u end up flipping vurgers and live with ur parents at 27
you grew complacent in life
and unfortunately that's a sad fact. You can look at history books and see billionaire families lose everything because the generations became lazier and lazier. They grew complacent and instead of increasing the family fortune they blew it and spent it. Until they ran out.
fair, but there arent that many people like that
while i agree that this is a possibility, you need to have luck, as in you have to be intelligent enough to become a doctor, you need to have the money to attend a good school
while i was working a summer job ordering computer equipment, i had a coworker that immigrated from north macedonia he was paid the least in my department, but worked the most, compared to someone higher up who slacked the first hour at work, went to a smoke break, and paid more than a true hard working person
intelligence usually isn't a problem especially in the medical field ๐ you do need money to attent a good school but you can just take loans.
Also ur comparing ur friend to soembody else compare him to who he was before.
Compare him to who he was when he immigraterd from macedonia
then compare him to the current him in 20 years and see where he is at
you have to be intelligent enough to become a doctor
well, in that I disagree, the fact of wether you're able or not to learn something depends on your perspective of the world and in the way you understand things, I know crazy inteligent people that can't understand simple stuff just because it's not their field of specialization or because they simply don't understand, I don't know how to put it the other way
yea
you just need to be average in intelligence or not have a mental disability that affects your iq
now, granted that the other way also checks, you have to have the mind structured in a specific way to become a doctor
he did improve his living conditions, but theres no way for him to become a millionare
you can do amazing things with average intelligence you can work quantum physics.
@uncut dove how old is he?
43
he probabl won't be a millionaire but you don't know where he will go
but he can easily clear 100k+
in 10 years from now
comparsion is the thief of joy. just improve who you are now
intelligence usually isn't a problem (granted), especially in the medical field
what? Do you not notice the fact that you're playing with human lifes here? like, at all?
granted for biology, but, for medicine? you can't mess up a diagnosis because the patient may die
Dude messing up a diagnosis is just like plain stupidity and not in the iq way
yk
and it happens all the time
and smart people do it more often
you just proved you know nothing of medicine
did you know that cancer of anything can have virtually any simptom on any other part of the body?
diagnose that
im saying that you can go through medical school while being below average in iq terms and be an amazing doctor. MEd school doesn't have extremely hard courses. It just has LOTS of information you need to learn and use
yes
but there are tests that can prove its cancer
a cautious doctor goes a long way man
i dont see an average person becoming a surgeon because it does require traits that not everyone has
and thank god there are, now, diagnose a self-inmune disease

idk u defintely can be a neuro surgeon
idk if you know just how smart a "average" person is
humans are incredibly smart and being just average means you can do about anything anybody else does granted with a harder time.
Now you can make a arguement that soembody below the average iq can't become a surgeon and I would agree but they can defintely be a medicine doctor aka MD
right now, the situation on quantum physics is "shut up and calculate"
most surgeons are probably around 110-130
in the iq range
and 110 is below average
or is average
okay but you need specific cognitive skills, there is no general metric of intelligence
but ofc im probably wrong
@uncut dove entirely TRUE btw
I compeltely agree and I think the IQ tests are a bs method to measure intelligence but oh well
btw iq tests are so stupid
that's because it's not wether if it's smart of not what you're talking about, it's if the people have the perspective, some crazy smart people, are simply dumb, they're idiots that think lots of themselves and won't learn nothing of nothing,
it's not wether if someone is smart or not, it's about how they think
and iq is not a measurement of inteligence, only thing proved by IQ is that it's inherited
did you know that?
you can STUDY
to get a higher iq
ofc a surgeon will have a higher iq
to become a neurosurgeon you need to be very precise, have good problem solving skills, skilled in analyzing patterns and so on
plus the human brain like grows yk
the more problems you do and the harder it is
the smarter you become
personally I think im smart but I will never take a iq test bro
I suck at riddles and all of that weird stuff
plus im very intrapersonal
and these traits you are given basically at random, sure you can improve at some areas but you can never really achieve performance of someone who was born with these skills
man, iq is not a measurement of inteligence, first of all, inteligence is something cualitative, it can't be expressed with a number, for example, I'm crazy good with maths and computers, but, I can't draw shit, I have hard times memorizing simple stuff and yet, I can learn a lot of something really quickly
all those points are examples of "skills" (I wouldnt use that word for that, but wathever, keep it simple) that are mostly unrelated between themselves and therefore if they could be measured, they would have to do so separatedly, and again, since how good or bad are you on something is something subjetive, you can't even measure a single "skill", to give an example, if someone can paint something really beatiful depends on the one that's looking at the painting
no those traits HELP with becoming one. Anybody that can work hard and isn't mentally incapacitated can become a neuro surgeon. It's incredibly hard and i assume impossible if you are not passionate.
no it doesnt
it doesnt physically grow ๐
no you don't
the connections become stronger
and you become better at solving
and finding patterns and what not
lets look at chess, or more specifically bobby fisher who was one of the greatest chess players, he was born with the supernatural chess ability
yea but that is like michael phelps
no it's not
most professional chess players were above average in chess in their childhood
like usain bolt was just made to run but it doesn't exclude others from becoming professionals.
yes you can try and learn chess in depth, but you will hit a wall where you reach your cognitive limit
ok but whats the cognitive limit?
it cant be measured what it is, but its the point where you plateau in your performance
to put it simply, your brain generalizes the "latent space" of ideas, and then holds the current "position" in that latent space and moves around, that adding the actual data becomes our comprehension of something, now, if Boby Fisher was crazy good at chess is because he happened to be born with a hippocampus specialized in whatever mess is the latent space of how pieces interact in the board across time and space, and if michael phelps if superhumanly good at sports is because he was simply born with a diferent proportion of muscular fibres
ok but tbh
you can't compare your brain structure with muscular fibres
i was not talking about iq
the cognitive limit is not a measure and cant be cleanly defined
I don't think there is, but the problem is that it's something somewhat logarithmic, so there is a point in which the growth is negligeble
Yes what I was saying is some people are born to do certain things
i cant say what my cognitive limit is
problem with chess is the fact that, if you're too good at chess there's a point in which becoming better is memorizing hundreds of thousands of games
Like when I was young when I was going through the immigration process
a part of the concrete roof fell off and hit my head
I had to go through all sorts of surgeries and what not. My mom put me through an iq test when I was a bit older like 9 or 10 and I scored 130
now i would 100% score lower
but you can't compare those two people, it's like comparing Euler which had a brain perfect for math and your niece that happens to get drunk after the fifth bottle of vodka
yes, your niece is born to drink but that's not the matter here
point granted is that some people are better than other on performing tasks, and some people exploit that and some people doesnt
@quasi hamlet but the arguement cracky was making is that some people are born to do certain things and I agree but those peopl are special cases. like nuero divergent people dominate stem and have a higher iq. But an average human can also succeed in stem. Comparing them in a way that is trying to discredit them is just incorrect
yk
thats the point I am making and its why I made that comparison some people are built for these things.
like I suck at math, and unfortunately, my major is math dominated. I don't know how I will pass that roadblock but I will. While I am not gifted at that, I know I am not a dumb person and it's within my reach. TO step away from it because I am "not talented" or "not smart enough" is just false.
true is the fact that you can't discredit people because they're worse at doing something, it's completely true.
Yet, since this cruel world doesnt care about credit, the surgeons with most success rate will be the more neurodivergent, and ordinary hard-working people will lack behind, because surgery is something extremely hard to do, so it's a bad example
same applies to medicine, but in a lesser scale, and same applies to everything in a diferent scale, that's our point
you can't say "I'm not a doctor because I'm not a genious", agreed, but you can, finish med school, going to your first hospital, and just being so bad on medicine that you're fired, it's the same neurodivergency that if you're a genious, just, the other way around, and the higher the standar is for a job, the more people it's filtered out by this
it doesnt mean you can't be a surgeon, or a doctor, it just means is hard, and if you happen to be lucky enough to be a genious but unlucky enough to be it on the opposite direction, then you sure are going to have trouble
Matter of fact, because of that, normal people that reach the pinnacle of science have so much more credit than literally anyone else
thik of Feyman
And you hit the target
nice
The exact point I was trying to make I'm just so lazy. I didn't wanna type it all out
@quasi hamlet Do you know the rapper Gunna?
yeah well but you still don't have into account the fact that so many people are simply unable to keep up with "smart people" on the subject, or it's too hard for them, or they think it's too hard for them and etc, etc, etc.....
the fact that you're second, third, fourth if you're lucky, 10th-40th for normal people it's just not encouraging enough to keep up the effort
but yeah, I think we more or less agree on that
no idea, but I really have to get some sleep, it's nearly 4 AM here
Oh I was gonna make the point that while I think he may not be talented at other things such as math etc. He is extremely lyrical and by no means is stupid or below average.
it's an example
we gonna get a strike or something because of what we've just discussed on game-dev or smth
my fault still tbh
๐ค prob
whats up guys. what do ya'll use for develop games? any unreal users?
Could you guys imagine a game like runescape or ultima online where the creatures and npc's we're controlled by a GM that's AI. For an dynamic and evolving world? Sounds fun. I dont know if any of guys were around, but when the internent was still brandnew and when BBS's were a thing, we played these guys called MUD's. But they were bascailly the first mmorpg games but mainly text with ANSI . The concept would be a already pre created world but figure how how to let the AI control and manipulate the world
I remember playing Neverwinter Nights on AOL as a kid and it changed my life, lol
can anyone explain why is it so small even whe n i transflrm it's scale into the size of the screen
can anyone help me with a pgzero code
if you pc can hold such a transformer without exploding then
By subclassing sprites
lol
Good morning all o/
More refactoring this morning, getting closer to publishing
Hello, I am making WarThunder like game in python. I want to implement multiple vehicle classes of vehicles: ships, planes, tanks, airships, all of them have an unique properties and behavior, for example some planes are able to carry bombs, have gunner turret, other only can carry rockets. Aircarriers are able to carry aircraft. Above all different vehicles have different controlling.
So, the question is:
How I should organize the architecture ?
I still have to make like three of four different sprites before recognizing their similarities and going, 'Hey, I can abstract that to a more generalized sprite and subclass to make specific sprites'
Like this, I first had both those last two objects as their own sprites with the only difference being the images and positions ```py
class SelectAPlayerButton(pygame.sprite.Sprite):
def init(self, pos, image, panel_image, action, group):
super().init(group)
self.image = image
self.rect = self.image.get_rect(center = pos)
self.panel_group = pygame.sprite.GroupSingle()
self.panel = PlayerPanel((WIDTH, pos[1]-16), panel_image, action)
self.panel_group.add(self.panel)
def get_clicked(self):
pos = pygame.mouse.get_pos()
if self.rect.collidepoint(pos):
self.panel.set_state('opening')
# if self.panel.state == 'opened':
self.panel.get_clicked()
def draw_panel(self, screen):
self.panel_group.draw(screen)
def update(self, dt):
self.panel_group.update(dt)
class SelectPlayerButton(SelectAPlayerButton):
def init(self, pos, action, group):
image = ui_images['select_player_button']
panel_image = ui_images['select_player_panel']
super().init(pos, image, panel_image, action, group)
class SelectOpponentButton(SelectAPlayerButton):
def init(self, pos, action, group):
image = ui_images['select_opponent_button']
panel_image = ui_images['select_opponent_panel']
super().init(pos, image, panel_image, action, group)```
Both the same object, might as well subclass and send the params to the parent
So my best advice for organizing both file and code structure, think really really hard about the relationship between objects and how to categorize them
I just don't want to repeat code
Totally get it
I subclass everything as much as I can, still and forever practicing though
I actually had the images being sent to the main button but changed my image handling to just import a dict of images into the file instead. I kinda like that idea more than loading all the images into main and sending them from there to all the instances
My main() no longer handles many of the images I'm using, just importing a dict of them where necessary
I have all these images in one folder atm
And they all get loaded into a dict at startup
In fact, main doesn't even have a reference to any of those images anymore
It could get them from the objects though, but no need
I like my stuff somewhat organized and having them all in one gimp project makes it pretty easy
I have made up a guessing game
import random
def hadanie_cisla():
print("Vitaj v hre 'Hรกdanie ฤรญsla'!")
print("Myslรญm si ฤรญslo medzi 1 a 100. Skรบs ho uhรกdnuลฅ.")
cislo = random.randint(1, 100)
pokusy = 0
while True:
tip = input("Zadaj svoje ฤรญslo: ")
# Kontrola, ฤi je vstup ฤรญselnรฝ
if not tip.isdigit():
print("Zadaj prosรญm platnรฉ ฤรญslo.")
continue
tip = int(tip)
pokusy += 1
if tip < cislo:
print("Moje ฤรญslo je vรคฤลกie.")
elif tip > cislo:
print("Moje ฤรญslo je menลกie.")
else:
print(f"Gratulujem! Uhรกdol si ฤรญslo {cislo} za {pokusy} pokusov.")
break
hadanie_cisla()
could just be that your image is not cropped well
one way to test this is to fill your image with a color
image = pygame.image.load(image_path)
image.fill("red")
well yes indeed it was
i checked it
thanks
Oh I got a much better blend on those file/rank labels, now those are as intended
Currently doing this way but I suspect there's an even better ```py
def custom_draw(self, screen):
mask = self.mask.copy()
mask.fill(self.color, special_flags=pygame.BLEND_RGBA_MIN)
screen.blit(mask, self.rect)
self.image.fill(self.color, special_flags=pygame.BLEND_RGB_MULT)
screen.blit(self.image, self.rect)```
1.This software is free and open source.
2.Any updates and feature enhancements must be discussed with the publisher before release.
3.Any use of this software that will generate income for the user must be discussed with the original publisher of this software in advance.
4.This software created by"HamidrReza Jahanshahi" known as "S.U.P.E".
5.H...
This way, it only gets redrawn when it either changes color or gets flipped, keeping the logic out of the constantly-running draw() method https://paste.pythondiscord.com/L7JA
Via a callback from the settings panel to main ```py
def set_label_color(self, color):
self.board.file_label_group.sprite.color = color
self.board.file_label_group.sprite.init_state = True
self.board.rank_label_group.sprite.color = color
self.board.rank_label_group.sprite.init_state = True``` any time it changes color
And then out to the board and to the sprites
And the other methods only do logic on a trigger, since their init_state flag immediately get set to False
good day
could someone help me with some homework
i have to understand the basics of coding like variables and tuples etc but i genuinely dont understand anything
when i look guides online i also get more confused
well now i regret arguing on the internet until 2am ๐ญ
wait why ahha
just scroll up in the chat xD
yeah
so a variable is a container for some sort of data, be it an integer, string, list, and so on
that i understand but i dont get how to make one
so would that be an int since its a single number?
okay thats good to know
a float is a decimal number, or an approximation thereof
now i saw you talking about tuples so imma explain those
and how they differ from lists
no, that would try to fit the variables eggs, flour and milk into the variable cake
the correct way is
cake = "eggs, flour, milk"
so tuples and lists are objects that can hold multiple other objects
well it doesnt have to be multiple, you can have an empty list
now the difference is that tuples are immutable, meaning you cant modify them after you create them
so if you do x = (1, 2, 3) you cant modify whats contained within x
like a grocery list?
could you prehaps show it to me in an image
like my school made an powerpoint
but i think i understand it wrong
and can all of this also be applied to pycharm or is that diffirent from python
pycharm is an ide
sorry im so confused what does that mean
thanks
Doesn't matter which ide or editor you use, python is python, just some make it easier or do it slightly different than others. Most ides have basic features to make working with code easier
ok so im making kinda a pygame-multi emulator (kinda like pygame but with some QoL features like buttons etc and a way to run like multiple games at once)
and im working on the "window" feature rn should i add the ability to add a title bar rn
the green and black are representing a "window" rn
i just temporarily filled the surface
Hmm, maybe even a small icon or something representing what it's supposed to be showing
yo I wanna make a game but I donโt got much knowledge about what I need I know some js and python
fyi pygame_gui module provides windowing and subsurfaces to exactly help you do what you want to achieve
Morning all o/
This sure is a handy little group ```py
class TooltipGroup(pygame.sprite.Group):
def init(self, *sprites):
super().init(*sprites)
self.tooltips = {
'dark': [],
'light': []
}
self.enabled = True
def add_dark_tooltip(self, sprite):
self.tooltips['dark'].append(sprite)
super().add(sprite)
def add_light_tooltip(self, sprite):
self.tooltips['light'].append(sprite)
super().add(sprite)
def set_tooltip_color(self, color):
super().empty()
self.add(self.tooltips[color])
for spr in super().sprites():
spr.alpha = 0
spr.image.set_alpha(0)
def custom_draw(self, screen):
'''
draws:
member sprites if self.enabled == True'''
if self.enabled:
super().draw(screen)```
So far it's just on a keypress but functionality is there
Now I can add a 'tooltip_color' key to my theme dict and when changing theme, change the tooltips accordingly
I have a lot of drawing in a few places/objects, so went through and gave all the draw methods docstrings
Easier to make sense out of the main draw method this way
More woods
Does anyone know how to or a good tutorial for tinting/shading through opengl?
I'd like to write a shader that tints/shades the entire screen. I can do that how I'm doing the board, but I'm experimenting
no... but I will say your chess is starting to look a lot more polished now
Oh thanks
The last month or so has been mostly polishing and refactoring
I still have an issue with my clicks on moves in the list to mass-redo moves, some of my squares/pieces are not assigning correctly in the process but redo or undo one at a time is working fine
I may just very reluctantly disable that feature
Hey, donโt know if this counts as game dev but I made a minimax chess engine and after a while I couldnโt find another way to improve speed or accuracy. Feedback would be appreciated! https://github.com/42-AH/mockfish
Interesting, just glancing through the code
By the way donโt look at the crusty old UI, that really isnโt my thingโฆ
I see, tk isn't really my thing so didn't pay any attention to the ui
hi everyone
im using pygame
but in my program, i need to open the file dialogue
i did a lot of research, and tkinter is apparently the simplest way to move my jpg file in pygame to whereever the user wants the jpg file to be saved in
how can i implement tkinter file dialogue to pygame?
may i dm you with further details or should i send all info here
do you want the pygame script instead bro?
Just do it here
is there a way to open file dialogue to save a file whereever the user wants in pygame?
yeah
how?
wanna see the script?
should info include my current code?
yes please
Yes please
Hereโs what I think would work:
import pygame
import tkinter as tk
from tkinter import filedialog
Initialize pygame
pygame.init()
Function to use Tkinter's file dialog to save an image
def save_file():
root = tk.Tk()
root.withdraw() # Hide the Tkinter root window
file_path = filedialog.asksaveasfilename(defaultextension=".jpg",
filetypes=[("JPG files", ".jpg"),
("All files", ".*")])
if file_path:
# For demonstration purposes, let's create a blank surface
surface = pygame.Surface((100, 100))
surface.fill((255, 0, 0)) # Fill it with red color
pygame.image.save(surface, file_path)
print(f"File saved at: {file_path}")
Your pygame loop or event handling would go here
save_file()
pygame.quit()
theres no way you wrote that in like 20 secs
I have a project similar Iโm working on
wow cool
Just copied and pasted module pretty much
shall i paste my current code?
Sure
ok!
Is this code distorted in your screen too
i didnt put into vs code yet
it keeps deleting my code message
when sending here
More than enough boards and frames, some of the colors are bad, that's easy to change, but I have a good variety and with the color picker, everyone should be able to find something that works for them
Thanks, tried keeping it pretty clean
oh bye :(
hi @covert rose could you please send the pygame script you mentioned sir?
yeah wait
thank you ๐๐ป
This is how I did them for one of my games ```py
''' import these '''
# from tkinter import Tk
# from tkinter.filedialog import asksaveasfilename, askopenfilename
root = Tk()
root.withdraw()
files = [('lvl files', '*.lvl')]
if is_loading:
filename = askopenfilename(filetypes = files, defaultextension = files)
else:
filename = asksaveasfilename(filetypes = files, defaultextension = files)
root.destroy()
return filename```
interesting...
see the tricky thing with my code is that it outputs two jpg files, asks user if they want to save these files or not, and if they do then it opens file dialogue and saves the jpg file in the user's chosen directory
which i am struggling to implement in my code
The entire method, just to be more clear, maybe ```py
def get_path(self, is_loading):
root = Tk()
root.withdraw()
files = [('lvl files', '*.lvl')]
if is_loading:
filename = askopenfilename(filetypes = files, defaultextension = files)
else:
filename = asksaveasfilename(filetypes = files, defaultextension = files)
root.destroy()
return filename```
just letting you know, idk anything about tkinter haha
pygame has methods for saving png from surfaces, if that interests you
can i send my code, maybe that clears thing better
The method I posted above should work for that
i cant post whole code for unknown reason , discord crashed.
for context, the save_maze() function is the one where i want this new code implemented on line 45
can you use pastebin or python discord server paste
ok
@covert rose https://paste.pythondiscord.com/
this is official from python discord server
just paste the script and it should generate a temp link for 30 days storing the script :D
In your line 55, where it says filename = base_filename + extension copy/paste the method I posted into your code (removing the self, arg from the definition) and instead of filename = base_filename + extension say filename = get_path(False) or even in addition to using your code, trying the method with a different variable name (maybe test_filename = get_path(False) and see what happens
You'll need to change the extensions defined in the function too, to match .jpg or whatever filetype you need
Sorry I am confused by your message @limber veldt
If it isnโt much trouble for you, could you send an updated code with your suggestion/improvement?
My English isnโt great so I struggle to understand some of message
If no I see if chatgpt can understand you for me ๐
Just pasted he method into my current project and called it with a keypress
Here it is in your code https://paste.pythondiscord.com/E4NA
With the other changes I mentioned, I can't test it, only you can
I tested the method in my code and as we can see, it works
The implementation might not be what you need but opening a save as... dialog with tkinter can be done like that
Some shading on the edges of squares, I dunno
I tried making a game earlier this year but somehow got things messed up when introducing the ability to open menus and pause/re-start the game, does anyone have any frameworks or suggestions for how to implement a game that needs live-action (WASD movement top-down) and then the ability to pause and re-start based on game actions? I know this sounds kind of vague but I'm not sure the best way to ask this question. I guess I am interested in things like what to use as a class and where the event loop should exist and how to implement pauses
sounds like a job for a finite state machine
im sure theres a couple examples on google or youtube but thats prolly the easiest way to go from what i think u want to achieve
Guys, I need feedback on how to make this more accurate and quick, thanks. https://github.com/42-AH/mockfish
Implement a neural network like NNUA or whatever the acronym stockfish calls it /j
May I ask a question here?
nnue
Oh...yeah
are you asking about the engine or the gui
you can take inspiration for the engine here
it has nnue
Gave the four main buttons shortcut keys and tooltips that show them
I looked at various tooltip implementations in the apps I'm running, vscode has a delay of about a third of a second before they fade in, so I gave mine the same, it works
And they don't fade out, just disappear
how do i stop a number from updating after it reach spesific point
so i have this a variable that contain a number that i keep subtract it but i want it to stop after it reach 0
value = min(upper_limit, value) will keep value at or below upper_limit
At or above I meant
i'll try that
There's also max() that does the opposite
Combining them can keep a number between two values val= min(10, max(0, val)) will keep val between 10 and 0
Sometimes it's appropriate to just use a condition, like if val > 0: val -= something
The min and max functions are fine most of the time
Depends on the implementation
I use the min/max way most of the time, it's one line compared to 5 or 6 lines to get the same result from conditionals
I still have to thought process them though, they're kind of counter intuitive since min() is used for setting a maximum limit and max for setting a minimum limit
yeah, but it also more faster. everything have their own pros and cons they say
True
In Pygame, pygame.time.set_timer() is a function that creates a recurring event at a specified time interval. It triggers an event at regular intervals, which you can handle in your game loop
pygame.time.set_timer(event_id, milliseconds)
in your game setup, something like so py my_event = pygame.event.custom_type() pygame.time.set_timer(my_event, 32)
Then in your event loop, something like this py if event.type == my_event: do_something()
It's a pretty limited timer, it works, but lacks functionality I need in timers
I have used it a couple of times, it is handy
My Defender is using it to cycle colors on a timer
May I ask a question?
Not really, a simple Timer() class can do way more
ye feel free
ye alright
Just feed it dt on an update() method and it can time things
How can I make a player cell?
Can you possibly be more vague
Hemlo guys
uh not entirely sure what that drawing shows
It's for a sci fy horror player area a ship of sorts
There is no such thing as a 'player cell' unless you make it
Y y'all ignoring me
When it's supposed to be in a design for a ship in my game which is supposed to take place under water and using the concept of four-dimensional rift to move anywhere in time so I'm trying to make an area which is generated to be where the player will be for the entire game similar to iron lung if that makes it any easier to explain
Not ignoring and hi o/
Yoooooo
Idk why I'm watching someone repair his cycle wheel on discord
Just writing some codes
What codes tho ?
is this a 2d game
Yes
Yes
Animated buttons, buttons that change color when clicked then about a tenth of a second later, change back, so you can see them clicking
More of them actually, I have animated button abstracted
Here's the latest one py class RightArrow(AnimatedButton): def __init__(self, pos, action, group): images = [ ui_images['right_arrow_enabled'], ui_images['right_arrow_disabled']] super().__init__(pos, images, action, group)
That's all of it
Woahhh cool tho
How old are u bro
Old as dirt /j
The AnimatedButton() class is nothing too fancy https://paste.pythondiscord.com/JALQ
Simple state machine
Instance the button, send it a function or method as the action it should perform when clicked, send a group to it, draw and update the group
And get images to it anyway you want, either by grabbig them from an imported dict like I did for the RightArrow or send the images to the RightArrow
Some of my buttons have tooltips, some don't
In which case, I just send it to the subclasses https://paste.pythondiscord.com/GIXA
Well, the group they go into to them
By making it a state machine, I can call the buttons from anywhere to change their state, like when I press a shortcut key to activate a button, even if not clicked, I can animated it by setting its state to 'clicked'
How many million years ?
tbh didnt even guess you ||that|| old
not meant rude
T^T
Someone got a 3d projection script that uses numpy? I would greatly apreciate it !
i might lemme check
nvm apperantly i deleted my numpy folder
i got a REALLY basic one from a while back? it doesnt have face culling or even in order-face drawing / painter's alg tho
so u get funky stuff like that which is obv wrong
the code's there if u wanna try fix it or use the logic from it
the matrices and the camera handling itself should be fine altho idk if the camera rotation methods rotate based on its location
Rude? Nah man, it's all good
nice
Playing around with tryna make a better woodgrain, getting closer
brah...!
Looks like made in Minecraft lol
Never saw a bumpy chess board but I applied a bump map to this to see how it would look, one side bumpy, the other not
people who have experience with render engines/blender dm me
make a border fr
What do you mean?
It has a border, they're called left, right, top and bottom margins
ur older than my parents :O
Obviously
Ur older than sand
How would anyone here implement point/triangle collisions?
My naive approach would be getting the scalar projection of the point from each face and checking if they're all the same sign
Oh nvm, I came up with this way ```py
inside = True
if (self.top.x - self.right.x) * (pos.y - self.right.y) - (self.right.y - self.right.y) * (pos.x - self.right.x) < 0:
inside = False
if (self.top.x - self.left.x) * (pos.y - self.left.y) - (self.top.y - self.left.y) * (pos.x - self.left.x) < 0:
inside = False
if (self.right.x - self.top.x) * (pos.y - self.top.y) - (self.right.y - self.top.y) * (pos.x - self.top.x) < 0:
inside = False
return inside
I was just checking if the clicked position was less than the inner radius of my color wheel, which works ok but unintentionally grabs the triangle if just inside the circle but not colliding with the triangle, this fixes it
import pygame, sys
from pygame import Vector2
screen = pygame.display.set_mode((400, 400))
center = Vector2(100, 200)
top = Vector2(39, 2) + center
left = Vector2(6, 57) + center
right = Vector2(72, 57) + center
def is_inside(pos):
if (top.x - right.x) * (pos.y - right.y) - (right.y - right.y) * (pos.x - right.x) < 0:
return False
if (top.x - left.x) * (pos.y - left.y) - (top.y - left.y) * (pos.x - left.x) < 0:
return False
if (right.x - top.x) * (pos.y - top.y) - (right.y - top.y) * (pos.x - top.x) < 0:
return False
return True
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
screen.fill('black')
buttons = pygame.mouse.get_pressed()
if buttons[0]:
pos = Vector2(pygame.mouse.get_pos())
if is_inside(pos):
pygame.draw.polygon(screen, 'red', (top, left, right))
pygame.draw.line(screen, 'red', (top), (left), 1)
pygame.draw.line(screen, 'red', (left), (right), 1)
pygame.draw.line(screen, 'red', (right), (top), 1)
pygame.display.update()``` quick example...edit: better example
to split the background and the chess itself
the border around
No other chess game I've looked at has a border
So I ask again, what do you mean by border, I know what a border is but not what you mean
Ok guys if anyone is wondering how to do 3d projection i have a script fully working available
I did a mockup (without moving anything yet, just giving a border) it does look good
Maybe a little too wide, it's 8px, could also try 4
And mitered corners
What is library sys and Vector2
sys is builtin, Vector2 is a class from pygame
More on pygame's Vector2 https://pyga.me/docs/ref/math.html#pygame.math.Vector2
And that method or function should be able to work with any triangle but it doesn't, surely something buggy in the code, but it works for bottom aligned equilateral triangles and is all I need it for
anyone know how i can import pygame into vsc
Ohh okayy tyy
have u pip installed it
if you're only using sys for sys.exit, you may as well not import it and use just exit ยฟright?
Yeah, sometimes I just raise sysexit or so
This function is working for all triangles that I've tested so far ```py
def is_inside(pos):
if (top.x - left.x) * (pos.y - left.y) - (top.y - left.y) * (pos.x - left.x) < 0:
return False
if (left.x - right.x) * (pos.y - right.y) - (left.y - right.y) * (pos.x - right.x) < 0:
return False
if (right.x - top.x) * (pos.y - top.y) - (right.y - top.y) * (pos.x - top.x) < 0:
return False
return True``` Going ccw on all checks seems to be working
btw is this THE optimized way or just the one use ? Because you can check if the number of times the line between (a point you know is inside and the point to test) intercepting an edge of the triangle, IS or not even.
like this yes
does any1 have any like 2d pixel game code made with pygame?
sure do "view source" here https://pygame-web.github.io/showroom/pygame-scripts/org.pygame.touchpong.html
for other kinds look here https://itch.io/c/2563651/pygame-wasm and make a pick all their sources can be viewed ( beware that does not mean you can rip them off )
thanks! and yes ofcourse im not ripping them off i just have a small project im doing
not commercial
u can prolly check past pygame game jams or others on itch too
Implemented, probably make a couple more colors but now they're an option anyway
Oh and oops, gotta resize my obs to the new window size
Moved/resized some elements slightly
yeah that's neat
Yeah I like it, thanks for the suggestion
Made a couple more and I think I'm calling it good enough, culled some boards and backgrounds too, keeping the dark color margins, losing all the lights, they just don't look good to me
And all the wood margins, goners
Just wood frames and boards now
And only three of them, light (like oak-ish, brown like walnut-ish, and red like mohagoney-ish
Also keeping what I'll call the three or four standard boards, just ivory colored light squares and dark blue, green, brownish, etc
And the two graphics boards, I'm not sure about keeping them yet
And I'll probably link the board to border change but not border to board. So like, if you change board, the boarder changes to match it but if you change border, the board doesn't change
Just so one can customize to their liking
how can i resize a image in pygame? ive done
pygame.transform.scale(player_standing, (50, 30))
but it doesnt work
u need to assign it to a variable
so
player_standing = pygame.transform.scale(player_standing, (50, 30))
ah i didnt see this but well thanks for the help but ive already fixed it
does anyone perhaps know any free pixel art of a hotel
even one nice image
Interesting ๐ง
Can anyone recommended a visual game engine. I got the AI already in place and the game engine and rules. But I want to build it with the idea to play it single player against the AI , AI vs AI and multiplayer. Im using pygame for the visuals right now.
https://renpy.org is a visual novel game engine. Not sure if that's the kind of visual you're looking for.
i create a free 3d open source one(the game engine) using ursina and i will rewrite it using pyopengl soon if you want it check it out:
i create an game engine in python using ursina in 8 days and i complete it later by working on it 4 more days.
my discord channel:
https//discord.gg/yMugmymnYz
add ":" between https and //
Have you guys heard anything about https://www.panda3d.org/ ?
For now I'm just thinking backgrounds I can snag for free, MTG related but they would just be digital game mats but also the board. Organizing the cards and stacks on that board and a mechanism to visualize your hard and interact with it and the board with valid actions. I guess I can leave placeholders in the meantime and try to flesh most of the visuals out first. uggh. sounds like a big undertaking. i know squach in this department.
I'd like to some day get into using 3d assets for 2d games, mainly for fx kind of things
That would be cool, thats something I can picture myself needing here soon. Although I keep complicating it more. I just need something basic for now that works. Maybe I can get some people on github once I get a really solid foundation.
its not enough for me plus coding there is less complicated because you have your own rules and in case the asset and prefab handling of ursina is much better than panda3d
what does this mean
IndentationError: unindent does not match any outer indentation level
it means youve indented something incorrectly
when youre using python, you need to make sure each of your blocks are indented to the same level
e.g.
โ
print('hello')
if age == 30:
print('meow')
else:
print('woof')
โ
print('hello')
if age == 30:
print('meow')
else:
print('woof')```
Hello any ideas on why this movement wont work?
import pygame
pygame.init()
SCREEN_HEIGHT = 500
SCREEN_WIDTH = 600
screen = pygame.display.set_mode((SCREEN_HEIGHT, SCREEN_WIDTH))
run = True
player = pygame.Rect((250, 250, 50, 50))
while run:
pygame.draw.rect(screen, (255, 0, 0), player)
key = pygame.key.get_pressed()
if key[pygame.K_a] == True:
player.move(-1, 0)
for event in pygame.event.get():
if event.type == pygame.QUIT:
run = False
pygame.display.update()
pygame.quit()
Its only meant to move in the left direction but it wont work
player.move() returns a rect object
ideally u should put player.move_ip(-1, 0), tho i would prefer player.x -= 1 in that sitation
also u should probably clear the screen every frame (screen.fill(some background colour)) or u'll end up with visual bugs
I did try the move_ip
Let me try player.x -= 1
can u send ur current code
import pygame
pygame.init()
SCREEN_HEIGHT = 500
SCREEN_WIDTH = 600
screen = pygame.display.set_mode((SCREEN_HEIGHT, SCREEN_WIDTH))
run = True
player = pygame.Rect((250, 250, 50, 50))
while run:
pygame.draw.rect(screen, (255, 0, 0), player)
key = pygame.key.get_pressed()
if key[pygame.K_a] == True:
player.x -= 1
for event in pygame.event.get():
if event.type == pygame.QUIT:
run = False
pygame.display.update()
pygame.quit()
it works fine for me
these arent errors as opposd to suggestions to structure the code
oh okay i hadnt tested it assuming it was an error
u can simplify the "if key[pygame.K_a] == True:" to just if key[pygame.K_a]:
it does leave a trail tho
where?
I mean the rectangle leaves a trail
thats what i meant by this
in ur gameloop add a line like screen.fill((0, 0, 0))
before ur draw the player
Thanks
so every frame it "clears" the screen and u redraw it
Also, by default does it run at 60 fps?
Import time aswell?
clock = pygame.time.Clock()
#inside the game loop
while run:
### all ur game logic
### ...
pygame.display.update()
clock.tick(60)
no its an inbuilt pygame thing
Great thank you
How long have you been doing pygame im just curirous becuase i wanna get into python and pygame
uh on and off for a couple years now
Hi, I made this code: Find The Number: Custom Edition
I'm a starter by the way. (kind of)
Oh and, I'm gonna go active again probably at the end of the week
Would you like help me build it? Like I said I got all the GameEngine, Rules and the AI implemented. I trained them for 1000 games last night and they were diffently getting better. I need to refine the rules a bit more but I got a really solid foundation.
I got the idea of using two different rewards rules for AI, this way I can test different methods against each other to see how I can keep improving it
Hmm, what about a symbolic RL reward calculator. It would be like hyperparameter tuning except the difference is you build the symbolic engine with the idea trying different formulas and keeping the best ones.
sorry I should ask this in the AI channel.
I wanna get started on game dev how can I ping me if you wanna help
I sent ya an invite
i will help
just tell me what your needs in my dm and what you aim for.
That sounds awesome! I sent you an invite
๐๐ป
is there any sort of delta in pygame as in no matter the fps the movement stays the same? becuase at the moemnt the mroe fps you get the faster the moevemnt is..
Pygame has pygame.time.Clock() that is used for timing. CLOCK = pygame.time.Clock() somewhere in your program initialization and in the main loop, something like CLOCK.tick(60) to maintain 60 fps
If you want or need deltatime, I get it like this dt = CLOCK.tick(FPS) * 0.001
With FPS assigned to a variable holding my desired framerate
Thank but just wondering why you would multiply it by 0.001?
Because I want it in milliseconds, the return is in seconds
thank you
That makes sense
Oh and also one last thing if you dont mind. Im currenty learning about Object oriented programming, and im wodering where i could use and implement this in my game?
Subclassing pygame.sprite.Sprite() or any part of pygame really. I often subclass sprite() and Group() for my own purposes
so you jut make a class for your character or something?
Sure
For pretty much all sprites, I subclass .Sprite() so I can take advantage of pygame.sprite.Group() drawing and updating
And sometimes even subclass from there to make specific sprites from general
So you could have like a class to show what is in the players inventory or liek the movement speed, or jumping power...
Sure enough, I happen to make just about everything a class
interesting I am really new to python only about 1 week in id say some im really just trying to soak up the info I can!
Organizing behaviors into objects they belong to helps me keep thing organized to some degree anyway
Just as an example, and with the condition that I'm no pro (just a hobbyist), this shows an AnimatedButton() class and a few subclasses of it. It's just a button that changes image when clicked and changes back by itself after some short delay, and gets an argument action that is a method or function called when clicked https://paste.pythondiscord.com/I4OA
Any Ideas why this will not work? Its meant to close the window when you press the X
import pygame
pygame.init()
HEIGHT = 500
WIDTH = 500
BLACK = (0, 0, 0)
window = pygame.display.set_mode((HEIGHT, WIDTH))
clock = pygame.time.Clock()
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running == False
window.fill(BLACK)
pygame.display.flip()
clock.tick(60)
pygame.quit()
The == is a comparison operator not an equal like a single = for assigning
Thanks.
I think of the double equal in my head as 'is_equal` since it returns only two possibilittis, True or False
I tend to follow that as convention when naming methods or functions that return only a bool, not always though
thanks for this
i got another error message that i never see before again today. do you also know what this mean
TypeError: 'builtin_function_or_method' object is not subscriptable
!e it means you tried to subscript a function.
max[5]
:x: Your 3.12 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "/home/main.py", line 1, in <module>
003 | max[5]
004 | ~~~^^^
005 | TypeError: 'builtin_function_or_method' object is not subscriptable
subscript?
Hoping this doesn't get deemed spam but here's a clip of a game I've been working on in Pygame ๐
Slight Bomberman inspiration but also taken a lot from more modern and difficult games (binding of isaac, celeste etc...)
Looks pretty cool, I might play this when it comes out.
Thanks!
It'll be another year or so at this rate. Lots of mechanics ๐
Looks great, and I spam shorts all the time, probably pushing the limits O.o
Pretty quiet channel and just seeing others posting projects is fun for me
been pretty busy to work on anything substantially and send here
i will be entering the new pygame jam tho when that starts (i think in november?)
fire
That's really cool
Love the pixel art on the releases page
oo
who drew that
john carmack?
thanks! its honestly ai stuff ๐
dont forget to leave a star if you like the simple engine!
i will add more assets + nav mesh + human npcs later on!
No pygame window is even showing up when I run but I can see that the classes are correctly running due to a print statement I added
I am following this tutorial is that is helpful https://youtu.be/WViyCAa6yLI?si=4hSt3GtlY4nIPERy
Did you play too much SNES as a kid? Have you been raised by Nintendo and Mario? Time to remake the most famous game of that generation! For this beginners tutorial we will use pygame to create a Mario style platformer game that includes an overworld as well.
Thanks to Brilliant for the support, you can find them here: https://brilliant.org/Cl...
Many thanks in advance
Have you tried running any other pygame code, like something known to work, and does it create a window?
Yeah, I oppened a different project and it worked
It's not like it even opens then immediately closes. Just nothing happens
I'm not familiar enough with that project so can't say when it should start working
There's one thing I think may be related
So randomly I kept getting some error from nowhere that I had to fix by changing the audio driver
After that, no window opened
https://gyazo.com/4cdd6ae467f69368c226fcd402044c35 when ever i refresh the json data gets sent again. im confused
Yeah, I saw that over in Clear's server, quite strange
So I'm wondering if something on pygame has gone wrong and impacted the project
Because it was a random audio error (I haven't even touched pygame audio yet) that appeared for seemingly no reason
Maybe that was the only visible issue
I think it was something to do with ALSA?
Might as well
Or continue trying to troubleshoot by trying other working code again, after having these driver issues
Since my other project hasnt had these issues, they seem to be on pygame-ce's part I'll try reinstalling when I get the chance
Thanks for the help though
I wonder if there was an older version of pygame in your system before installing this one?
Ooh, possibly
Tbh i never uninstalled pygame when I installed CE so it could be that
Because there could be conflicts there, installing -ce beside non-ce might be an issue
That's the general advice I've seen with installing -ce, to uninstall the old first
so, i tried unistalling pygame and it said it skipped over it beacus eit wasnt installed. i then unistalled and reinstalled pygame ce and same issue
Sorry man, beyond my troubleshooting skills at this point, but I still suspect there's a conflict from an old installation somewhere
If other pygame-ce code works and this code doesn't, that makes me think it's project specific so comparing your code to Clear's would probbaly be my next step
I've litterly went charcter by character to make sure it was 1-1. the only change being ahving to change the audio drivers
Without the audio driver chnage i get these errors
@covert snow โ /workspaces/Silver-Dofe (main) $ cd /workspaces/Silver-Dofe ; /usr/bin/env /home/codespace/.python/current/bin/python3 /home/codespace/.vscode-remote/extensions/ms-python.debugpy-2024.12.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher 47991 -- /workspaces/Silver-Dofe/code/main.py
pygame-ce 2.5.1 (SDL 2.30.6, Python 3.12.1)
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5220:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM default
so uh,
ive fixed it
ive just cloned my repo
and ran it somwehre else
now it works i guess
thanks so much anyway
Well, both the members here I know who might know anything about this are not currently online...
do you know why that fixed it?
No idea, but awesome
doesnt have the audio driver problem aswell
That's a great tutorial, glad it's working for you (no I haven't done that one myself)
But I have watched it
granted, now im having commit isuees
I watch all of Clear's releases
so i dont think i can use codepaces now?
im not to experience with git stuff but thats where the issues are
You're more experienced with it than I am, so maybe others know
well i can still commit to agit hub repo with or without codspaces so i odnt hink it really matters
would love to know why this debaucle hapened from them
so, ive deleted my codespace then created a new one from my working code. That codebase has the exact same issue as the first one
im really confused
guess no codespaces for me
Yo
Should i directly jump into game dev with python
With some basic knowledge such as functions statements etc
Or stick to normal python coding
Learn Python for a bit first
Get a good grasp then try some arcade games to start. Pong etc
Same advice here, having at least some understanding of classes and objects helps a lot
Hi guys
Hi
Whatsup?
Just refactoring some ideas
Oo!! 
There are a couple of things I don't like about some of my code, so re-imagining some of it
And one main issue that still needs fixing
do it!! 
what is it?
It's a chess game with undo and redo moves, right? I want to mass undo/redo to any state in the moves-so-far list, and it's almost working but not quite
Oo i see!!
Undo/redo both work fine on their own but I want them to work faster, like in an iteration, like a while loop
Btw i'm not a game developer!! But a web designer!!
donโt mind it
I get it, each does their own thing, I like game dev as a hobby
Oh nice!! My friend is in the way to learning game development and i'm learning web development
why i cant blit the enemy
enemy = pygame.transform.scale(pygame.image.load("game assets/enemy.png"), (50, 50)).convert_alpha()
enemy_mask = pygame.mask.from_surface(enemy)
enemy_list = []
#Timer
game_timer = pygame.USEREVENT + 1
pygame.time.set_timer(game_timer, 900)
#game while loop
run = True
game_active = True
while run:
clock.tick(60)
for event in pygame.event.get():
if event.type == pygame.QUIT:
run = False
#if event.type == pygame.MOUSEMOTION:
#print(event.pos)
if game_active:
if event.type == pygame.MOUSEBUTTONDOWN:
if jump_rect.collidepoint(event.pos):
gravity = -15
if event.type == game_timer:
enemy_list.append(enemy_mask.get_rect(bottomleft = (500, 370)))
if game_active:
#background
screen.blit(sky, (0, 0))
screen.blit(ground, (0, 530))
#pygame.draw.line(screen,'Red',text_rect.topleft, text_rect.bottomright)
#enemy
#enemy_rect.left -= 5
screen.blit(enemy, enemy_list)```
ignore those codes lines that i commented. i've been practicing some stuff
Have you heard of the memento pattern?
I used this in the past to good results. Works great on turn based stuff. Real-time not so much
Your enemy_list is a list, it needs to be a single destination as a tuple, tryscreen.blit(enemy, enemy_list[0]) to get the first element of that list instead of the list itself
oh i see
And you're gonna need a guard before blitting that
i need to make it as tuple first
Because if the list is empty, it's an index error
does that apply to other stuff
What?
guard?
yup that my code
If you try blitting something at index 0 into that empty list, it will be an error
so how do i fix that
Put a guard
what is a guard
Something like if enemy_list: before trying to blit something there
oh ok
That will test if there is anything in the list
If there is, blit, if not, don't blit
Sprites and groups man, really
Really really really
See, pygame.sprite.Group() can be drawn any time and it will draw whatever is in the group, if it's empty, nothing will happen
It's basically a list of sprites that the group can update and draw. if nothing is in it, it does nothing and you can skip this kind of guard
ah ok
So it's a container for as many sprites as you want to add to it
It's a little advaanced stuff, like learning how to subclass pygame sprites but don't let that discourage you, it is not that hard
i'll gonna do that later. rn im really some more simple stuff like timer for now
sounds like pyCraft
@limber veldt how did u become so good at programming in python