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
monkey for sale
17
Years of Service
User Offline
Joined: 8th Jun 2007
Location: Inside you head
Posted: 15th Apr 2008 05:23
I notice that there are many programs that use something called Dark Physics, but looking for it it appears to only be for DB pro, is there no physics engine for DB?

Why are you reading this?
Link102
20
Years of Service
User Offline
Joined: 1st Dec 2004
Location: On your head, weeeeee!
Posted: 16th Apr 2008 00:23
nope. But making you own physics engine is way better then getting some pluggin like dark physics. If you create your own, you understand exactly what it can and what is can't do. If there's a bug in dark physics you'dd have to wait for a patch to get it fixed. etc.

Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 16th Apr 2008 00:53
And some things can be faked without really having to get into deep physics maths. What kinds of things were you trying to do?

Enjoy your day.
monkey for sale
17
Years of Service
User Offline
Joined: 8th Jun 2007
Location: Inside you head
Posted: 16th Apr 2008 04:24 Edited at: 16th Apr 2008 05:23
actually i want the challenge of making it realistic, so I dont want to fake it, but my knowledge goes as far as all objects fall at the same speed, and i can mimic physics in 1 dimension...

but the kinds of things i am trying to do is rigid body dynamics, bouncy balls, falling boxes, ramps. in 2 dimensions

and since this topic applies to the program im working on, i also have a question about a strange error in my game. 3D objects that i lock to the screen, i can see through, i have a sphere with a recessed middle, but for some reason i can see inside of it, any ideas?

Why are you reading this?
Not_Maindric
17
Years of Service
User Offline
Joined: 10th Jul 2007
Location: Omaha, NE
Posted: 16th Apr 2008 14:55 Edited at: 16th Apr 2008 14:55
Quote: "all objects fall at the same speed"


Without resistance. Such as paper will not fall at the same speed as a bowling ball because air it making the paper fall slower, and air does not resist to much on a bowling ball. But in an airless environment, yes, they do.

Link102
20
Years of Service
User Offline
Joined: 1st Dec 2004
Location: On your head, weeeeee!
Posted: 16th Apr 2008 20:00
Quote: "rigid body dynamics, bouncy balls, falling boxes, ramps"


use google, sometimes you can just copy/paste (or transate) it from a c++ cource code.

monkey for sale
17
Years of Service
User Offline
Joined: 8th Jun 2007
Location: Inside you head
Posted: 16th Apr 2008 22:09 Edited at: 16th Apr 2008 22:13
since resistance would be hard to program, i dont intend to go that far, and i dont want to just copy and paste code, because then i dont understand it.

Why are you reading this?
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 17th Apr 2008 00:06 Edited at: 17th Apr 2008 17:00
Quote: "but the kinds of things i am trying to do is rigid body dynamics, bouncy balls, falling boxes, ramps. in 2 dimensions"


Well, these things can be "faked." By fake I mean that you don't necessarily need a Newtonian motion physics equation to create the effect or the display you want. Now if you are doing a physics demo where you want to explain the results in terms of how mathematics attempt to describe the real world then of course you'll want your equations and results as accurate and standarized as possible and most likely represented by established phyics eq.

When I first joined these forums, I had just started trying stuff with DBC and I wanted to understand how to program poolball physics so I could figure out how similar objects would bounce off of each other in a game I was trying to make. Now I look at my approach back then as unnecessary; though I learned a lot. All I have to do is find some way of getting the same reaction I was looking for when one ball strikes another, and I can make the reaction as slow or as fast as I want depending on what looks best for the situation. I don't have to rely on the mathematics to tell me how fast or slow it should be given a certain mass, veolcity, gravity and angle. I'm not knocking any physics engine by any means, in fact I think they're great and extremly useful especially if the functions are laid out all nice and neat and you only have to plug in time and maybe an object position or something, I'm just trying to convey the idea that it may not always be necessary to use one.

A bouncey ball for example: Just looking at the Y direction, it goes up, and it comes down. Now it can't just go from 0 to 300 (or whatever height) in one leap - that just wouldn't look right. It has to go up incrementally. But it can't go up uniformly 1 tick at a time or that won't look right either. So what to do? Well, as it goes up it starts out fast and gets slower as it reaches the top. Then the opposite on the way down.

We need a percentage of change for each direction. We have to decrease the incremental value of y as it goes up by some percentage, and we have to increase the incremental value of y on the way down. Simple up=y*.97 (or some other percentage less than 100) and down=y*(1+(1-.97)) ( a percentage greater than 100 ).

