Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
Zombie 20
19
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 21st Apr 2007 08:10
Hey everyone, hope you are doing well.

I had a question regarding a wonderful pastime of dominoes. Set 'em up and knock 'em down.

Anyway, I was wondering, does darkbasic classic have any system commands that i don't know about to implement "fake" physics to create the falling and tumbling of dominoes. Or will i need to purchase dark physics, if i do thats cool, but if it can be done with classic, that would be cool too.

Thanks everyone.

zombie

Zotoaster
21
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 21st Apr 2007 13:52
You could program your own, but I don't recommend it, it'll be hard, and slow heheh. I don't know of any plugins that work with DBC, atleast not any physics plugins. Perhaps instead of DarkPhysics, you could buy DBPro, then use a plugin called Newton to handle the physics for you, and it's free.

Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 21st Apr 2007 20:18
While I do agree with Zotoaster, it can be very difficult to program a physics engine, it doesn't necessarily have to be. I think you nailed it when you wrote "implement 'fake' physics". The thing about computer graphics is, as long as it looks ok, it's usually good enough (depending on the project). It really depends on the effort you want to put into it and what kind of result you can be happy with.

For falling dominoes, you need just a few things: acceleration, rotation, gravity, and speed. For one of the DBC challenges, I posted a bouncing clock. The physics of it uses three basic motion physics equations. The tumbling has all been faked with random rotation. I didn't spend time optimizing the loops, so those take up some speed. I have nested loops and that slows down the process a bit, but I can easily get over 200 fps (1.5 ghz processor) the way it is. The speed is also controlled by a time element I apply to each cube, by adjusting the time element, it speeds up or slows down how fast the cubes bounce. So you could run the demo at 30 fps and mess with the time and the cubes will bounce faster or slower - though the fewer fps the faster the time passes, the more jagged the demo will become.

My whole point is, it comes down to what you consider passable. Look through the DBC challenges and look for my bouncing clock example. There are 3 functions that control the physics.

Enjoy your day.
RUCCUS
21
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 21st Apr 2007 20:28
It really isnt that hard;

1. Store all of the current "falling" dominoes in an array (their object numbers I mean).

2. Cycle through every falling domino, xrotate it down a bit, check for polygonal collision, if a collision occurs, add the object hit to the falling dominoes.

3. Check if any falling dominoe's x angle is greater than or equal to 90, if so remove it from the falling list.

You could even go as far as to make certain blocks that dont fall when hit, then you could make walls and such that dominoes would bump into and stop falling.

If you wanted to improve speed, instead of using polygonal collision with DBP's native commands, either use sparky's collision dll for the object collision commands, or use raycasting, casting an intersection ray from a point at the top of the domino before it's rotated to a point at the top of the domino after it's rotated, checking for intersection with any domino's within x distance.

Better yet, when a collision does occur, check if the collision is on the lower half of the domino or the higher half. If on the lower, rotate it backwards, if on the higher, rotated it forwards. Now, you can have a domino at a lower y value hit a domino at a higher y value and cause that domino to fall backwards, changing the direction.

More realism could be added by adding gravity to all dominoes, just throw in an intersection from the domino's bottom to some large negative value directly below the domino, checking for intersection with a map model of maybe a table, if the distance is greater than 0 then move the domino down at an increasing rate. Alter your fall-stopping routine to instead check when a domino has hit the map model to have it stop falling.

Zombie 20
19
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 22nd Apr 2007 01:32
Wow, thank you all for the long explinations, I suppose questions regarding physics doesn't come up often haha. I was just curious becasue I would love to build a kid's bedroom and have dominoes or hotwheels or some other child's plaything that brings back such nice memories.

Anyway, i'll work with everything you've all suggessted. Thanks again guys, well gotta go do stuff. Laters. Also, i know its off topic, but what is the difference between a skysphere and a skybox?

Sinani201
19
Years of Service
User Offline
Joined: 16th Apr 2007
Location: Aperture Science Enrichment Center
Posted: 22nd Apr 2007 03:48
I have an easier way: USE ANIM8OR

What happens when when you mix baking soda, pop rocks, and water?
TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 22nd Apr 2007 05:13
Quote: "what is the difference between a skysphere and a skybox
"


Pretty much says it all in the names. A skysphere creates a sky (or space in a space sim) by texturing a sphere.

A skybox does the same thing only with a box (cube).

Skyboxes give more professional results because many textures get squashed at the north and south poles when you are using a sphere.

But, it's not just a case of texturing a cube with six normal views - if you do that, perspective distorts the textures so you see the edges and corners of the box and it just ends up looking like your world is in a textured box.

Instead, special software distorts the edges of the textures to counteract the perspective effect and your eyes are tricked into not seeing the actual box.

If you don't have the software (I think Bryce is one program which does it), there are plenty of web sites you can download them from for free.

TDK_Man

RUCCUS
21
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 22nd Apr 2007 15:47
Just a note, theres also special software that distorts the poles of a skysphere texture so they show up properly as well, photoshop mainly .

IIRC skyspheres were proven to be more efficient. The argument was sky spheres have a lot more polies, but then someone showed the maths of how using a skybox requires a larger camera range to see the entire box...blah blah blah.

Login to post a reply

Server time is: 2026-07-05 18:38:01
Your offset time is: 2026-07-05 18:38:01