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
    17
    arrow-down
    1
    ·
    8 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
        0
        ·
        8 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.

  • LazaroFilm@lemmy.world
    link
    fedilink
    English
    arrow-up
    12
    arrow-down
    1
    ·
    edit-2
    8 months ago

    This question isn’t only for mobile game. I remember asking myself this very question with Super Mario Land on Game Boy when finishing a level and you had a chance to get 1up 2up 3up or a mushroom.

  • PhlubbaDubba@lemm.ee
    link
    fedilink
    arrow-up
    6
    arrow-down
    1
    ·
    8 months ago

    It could actually depend,

    You could derive the result from a pseudorandom value and then call an animation to reflect that result, or you could derive it from building the visual in a game engine and just letting it play same as it would if it was a physical version of the game.

    If I had to guess I’d imagine a mobile game might lean towards the RNG option simply because I personally would estimate it would be less of a burden on the hardware, which for mobile gaming can be a big deal.

  • intensely_human@lemm.ee
    link
    fedilink
    arrow-up
    4
    ·
    8 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”.

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

    • conciselyverbose@kbin.social
      link
      fedilink
      arrow-up
      1
      ·
      8 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
        ·
        8 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.

  • KeenFlame@feddit.nu
    link
    fedilink
    arrow-up
    4
    arrow-down
    1
    ·
    8 months ago

    Physics engines are rarely deterministic, which means most of these games use what you would call the “animation deciding results”

    It is very rare that it works the other way around contrary to what others have commented it is non trivial to make weighted deterministic random in this manner

    While technically possible, only very specialised games with reasons good enough to budget the programming required will go the route you describe as “result calculated before the animation”

      • KeenFlame@feddit.nu
        link
        fedilink
        arrow-up
        0
        arrow-down
        2
        ·
        8 months ago

        It’s really not! These days anyone can make games, I promise if you just have the drive, the tools available now are absolutely stellar in comparison to just a few years ago

  • CaptainBasculin@lemmy.ml
    link
    fedilink
    arrow-up
    4
    arrow-down
    2
    ·
    edit-2
    8 months ago

    Just like every video game, your odds can be heavily rigged against you if the developer wants it.

    Use this game as an example. No one’s going to recognise if the developer does intentional weighting (guiding the ball towards smaller wins via additional small vectors other than bouncing)

    On a carnival game, game host could use a weighted die to rig the odds towards it? On a video game, developer controls everything.

  • JakenVeina@lemm.ee
    link
    fedilink
    English
    arrow-up
    1
    ·
    8 months ago

    If the animations look realistic, it’s almost certainly not predetermined. That’s by far the simplest way to get the desired effect. However, that doesn’t mean it’s fair. It could easily use a real physics engine, but still subtly rig the system. For example, bounces off of the pins could have an elasticity factor of 0.4 for bounces towards the big prize, but 0.5 for bounces away from it. Or maybe the hitboxes on the center pins are just a little bit bigger. Stuff that will noticably affect the large-scale statistics, but that you’re not gonna notice with your eyes.