Going to say this first so you'll notice it:
If there's anything I need help with, it's figuring out how exactly I should modify the velocity of a planet after it merges with another.
It's things like this that make me wish that we still used our IRC channel, haha.
But, then again, I use steam for chatting much more than IRC
testtubegames wrote:Yikes! You're on my tail, wtg!
Very well made -- and works great. I missed the first iteration of it, but with the additions it works quite smoothly. (And even as I reload it, I noticed another change! Wow! Go wtg. The new rotation is a nice addition.)
Thanks! Maybe I'll add a grid too.
testtubegames wrote:
I noticed a little bug -- when you are flinging planets, they occasionally launch not at the place you put them, but where your mouse currently is. (After you've pulled back to fling.) I took a peek in the code, and it looks like it probably stems from you prediction code lagging the game a bit... and the loop that checks for whether the planet is flung doesn't trigger until it's too late and the cx, cy values have been reset. (Or some such thing.)
Yeah, that's definitely lag.
Sadly there isn't too much I can do besides keep them in the same loop, would have to find some way to do that.
testtubegames wrote:
Also, kudos to you for trying to speed up the sim. I learned a whole bunch from trying to do that, myself. Barnes Hut is a good tool, too, and fits well with your quest to understand all the cool algorithms out there
Haven't done it yet, but I am working on a separate program to test out the Barnes-Hut algorithm (no physics, just the creation of the tree).
testtubegames wrote:
I'm jealous of your prediction lines... way better than mine, since they take into account the actual future. The downside of course is the lag, but it sure is neat to be able to know how your new planet will interact with the current ones in the distant future.
If you're willing to sacrifice performance or the ability to see the prediction
as you are flinging the planet, you could definitely have the accurate predictions I have! But hey, your predictions are adequate for the most part.
All I really did was copy the array containing all the planets, and simulate them for whatever amount of time.
Sadly, this is super-duper inefficient!
testtubegames wrote:
Though, I imagine you could do some optimizing with the code you already have and make great strides. (As Random noted, you can avoid Sin/Cos calls, and that kind of thing.)
If I wanted to make anything big, I'd definitely rewrite the whole thing, and I'd definitely like to try to make something much more usable.
I can probably only avoid calls to trig functions if the law is r^-2, and I do plan on adding other laws eventually.