hi...
i guess i should ask for some advice before going all-out on a mad solution... 😕
i'm building a multiplayer billiards game, and have run into a couple of problems...
while creating the AI for single-player mode, i found that balls don't really travel where they are mathematically supposed to... after some testing, i concluded this is due to the subtle difference in contact points between what's expected by the AI and what the engine gets as it iterates in discrete steps...
you see, the AI is programmed to shoot for an "ideal" target, but as the ball gets there, there's no guarantee that the collision will be registered at that precise point, since it'll most likely fall between steps 🤓
this also led to a larger problem... while i could simply have the AI "cheat" the targeted ball to correct for this, in multiplayer, it'll simply not do...
how can i expect a game to flow nicely, if i'm unable to have matching results on two different machines?
i ran a few controlled tests just to notice that under the same conditions in two separate runs - the results are DIFFERENT 😮 😮 😕 🙁
ok, then i figure... 🤓 -> *mad scientist mode - activate!* -> 🤓
i'll use a raycast to find the first collision, then "load" the targeted ball with the expected results, then proceed into recursively repeating this for every ball hit by the current one, untill the "energy" runs out (balls stop)... all this before actually shooting the cue ball... then, the balls, now loaded with the direction they should go when struck, can correct themselves when they actually collide...
this leads to an even bigger problem... this method assumes every ball hit is stopped... hence, calculating ahead is due, i'd have to take the expected direction of each ball set in motion and use line intersection to determine a possible moment of impact based of the projected velocity of both balls involved in each intersection
(am i still making sense?)
so before i venture out into the jungle of my own madness... IS THERE A BETTER WAY?
any advice is welcome - anything more relevant than "look both ways before crossing the street" will do 🙄
thanks in advance!
i guess i should ask for some advice before going all-out on a mad solution... 😕
i'm building a multiplayer billiards game, and have run into a couple of problems...
while creating the AI for single-player mode, i found that balls don't really travel where they are mathematically supposed to... after some testing, i concluded this is due to the subtle difference in contact points between what's expected by the AI and what the engine gets as it iterates in discrete steps...
you see, the AI is programmed to shoot for an "ideal" target, but as the ball gets there, there's no guarantee that the collision will be registered at that precise point, since it'll most likely fall between steps 🤓
this also led to a larger problem... while i could simply have the AI "cheat" the targeted ball to correct for this, in multiplayer, it'll simply not do...
how can i expect a game to flow nicely, if i'm unable to have matching results on two different machines?
i ran a few controlled tests just to notice that under the same conditions in two separate runs - the results are DIFFERENT 😮 😮 😕 🙁
ok, then i figure... 🤓 -> *mad scientist mode - activate!* -> 🤓
i'll use a raycast to find the first collision, then "load" the targeted ball with the expected results, then proceed into recursively repeating this for every ball hit by the current one, untill the "energy" runs out (balls stop)... all this before actually shooting the cue ball... then, the balls, now loaded with the direction they should go when struck, can correct themselves when they actually collide...
this leads to an even bigger problem... this method assumes every ball hit is stopped... hence, calculating ahead is due, i'd have to take the expected direction of each ball set in motion and use line intersection to determine a possible moment of impact based of the projected velocity of both balls involved in each intersection
(am i still making sense?)
so before i venture out into the jungle of my own madness... IS THERE A BETTER WAY?
any advice is welcome - anything more relevant than "look both ways before crossing the street" will do 🙄
thanks in advance!