Here's an example:



Now if you add an x influence it will move sideways. You can use the same premise to slow down x due to friction or whatever.

DBC also has useful functions for this sort of thing. CURVEVALUE changes the value similarly from a start value to a destination value at a certain rate of change.

Quote: "3D objects that i lock to the screen, i can see through, i have a sphere with a recessed middle, but for some reason i can see inside of it, any ideas?"


Could be different things. The object is too close to the camera, maybe the normals are reversed... When you say 'lock to the screen' what do you mean?

Enjoy your day.
monkey for sale
17
Years of Service
User Offline
Joined: 8th Jun 2007
Location: Inside you head
Posted: 17th Apr 2008 02:10
there is a command that locks 3D objects to the screen, so that they stay in place on the window.

It isnt technically necassary for it to have real physics, but since i like to teach myself things and its a new subject I would like to do it, but since 3D would be considerably harder than 2D due to the 2 additional axes of rotation and the 1 additional of movement.

Why are you reading this?
Ortu
DBPro Master
17
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 17th Apr 2008 02:59
yeah, lock object on object#

as for seeing through it, you might try changing the cull setting with the set object command

monkey for sale
17
Years of Service
User Offline
Joined: 8th Jun 2007
Location: Inside you head
Posted: 17th Apr 2008 04:01
with back face culling off it has odd bald patches, turning it on makes it worse...

Are there any good tutorials on how to implement realish physics into a game? So far the only thing i know is that i cant just have the objects hit the ground and change direction, they will have to "absorb" some of the energy so that they dont always bounce to the same height every time.

I have found this guide, but not many others.
http://forum.thegamecreators.com/?m=forum_view&t=124945&b=30

Why are you reading this?
Link102
20
Years of Service
User Offline
Joined: 1st Dec 2004
Location: On your head, weeeeee!
Posted: 17th Apr 2008 14:03 Edited at: 17th Apr 2008 14:03
I´ve found an ebook about physics:
http://fliiby.com/file/16547/qzpp01c6bu.html
scrol down to the second menubar (the blue 3d button thingey), it has the download button on it.

Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 17th Apr 2008 17:11
Quote: "there is a command that locks 3D objects to the screen, so that they stay in place on the window. "

Just making sure you were talking about the command LOCK OBJECT ON which shoudn't have an influence on the visibility of faces if your object is within view.

Quote: "with back face culling off it has odd bald patches, turning it on makes it worse"

Your symptoms sound like it's a problem with the normals. Whatever 3d program you are using, try recalculating and/or reversing the normals before output.

Here's an example: the cube on the left has reversed normals. the cube on the right does not. You can see "into" the cube on the left:



Enjoy your day.
monkey for sale
17
Years of Service
User Offline
Joined: 8th Jun 2007
Location: Inside you head
Posted: 19th Apr 2008 23:07 Edited at: 20th Apr 2008 05:58
Here is what I have, if you look at the sphere object it has an odd transperency to it, but anim8or shows it is alright.

Also, can anyone think of a better way to do the toolbar? this is technically my first DB project, at least the first that isnt Carbonade or Bacteria Bash....

Since this is my first "project" can anyone think of better ways to streamline the code? Im trying to keep the main loop small since I dislike scrolling through it.

I am Lucifer, lord of the dead. Beware I, fore thou arst doomed

Attachments

Login to view attachments
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 20th Apr 2008 22:50
Do you have a different archiving format other than winace? WinZip would be probably be the easiest and most general to deal with.

Enjoy your day.
monkey for sale
17
Years of Service
User Offline
Joined: 8th Jun 2007
Location: Inside you head
Posted: 21st Apr 2008 00:03
here you go

I am Lucifer, lord of the dead. Beware I, fore thou arst doomed

Attachments

Login to view attachments
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 21st Apr 2008 04:18 Edited at: 21st Apr 2008 04:22
Weird. No matter what I tried, that transparency you were talking about kept happening - until I didn't use LOCK OBJECT ON. I tried a method that Milkman had put together a while ago that can be used in place of LOCK OBJECT ON and it worked. The model no longer had the transparency. Here's a link to the function:

http://forum.thegamecreators.com/?m=forum_view&t=99244&b=6

Don't include SET OBJECT ROTATION ZYX or SET OBJECT ROTATION XYZ inside of the function. It's better if you set those before and after the function is called. The reason for them is to keep locked objects from flipping when the camera is rotated. You will also have to call the function every iteration of the loop which might eat some resources.

