was8bit 2024-06-18 18:13 (Edited)
I've wracked my brains, and they are fried...
So i lay down the gauntlet, given the challenge, of crafting a collision system that works with these rules..
1) using existing setup, of...
... speeds limited to 1 or less than 1
... six (6) balls that remain the same size(16x16)
... balls continue to bounce off the edges of the screen
2) with the goal of...
... balls that bounce off each other with believable realism
... must account for simultaneous multiple collisions
3) may use any system you prefer...
... sprite hits
... calculated radius/distance
... arrays, etc..
POST your entries as a REMIX...
Many attempts have been randomly made... i believe if we collaborate, we might get something we all can use for lots of fun games :)
... added analyzer
McPepic 2024-06-18 19:16
How’s this?
SP4CEBAR 2024-06-18 21:20
Nicely anti-aliased circles
was8bit 2024-06-18 22:52
Thanks, i got lucky ;)
was8bit 2024-06-21 15:54 (Edited)
@McPepic... sorry, missed your entry...
It looks nice :)
However, your system creates more energy into the system... system should retain (as best as possible) the initial energy level... some runs seem ok... other runs eventually peg the balls past the speed of light ;)
McPepic 2024-06-21 17:37
Ah, curse you laws of physics! Foiled again!
was8bit 2024-06-22 03:21
:D
Don’t feel badly, yours start out looking great :)
nathanielbabiak 2024-06-28 02:44 (Edited)
"Believable realism" is incredibly complex. The algorithm itself is close to a six-parter, and each step takes what I'll call a "black box" function - an algorithm that does something super complex on its own. It becomes a physics simulator at that point.
nathanielbabiak 2024-06-28 02:55 (Edited)
The first step is: find the next collision in time. It's a "black box" function becuase the accuracy of that timestamp (i.e., +/- tolerance on time T) doesn't matter, but it needs to be the exact same accuracy as for the next step. "Exact" meaning you need to crawl so far in the weeds that you consider floating point numeric approximation errors.
The second step is: confirm yes/no if any other objects (objects being balls or walls) are touching eachother, at the exact same timestamp as in the first step.
The third step is: treat the collision as a single as a single impact with one action and one or more reaction vectors ("one or more" depends on whether or not the reaction is a single object or multiple objects).
Then continue to simulate "through time" until all the balls come to a stop or the next collision occurs.
nathanielbabiak 2024-06-28 03:00 (Edited)
The problem right now (with all the uploads on this site, including my own), is that overlap is the basis for "contact" and multiple overlaps can occur in sequential itterations of a loop, leading to sequential frames of "contact".
(...Consider a ball at rest adjacent to a wall, yet not quite "in contact" based on the evaluation of overlap alone, but it is actually contacting the wall due to its position. Now consider it is hit by another billiard ball that causes a reaction with the wall...)
was8bit 2024-06-28 03:09 (Edited)
If the speed of the balls are kept to 1 or less pixels in movement, and used distance between ball centers to calculate contact, it should simplify things abit, don’t you think ?
If ball movement per 1 passage of time was much larger than 1, you would have to account for fractions of time for accuracy
nathanielbabiak 2024-06-28 03:12 (Edited)
Unfortunatley not. Check out a Newton's Cradle toy and how it relates to this topic: picture four balls at rest - and touching - all in a row, with one ball arriving to provide an action. How would "believable realism" evaluate the reaction of the four balls at rest in the moment after collision?
nathanielbabiak 2024-06-28 03:13
By the way - Hi! I don't think we've been on here synchronysly in a long time. How have you been?
was8bit 2024-06-28 03:22
Super busy between work and family, as usual... i really need big blocks of time to do anything substantial here, so its usually just little bits as i time...
was8bit 2024-06-28 03:23 (Edited)
That newtons cradle seems like a fun challenge... i will take that one.. it reduces the 3d problem to 1 direction at a time... i think i can do it ;)
was8bit 2024-06-28 03:28
The example introduces wiggly lines that suspend the balls, and i believe that wiggle interfers with the pure left/right movement...
In carrom, the pieces are rather predictable if you can get your angles correct before you shoot...
McPepic 2024-07-28 13:50
Second time’s the charm?
was8bit 2024-07-29 03:39
Oooo…. That is so smooth :D
I will have to study your code some, but it sure looks great :D