HOW MUCH CAN SIMPLE ENGINE HANDLE ??
Vložit
- čas přidán 30. 05. 2019
- Multithreaded (CPU only) version of my Simple Engine written in C++ and using SFML for graphics.
Running on a i5 7300hq and a GTX 1060.
Recording decreased performance by ~20%.
Github github.com/johnBuffer/UnitedE... - Věda a technologie
It took a lot of balls to make this video.
many balls were used in the making of this video
@@kaidatong1704 Let's spend a week celebrating the balls of different orientation and color 🌈🏴
180000 to be exact
@@explosify5035 How long did it take to count them?
I wonder if you could make a more accurate simulation of water by applying a constant force back and forth on the balls so they wiggle a lil
This also shows crystal grain structure pretty well, really cool
first I though, a bit buggy, then I remembered, those defects also happens in nature, not a bug at all
@@monad_tcp Hello, sorry to bother you, but what do you mean by that? Are the defects the empty lines between circles at the end?
And what are you referring to when you say it happens in nature too?
@@EliorFureraj15 I'm not too well read on the subject. but I believe they are speaking of how the balls naturally fall into a perfect tesselation, however between the large clumps are empty spaces. and in nature, crystal structures form these sort of semi-perfect tesselations that don't always perfectly fit together.
lmk if I helped at all, and if not I'd love to try and explain it a bit more :)
@@EliorFureraj15 there's a video about this czcams.com/video/xuL2yT-B2TM/video.html
@@capsey_ I got that within same recommendation section, almost next to this one. see screenshot for proof imgur.com/a/tp3G2UC
It's fascinating watching the waves propagating against the flow.
That's how traffic jams flow!
It's not accurate physics lmao
@@TheRealFlenuan I was thinking the same thing with propagating against the flow. It can fascinate you without beeing accurate. It's just a fun thing to think about.
@@TheRealFlenuan it's only inaccurate because the engine can't cope with granting infinite force propagation beyond n particles from the initial collision, such that the original particle must assume there's a solid floor somewhere beneath it, and now gravity goes out the window. "Turtles all the way down" should become the textbook name of this problem. Feel free to use it.
@@TheRealFlenuan These are the sames waves that cause this ? czcams.com/video/DvtbQs7hWXw/video.html
for some reason, when I watched the video, I imagined orchestra music playing in my head that got higher in pitch every time you increase the circle drop rate
Good
What you are searching for is Hall of the Mountain King
@@suwedo8677 this is exactly what was playing in my head
It's called "Synesthesia".
@@suwedo8677 совершенно не то
80k circle collisions in a respectable framerate well done! Maybe some of the computation can be batched and parallelized for additional speed.
Maybe he is using sleeping
CUDA/OpenCL/AMP - to help
But because he use SFML, he can use amp.h
It's parallelized using a threads pool library I made. But it's far from perfect, there are some bugs and the threads workload isn't very well balanced.
Imagine if he could also implement multi-threading support!
2:00 I like that shock wave that traveled backward. I remembered there is a similar phenomenon in trans-sonic flow. Been a while since i took fluid dynamic.
just noticed that. and it happens on like multiple levels afterward so cool
I've played around with these before, you see a different kinds of fluid dynamics in these systems, you can drag large objects through it and it'll simulate the vacuum area that gets dragged behind it along with the turbulence you would expect... All that from simple repulsive balls..
Looks good. Now shake it!
Amazing! It's not even close to number of atoms in a water drop!
The Matrix has some serious computing power..
It just goes
...The matrix
3:44 is a moment when you can spot a kangaroo right there.
Dear Fellow Scholars, this is Two Minute Papers with Dr. Károly Zsolnai-Fehér.
😂
This video deserves more views
Well the algorithm caught onto it so here we go
@@LuciSheppy thats exactly what i was gonna say lol
Interesting watching the various types of waves and phase transitions.
You're supposed to watch this while listening to "In the hall of mountain king". Trust me, i tried it.
youre right lol
I like how this is an indirect simulation of imperfect crystal formation
That was a very helpful deconstructed video processing demonstration.
Thank you! This is really inspiring.
Omg i didn't expect such a simple simulation to produce actual crystal grain structures identical to real materials. Including correctly simulated point imperfections and lattice faultlines! Suuuuuper cool! Ive only seen this in textbooks before, but not animated. The point imperfections were actually even flickering in this simulation, bringing them out even more! Also very interesting that there was a certain average size to the grains produced.
Beautiful and satisfying!
Okay
"Hey guys look a my rainbow balls"
- youtube recommend page 2021
This is so mesmerizing
Found it interesting how the render time kept going down as physics time increased, even when you zoomed out/in. Also you should have gone to the millions :P
That is incredible stability considering
Great job❣
That was like beautiful 3 dimensional water physics sometimes
you could see a well-established crystal structure near the beginning and molecular skips in the lattice causing all of the worm like lines travelling about.
That looks like a water simulation in the end
Quite awesome!
That’s impressive!
That's pretty impressive. I assume you put some kind of optimizations into how static collisions are calculated?
will be perfect with "In the Hall of the Mountain King" music ^^
It's amazing, the power of today CPUs..
damn I am really impressed. I probably couldn't even run 1/10000 of that using my code before my computer would explode. This is so fast.
Wow looks awesome! Just a quick question. Wouldn't it make sense to put all the the calculation inside a computeshader?
youtube reccomended me this for no reason, but kinda satisfing tho.
@CZcams Algorithm oh poop
Awesome video! How do you compile the project?
it looks nice
but how did you handle that many collisions without any unacceptable lag?!? Amazing work dudee
I love it!
this is gonna blow up
as an average SFML enjoyer, and still learning, i love this video
At the end I was waiting for the whole thing to be turned upside down
I never thought I’d witness a resinace cascade first hand
pretty colours
end result is great album cover material
Love it
This is a really nice simulation of objects generation on your computer, molecular structures, and hexagons. You can see the granules of the structure move as it grows slowly but at the end where they grew fast they are small. And hexagons because when there’s a gap between a bunch it stays till the weight of the one above it collapses it.
Short answer: 180K
Long answer: This video
1 engine was harmed in the making of this video
2:06 that effect when some wave moves up against flow is very funny :) what is it ?
It's actually a bug when collision doesn't handle velocity update correctly resulting in the object moving in the wrong direction :D
@@PezzzasWork nice bug
I was kinda hoping for a full-width barrage at the end, but cool video anyway!
Would love to know more about the implementation, making a particle sim myself. What spatial partition methods did you use? Did you have a system to stop ticking entities which weren't moving above a given threshold? Thanks!
I am using a fixed grid and nothing special happens to static objects, my approach is very basic :)
@@PezzzasWork Always great to find down to earth implementations that just work well! I'm not very familiar with C++ so I have a harder time parsing the source which is why I asked, thanks for the reply!
I've been using a Octree myself but I'm finding difficulty inserting entities in a way that spatially proximate entities will also be close in memory as to reduce cache misses... maybe I should have started with a grid!
Are you telling me 180k objects are iterated every 40ms along with a collision detection algorithm running for every single one?
i did something like this in code bullet's marble calculator, it didn't go well on that old chromebook
Frame time's gangsta unless he puts bunch of TNT's in there.
I want to play around with this so much right now
is it position-based verlet? are you using shock propagation? it looks suspiciosly stable at the bottom.
Everybody gangsta till the wall starts peeing
I see you're using my favorite cereal kix as a demonstration
Oh wait it's more like cap'n crunch oops all berries
Wow the resulting structure actually has a temperature
It is strange that the deep(defined by zone, density, and relative inactivity) parts aren't forced to settle and change into a pasive state until a neighboring zone is agitated.
i like the sound
Looks like the engine couldn't keep up and there was interpenetration especially at the larger 'flow' sizes where there was a reverse wave travelling back up the stream.
That's pretty good! Have you compared it to box2d?
I did not try to compare but I'm sure on the performance it's way faster because it's very basic. It jus handles circle - circle collisions. I made it for massive and inaccurate scenario like an army of zombies.
@@PezzzasWork "assume 5000 pergectly cyclical massless zombies" 😁
This is how rock layers are formed.
Plot twist: this uses the collision system he was trying to make that time
I call this limitation on simulated force propagation the "Turtles all the way down" problem.
Insane!
180000 objects
GD creators: gotta crank those numbers up, those are rookie numbers
the thumbnail made me think it's powder toy
Great example of sedimentary deposits over time
Now that's alotta balls
Bit rate does BRRRRR
Hey, thats pretty good! Does it have any optimization? What cpu does it run on?
fuck you and your username making middle-click scrolling impossible
@@paavorotsten508 i am able to do it fine, what happens when you do it
@@logicbuilder1204 goes sideways
@@paavorotsten508 try control zero
@@logicbuilder1204 Didn't help so I tried zooming out instead, and now I'm finally able to scroll down again
I have seen an approach to optimize such problems. All the balls in the "crustal structure" which are not moving don't need to be updated. It's possible to create an importance map of all the balls and update them accordingly.
But either way your engine is pretty good👍🏻👍🏻
You have to be careful though. Sometimes that type of optimization can lead to some not being updated when they should be getting updated
@@vibaj16 Yes, I think a conservative approach to creating the importance map is key👍🏻
Owo new skittles ad?
Interesting how having an emitter active gives you an increased render time. See 0:16 when it goes up.
I think that's due to having to perform trajectory calculations instead of just dropping the balls, that's just a guess though.
probably because it has to instantiate and create a whole bunch of new balls, though I haven't looked at the engine at all
It's vsync
@@waldolemmer The increased render time is just waiting for the screen refresh. Notice how it's glued to a 16ms total frame time (60fps) even as the sim time increases. If you look at the code, you can see that the key "E" on the keyboard is bound to both creating an emitter and to enabling vsync. It has nothing to do with trajectories (they were always being calculated) and it has nothing to do with instantiating anything.
It looks like when you put a magnet up to a tv
How do you use multithreading? Like how is the work divided up, then re-integrated?
The final looks like Perlin noise
What happens if you take away most of the friction? Like to the point it acts like water?
Multithreading or GPU?
Very cool! I also want to write my own physics engine, only using a shader.
-
Очень круто! Я также хочу написать свой собственный физический движок, только используя шейдер.
1:51 is the view count for this video for when I’m watching. Crazy to think each ball represents one of us watching. How 44,000 views seems relatively low for a CZcams view count but how large is actually is
Now 1:58
Ok now add a function where she loves me back
this is amazing
someone make a physics based game out of this
You can try "The powder toy"
@@pashadanilov3490 oh yeah thats s childhood game
Money you make per second in idle games be like:
Could you please add the solution file to the Github? I don't know how to open it
If everything had a friction of zero would it act like a fluid?
cooool
Could you put people on that land you created?
Would it be possible to get collision detection/response code?
Just added the repo in the description. The Github is a bit messy but you can find the collision detection and response code in include/access_grid.hpp and include/collision_solver.hpp
@@PezzzasWork thank you very much! I've tried to implement something similar myself but the collision response became buggy when i put ball on top of another for some reason
@@MichaeltLoL I've got the same kind of bugs tons of times while experimenting with physics. It's generally because the response is too high which leads to instability because energy is "created" . For this project in particular I used a very empirical approach with some "magic coefficients" that appeared to work fine. What also helps is to solve collisions multiple times, it can really absorb position correction overshoots which happen really often when you have a complex system with a lot of bodies. Honestly what I've learn from all my physic projects is that if you want to do things seriously, it is not that easy!
my pc would die at the second ball
Hewwo mister ObamA? HEWWOOoo?!
I would like to know what errors are in the engine
if you would give them less friction it could be a realistic water simulation
How can i compile this, Or is there a Pre compiled EXE?
this just went from few balls bouncing to fluid simulation
There should be error in physics implementation. Balls didn't preserve energy correctly on hit. So you can see stream spread go up phenomenon, which should not be
How on earth the physics time just stops growing?
1:30 thats a nice laminar flow right there. i also like how the "fluid" animation seems to get better with each step up
you’re varying the color based on the number of the balls? the color changed slower in the beginning.