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.

  • tal@lemmy.today
    link
    fedilink
    arrow-up
    29
    ·
    9 months ago

    In theory, it could do either – there’s no way of knowing from just looking at a screenshot – but I’d assume that normally, it’s simulating the physics and looking at where the ball winds up to determine the score, and that if the physics engine is deterministic, that any variation from launch to launch in a pachinko simulator would come from slightly varying launch speed and angle.

    If you can manage to get a ball stuck in a game, or if the game can fire multiple balls simultaneously, then I’d say that’d be consistent with it just simulating the physics and determining the outcome from where the ball winds up.

    I don’t really know what the benefit to computing a result in advance would be, unless one has a model that optimizes for player engagement or something.

    • fidodo@lemmy.world
      link
      fedilink
      English
      arrow-up
      3
      ·
      9 months ago

      One thing I’d watch out for as a developer is that players might find a setup to get max points every time, so I’d fuzz the plunger input to make it more random.

    • AeroLemming@lemm.ee
      link
      fedilink
      English
      arrow-up
      2
      ·
      9 months ago

      There are only seven buckets. Couldn’t you predetermine the result while also giving the illusion of the physics doing it by just simulating a bunch of slightly varied drops and presenting the first one that gives the desired result?

      • fidodo@lemmy.world
        link
        fedilink
        English
        arrow-up
        2
        ·
        9 months ago

        In this mini game you have fine control of the plunger, so it’s not just 7 bucket animations but also thousands of launch powers and ricochets you need to account for. I’ve played this game, you can reliably and finely adjust where the ball falls with the plunger, but the ricochets off the bumpers are so aggressive it’s impossible to get a consistent result, plus there could be fuzzing on the plunger input.

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

          The fuzzing of the plunger input is what I was thinking about. You could run a bunch of simulations right as the plunger is released with slightly different inputs and then pick the one with the desired result to display on the screen. You’d need to have a pretty efficient simulation, but the user would be none-the-wiser.