73

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.

all 27 comments
sorted by: hot top controversial new old
[-] tal@lemmy.today 27 points 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 3 points 8 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.

[-] ArbitraryMary@lemmy.world 19 points 9 months ago

In case of that particular game, it’s rigged to fuck. Anything that tries to get you to spend money is going to be. So I’d say a previously calculated result dictates the outcome.

[-] Ugurcan@lemmy.world 3 points 9 months ago

Yup. Both are possible, but if the game is addictive and you keep launching that exact same game among bazillions of other similar games, it’s 100% rigged towards manipulating your compulsive behavior.

[-] LazaroFilm@lemmy.world 12 points 9 months ago* (last edited 9 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.

[-] JakenVeina@lemm.ee 11 points 9 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.

[-] infinitepcg@lemmy.world 2 points 8 months ago

If the animations look realistic, it’s almost certainly not predetermined

You could do a perfectly realistic simulation, record the path for each outcome and then play one of them.

Or, if the physics simulation is deterministic, you could store a set of starting positions and their outcomes.

[-] intensely_human@lemm.ee 9 points 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”.

[-] Paradachshund@lemmy.today 2 points 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 2 points 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 1 points 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.

[-] PhlubbaDubba@lemm.ee 8 points 9 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.

[-] CaptainBasculin@lemmy.ml 7 points 9 months ago* (last edited 9 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.

[-] Nibodhika@lemmy.world 7 points 9 months ago

The easy way if doing this is just using a physics engine and calculate the result depending on where the ball lands. Prototyping a game like that would take me a few hours probably.

That being said if the game asks for money to do anything it's highly unlikely that that's what it's doing, instead it's probably choosing your result based on how much do they want you to win and then calculate a path for the ball that gets this result.

Something that makes it difficult to do this second alternative is if you have some semblance of control, e.g. if you choose the strength to use for the ball or something, that makes it slightly trickier to pull off because you're against the clock on finding a path and might end up with an unrealistic move (however if those round things make the ball kick around like they do on a pin all machine they can be used to set the course you want).

Long story short it's easier to do the animation deciding the result but if the game asks for money in exchange for anything in-game it's more profitable to do the results deciding the animation.

[-] fidodo@lemmy.world 1 points 8 months ago

I know this game, this is a mini game within the main game and I'm not actually sure how they make money since they have no ads and they shower you with so many power ups that I've never come close to running out. I guess lots of players are just bad at the game so they need to buy power ups? This particular mini game doesn't have any pay to win mechanics, you get balls by beating levels in the main game so it's just there to encourage reengagement.

It's a standard match 3 game but I play it as a fidget game since there are no ads and the levels are reasonably beatable with the tons of power ups they give you.

[-] KeenFlame@feddit.nu 6 points 9 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"

[-] Krudler@lemmy.world 8 points 9 months ago

I just want to say, having worked in the lottery industry and having made one of the first predetermined pachinko games, it's actually fairly easy.

[-] Sethayy@sh.itjust.works 2 points 9 months ago

And with how cheap 2d simulations are (even cheaper on a gpu) they could pretty easily run a a couple hundred then pick their favorite odds, save the path trace as a bezier, ship those weights with the game and no one could tell the difference

[-] Krudler@lemmy.world 2 points 8 months ago

That's it in a nutshell.

I had to implement the system in a special way, but that's due to the nature of the lottery industry, auditability, security, etc being critical.

There was really two systems at play. One was a "entry code" that the player would acquire either by scratch ticket or other means which they would enter into the system. That would tie their entry to an outcome. The winning decision could have been predetermined at the time the codes/entries were generated, or there could be an instant probability-based determination on the server end.

At any rate, what would be presented to the user then is the ability to drop 10 little pucks anywhere they want, and watch them fall and bounce around, but regardless of where they dropped them, they were going to in the same bins either way. Then the prize would be revealed.

At the time there was no easy physics systems, so I had to code my own but it wasn't that hard. I just brute forced it to drop a million pucks overnight, going left to right in tiny sub pixel increments. Built a table of animation strings which provided a convincing animation for the puck to go into any bin, regardless of where the player dragged it in the interactive portion of the play.

In the end, even though it was an incredibly innovative lottery product at the time, the first of its kind actually, we could not deploy because every state/intl lotteries thought it was far too convincing that the player had influence on the outcome, even though it was fully disclosed no action that their actions had no bearing on the outcome.

[-] KeenFlame@feddit.nu 1 points 8 months ago

It may be considered easy, and for sure this one probably is, but it doesn't compare in complexity to normal physics engines. The whole thread read like it was, so I felt I should provide a better perspective on it.

[-] TokenBoomer@lemmy.world 2 points 9 months ago

It’s magic. Just say it’s magic.

[-] KeenFlame@feddit.nu -1 points 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

[-] fidodo@lemmy.world 1 points 8 months ago* (last edited 8 months ago)

There are plenty of deterministic physics engines. In this case I don't think it would make sense to add extra complexity to rig the result, this mini game already has plenty of obstacles to make getting max points hard. What they might do is fuzz the plunger input randomly so you can't memorize the perfect location and get max points every time.

[-] fidodo@lemmy.world 4 points 8 months ago* (last edited 8 months ago)

I've played that mini game, definitely don't think it's rigged. I've gotten max points plenty of times, it's just hard since the 10 is in the middle and there are obstacles in the way. I would guess they fuzz the plunger so you can't memorize the perfect location for max points every time.

this post was submitted on 02 Feb 2024
73 points (95.1% liked)

Ask Lemmy

26646 readers
1524 users here now

A Fediverse community for open-ended, thought provoking questions


Rules: (interactive)


1) Be nice and; have funDoxxing, trolling, sealioning, racism, and toxicity are not welcomed in AskLemmy. Remember what your mother said: if you can't say something nice, don't say anything at all. In addition, the site-wide Lemmy.world terms of service also apply here. Please familiarize yourself with them


2) All posts must end with a '?'This is sort of like Jeopardy. Please phrase all post titles in the form of a proper question ending with ?


3) No spamPlease do not flood the community with nonsense. Actual suspected spammers will be banned on site. No astroturfing.


4) NSFW is okay, within reasonJust remember to tag posts with either a content warning or a [NSFW] tag. Overtly sexual posts are not allowed, please direct them to either !asklemmyafterdark@lemmy.world or !asklemmynsfw@lemmynsfw.com. NSFW comments should be restricted to posts tagged [NSFW].


5) This is not a support community.
It is not a place for 'how do I?', type questions. If you have any questions regarding the site itself or would like to report a community, please direct them to Lemmy.world Support or email info@lemmy.world. For other questions check our partnered communities list, or use the search function.


Reminder: The terms of service apply here too.

Partnered Communities:

Tech Support

No Stupid Questions

You Should Know

Reddit

Jokes

Ask Ouija


Logo design credit goes to: tubbadu


founded 1 year ago
MODERATORS