#game-development
1 messages ยท Page 51 of 1
Good question.
Depends on the size of the sprite. If you have that many, might be worth-while to create a sprite-sheet ahead of time.
Cool, best of luck. Shout if you need anything.
will do!
ah! quick question
most of the grid will be empty
so in my moderngl version i used a frag shader to draw the background grid
does arcade have shaders?
or should i just generate a background image and use that as a sprite
Paul Craven... the name sounds familiar- oh yep, just checked the roles
The man himself, nice to meet you in person, haha
well, "in person", as much as a discord channel can convey of that meaning- you know what I mean
Now look what I've done
@fierce wraith Arcade is perfect for that project I think. If people just knew how hardcore the rendering in the first version is they would probably not believe you ๐
@fierce wraith You can either create an image and use it as a sprite, or you can use a ShapeElementList. The ShapeElementList allows you to stuff a bunch of OpenGL drawing commands together and draw as a batch.
I tried downloading pymunk for some physics with pip install pymunk
but uhh...
so I did python -m pip install -U pymunk instead
will it work? xD
Hm, interesting. Did the second command work? If so, you might have multiple Python's installed on your computer.
I think the second method is the preferred way to install packages anyway.
I probably do ngl
no wait-
I actually don't
because last time I had to reinstall it because pip 20.0.0 was broken
this is pretty much what happened
so in theory it installed?
That looks like a successful install. And yes, pip 20 messed up a lot of code that was platform specific.
it showed up on stackoverflow very quickly lol
@potent ice yeah hahah. way to much time spent on getting that stuff to work haha
@frozen knoll is there a easy way to up the sample count?
these lines look kinda pixel-y
It looks like anti-aliasing isn't turned on. Are you subclassing from Window? What platform are you on?
This is what I get with draw_line on windows:
I don't see any anti-aliasing in what you posted, which is odd.
windows and im just running the lines example
@potent ice writing to a buffer from the cpu is bad right?
like writing directly
not using a uniform
@frozen knoll its not to big of a problem, i was just wondering ๐
@lunar jetty uninstall it and reinstall it on powershell within the prompt. that's what worked for me!
(if it's not on path, the program can't run it)
first let me see if it even works
well it imports
rn I can't be bothered to write a test code tho
just do pygame.init()
I don't use pygame
oh, well i'm stuck
I'm using Arcade
I'll just test it at leisure
k
@lunar jetty That's too far into meme territory and too far out of on-topic territory for me.
my bad
Any good book to learn pygame
?
@fierce wraith Nothing wrong with writing to buffers. Like with everything else it does have a cost.
Anybody know a good book that teaches you pygame
You can look at http://ProgramArcadeGames.com it is free on-line.
Or if you aren't set on pygame, see http://arcade.academy/ and https://arcade-book.readthedocs.io/en/latest/
But @frozen knoll if I didnโt want to use a website and buy a paper book. What would you recommend?
Exported the default Beat Saber map. Could be fun to make it load light show data and play that with music. (I stripped the materials for now to make it visible)
@frozen knoll i cannot believe you didn't mention your OWN book
Guess he doesn't like to plug himself
Also for some reason I don't know how to use transparency in my sprites
Because what hecky would I need the sprite's background for
also bonus question, if I have 16x16px tiles is there a way to upscale them without them looking like garbage?
because when I try to upscale it while processing the layer...
blurry garbage
What are you working with library-wise? You'd need to double the size so everything lands on a pixel boundry, and turn off multi-sampling.
so far I'm only importing arcade
but basically I wanna go for Cave Story (the original, not CS+) style graphics
in a window that's 800x600
it's probably more than 16x16, it's at least 32x32 with the tileset
or that's what it looks like
hold on I need to look at the actual game and not a poorly upscaled image from the web
oh no it's actually 16x16 in the original
either way the point is I don't want 16x16 graphics that'll be 1:1 scale in the window because that'll be microscopic in a 800x600 window
sprites for ants
unless it's possible to just stretch the whole thing somehow?
I think with pyglet and arcade you can render those tiles with nearest interpolation to make them pixelated when scaled
Default is linear interpolation
So in theory you can render the 16x16 tile covering the entire screen and it will look like the original
which is pretty much what I wanna achieve
upscale pixel art while keeping original appearance
When you create an arcade window, you can turn antialiasing to False, which will not blur the pixels.
You'll need to scale in powers of 2 though I think. 2, 4, 8, or whatever.
(Don't update to Arcade 2.2.8. Bad things...bad things. And I'm not smart enough this morning to solve my issues.)
hold up
when was it released
because I downloaded it I think yesterday or before yesterday
but yeah another issue actually I believe is when I upscale whilst processing a layer, it just goes completely out of the grid, just overlapping one another
(I scaled it 2)
oh ooh
yeah uh
mama
in order to demonstrate more clearly I took a tileset from a well-known block game that everyone knows and has reference for
I got 3 layers, the Ground (which is grass and dirt), Background which is all I'm not supposed to collide with and Leaves layer just for cosmetic reasons because in this tileset leaves are gray
I set them up as such
test_map = "maps/untitled.tmx"
leaves_layer_name = "Leaves"
walls_layer_name = "Ground"
background_layer_name = "Background"
test_map = arcade.tilemap.read_tmx(test_map)
self.leaves_list = arcade.tilemap.process_layer(test_map, leaves_layer_name, 2)
self.background_list = arcade.tilemap.process_layer(test_map, background_layer_name, 2)
self.wall_list = arcade.tilemap.process_layer(test_map, walls_layer_name, 2)
I dunno, should I scale it when drawing lists instead or something?
Am I missing something?
and this is what it looks like
instead of this
ah looks like linear interpolation. I'm sure there is a way to set nearest interpolation in arcade
Maybe search in docs
I'll do that
oh the first line doesn't have an indent for some reason
let me fix that to avoid confusion
there
The sprite list do have a filter parameter for draw : http://arcade.academy/arcade.html?highlight=gl_nearest#arcade.SpriteList
But I have no idea if that is related to what you are rendering at the moment
It should be possible to set somewhere at least
process_layer makes a SpriteList.. then spritelist.draw(filter=gl.GL_NEAREST)
I gotta import gl from Pyglet?
Seems so import pyglet.gl as gl
okay so that partially solves my problem
because now it's not smoothing
BUT
the tiles still overlap halfway
yay. Progress at least ๐
I mean hell I'll take it
but I'm not done yet
yet the collision detection seems right somehow
well kinda
not sure yet
should tile scaling be 2?
but what I do know is the tiles are upscaled correctly, but I think the problem is their positions aren't updated anyhow
makes me wonder if this is even the right way to go about it
yeah
I asked already if I'm supposed to do it elsewhere
but no one said anything so I assumed that's how I gotta do it
Scaling is set to 0.5 in examples. I don't know why
๐คทโโ๏ธ
Try it?
I got no idea why would I do that but alright
it probably just has to do with the example sprites though
๐คทโโ๏ธ
1.0? ๐
the issue is it's identical to what you see above size-wise
and I'm not making a game for ants
that's why the whole talk about upscaling in the first place
well not identical per se but still way too small
Getting closer at least
no I do not
I wish to acquire it
lol
problem is it does upscale them but it doesn't put them farther apart once it does
or rather, problem is it upscales tiles individually
@frozen knoll Can you think of any way to solve this issue? Also, why do you say you done goofed with 2.2.8?
Documentation doesn't do me much justice on that front I'm afraid
Otherwise I wouldn't bother you
Been digging here as well
The last image you posted looks reasonable
Maybe a good idea to summarize that the problem is now
I just summarized the problem though
problem is it does upscale them but it doesn't put them farther apart once it does
or rather, problem is it upscales tiles individually
Oh, I think you are hitting the 2.2.8 bug. I'm working on it.
It is a mess.
Go back to version 2.2.7
I've been banging my head all morning on this.
Right now some of my hitboxes are getting double-scaled:
But not all of them, which I don't understand.
uuuh, how do I downgrade again?
I am but an aspiring newbie
so this may be a bit of a noob question
if that matters I had no earlier version on this machine
Using PyCharm or command line?
oh wait --upgrade can be used for downgrading too
there we go
yep now everything is in order
Thanks for clearing that up
I think you normally do pip install arcade==2.2.7
I released a 2.2.9 which is the same as 2.2.7 while I sort out my mess-up.
I wonder how to go about making character movement with momentum
I think I'm generally gonna have to make my own physics engine
I hope I'm wrong
Pymunk if you want to get fancy.
I don't really need fancy physics, I just want momentum based character movement
not just running at constant speed and changing direction just like that
like for instance you run in one direction, and you steadily build up speed up until a certain limit, and to run the other way you must first lose the momentum
is that complicated to do?
No, that's pretty much standard stuff
vel += acc
Pretty much all you need. You might want to set acc to zero evey frame automatically, but maybe not.
I need to finish my boid stuff @fierce wraith, dropped it because of AoC
whats the best way to hand 2d movement in pygame, vectors, or rect??
@ColdEmber#0538 same. Ive learnt a lot in the last few months
huh. Let me see if I can figure that out in practice
. . .
what
XD
do I have to bring these into the class first?
but then--
why does jump speed work
I never put THAT inside the class
hmm
removing that line with player acceleration fixes it
can you show your def main():
should I put it before instead of after?
uh sure
def main():
window = MyGame()
window.setup()
arcade.run()
why though?
but yeah I can't seem to be able to do this for some reason, or I'm just doing it wrong @fierce wraith
Constants, that don't change, should be declared at the top of the program.
Check to make sure it is an exact match.
The top screenshot has HEIGTH instead of HEIGHT which would mess that variable up.
now I see, only constants should be declared at the top
The top screenshot has HEIGTH instead of HEIGHT which would mess that variable up
90% of my errors with any cartesians reference
not in my case, I complete variables from context actions because it's faster
still, I refactored it
@fierce wraith i have a problem with my boids at the edge of the screen, they kinda stop, i believe it's because, even though i "look" ahead, when they get past the screen and go on the other side via the pacman effect, they're all alone, so they lose their velocity fast since no force applies to them
now I wonder how to do gravity and collision detection with tile maps without relying on the platformer physics engine
it seems they don't have their won velocity or smthg too
they only move in groups
Damn. I also need to complete my version of boids
Me and Leterax was playing with gpu version, but there was some inaccuracies causing trouble
@jovial fable you should probably give your images a blank background, although that's not really to do with the code
ah yeah, i just print screened something and put the background because i'm lazy af
want the code right before be annoyed with transparency
fair enough
try making the boids avoid collision but stay close
i think that the problem is that they're overlapping
@jovial fable 
They don't collide i think, but the area where avoidance is applied is smaller than the sprite and round.
I need to play with the coefficients i put between attraction, tracking and avoidance
run it off the center x and y and make a radius from that
But i'm more concerned with
They always end up going in the right direction
And they get stuck and lose everything on the corner of the screen
make it so that they are repelled from a certain radius from the edge of the screen
Ah to keep them
That would be a solution
I think my problem comes from, i look ahead of their current direction with euclidian distance
But i'm not sure what happens here when they go on a corner
I only use thoroidal distance for attraction i think
i'm going to pretend i know what that is
i don't know big words like thoroidal and euclidian
and corner
time for the online dictionary```
corner
/หkษหnษ/
Learn to pronounce
noun
1.
a place or angle where two sides or edges meet.
"Jan sat at one corner of the table"
2.
a location or area, especially one regarded as secluded or remote.
"fountains are discovered in quiet corners and sleepy squares"
on another note, what do you think of the art for the weapons in my game?
gimme a sec to grab the rest
pretty nice
unfortunately, i am experiencing a bug that seems hell bent on hiding these from my code
just the hammer where the handle is a bit short in my opinion
ok
k, cool
could u help me fix the bug? i've got a vid of it
jsut suggestion
i'd rather look at code, and i have no idea if i can help you ๐ฎ
i'm at work so videos erh
oh, ok
i'll send u the code
the bug is that when i press the button, it signals that it activates but it doesn't show/change the image
at what line?
173, about here: ```python
for event in pygame.event.get():
if event.type == pygame.KEYUP and weapon == True:
pygame.mixer.music.load('button_sound.mp3')
pygame.mixer.music.play(0)
suwrite = open(su, 'w')
s1 = open('save-txts\sword1.txt')
s2 = open('save-txts\sword2.txt')
s3 = open('save-txts\sword3.txt')
s1r = s1.read()
s2r = s2.read()
s3r = s3.read()
snuh = sn.read()
if snuh == '1':
suwrite.write(s1r)
print(suwrite)
print(s1)
elif snuh == '2':
suwrite.write(s2r)
print(suwrite)
print(s2)
elif snuh == '3':
suwrite.write(s3r)
print(suwrite)
print(s3)
that is my estimation of where the error is
also, corrupted bash blade is a legit name for a sword, do not question me
so you sure that the if condition is fulfilled (pressed up)
does "snuh" = smthg
snuh == sn == sword-num.txt
tried to launch your games, but i didn't went to weapon selection :p
but it looks very pretty and cool
thx!
i'm working on it with @delicate totem
anyway, i gtg now, but if u find an answer, private message me? thx ๐
@surreal furnace did you try with readline? i think the problem is everytime you call snuh you "consume" a line, so the first time you have snuh you get "3", but the second time you get ""
empty strings
uh, no i didn't!
also you name a variable type
don't do this, type is a builtin
i can't test further because i have work, but maybe your problem was there
maybe not also :p
i just noticed you get a value for snuh only 1 time and not all the other time
Good enuff!
Hmm, should I just reverse engineer arcade's platformer engine for collision detection against tile layers or make it from scratch myself
also is this a good way to do capped movement speed acceleration?
elif key == arcade.key.RIGHT:
self.player_sprite.center_x += self.player_velocity
while self.player_velocity < 5:
self.player_velocity += PLAYER_ACCELERATION
actually let me finish the function
oh wait this is the wrong function lmao
def on_key_press(self, key, modifiers):
if key == arcade.key.LEFT:
self.player_sprite.center_x -= self.player_velocity
while self.player_velocity < 5:
self.player_velocity += PLAYER_ACCELERATION
elif key == arcade.key.RIGHT:
self.player_sprite.center_x += self.player_velocity
while self.player_velocity < 5:
self.player_velocity += PLAYER_ACCELERATION
pardon me I just woke up
@lunar jetty This:
while self.player_velocity < 5:
self.player_velocity += PLAYER_ACCELERATION
Is largely equivalent to:
self.player_velocity = 5
(Within rounding error, assuming a small enough value for PLAYER_ACCELERATION)
Maybe you meant to use if?
self.player_velocity starts as 0 and frame by frame increases by PLAYER_ACCELERATION
and yeah I guess I wanted to use if
but it increases until it hits the cap (here 5) and when it does it stops increasing the speed and just changes position
@potent ice do compute shaders have a similar limitation to unroll for loops like vertex shaders?
If not we could just try a O(n^2) approach and loop over all of them
But can they have any size?
yes
II though vertex shaders only went to like 1028 or 4096
Because they somehow unroll the loop
Still, it would probably be inefficent to use large loops in a compute shader because each invocation runs in a different shader core and you want to parallelize the execution
But it wil work at least ๐
Unless you reach the 5-10 second gpu stall limit most drivers have killing the process
I had to disabled that on my computer when doing extremely heavy calculations (compute shader running more than 10s)
I was hoping to make a tutorial on compute shaders covering the basics some time in the near future
I'm not an expert, but at least covering the basics..
That would be awesome
I get how to use them for easy stuff
But stuff like shared memory???
Or how the workgroups interact with each other
Yeah. It's all a bit abstract ๐
I get the concept of shared mem, but when do I actually need/use it? And is it actually that much faster?
It gets a bit easier in 5.6 with image unit support. Easier to visualize what you are doing.
Nice!
If only I knew what that means haha
That's why you should play with it soon
Is this chanel for talking about PyOpenGl?
Is there a recommended way on how to go about scaling fonts? My way would be to design the game at a certain resolution, let's say 1280x720, use that as a fixed point and then simply do e.g. font size 18 * ( higher_res / 1280). Anyone got a better idea?
Whatโs wrong with that method?
I am just curious if my thinking is correct.
Maybe there are better ways somebody thought of
@potent ice when will 5.6 be released? Or ready for me to build
And any other cool features coming with 5.6, or are you saving them for 6.0 hehe
Hey guys, I'm making a game for my capstone using python. Why do you guys think is the easiest video game controller to implement in python?
Just anything xinput?
console text input CYOA is obviously the easiest
I mean a game controller as in a gamepad, sorry
what are you using to make the game?
Pygame?
if so, most controllers work, but the layouts differ from controller to controller
I'm coding my game from the ground up without using a game engine, the game is playable with a keyboard, but I was hoping to add controller support without adding something like pygame
you might be able to do it with the serial library, idk
Anyone know how to get a walk grid working? I currently have it in my player movement so that when they move in any direction, if they are not on a multiple of 50, they will keep going until they hit the next multiple of 50. Probably better ways of doing this but I keep having errors.
@hidden fog Linux? Windows?
I recommend pulling in pyglet for gamepads, but if you want to do it the hard way:
https://gist.github.com/rdb/8883307 (Windows)
https://gist.github.com/rdb/8864666 (Linux)
@hidden fog if you are fine just supporting Xbox controllers, using the XInput API is more reliable: https://gist.github.com/dcoles/4378653
Hi all! I've posted this in kivy support as well, but it's not quite related to kivy - it's more of a graphics/math question.
I'm experimenting with switching my game's camera from a simple translate/clip view to something similar to gluLookAt/gluPerspective. I've done this, but then my screen-to-world mouse coordinate translation is no longer working, the translated coordinates always remain within a fraction of a pixel to a few pixels from look_at's eye_x/eye_y/center_x/center_y.
I've spent a few weeks researching and learning more about how this all works, but I'm still at a loss as to what additional step is needed to use the matrices in order to achieve my goal. I've tried many different solutions, but I'm sharing the original screen_to_world method I was originally using, along with the prior camera view method, in an effort to help communicate my goal and not confuse the issue.
Here is a single file that should represent the issue I'm running into, though it will require that you have kivy installed.
https://gist.github.com/spinningD20/951e49cb836f08c434a0e9ab0e90c766
I'd appreciate any help!
@potent ice its projection * model * camera right?
@fierce wraith Normally proj * cam * model
It's extremely obvious when they have the wrong orientation
i ended up scratching my idea anways hehe. but thanks!
I tried a few different orders, with and without calling inverse, without success
I never manage to reason about this
Either it just works or i'm done for
gosh golly gee
I still can't grasp how to do player movement acceleration in Arcade
nothing works, it goes to capped speed instantly no matter what I try
Hm. I can take a look if you want me to
what I currently tried looks like this
def on_key_press(self, key, modifiers):
if key == arcade.key.LEFT:
while self.player_velocity < 5:
self.player_sprite.change_x = -self.player_velocity
self.player_velocity += PLAYER_ACCELERATION
elif key == arcade.key.RIGHT:
while self.player_velocity < 5:
self.player_sprite.change_x = self.player_velocity
self.player_velocity += PLAYER_ACCELERATION
Ah.
am I supposed to do some logic in on_update instead?
how would the logic look more or less in on_update then?
because I can't visualize it in my head
so acceleration shouldn't be a constant then?
or did I not understand the previous message
No, you change it depending on what key the user is pressing
bleh, I keep getting tangled up in this
by golly this is hard
everyone keeps telling me
vel += acc
pos += vel
but that's much easier said than done
it's never so simple no matter how I try to get to it
ignoring the fact that the if statement will return an error asking for the "modifiers" parameter, am I doing this right so far?
def on_update(self, delta_time):
self.physics_engine.update()
if self.on_key_press(arcade.key.LEFT):
if self.player_velocity > -5:
self.player_velocity += self.player_acceleration
self.player_sprite.change_x = self.player_velocity
elif self.on_key_press(arcade.key.RIGHT):
if self.player_velocity < 5:
self.player_velocity += self.player_acceleration
self.player_sprite.change_x = self.player_velocity
def on_key_press(self, key, modifiers):
if key == arcade.key.LEFT:
self.player_acceleration = 0
self.player_acceleration = self.player_acceleration - PLAYER_ACCELERATION
elif key == arcade.key.RIGHT:
self.player_acceleration = 0
self.player_acceleration = self.player_acceleration + PLAYER_ACCELERATION
the on_key_press is most likely wrong
There's no sense setting player_acceleration to zero
You'd probably want something like:
self.player.change_x += acceleration
if self.player.change_x > SPEED_LIMIT
self.player.change_x = SPEED_LIMIT
...in the on_key_press?
what's the point of doing acceleration logic there? it'll instantly rise to the speed cap
and the point is to build up speed
I ain't making an IWBTG
it's a wonder I can't find any tutorial or stackoverflow or anything really that explains this
and I set it to zero because unless I do I can for example press "left" 5 times and once I press "right" it'll be as though I pressed "left" 4 times still
also how do I even deal with the modifiers parameter in an if statement
if I don't need it
eh, I'm still new so I get lost easily, but I have to start somewhere
if self.on_key_press(arcade.key.LEFT, not arcade.key): this is probably wrong
and if I can't do it this way then I have no idea how to do game logic for that in on_update
Sorry, in on_update. But there is no reason in on_keypress to set the variable to zero, then immediatly set it to a different value.
I'm honestly lost at this point
Something like:
def on_update(self, delta_time):
""" Movement and game logic """
# Calculate acceleration based on the keys pressed
if self.up_pressed and not self.down_pressed:
self.player_sprite.change_y += ACCELERATION_RATE
elif self.down_pressed and not self.up_pressed:
self.player_sprite.change_y += -ACCELERATION_RATE
if self.left_pressed and not self.right_pressed:
self.player_sprite.change_x += -ACCELERATION_RATE
elif self.right_pressed and not self.left_pressed:
self.player_sprite.change_x += ACCELERATION_RATE
# Call update to move the sprite
# If using a physics engine, call update on it instead of the sprite
# list.
self.player_list.update()
def on_key_press(self, key, modifiers):
"""Called whenever a key is pressed. """
if key == arcade.key.UP:
self.up_pressed = True
elif key == arcade.key.DOWN:
self.down_pressed = True
elif key == arcade.key.LEFT:
self.left_pressed = True
elif key == arcade.key.RIGHT:
self.right_pressed = True
def on_key_release(self, key, modifiers):
"""Called when the user releases a key. """
if key == arcade.key.UP:
self.up_pressed = False
elif key == arcade.key.DOWN:
self.down_pressed = False
elif key == arcade.key.LEFT:
self.left_pressed = False
elif key == arcade.key.RIGHT:
self.right_pressed = False```
@potent ice one of the examples is conways game of life right?
Was that done in a compute shader? Or is that another project I can start on hahah
And cs can write to textures like any other shader right?
@lunar jetty Full working example at: https://github.com/pvcraven/arcade/blob/master/arcade/examples/sprite_move_keyboard_accel.py
Okay so that works
now the next problem would be lowering the change_x when releasing the key
by the way thank you for spending time and effort to help me, I really appreciate it when someone puts effort in to help me learn
You want friction?
Something like:
if self.player_sprite.change_x > FRICTION:
self.player_sprite.change_x -= FRICTION
elif self.player_sprite.change_x < FRICTION:
self.player_sprite.change_x += FRICTION
else:
self.player_sprite.change_x = 0
if self.player_sprite.change_y > FRICTION:
self.player_sprite.change_y -= FRICTION
elif self.player_sprite.change_y < FRICTION:
self.player_sprite.change_y += FRICTION
else:
self.player_sprite.change_y = 0```
not sure what should I set FRICTION to then, because I tried a few values and it ends up slightly moving right after slowing down instead of down to a halt
I solved it though
by doing this:
if self.player_sprite.change_x > 0:
self.player_sprite.change_x -= FRICTION
elif self.player_sprite.change_x < 0:
self.player_sprite.change_x += FRICTION
else:
self.player_sprite.change_x = 0
well
kind of anyway
but that's probably because of my speed limit
yup
fixed it
meanwhile don't mind me trying to figure out why doesn't the sprite change textures when I change directions
I don't get it, I'm sure everything is done correctly
class Player(arcade.Sprite):
def __init__(self):
super().__init__()
texture = arcade.load_texture("sprites/chad.png", scale=PLAYER_SCALING)
self.textures.append(texture)
texture = arcade.load_texture("sprites/chad.png", mirrored=True, scale=PLAYER_SCALING)
self.textures.append(texture)
self.set_texture(TEXTURE_RIGHT)
def update(self):
self.center_x += self.change_x
self.center_y += self.change_y
if self.change_x < 0:
self.set_texture(TEXTURE_LEFT)
if self.change_x > 0:
self.set_texture(TEXTURE_RIGHT)
if self.left < 0:
self.left = 0
elif self.right > SCREEN_WIDTH - 1:
self.right = SCREEN_WIDTH - 1
every constant in this example is defined correctly
the issue must be outside the player class because I tried legit copy-pasting the example from arcade.academy and it still didn't work
I guess for some reason I just can't do the character facing direction logic inside the class and have to do it in on_update instead
possible bug question mark?
Off-hand I can't see anything that looks off.
You might try a graphic that is easy to tell left/right like:
":resources:images/enemies/bee.png"
You might try printing after the lines like self.set_texture(TEXTURE_LEFT)
Just to make sure you get there.
I think the chad meme is easy enough to tell left from right
and copy-pasting this facing logic code into on_update makes it work
after changing from self to self.player_sprite of course
I honestly don't get it lol
but it works
it just works
@fierce wraith CS can write to images. It's a bit different, but yes you could make conway's game of life with fragment or compute. The existing example is using a fragment shader.
Hi all, I'm going to ask just once more here, I'm trying to solve a screen to world coordinate conversion issue, using modelview/projection matrices and normalized screen coordinates. I have made a short video here displaying the issue, and I will link to the standalone example.
How do I fix this? Relevant code example here:
https://gist.github.com/spinningD20/951e49cb836f08c434a0e9ab0e90c766
https://gist.github.com/spinningD20/951e49cb836f08c434a0e9ab0e90c766
If anyone has any ideas, I'm all ears. Thanks!
sorry to say this, but i have no idea how code in 2d, let alone 3d, so unfortunately, i can't help you ๐ฆ
but ask @foggy python and they'll probably be able to help
since we're on arcade is there a way to change the scaling of a sprite? I'm trying to zoom in on a sprite (scale it up) via the scroll wheel. I can increment the sprite's scale property with the on_mouse_scroll() method, but come render time, nothing seems to have changed. If I initialize the sprite with a different scale, it works, but I can't seem to change it dynamically. Am I missing something?
@potent ice would a cs be any faster than a fs?
@fierce wraith Probably slightly faster because you bypass the geometry pipeline, but what matters more is the flexibility it provides. You can do things like order independent transparency and reduce the number of writes in cases were additive blending is used.
Ah ok
@potent ice is this something I could use to learn about shares mem and workgroups etc?
I really need a refresher on the topic myself. Been 5 years since I used any of the fancy features
will arcade's on_draw method redraw sprites with updated scale factors? I can't seem to get it to re-render with a different scale
Anyone know a good game engine for python?? Not panda or pygame..
make your own!
Hey can anyone help test a text game i made i'm new to python
@scenic stagsure send me the .py file๐
i put it in #303934982764625920
just relised i left the cheat code i used for testing in ๐
boblol
๐ข
@scenic stagcan't find it
I still need a game engine . Please help
@scenic stagwhat??
@potent ice oh wow! i was pretty afraid of running into problems with looking up the texture 9x per cell, but im watching a talk on cs rn and they said the SIMD can run the instructions concurrently. so while one thing is waiting for mem access, the other can do calculations!!
thats so cool
@abstract zephyr what do you use to code python?
@scenic stagI still use built in IDE and notepad++. Tried sublime but got bored
@scenic stagwhat about you??
i use pycharm
i dont know how to set up notepad++ put put that file in notepad++ and run it
Do you read webnovels??
no what are they?
Never mind๐ . Search in google .
seems kinda off-topic
@scenic stagwhat
dw lol
@fierce wraithtrue๐
did you get the game to work?
@abstract zephyr why do you not want to use pandas3d or pygame?
@scenic stag for testing your game, posting it in #303934982764625920 and then talking about it in #360148304664723466 would probably be best.
ok ty
@fierce wraithI am bad at all types of c and java . And unity uses c.
I used panda for a while
arcade, is a easy to learn framework
pyglet?
arcade is made by @frozen knoll
hm, before you get your hopes up, python is a pretty slow language, 3d games are pretty hard to make in pure python
Depends how complex they are
i assume you want something like what you could make with unity
@fierce wraithbut its the only language I am good at . I know other languages but am not very good
well what do you want to make
hm
@fierce wraithso?
Just use pyglet or something then? It supports 3d
@potent icereally??
I am busy with school. So I did not bother testing all of them
@potent iceno problem
can you get away without writing shaders for pyglet? thats pretty cool
Yeah, but it's GL2.1, so no shaders needed
ah ok
godot seems to have a python like scripting lang
moderngl if you want to go hardcore ๐
haha yes!
should i use a buffer for the game of life or a texture?
probably a texture right?
texture yes, because it's easy to get wrapping on the edges
is there a bool texture? haha
repeat I mean
i really just need one bit hah
Easier to just use 1 component f1 texture
.. but you want to use RGB because @hybrid badger will kill you if you don't make the color version
well i can color afterwards
post processing!
hm in this example i found:
https://github.com/markkilgard/opengl4_examples/blob/master/filter/convolution.glsl#L35 they use a image2D not a sampler
is there a significant difference?
they also have this function:
void retirePhase() { memoryBarrierShared(); barrier(); }
for some reason they are syncing mem for every thread..
image2D uses image units, not texture units
whats the difference?
ah since i only ever read or write but never both that sounds fine to me
Don't fuck up the readonly/writeonly flags.. is my tip. That shit leads straight to hell ๐
That's glsl functions
oh nvm. image2D is the glsl type. We bind them using Texture.bind_to_image
gotcha
shared vec4 pixel[NEIGHBORHOOD_HEIGHT][NEIGHBORHOOD_WIDTH]; // pixel values read from input image
void general()
{
const ivec2 tile_xy = ivec2(gl_WorkGroupID);
const ivec2 thread_xy = ivec2(gl_LocalInvocationID);
const ivec2 pixel_xy = tile_xy*tileSize + thread_xy;
const uint x = thread_xy.x;
const uint y = thread_xy.y;
// Phase 1: Read the image's neighborhood into shared pixel arrays.
for (int j=0; j<NEIGHBORHOOD_HEIGHT; j += TILE_HEIGHT) {
for (int i=0; i<NEIGHBORHOOD_WIDTH; i += TILE_WIDTH) {
pixel[y+j][x+i] = imageLoad(input_image, read_at);
}
}
}
retirePhase();
// Phase 2: Compute general convolution.
vec4 result = vec4(0);
for (int j=0; j<filterHeight; j++) {
for (int i=0; i<filterWidth; i++) {
result += pixel[y+j][x+i] * weight[j][i];
}
}
// Phase 3: Store result to output image.
imageStore(output_image, pixel_xy, result);
}```
this looks about like what i want
but i dont get why they are using shared memory. they end up having to sync it with retirePhase
const ivec2 tile_xy = ivec2(gl_WorkGroupID);
const ivec2 thread_xy = ivec2(gl_LocalInvocationID);
const ivec2 pixel_xy = tile_xy*tileSize + thread_xy;
const uint x = thread_xy.x;
const uint y = thread_xy.y;```
that part is just black magic to me haha
I would read this carefully: https://www.khronos.org/opengl/wiki/Compute_Shader#Outputs
But probably easier to start playing with visualizing things in a texture first so it's easier to understand the difference between work groups, local and global incovation
im doing image load store ops right?
imageLoad is like a texelFetch
mhm
my work groups will be the size of the kernel right?
so i think im starting to get how it all fits together.
you have single "threads", they are like what pixels are to the fragment shader
the threads are grouped into thread-/workgroups and are executed in parallel on SIMD chips. but the gpu has a lot of these groups.
I'm trying to wrap my head around it as well. Been so long, but I'm busy release stuff now
I need some help with this issue. If you notice the first box, the first line is a lot shorter than the third. My code allows to set a max width and the string "textbox" did not fit into the first line, but "test " fit into the third. What I need to do is to justify this. I am not quite sure how to go about it. Measure the first line, then restrain the rest to that size? But what if the problem arises in the next line again?
This is the line breaking code: https://hastebin.com/sifayasasi.py
Note: self.multi_line_manual just prints the lines it gets in the list, without any further text formatting
Did what I just said, restricting based on the first line, on the first box it is better now, but on the third the issue reversed itself. But even if I do a recursive to account for that, I may have the issue again on another line. This is hard :D.
@fierce wraith moderngl 5.6 is out now. pip install -U moderngl ๐ฅณ (since you asked earlier)
You are thinking about moderngl-window
Two different things, but yes.. that will be released very soon as well
Ah. Right
@fierce wraith there is an example for compute shader writing to texture in examples/ in case I did not mention it
Ah. Thanks!
Hmm pygame seems to be quite slow
29 fps on a not so slow machine with in i5 6600K and a AMD RX480 8GB
Each of those boxes is one surface and is drawn via blit
Anyone got any experience there?
@potent ice im gonna want this kind of loop for the kernel right?
for (int j=-1; j<=1; j++) {
for (int i=-1; i<=1; i++) {
...
}
}```
that will give me values from (-1, -1) to (1, 1) right?
Compute shader?
If so.. I would find an example doing something similar and dissect that first
yeah ๐
It's so easy to approach thing the wrong way with compute shaders in the beginning. Reset everything you know about shaders and start from scratch ๐
when binding a texture, why would i not allow read and write?
@potent ice
self.texture01.bind_to_image(0, read=True, write=True)
it it just for speed reasons?
Okay, I have kind of solved it. I have added pygame.HWSURFACE to every surface (I've assumed that is done automatically on a directx surface window) and .convert() to the close button image after loading it. That did the trick. Not that anyone cares.
@still shard ah right. I think I had a similar problem before.
i assume this will fail catastrophically:
# bind the textures
self.texture01.bind_to_image(0, read=True, write=True)
self.texture02.bind_to_image(1, read=True, write=True)
# run the compute shader
self.compute_shader.run(group_x=self.num_group)
# render the result
self.texture01.use(location=0)
self.quad_fs.render(self.program)```
but i think that should work.. maybe?
not sure on the group_x thing.
its a 3x3 kernel..
so shouldnt i also have a group_y?
Well. read-write is legal at least, but I have no idea about performance
I'm as clueless as you ๐
only one way to find out then!
๐ฃ
haha
0(12) : error C1318: can't apply layout(r8ui) to image type "image2D"
0(12) : error C1314: can't apply layout(size1x8) to float image
0(12) : error C7596: OpenGL requires image variables declared without using the 'writeonly' qualifier to have a format layout qualifier
0(14) : error C1318: can't apply layout(r8ui) to image type "image2D"
0(14) : error C1314: can't apply layout(size1x8) to float image
0(14) : error C7596: OpenGL requires image variables declared without using the 'writeonly' qualifier to have a format layout qualifier
0(29) : error C1115: unable to find compatible overloaded function "imageLoad(struct image2D_bindless, vec2)"
0(41) : error C1115: unable to find compatible overloaded function "imageStore(struct image2D_bindless, ivec2, uint)"```
great start
How did you create the texture?
self.texture01 = self.ctx.texture((256, 256), 1, dtype='u1')
@einarf I am surprised nobody picked up on the slipsum though ๐
this seems to say r8ui is a fine format
https://www.khronos.org/opengl/wiki/Layout_Qualifier_(GLSL)
Try fixing the other errors first.
the others are complaining about it being a image2D_bindless @potent ice
because it cant bind the image
can't apply layout(size1x8) to float image is complaining about the uint size of 1x8 bytes
OpenGL requires image variables declared without using the 'writeonly' qualifier to have a format layout qualifier is because it then somehow doesnt even use the format
unable to find compatible overloaded function "imageLoad(struct image2D_bindless, vec2)" is because it couldnt even bind the image2D
uimage2D maybe?
@still shard Sorry. I don't use pygame that often ๐ฆ
still thinks it isnt bound
but i bind them
self.texture01.bind_to_image(0, read=True, write=True)
I've mainly worked on RBG8 textures in writeonly mode
For lighting calculations (deferred lighting)
@fierce wraith Start simpler if you get in trouble ๐
i might be onto something!
@potent ice whats the difference between binding and location?
layout(binding=0, rg32f) uniform image2D input_image;
vs
layout(location=0, rg32f) uniform image2D input_image;
ok
i finally found the bug
its at compile time. not when executing
if i leave the imageLoad call out its fine
nvm
its just my stupidity
imageLoad takes a ivec2 not a vec2
imageRead and write both use gvec4 so there is no point in using the r8ui format, ill just have to write a uvec4(value, 0,0,0) that way.
what format should the data i write to a texture have?
can it just be a np array? should i flatten it?
@potent ice well atleast no more errors. it doesnt do anything i would expect but oh well..
you can run it yourself if you want,
https://github.com/Leterax/Visualization/tree/master/ConwaysGameOfLife
in arcade is it preferable to zoom in on a sprite by scaling it or by changing the viewport?
I have basically 2 sprites on screen and I want to be able to "zoom in" on them with the scroll wheel
in that case zoom the viewport
bleh, I have trouble doing jumping dependent on how long I hold down the jump key
I'm new to this, but could you start some sort of counter on key_down, and then determine how long the held the key
and then resolve it on key_up?
though that means you end up jumping on key_up which might be slightly later than you wanted
What have you done so far?
all I tried so far I scrapped and deleted because it hasn't been getting me anywhere
btw I'm doing this in arcade
I think the best way to implement this is to have a jump factor, for example 50, and each tick if the space key is pressed, you augment the player vertical velocity by this factor, and decrease the jump factor of 10, for example. And you reset the factor when the player is back on the ground
yeah but then I try to do it along with a check for if I can jump (because I don't wanna be able to jump into infinity) and my head becomes mush
Yeah, that's why you should decrease the jump factor
At some point it is going to reach 0
that's not what I mean
I get it, that sort of things can be really hard at the beginning
@still shard I got the zooming to work with set_viewport thanks! A followup: It looks like my mouse-click actions are using the mouse's raw position as opposed to its relative position with respect to the new viewport. Is there a preferred solution to this or do I need to calculate my mouse's relative position by hand?
I've never used this library, sorry. I don't know which functions they provide
I have just drawn from my experience with systems like that
I see. From a quick search, I can't seem to find a built in function. How would I calculate my mouse's relative position in the viewport?
Subtract the widget position to the absolute mouse position?
I swear how can this be so difficult to do it's such a simple concept I wish I could just figure it out because I'm going out of my mindnightmarenightmarenightmare
for reference I want the jumping to work more or less like in Cave Story
I want the movement to be more floaty, I hate the movement that's in every tutorial I can find
just sliding it at constant speed like I was playing IWBTG
Have you tried my idea? If you multiply the factor by a scalar instead, the jump should be pretty floaty
I've been at it for hours now and what you said now just flew over my mushy head
@keen bison Calculate adjusted mouse clicks by 'hand' so to speak. Add in the left/bottom viewport and adjust for scaling.
@frozen knoll I'm trying to do the mouse calculation by hand now. One more thing I need to figure out is how to get the 'zooming' centered around the mouse (which can only be solved after I figure out how to get the adjusted mouse position)
I've messed with the scaling factors just to see what would happen
I can get it to zoom "centered" around 0,0 , the center, and the top right corner
I know there's some formula I can extract to make it center around any arbitrary point, but it's just not coming to me right now
Yes, times like this is when we wish we could go back to the math teacher and ask questions.
Or, at least, that's been my experience.
I'm having that experience right now
It should just be more or less an offset
What do you mean?
Like, if you want to zoom by 150%, you would just divide the current screen size by 1.5, and you can move it by the difference between the middle of screen and the mouse, divided by 1.5 too
It is for arcade, right?
yeah
god I'm so frustrated at this point
I kid you not
no matter how I try to jam it together it won't work
I don't really know arcade, do you have a link to the docs of whatever function you use to actually zoom the screen?
Thanks
along with the analogous get_viewport
get_viewport returns a four element tuple?
yeah, the left, width, bottom, and height
Okay, and to get the mouse position?
I'm using the coordinates returned by the mouse press handler
err, in this case it's scrolling so
that to be more precise
Okay thanks
and I'm using get_size() which returns my window (not viewport) width and height that I'm making a fraction to determine my aspect ratio
that's what I'm using to scale thing by when I zoom for now
I don't really understand what left, width, bottom and height correspond to
from what I've seen, left is the coordinate that the left of your viewport is anchored to. As in if your viewport is literally your window, then your left and your bottom is 0
and I think width and height is how many pixels from the original view to show? I'm not entirely sure
nope width and height is just how big the viewport is
somewhat unrelated to the original view
left and bottom is just where the viewport anchors on the original view
zoom_factor = 0.5 # zoom in by 2
m_x, m_y = ... # Mouse coordinate
left, width, bottom, height = get_viewport()
width *= zoom_factor
height *= zoom_factor
left = m_x - (width / 2)
bottom m_y - (height / 2)
set_viewport(left, right, width, height) ```Something like this?
If I get all variables and parameters right, which I probably didn't
I will try it out. Only thing I've noticed is that if I zoom both width and height by the same factor, it stretches strangely
I had to multiply them by the aspect ratio of the screen
in my case 16:9
I kinda get it working but now I also need to make it so that if you already jumped and you let go of and press jump again in mid-air it doesn't react
yeah any factor of the aspect ratio seemed to work fine
I just used 16:9 in my experiments
because as it is now, infinite chain jumps
perhaps you can set a boolean indicating that you're jumping?
and check the boolean when you attempt to jump?
that won't work because the function checks for a key press once per every frame
You can just check if you have any vertical velocity when you want to jump, and only jump if it is equal to zero
weird thing is for whatever reason when I'm touching the ground my vertical velocity is always -0.2
it's really weird
may be
omg okay I think I finally got a working prototype
def on_update(self, delta_time):
if self.z_pressed:
if self.can_ext_jump:
self.player_sprite.change_y = self.player_jump_accel
self.player_jump_accel -= GRAVITY
if not self.z_pressed:
if self.player_sprite.change_y != 0:
self.player_sprite.change_y -= GRAVITY
self.can_ext_jump = False
if self.player_sprite.change_y == 0:
self.can_ext_jump = True
self.player_jump_accel = PLAYER_JUMP_POWER
oh yeah forgot one line
there
@frozen knoll sorry to bother but do you have any idea why would setting the gravity constant to anything less than 0.3 in the platformer engine make glitches? Because for debug purposes I put in a print command that returns the player sprite's change_y every frame and it was jumping from 0.0 to -0.4 or worse (varies with exact value) and rendered any manner of collision check with walls useless
and I'm sure it's because of the gravity constant because all I had to do was to increase it to fix the issue
Know how told use ragdoll in pygame. I's itโs possible?
ok. i am so confused right now..
@potent ice i decided to go as simple as possible, just copying the texture with a cs. so kernel_size of 1
layout(local_size_x=1,local_size_y=1) in;
invoke the cs with full dims of the texture
self.compute_shader.run(720, 720, 1)
and this is my very simple cs:
const ivec2 pixel_xy = ivec2(gl_GlobalInvocationID.xy);
vec4 pixel = imageLoad(input_image, pixel_xy);
imageStore(output_image, pixel_xy, pixel);```
that produces the image seen above
but if i add a /2 to the pixel_xy in the imageLoad call:
vec4 pixel = imageLoad(input_image, pixel_xy / 2);
it works...
wtf
now i can also up the kernel size and it works fine
but why the /2???
@fierce wraith What's the fomat of the texture.. and what format do you use in the shader?
paste the lines?
self.texture01 = self.ctx.texture((720, 720), 1, dtype='f4')
layout(binding=0, rg32f) uniform image2D input_image;
Do you see the error in the first line?
yes
and f4 is f64?
components refers to RGBA
i just copied it from:
https://github.com/moderngl/moderngl/blob/master/examples/compute_shader_render_texture.py
nvm, f4 is float32
so why does it work in the example?
layout(binding=0, r32f) uniform image2D input_image; is correct for the texture im using?
self.texture01 = self.ctx.texture((720, 720), 1, dtype='f4')
means one component f4 texture
so r32f
yep
yeah that fixed it
So I guess the image read got clamped when reading outside the image memory area yielding black
yeah:
Load operations from any texel that is outside of the boundaries of the bound image will return all zeros.
https://www.khronos.org/opengl/wiki/Image_Load_Store
bingo
but why does it work in the example?
they are using a 1 component texture but a 2 component layout
oh shit. I need to fix that then ๐
I was hoping to only throw ๐ฉ at you, but it came back the other way instead
haha
Probably redoing it using rgb texture instead
generate something slightly more interesting
so now rainbow waves? hehe
yeap, showing the different variables in each channels
nice
well..
something is happening
no fucking clue what
or why
so first i read the surrounding pixels and then i average them
ah
it works!
@potent ice can i set the components of a texture and the format after loading it from a file?
self.t = self.load_texture_2d('test.png')
self.t.swizzle = 'R000'
self.t.components = 1
self.t.dtype = 'f4'
```?
is that good enough?
What are you trying to do?
well rn its a blur kernel so id like to try blurring a image
I don't understand how that is related to the texture format ๐
well i need to get the image into a texture and then bind it to my cs
and i though they have to match format
or should i just change the cs format to rgba32f?
That's probably easier
self.texture02 = self.ctx.texture((720, 720), 4, dtype='f4')
and
layout(binding=0, rgba32f) uniform image2D input_image;
and
self.texture01 = self.load_texture_2d('test.png')
rgba8 I guess
ah
but make sure the texture actually has alpha channel
yay ๐
You can do game of life with frag shader as well, but I guess that's less interesting
Now you can start throwing around the "GPGPU" word every second sentence!
hahahaha YES!!
i work with gpgpus hehe
hey @hybrid badger do you have a sec to look over my game of life logic?
if ((cell_alive == 1) && (neighbours == 2 || neighbours == 3)){
// we are alive and have 2 or 3 neighbours!
// stay alive!
}
else if (neighbours == 3){
// we are dead, but have 3 neighbours
// become alive!
}
else{
// we are either alive or dead, but don't have the right number of neighbours
// die!
}
very interesting..
blue means, i was dead before and still am
red means, i was alive and am still alive
green would be, i was dead and am not alive
but i started with a blank screen...
ahh fuck..
my blank screen is white
ofc white is rgb (1,1,1)
and ofc when i try to paint something in red in paint.. paint doesnt use actual red..
@fierce wraith https://github.com/moderngl/moderngl/blob/master/examples/conways_game_of_life.py#L46-L85
@potent ice could you help me with the switching thing?
def render(self, time: float, frame_time: float) -> None:
self.ctx.enable(moderngl.BLEND)
self.ctx.clear(51 / 255, 51 / 255, 51 / 255)
# render the result
self.texture01.use(location=0)
self.quad_fs.render(self.program)
# bind the textures
self.texture01.bind_to_image(0, read=True, write=True)
self.texture02.bind_to_image(1, read=True, write=True)
# run the compute shader
w, h = self.texture01.size
group_size_x = int(ceil(w / self.kernel_size))
group_size_y = int(ceil(h / self.kernel_size))
self.compute_shader.run(group_size_x, group_size_y, 1)```
do i just have to call
self.texture01, self.texture02 = self.texture02, self.texture01?
Looks reasonable
Could be something else
That is a broad questin
but yes, it is possible, there are several
You can also do it the other way around and use Python as an embedded scripting language in a C/C++ program
so whatever strikes your fancy
Of course, a python game engine cannot be as extensive as say Id5 and run as fast and look as good
there are limits
but it all depends on what you want to do. A small arcade game will work fine. Programming a game on the graphical level of DOOM 2016? Not so much
@abstract zephyr
@still shardsimple platformer
How long will it take
Game will look like mario snes versions
Idk how long you need
but simply use pygame or arcade
cuts down a lot of time
Or use a 2d engine like https://defold.com/. Not python, but LUA, but it works well
Making a "game engine" is a lot of work and requires experience to do right.
but if it's something you are just using personally you can of course make a lot of shortcuts
Ragdoll in pygame?
Write games, not engines
There is no ragdoll physics in pygame. It is a render engine, not a game engine per se
Shit
It's a graphics / media library
I agree with einarf, gameengines are easy to hack, but hard to get right and be able to reuse it
I really want to repeat to use defold. It cuts down the time necessary a lot
or the free version of GameMaker
No, it is not a toy, it is a serious engine
Oh wait, that one is gone
It says "The ultimate game engine for web and mobile"
So I guess platform is important to you as well here
it can also do desktop
BUt it sounds like he is not very experienced and I think an engine like that is a lot better to get your feet wet
Game programming is hard enough as it is, this can at least teach one the principles and concepts of doing so
Nothing wrong with that. Start high level and move on when you are restrained by engine limitations.
About "engine with python". I think Godot does that. It's been a while after i looked at it, though.
But yes, you can write games in python. Several engines also have a python interface. Unreal engine, blender / bge etc
i never thought about this, how will i go about generating the worlds?
@potent ice can i tell moderngl to use cap at a certain framerate?
like 3fps haha
Nah. It only supports vsync on/off
so just sleep x time at the end. fair enough
imageLoad ignores the texture wrap thing right?
so i just need to create my own function for wrapping?
ivec2 wrap(ivec2 p){
return mod(p, image_size);
}```
Never tried it, but I assume images don't follow any of the rules from samplers
yup
but that was simple enough ๐
you got any ideas on how to generate a random world?
i think just randomly setting each pixel to alive/dead will yield bad results
Look up glsl simplex noise functions
then layer those and you will get something interesting in the end
is that like perlin noise?
similar
can use perlin as well of course
Are you just generating a static texture?
Just use noise octaves : https://flafla2.github.io/2014/08/09/perlinnoise.html
Add 3 layers or something
then add some threshold
in moderngl-window 2.1, but not released yet, but you can just copy the integrations/imgui module locally
Kind of having a burnout today. Need a break ๐
def generate_world(self):
fbo_1 = self.ctx.framebuffer(color_attachments=[self.texture01, self.texture02])
fbo_1.use()
self.quad_fs.render(self.world_generation_program)
self.wnd.fbo.use()```
thats actually pretty cool!
and very simple
ok! take a break!
amazing work you've been doing
Thanks. Appreciated ๐
huh. very weird:
def generate_world(self):
fbo_1 = self.ctx.framebuffer(color_attachments=[self.texture02, self.texture01])
fbo_1.use()
self.quad_fs.render(self.world_generation_program)
self.wnd.fbo.use()```
if i first call this:
```py
self.texture01 = self.load_texture_2d('l1.png')
self.texture02 = self.load_texture_2d('l1.png')```
and then the generate function it works
but if i create the two textures like this:
self.texture01 = self.ctx.texture((720, 720), 4, dtype='f4')
self.texture02 = self.ctx.texture((720, 720), 4, dtype='f4')```
it doesnt
ah its f1 not f4 ๐
i have noise generator
you became a parent?
nerf ๐
haha love the video compression!
Yeah I tried to post pixel particlesystem with 1M points last week. I gave up.
Now fill that texture with numpy
yikes thats gonna take for EVER
@potent ice 3d ca...hmmm hahaha
3d?
Yeah 3d game of life
That would probably need some rule adjustments
ohh i would love to have imgui or whatever its called rn
i can now set a framerate at which the game runs, separate from the screen updating/input handling. it would be so cool to have a slider and go from 1fps to 2500fps haha
yay. posted it in #303934982764625920 ๐
if self.z_pressed:
if self.can_ext_jump:
self.player_sprite.change_y = self.player_jump_accel
self.player_jump_accel -= GRAVITY
if not self.z_pressed:
if self.player_sprite.change_y != 0:
self.player_sprite.change_y -= GRAVITY
self.can_ext_jump = False
if self.player_sprite.change_y == 0:
self.can_ext_jump = True
self.player_jump_accel = PLAYER_JUMP_POWER
Is there any way to make this jump slower? Other than decreasing Gravity because anything below the current value makes it glitch out when touching ground
(also this is in on_update and I'm using Arcade)
which framework should i use if im planning ot make a 2d platformer
quite literally just getting into game dev with python so dont make fun of me

I don't think it gets any easier
@lunar jetty you probably want to multiply changes to your velocity with dt, otherwise different frame rates will cause different jump speeds.
ah yes good idea
(Don't know whether that's the cause of your ground glitch though.)
@fleet basin ty