Another way, where you won't lock the objects to the camera per se is to offset the objects position based on the camera position. You can do this using NEWXVALUE and NEWZVALUE. Here's an example of that - use the arrow keys to move and rotate the camera:



This is actually a variation of Milman's code but only uses built in DBC commands instead of trig.

Enjoy your day.
monkey for sale
17
Years of Service
User Offline
Joined: 8th Jun 2007
Location: Inside you head
Posted: 21st Apr 2008 16:58
I have an odd habit of breaking things like that... robots, games, electronic devices, I always find some random glitch which usually ends up in me losing blood.

Alright, now im curious to know if there is any ways to streamline my code, my program maintains a steady 30 FPS on my home system(I think my comp may be screwed up) but only 2/3 of the sync rate on my school computers.

I am Lucifer, lord of the dead. Beware I, fore thou arst doomed
monkey for sale
17
Years of Service
User Offline
Joined: 8th Jun 2007
Location: Inside you head
Posted: 23rd Apr 2008 21:03 Edited at: 24th Apr 2008 02:40
Alright, now i have a strange error when i added 1D of physics, gravity.....

When i select an object from the toolbar and place it onto the map, it starts falling, but it also creates a copy of itself which doesnt move, but if i get rid of the physics part it doesnt, can anyone help me figure out why? right now i dont have access to a zip program, so the code is posted, note of warning, it is long. The models needed are in the original file uploads of my previous post.

The part of the code where the glitch happened is after i added gosub applyNPhys.



I am Beelzebub, funny name for a satanic being...
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 25th Apr 2008 03:57
haven't read the code so excuse me if I'm way off.
Are you cloning an object to create the new object? If so it could be that you aren't deleting the original and so it stays floating above ground.

It is far better to complete a 10 line program than to start a 10,000 line program.
monkey for sale
17
Years of Service
User Offline
Joined: 8th Jun 2007
Location: Inside you head
Posted: 25th Apr 2008 04:14
when you select an object it creates an object of the selected tool number plus 500, then when you right click it deletes that and sets the selected tool to 0, if you left click it deletes the object and sets the tool number to 0, at least it is supposed to, and it has done this until i added the physics part, it should never clone the objects.

I am Beelzebub, funny name for a satanic being...
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 25th Apr 2008 04:52


if object exist(x+1000)
object#(x,7) etc

It seems you are initially checking for object x+1000 but then referencing object x (not x + 1000) which is a different object, no?

Enjoy your day.
monkey for sale
17
Years of Service
User Offline
Joined: 8th Jun 2007
Location: Inside you head
Posted: 25th Apr 2008 05:14 Edited at: 26th Apr 2008 01:25
the x is part of the array, i dont want too eat up memory with 1000 zeros before adding anything, the physical objects are +1000, grid objects are +500, and the toolbar is 1-10, and +100

EDIT: good news, i found the problem, one of the freshmen on my robotics team suggested coloring the objects, the issue was that the object that shows where you are placing the actual object was based on the total number of objects, so when i added another object it was trying to access an object one ahead of the actual object.

I am Beelzebub, funny name for a satanic being...
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 26th Apr 2008 04:42
that's what I meant
good idea to colour them

It is far better to complete a 10 line program than to start a 10,000 line program.
monkey for sale
17
Years of Service
User Offline
Joined: 8th Jun 2007
Location: Inside you head
Posted: 27th Apr 2008 19:35
alright, can someone help me with springs? on my reading, each spring is made of 2 nodes, to create flexible objects such as rope,cloth,or jelly, you connect the springs together. The springs force is equal to the inverse of its' stiffness times the displacement of the node from its' orginal position.

so based on that, i can make a solid mass of nodes, so how do i simulate it to move? I think each node must have a mass, so then I apply newtons law; Force=mass*acceleration; to every node, then have the spring apply its inverse force to the node?

can anyone help me with the code portion of this?

I am Beelzebub, funny name for a satanic being...
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 27th Apr 2008 21:30
monkey for sale
17
Years of Service
User Offline
Joined: 8th Jun 2007
Location: Inside you head
Posted: 28th Apr 2008 01:49
hmm, its nice, but has no rotation, or connectd springs

If I shot lightning out of my hands, what would you do?

Login to post a reply

Server time is: 2025-06-07 20:10:18
Your offset time is: 2025-06-07 20:10:18