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
    9
    ·
    9 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
      2
      ·
      9 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.

      • intensely_human@lemm.ee
        link
        fedilink
        arrow-up
        1
        ·
        9 months ago

        True. I think this happens with pinball recall for lumosity. The level you’re on isn’t correlated to the number of bumpers on the board, but to path length. I figure they just try paths until one’s sufficiently long to be a challenge to the player.

        Unfortunately it has the opposite effect. I look at the board and my eyes instantly calculate all the paths and one’s the longest. No working memory required on my part. And that longest path is where the ball’s coming in 90% of the time. It sucks.

    • Paradachshund@lemmy.today
      link
      fedilink
      arrow-up
      2
      ·
      9 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…