If your code depends on the checkmark (and tests to determine if the objects on the checkmark overlap), then:
when objects move "too fast", they pass each other without colliding
when several objects collide in the same tick, the final result (for example, how they bounce, what damage they receive, ...) depends on the order that you check for collisions, and not on the order in which collisions can / must happen. In rare cases, this can lead to a game blocking (for example, 3 objects collide in the same tick; object1 and object2 are set to collide with them, then object2 and object3 are set to collide with them, causing object2 to collide again with object1, so that the collision is between object1 and object2 should be redone, but this causes object2 to collide with object3 again, so ...).
Note. Theoretically, this second problem can be solved using "recursive tick division" (if more than two objects collide, divide the tick length in half and try again until only two objects collide in this "sub-tick"), It can also lead to blocking and / or abnormal termination of games (when 3 or more objects collide at the same moment, when you end up with a “forever disappear” script).
Besides; sometimes when game developers use "ticks", they also say "1 fixed tick length = 1 / variable frame rate", which is absurd because what needs to be a fixed length cannot depend on any variable (for example, when the graphics processor in the absence of speed of 60 frames per second, all the simulation is in slow mode); and if they don’t do this and instead have “ticks of variable length”, then both problems with “ticks” become much worse (especially at a low frame rate), and the simulation becomes non-deterministic (which can be problematic for several players, and can lead to to other behavior when the player saves, loads or pauses the game).
The only correct way is to add a dimension (time) and give each object a segment described as “initial coordinates and final coordinates”, plus “trajectory after final coordinates”. When an object changes its trajectory (either because the unexpected happened, or because it has reached its “final coordinates”), you will find the “fastest” collision by going through the “distance between two lines” (object1.radius + object2 .radius) "calculation for an object that has changed for every other object; then change the" final coordinates "and" trajectory after the final coordinates "for both objects.
An external “game loop” would look something like this:
while(running) { frame_time = estimate_when_frame_will_be_visible();
Please note that there are several ways to optimize this, including:
divide the world into "zones" - for example, so if you know that object1 will go through zones 1 and 2, it will not be able to collide with any other object that also will not go through zone 1 or zone 2
store objects in the segments "end_time% bucket_size" to minimize the time taken to find the "next closest end time"
use multiple threads to execute "Calculate_object_position_at_time (frame_time);" for each object in parallel
do all the work "simulation state until next frame time" in parallel with "render ()" (especially if most of the rendering is done using the GPU, leaving the processors free).
For execution:
When collisions occur infrequently, they can be significantly faster than ticks (you can hardly do work for a relatively long period of time); and when you have free time (for any reason - for example, due to the fact that the player paused the game), you can timely calculate the future (effectively smooth out the overhead over time to avoid sudden jumps in productivity )
If collisions happen often, this will give you the right results, but it can be slower than a broken joke that gives the wrong results under the same conditions.
It also simplifies the arbitrary relationship between “simulation time” and “real time” - things like fast forward and slow motion won't crash (even if the simulation runs at the speed that the hardware can run, or so slow it’s hard to say if anything is moving at all); and (in the absence of unpredictability), you can pre-calculate arbitrary time in the future, and (if you save the old information about the “segment of the line of the object” instead of discarding it after the expiration date), you can go to an arbitrary time in the past and ( if you store old information only at certain points in time to minimize storage costs), you can return to the time described by the stored information, and then calculate the transfer to an arbitrary time. Together, these things also make it easy to do things like "instant slow motion playback."
Finally; , , " " .
, - , / (, , ), ( , ) (, /angular, )./) , , , ; "" , , N .