Given that you want to reduce the number of calculations, you could improve this by factoring out the common parts: acceleration_x = normalised_x * s.strength * inverse_square_dropoff = normalised_x * s.strength / distance^2 = (distance_x / distance) * s.strength / distance^2 = distance_x * s.strength / distance^3 = distance_x * (s.strength / distance^3) = distance_x * k acceleration_y = distance_y * k So what you want to calculate is k = s.strength / distance^3, then you can multiply both distance_x and distance_y by k to get the accelerations. That saves about 3 multiplications and 1 call to get_strength(). I get that that's maybe less obvious for a tutorial, but it might make a difference if you're rendering a lot of particles!
Thank you for this video this was a whole lotta fun and the explanation of the mathematics behind it all, really helped me get a firmer grasp on the implementation.
0:10 I like your TaskBar. Tip: You can remove those two Lines before the Icons in the Middle. Just "Right-Click" on TaskBar and Choose "Lock The TaskBar".
Be sure to track the particles movement with a trail drawn behind it, because actual orbits will process slightly each time. Also you'll notice that the small planets tend to get thrown out of the system. Looking forward to the Galaxy simulators
Since we're in c++ we would use #include not #include (math.h is the c-style header). #include is also deprecated in C++11 and onwards so its best practice not to use it.
coming from a lot of pygame this series was the perfect start into sfml. I have tried sfml before, but i found were hour long videos and i still failed. But this seemed too easy to be true lmao. Thank you very much
Man, nice video! really wanted to see more vids of yours, unfortunately i already watched every one, thanks man for giving me a great head start for SFML (and for how to bluescreen my windows lol)
Please Release Episode 3, guy, you are saving me, you are really good at it, it is easy, the way you teach us!
Given that you want to reduce the number of calculations, you could improve this by factoring out the common parts:
acceleration_x = normalised_x * s.strength * inverse_square_dropoff
= normalised_x * s.strength / distance^2
= (distance_x / distance) * s.strength / distance^2
= distance_x * s.strength / distance^3
= distance_x * (s.strength / distance^3)
= distance_x * k
acceleration_y = distance_y * k
So what you want to calculate is k = s.strength / distance^3, then you can multiply both distance_x and distance_y by k to get the accelerations. That saves about 3 multiplications and 1 call to get_strength().
I get that that's maybe less obvious for a tutorial, but it might make a difference if you're rendering a lot of particles!
Please make a part 3, I want to see this amazing learning project completed!
I love the fact that you cut straight to the chase, good video keep it up.
Thank you for this video this was a whole lotta fun and the explanation of the mathematics behind it all, really helped me get a firmer grasp on the implementation.
Really nice explanation, cannot wait to see the next episode :)! Good work!
0:10 I like your TaskBar.
Tip: You can remove those two Lines before the Icons in the Middle.
Just "Right-Click" on TaskBar and Choose "Lock The TaskBar".
absolute legend, the comment I did know I needed, thank you 😄
still waiting for the ep 3 !
Be sure to track the particles movement with a trail drawn behind it, because actual orbits will process slightly each time. Also you'll notice that the small planets tend to get thrown out of the system. Looking forward to the Galaxy simulators
Just so everyone knows theres a chance you will have to include #include otherwise its gonna chuck a error when it tries to squre root
Since we're in c++ we would use #include not #include (math.h is the c-style header).
#include is also deprecated in C++11 and onwards so its best practice not to use it.
coming from a lot of pygame this series was the perfect start into sfml. I have tried sfml before, but i found were hour long videos and i still failed. But this seemed too easy to be true lmao. Thank you very much
@Zipped when's episode 3 coming out? These tutorials are great! :D
Man, nice video! really wanted to see more vids of yours, unfortunately i already watched every one, thanks man for giving me a great head start for SFML (and for how to bluescreen my windows lol)
part 3?
Nice work my dud, don't know why you don't have more subs
Really nice videos. You motivated me to make my own physics engine
Will part 3 be coming out anytime soon? I've been waiting lol
Waiting for part 3 ! :)
I am hoping for episode 3 to come out!
Great video !
Do you think you'll one day do a video about networking in SFML ?
big brain
Great work! I do similar tutorials in Python.
I just checked them out, very neat stuff, keep it up!
@@zipped1214 Thanks! By the way, looking forward to seeing part 3 :)
@@NETSEDU8 Thanks, I'm hoping to get to it soon :)
I'm impressed by his skills but i cannot see why he isn't hiding the links in the taskbar 😂😂😂😂
You should give a try to "Dear ImGui" library. It's very helpful for creating simulation. You should give it a try