HOW MUCH CAN SIMPLE ENGINE HANDLE ??

  Рет қаралды 119,380

Pezzza's Work

Pezzza's Work

5 жыл бұрын

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...

Пікірлер: 353
@Champignon1000
@Champignon1000 3 жыл бұрын
It took a lot of balls to make this video.
@kaidatong1704
@kaidatong1704 3 жыл бұрын
many balls were used in the making of this video
@Champignon1000
@Champignon1000 3 жыл бұрын
@@kaidatong1704 Let's spend a week celebrating the balls of different orientation and color 🌈🏴
@explosify5035
@explosify5035 3 жыл бұрын
180000 to be exact
@Champignon1000
@Champignon1000 3 жыл бұрын
@@explosify5035 How long did it take to count them?
@glngrbread6363
@glngrbread6363 3 жыл бұрын
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
@dELTA13579111315
@dELTA13579111315 3 жыл бұрын
This also shows crystal grain structure pretty well, really cool
@monad_tcp
@monad_tcp 3 жыл бұрын
first I though, a bit buggy, then I remembered, those defects also happens in nature, not a bug at all
@EliorFureraj15
@EliorFureraj15 3 жыл бұрын
@@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?
@AbsolutelyPlasmadic
@AbsolutelyPlasmadic 3 жыл бұрын
@@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 :)
@capsey_
@capsey_ 3 жыл бұрын
@@EliorFureraj15 there's a video about this kzbin.info/www/bejne/rqavY6yKYqdliq8
@kaidatong1704
@kaidatong1704 3 жыл бұрын
@@capsey_ I got that within same recommendation section, almost next to this one. see screenshot for proof imgur.com/a/tp3G2UC
@Nukestarmaster
@Nukestarmaster 3 жыл бұрын
It's fascinating watching the waves propagating against the flow.
@MarcCastellsBallesta
@MarcCastellsBallesta 3 жыл бұрын
That's how traffic jams flow!
@TheRealFlenuan
@TheRealFlenuan 3 жыл бұрын
It's not accurate physics lmao
@kejith1004
@kejith1004 3 жыл бұрын
@@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.
@agvulpine
@agvulpine 3 жыл бұрын
@@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.
@Thesoorajtom
@Thesoorajtom 3 жыл бұрын
@@TheRealFlenuan These are the sames waves that cause this ? kzbin.info/www/bejne/eqfXk4SpbM2Kjtk
@kylaxial
@kylaxial 3 жыл бұрын
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
@skepticmafia
@skepticmafia 3 жыл бұрын
Good
@suwedo8677
@suwedo8677 3 жыл бұрын
What you are searching for is Hall of the Mountain King
@quack3891
@quack3891 3 жыл бұрын
@@suwedo8677 this is exactly what was playing in my head
@_CloudyBunny
@_CloudyBunny 3 жыл бұрын
It's called "Synesthesia".
@SirusStarTV
@SirusStarTV 3 жыл бұрын
@@suwedo8677 совершенно не то
@teenspirit1
@teenspirit1 3 жыл бұрын
80k circle collisions in a respectable framerate well done! Maybe some of the computation can be batched and parallelized for additional speed.
@silvertakana3932
@silvertakana3932 3 жыл бұрын
Maybe he is using sleeping
@vailder
@vailder 3 жыл бұрын
CUDA/OpenCL/AMP - to help
@vailder
@vailder 3 жыл бұрын
But because he use SFML, he can use amp.h
@PezzzasWork
@PezzzasWork 3 жыл бұрын
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.
@roadkinggod
@roadkinggod 3 жыл бұрын
Imagine if he could also implement multi-threading support!
@alexm7023
@alexm7023 3 жыл бұрын
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.
@clown134
@clown134 3 жыл бұрын
just noticed that. and it happens on like multiple levels afterward so cool
@SerBallister
@SerBallister Жыл бұрын
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..
@suvidani
@suvidani 3 жыл бұрын
Looks good. Now shake it!
@eltonrr1
@eltonrr1 3 жыл бұрын
3:44 is a moment when you can spot a kangaroo right there.
@yoavelbag4957
@yoavelbag4957 3 жыл бұрын
Amazing! It's not even close to number of atoms in a water drop! The Matrix has some serious computing power..
@DontWatchAdsJustRefresh
@DontWatchAdsJustRefresh Жыл бұрын
It just goes
@dradex9562
@dradex9562 Жыл бұрын
...The matrix
@danimadi3
@danimadi3 3 жыл бұрын
Dear Fellow Scholars, this is Two Minute Papers with Dr. Károly Zsolnai-Fehér.
@bobthebuilder5493
@bobthebuilder5493 3 жыл бұрын
😂
@blackdragon3638
@blackdragon3638 3 жыл бұрын
You're supposed to watch this while listening to "In the hall of mountain king". Trust me, i tried it.
@unluckypanda5448
@unluckypanda5448 3 жыл бұрын
youre right lol
@petersmythe6462
@petersmythe6462 3 жыл бұрын
Interesting watching the various types of waves and phase transitions.
@c_1947
@c_1947 3 жыл бұрын
This video deserves more views
@LuciSheppy
@LuciSheppy 3 жыл бұрын
Well the algorithm caught onto it so here we go
@Vexinal
@Vexinal 3 жыл бұрын
@@LuciSheppy thats exactly what i was gonna say lol
@dromeosaur1031
@dromeosaur1031 3 жыл бұрын
Thank you! This is really inspiring.
@AAvfx
@AAvfx 3 жыл бұрын
Beautiful and satisfying!
@raiseddd
@raiseddd 3 жыл бұрын
Okay
@spearhead30
@spearhead30 3 жыл бұрын
That was a very helpful deconstructed video processing demonstration.
@enque01
@enque01 3 жыл бұрын
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.
@XGD
@XGD 3 жыл бұрын
I like how this is an indirect simulation of imperfect crystal formation
@Nosikas
@Nosikas 3 жыл бұрын
This is so mesmerizing
@konradburnett688
@konradburnett688 Жыл бұрын
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.
@RolandOrre
@RolandOrre 3 жыл бұрын
Great job❣
@zebraforceone
@zebraforceone Жыл бұрын
That is incredible stability considering
@jomy10-games
@jomy10-games 3 жыл бұрын
That’s impressive!
@wokafish249
@wokafish249 3 жыл бұрын
"Hey guys look a my rainbow balls" - youtube recommend page 2021
@guilhermealveslopes
@guilhermealveslopes 3 жыл бұрын
Quite awesome!
@christophergreeley4880
@christophergreeley4880 3 жыл бұрын
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
@kalebbruwer
@kalebbruwer 3 жыл бұрын
That's pretty impressive. I assume you put some kind of optimizations into how static collisions are calculated?
@cantstopthis1123
@cantstopthis1123 3 жыл бұрын
this is gonna blow up
@dnsbrules_01
@dnsbrules_01 3 жыл бұрын
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.
@BossBeneBaby
@BossBeneBaby 3 жыл бұрын
Wow looks awesome! Just a quick question. Wouldn't it make sense to put all the the calculation inside a computeshader?
@angrywolfjr7164
@angrywolfjr7164 3 жыл бұрын
as an average SFML enjoyer, and still learning, i love this video
@MarcCastellsBallesta
@MarcCastellsBallesta 3 жыл бұрын
I love it!
@gimmethedata4256
@gimmethedata4256 3 жыл бұрын
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.
@thegamingdeath123
@thegamingdeath123 2 жыл бұрын
it looks nice
@kedman1095
@kedman1095 3 жыл бұрын
will be perfect with "In the Hall of the Mountain King" music ^^
@Jake629
@Jake629 3 жыл бұрын
pretty colours
@WryTrvr
@WryTrvr Жыл бұрын
That was like beautiful 3 dimensional water physics sometimes
@yodayoda4137
@yodayoda4137 3 жыл бұрын
That looks like a water simulation in the end
@sourcelocation
@sourcelocation 3 жыл бұрын
Awesome video! How do you compile the project?
@turlupouet
@turlupouet Жыл бұрын
Love it
@RedStinger_0
@RedStinger_0 Жыл бұрын
end result is great album cover material
@anothrnoml
@anothrnoml 3 жыл бұрын
i did something like this in code bullet's marble calculator, it didn't go well on that old chromebook
@Kian00
@Kian00 3 жыл бұрын
I never thought I’d witness a resinace cascade first hand
@cleanlens
@cleanlens 3 жыл бұрын
youtube reccomended me this for no reason, but kinda satisfing tho.
@cleanlens
@cleanlens 3 жыл бұрын
@KZbin Algorithm oh poop
@yudhistira7231
@yudhistira7231 3 жыл бұрын
but how did you handle that many collisions without any unacceptable lag?!? Amazing work dudee
@felulaval4742
@felulaval4742 3 жыл бұрын
At the end I was waiting for the whole thing to be turned upside down
@Alexander_Sannikov
@Alexander_Sannikov 3 жыл бұрын
is it position-based verlet? are you using shock propagation? it looks suspiciosly stable at the bottom.
@Tiniuc
@Tiniuc 3 жыл бұрын
I want to play around with this so much right now
@exel001
@exel001 3 жыл бұрын
2:06 that effect when some wave moves up against flow is very funny :) what is it ?
@PezzzasWork
@PezzzasWork 3 жыл бұрын
It's actually a bug when collision doesn't handle velocity update correctly resulting in the object moving in the wrong direction :D
@IvaHaze
@IvaHaze 3 жыл бұрын
@@PezzzasWork nice bug
@akrickok3482
@akrickok3482 3 жыл бұрын
I was kinda hoping for a full-width barrage at the end, but cool video anyway!
@ruskyivanich2107
@ruskyivanich2107 3 жыл бұрын
I see you're using my favorite cereal kix as a demonstration
@ruskyivanich2107
@ruskyivanich2107 3 жыл бұрын
Oh wait it's more like cap'n crunch oops all berries
@typicalhog
@typicalhog 3 жыл бұрын
Insane!
@blackdragoncool
@blackdragoncool 3 жыл бұрын
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!
@PezzzasWork
@PezzzasWork 3 жыл бұрын
I am using a fixed grid and nothing special happens to static objects, my approach is very basic :)
@blackdragoncool
@blackdragoncool 3 жыл бұрын
@@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!
@gabef9538
@gabef9538 3 жыл бұрын
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.
@donovanmahan2901
@donovanmahan2901 3 жыл бұрын
Wow the resulting structure actually has a temperature
@Sciencedoneright
@Sciencedoneright 3 жыл бұрын
Plot twist: this uses the collision system he was trying to make that time
@vwr0527
@vwr0527 3 жыл бұрын
How do you use multithreading? Like how is the work divided up, then re-integrated?
@miranda.cooper
@miranda.cooper 3 жыл бұрын
What happens if you take away most of the friction? Like to the point it acts like water?
@UserName-ik9qm
@UserName-ik9qm 3 жыл бұрын
i like the sound
@BirdTho
@BirdTho 3 жыл бұрын
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.
@Mark00747
@Mark00747 3 жыл бұрын
Could you please add the solution file to the Github? I don't know how to open it
@abhay_more
@abhay_more 3 жыл бұрын
The final looks like Perlin noise
@IdkwhymynamecantjustbeCody
@IdkwhymynamecantjustbeCody 3 жыл бұрын
This is how rock layers are formed.
@bluethumbbuttoneek9465
@bluethumbbuttoneek9465 3 жыл бұрын
Now that's alotta balls
@gdgames9585
@gdgames9585 3 жыл бұрын
Owo new skittles ad?
@Lol-pz9ow
@Lol-pz9ow 3 жыл бұрын
Bit rate does BRRRRR
@mr2octavio
@mr2octavio 3 жыл бұрын
I would like to know what errors are in the engine
@markoftheland3115
@markoftheland3115 4 жыл бұрын
That's pretty good! Have you compared it to box2d?
@PezzzasWork
@PezzzasWork 4 жыл бұрын
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.
@horowitzhill6480
@horowitzhill6480 3 жыл бұрын
@@PezzzasWork "assume 5000 pergectly cyclical massless zombies" 😁
@bennysh
@bennysh 3 жыл бұрын
It's amazing, the power of today CPUs..
@starshipsn1013
@starshipsn1013 3 жыл бұрын
It looks like when you put a magnet up to a tv
@auroralshine6176
@auroralshine6176 3 жыл бұрын
Frame time's gangsta unless he puts bunch of TNT's in there.
@MrBallL0L
@MrBallL0L Жыл бұрын
Proud to be in the video 👍
@Aresydatch
@Aresydatch 3 жыл бұрын
How can i compile this, Or is there a Pre compiled EXE?
@agvulpine
@agvulpine 3 жыл бұрын
I call this limitation on simulated force propagation the "Turtles all the way down" problem.
@susitu6609
@susitu6609 2 жыл бұрын
1 engine was harmed in the making of this video
@thecoolguy1233
@thecoolguy1233 3 жыл бұрын
If everything had a friction of zero would it act like a fluid?
@eco1969
@eco1969 Жыл бұрын
Great example of sedimentary deposits over time
@Luke-mf6tg
@Luke-mf6tg 3 жыл бұрын
Could you put people on that land you created?
@Ur_N0.1_fan
@Ur_N0.1_fan 3 жыл бұрын
Hewwo mister ObamA? HEWWOOoo?!
@unluckypanda5448
@unluckypanda5448 3 жыл бұрын
the thumbnail made me think it's powder toy
@priuxls
@priuxls 3 жыл бұрын
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👍🏻👍🏻
@vibaj16
@vibaj16 3 жыл бұрын
You have to be careful though. Sometimes that type of optimization can lead to some not being updated when they should be getting updated
@priuxls
@priuxls 3 жыл бұрын
@@vibaj16 Yes, I think a conservative approach to creating the importance map is key👍🏻
@126sivgucsivanshgupta2
@126sivgucsivanshgupta2 2 жыл бұрын
how does render time decrease ?
@TheSuckerOfTheWorld
@TheSuckerOfTheWorld 3 жыл бұрын
Interesting how having an emitter active gives you an increased render time. See 0:16 when it goes up.
@thatotherandrew_
@thatotherandrew_ 3 жыл бұрын
I think that's due to having to perform trajectory calculations instead of just dropping the balls, that's just a guess though.
@theaveragepro1749
@theaveragepro1749 3 жыл бұрын
probably because it has to instantiate and create a whole bunch of new balls, though I haven't looked at the engine at all
@lm1338
@lm1338 3 жыл бұрын
It's vsync
@lm1338
@lm1338 3 жыл бұрын
@@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.
@AhmedHan
@AhmedHan 3 жыл бұрын
Are you telling me 180k objects are iterated every 40ms along with a collision detection algorithm running for every single one?
@HugoStuff
@HugoStuff 3 жыл бұрын
Money you make per second in idle games be like:
@CSDragon
@CSDragon 3 жыл бұрын
how did the render time go down as the number of objects went up?
@elorrambasdo5233
@elorrambasdo5233 3 жыл бұрын
The render time was trying to stabilize the frame rate.
@busy_beaver
@busy_beaver 2 жыл бұрын
What's that strange wave of a strange mess going upwards the right flow of balls between 2:35 and 2:52 , then going down?
@arkhaic1792
@arkhaic1792 3 жыл бұрын
this is amazing someone make a physics based game out of this
@pashadanilov3490
@pashadanilov3490 3 жыл бұрын
You can try "The powder toy"
@arkhaic1792
@arkhaic1792 3 жыл бұрын
@@pashadanilov3490 oh yeah thats s childhood game
@cakedon
@cakedon 3 жыл бұрын
if you would give them less friction it could be a realistic water simulation
@atlasua2021
@atlasua2021 3 жыл бұрын
Multithreading or GPU? Very cool! I also want to write my own physics engine, only using a shader. - Очень круто! Я также хочу написать свой собственный физический движок, только используя шейдер.
@Pinupopinion
@Pinupopinion 3 жыл бұрын
Ok now add a function where she loves me back
@MrSerozka
@MrSerozka 3 жыл бұрын
Why does render time lowers when number of balls increases?
@Wolfoxy1904
@Wolfoxy1904 2 жыл бұрын
my pc would die at the second ball
@soup-not-edible
@soup-not-edible 3 жыл бұрын
WHAT GPU / CPU DO YOU HAVE
@AHSEN.
@AHSEN. 3 жыл бұрын
cooool
@jasyak2
@jasyak2 3 жыл бұрын
Short answer: 180K Long answer: This video
@themihanoid5020
@themihanoid5020 3 жыл бұрын
I want (and need) it
@Henrix1998
@Henrix1998 3 жыл бұрын
How on earth the physics time just stops growing?
@darkfrei2
@darkfrei2 3 жыл бұрын
Are collisions cached?
@Lb.q2
@Lb.q2 3 жыл бұрын
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 KZbin view count but how large is actually is
@AndreasRSD
@AndreasRSD 3 жыл бұрын
Now 1:58
Procedural Tree Physics + wind simulation experiment
0:30
Pezzza's Work
Рет қаралды 6 М.
Creating a Brick Breaker with my PHYSICS ENGINE
7:21
Pezzza's Work
Рет қаралды 109 М.
Кәріс өшін алды...| Synyptas 3 | 10 серия
24:51
kak budto
Рет қаралды 1,1 МЛН
Универ. 13 лет спустя - ВСЕ СЕРИИ ПОДРЯД
9:07:11
Комедии 2023
Рет қаралды 928 М.
СҰЛТАН СҮЛЕЙМАНДАР | bayGUYS
24:46
bayGUYS
Рет қаралды 838 М.
ХОТЯ БЫ КИНОДА 2 - официальный фильм
1:35:34
ХОТЯ БЫ В КИНО
Рет қаралды 2,8 МЛН
What's The Best Sounding Inline-Twin? AngeTheGreat Engine Simulator
4:47
Forgotten Mustard
Рет қаралды 60 М.
Turning bugs into Art
7:43
Pezzza's Work
Рет қаралды 193 М.
Is a Realistic Honey Simulation Possible? 🍯
4:36
Two Minute Papers
Рет қаралды 2,2 МЛН
Ant Colony Simulation with 5000 ants (2d).
5:24
Zoom Horizon
Рет қаралды 107 М.
Analysis of a Professionals CFD Case.
10:25
nelson phillips
Рет қаралды 19 М.
Beautiful Fluid Simulations...In Just 40 Seconds! 🤯
5:04
Two Minute Papers
Рет қаралды 236 М.
Adaptive Tearing and Cracking of Thin Sheets, SIGGRAPH 2014
4:01
Tobias Pfaff
Рет қаралды 1,5 МЛН
AIs learn to WALK
20:21
Pezzza's Work
Рет қаралды 51 М.
Fast Inverse Square Root - A Quake III Algorithm
20:08
Nemean
Рет қаралды 4,9 МЛН
Эффект Карбонаро и бумажный телефон
1:01
История одного вокалиста
Рет қаралды 2,8 МЛН
How To Unlock Your iphone With Your Voice
0:34
요루퐁 yorupong
Рет қаралды 19 МЛН
Выложил СВОЙ АЙФОН НА АВИТО #shorts
0:42
Дмитрий Левандовский
Рет қаралды 1,9 МЛН
Will the battery emit smoke if it rotates rapidly?
0:11
Meaningful Cartoons 183
Рет қаралды 4,9 МЛН
Carregando telefone com carregador cortado
1:01
Andcarli
Рет қаралды 2,3 МЛН
Не обзор DJI Osmo Pocket 3 Creator Combo
1:00
superfirsthero
Рет қаралды 1,3 МЛН