Dear mobile game devs. When I play games like that, I always wonder if it’s the physics engine that’s actually random and produces the result?

Or is the result calculated before the animation happens, and dictates the animation?

I’ve always wondered. I have some notion of programming, but from far back, and I’ve been scratching my head long enough about this.

Thanks in advance.

  • intensely_human@lemm.ee
    link
    fedilink
    arrow-up
    8
    ·
    7 months ago

    The cheapest way to do this is to let the animation (the physics simulation) determine the result.

    Picking a bin for the ball to go into, then working backward from that to an animation that looks like it’s following the same physics at other animations, is far more computational work.

    Therefore, my money is on the animation determines the result. Now, it may be pre-determined from parameters, but that doesn’t mean it’s predictable, due to a concept called “computational irreducibility”.

    • conciselyverbose@kbin.social
      link
      fedilink
      arrow-up
      1
      ·
      7 months ago

      You could very easily just project the last bounce, and if it’s going to go into the good spot, cheat and adjust the path, based on predetermined odds. It wouldn’t be hard at all to turn a 1 in 7 chance if the physics would be uniformly distributed without cheating into 1 in 700.

    • Paradachshund@lemmy.today
      link
      fedilink
      arrow-up
      1
      ·
      7 months ago

      I’ll +1 this by also mentioning that physics, despite seeming fancy, is one of the easiest things to implement in most game engines because they all have built in physics systems at this point. That’s why there are so many no budget games that rely on physics heavily.

      Now getting physics to be really good and interesting is a whole 'nother can of worms…