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

Ask Lemmy

26701 readers
1923 users here now

A Fediverse community for open-ended, thought provoking questions

Please don't post about US Politics.


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 [email protected] or [email protected]. 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 [email protected]. 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
 

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.

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 6 points 9 months ago (3 children)

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"

[–] [email protected] 8 points 9 months ago (2 children)

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.

[–] [email protected] 2 points 9 months ago (1 children)

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

[–] [email protected] 2 points 9 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.

[–] [email protected] 1 points 9 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.

[–] [email protected] 2 points 9 months ago (1 children)

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

[–] [email protected] -1 points 9 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

[–] [email protected] 1 points 9 months ago* (last edited 9 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.