1
\$\begingroup\$

Hello fellow game devs and stack overflowers...

I recently made a transition from OpenGL ES 1.1 to 2.0 (on Android via NDK) and things are going well so far. I'm working on doing a dice rolling application (gaming dice up to 20 sided, not just regular 6 sided die) as a way to learn more about how physics is implemented in a gaming environment.

I've explored implementing existing engine options (such as Bullet) and I don't think I need to implement something quite so sophisticated. I've found several tutorials that handle a lot of the general physics involved with initial trajectory, velocity, angle of contact and reflection angle, etc. I'm confident that I'd be able to implement ball-like behavior without much trouble.

My question lies in when I attempt to make the interaction of the die shape with another surface more "realistic," for example... the die strikes the floor surface at such an angle where only one corner makes contact with the floor. In my mind, the center of gravity of the object would play a part in determining how the die bounces away, possibly even spinning it it faster, etc... but I am not sure what the actual math involved is.

Are there any recommended resources for getting into this level of detail? Initial searches haven't turned up much...

Thanks to everyone in the community, -Jeremiah

\$\endgroup\$
2
  • \$\begingroup\$ Physics "in a gaming environment" is one of three things: 1) incredibly simple like just a bouncing ball or sliding puck that even I could do, 2) use a physics library and stop worrying about it, or 3) extremely complex and custom physical simulations for automobiles/airplanes/machines. The reason you may not find much to read is that you've veered straight into #2, and those libraries are written by people already familiar with classical mechanics and they don't really write how-to blogs for each other =) \$\endgroup\$ Jun 1, 2012 at 5:53
  • \$\begingroup\$ Thanks for this... that does make sense. I realize if I were to do more of a "shooter" or something that I'd more likely be doing very simple point/sphere collision with simple hit zones... so I may be tackling something unnecessarily difficult. Still, I'm getting some research done here and there and think I may be able to hack something together that isn't going to break my brain. \$\endgroup\$
    – Maximus
    Jun 1, 2012 at 18:08

1 Answer 1

2
\$\begingroup\$

I suppose you want to make a game somewhere down the road, else you wouldn't post here. My advice: Fake it. Fake it as much as you can, and make it more realistic only if it's overall easier and/or looks decidedly better than when faking it. The ultimate goal in games is to make a fun game, not to implement physics at the quantum level. Leave that to the scientists.

As for your actual question: A D20 is, for all intents and purposes, a ball, so you fake it by treating it as a ball. Maybe add some random bounces up or to the side while rolling if you have a very flat, rigid surface on which you roll the die, but otherwise, it's a ball.

Edit: I've just noticed your "Android" tag, so you are working with inherently limited hardware. Another reason to fake it, because it's cheaper in CPU cycles.

\$\endgroup\$
1
  • \$\begingroup\$ Haha... i do intend to fake it as much as possible. Other die shapes are much less ball like (D6 of course and D8). Even if I fake it, I'm curious what the actual computations might look like so I can decide for myself what corners to cut. Thank you for the answer! \$\endgroup\$
    – Maximus
    May 31, 2012 at 19:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .