Have you seen this video by John Jackson? ua-cam.com/video/VLZjd_Y1gJ8/v-deo.html It is similar to what I was intending to make in that it covers the general concepts but without any live coding or walking through functions. I'm trying to decide if I should take a similar approach but cover more things like splitting the world into chunks, adding randomness to the elements piling up, class structure, multithreading, and explosions, etc. Or should I do a simpler condensed live-ish coding session where follow along to make a very basic falling sand simulation in JavaScript and HTML canvas?
Wonder what the main loop looks like, Noita creators said they were checking positions of the particles starting from the bottoom moving up, once right to left, and then the opposite direction. For my simulation i used 4 different kind of for loops, from the bottom right, left and then from the top right and left
Currently the main loop splits the matrix into 12 columns and a thread is created for each column. Even numbered threads are launched and perform the step functions for elements in their column from the bottom up. The order in which elements in each row are stepped is random. Once even numbered threads are complete the odd numbered threads are launched. I found there was some strange behavior of elements stacking up near the borders where the columns are defined so I add a random offset to the starting 'x' of each column every frame. This multithreading has significantly improved performance.
Starting to look really good! You're coding in Java right? How are you rendering the pixels at the moment? Are all the particles a different shape object? Or is it like one giant texture? Aka, how many draw calls are you making because it looks quite fast!
Thanks! Yes currently using LIBGDX and Java. I do want to switch to c++ and OpenGL but currently don't know how to do that and would have to spend time switching over. If you have any recommendations let me know! I am using the ShapeRenderer object in LIBGDX to make the drawing calls. After performing all the movement logic for all elements I will again iterate through all rows and draw a square for each element. I have one optimization where I will check if the following element (and so on) has the same color as the current one and will then make one longer rectangle which reduces the amount of calls by a lot. But doesn't provide any help if a large portion of the screen is occupied by different elements. And I do see slowdown because of that. I have plans to try and make a single texture out of the whole matrix and try drawing that just once but have not tried it yet Here is the current code I use: github.com/DavidMcLaughlin208/FallingSandJava/blob/master/core/src/com/gdx/cellular/CellularMatrix.java#L124-L151
Hey! How's the tutorial video progressing? You seem to be busy with other things, naturally, but it would be nice to know if that project is still alive! This is very impressive stuff, I'm sure we'd all love to learn from you :)
Yes! I will have a lot more time in the coming months to work on this. I have the script for the tutorial video mostly completed and in a week or two will begin recording it. The video will be more conceptual with code samples. But I am also considering a code-along video series for this if I have time. I am also currently learning c++ and SFML to port this project and then will continue exploring new features. Thank you for the kind words.
This is incredible!! Would love to see that tutorial on how to code this stuff!! Very nice!
I love it! Keep up the good work
Looking forward to the tutorial.
Have you seen this video by John Jackson? ua-cam.com/video/VLZjd_Y1gJ8/v-deo.html
It is similar to what I was intending to make in that it covers the general concepts but without any live coding or walking through functions. I'm trying to decide if I should take a similar approach but cover more things like splitting the world into chunks, adding randomness to the elements piling up, class structure, multithreading, and explosions, etc.
Or should I do a simpler condensed live-ish coding session where follow along to make a very basic falling sand simulation in JavaScript and HTML canvas?
@@marf1610 Make the complicated one! Would be more appreciated!
@@mathijswy Ok thanks! That's what I wanted to do but wasn't sure if there was an audience for it.
Yes! Subbed!
Video is up on my channel!
Wonder what the main loop looks like, Noita creators said they were checking positions of the particles starting from the bottoom moving up, once right to left, and then the opposite direction. For my simulation i used 4 different kind of for loops, from the bottom right, left and then from the top right and left
Currently the main loop splits the matrix into 12 columns and a thread is created for each column. Even numbered threads are launched and perform the step functions for elements in their column from the bottom up. The order in which elements in each row are stepped is random. Once even numbered threads are complete the odd numbered threads are launched.
I found there was some strange behavior of elements stacking up near the borders where the columns are defined so I add a random offset to the starting 'x' of each column every frame. This multithreading has significantly improved performance.
github.com/DavidMcLaughlin208/FallingSandJava/blob/master/core/src/com/gdx/cellular/CellularAutomaton.java#L132-L145
Starting to look really good! You're coding in Java right? How are you rendering the pixels at the moment? Are all the particles a different shape object? Or is it like one giant texture? Aka, how many draw calls are you making because it looks quite fast!
Thanks!
Yes currently using LIBGDX and Java. I do want to switch to c++ and OpenGL but currently don't know how to do that and would have to spend time switching over. If you have any recommendations let me know!
I am using the ShapeRenderer object in LIBGDX to make the drawing calls. After performing all the movement logic for all elements I will again iterate through all rows and draw a square for each element. I have one optimization where I will check if the following element (and so on) has the same color as the current one and will then make one longer rectangle which reduces the amount of calls by a lot. But doesn't provide any help if a large portion of the screen is occupied by different elements. And I do see slowdown because of that.
I have plans to try and make a single texture out of the whole matrix and try drawing that just once but have not tried it yet
Here is the current code I use: github.com/DavidMcLaughlin208/FallingSandJava/blob/master/core/src/com/gdx/cellular/CellularMatrix.java#L124-L151
rad
Hey! How's the tutorial video progressing? You seem to be busy with other things, naturally, but it would be nice to know if that project is still alive! This is very impressive stuff, I'm sure we'd all love to learn from you :)
Yes! I will have a lot more time in the coming months to work on this. I have the script for the tutorial video mostly completed and in a week or two will begin recording it. The video will be more conceptual with code samples. But I am also considering a code-along video series for this if I have time.
I am also currently learning c++ and SFML to port this project and then will continue exploring new features.
Thank you for the kind words.
@@marf1610 sounds awesome! Looking forward to it.
Video is up on my channel!
@@marf1610 awesome! Bless ya