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.

Dark Physics & Dark A.I. & Dark Dynamix / Dark Physics News - December

Author
Message
Mike Johnson
TGC Developer
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 3rd Dec 2007 18:21
For various reasons been unable to commit much time to Dark Physics. However, for the next two weeks my main focus is on Dark Physics and my aim is to solve as many existing problems as possible and get an update out on the 14th. Also intending to add in a few new features such as soft bodies and force fields.

So far I have spent time reading a lot of the older posts and making notes as to what needs to be done. Also been getting assistance from a few other people.

If anyone has any issues they would like to highlight then please let me know. Either email or post and ideally provide a small example program so I can see the problem. For now it would be better to get bug fixes done first and later look at adding new commands.

Here is an overview of some of the things I've sorted today:

General
When an object is removed from the simulation control is now correctly returned to DB Pro.

Fixed an issue which resulted in being unable to switch kinematic objects off.

The command “phy set rigid body rotation” will now clear angular and linear velocity. Seen a few people mention this problem. Not sure if this is the behaviour that everyone wants to see.

Updated string table for “phy get character controller exist”.

The command “phy get rigid body type” now returns the correct type index.

Materials for convex objects are now applied correctly.

Collision
New command added “phy get collision”. It takes two parameters “object A” and “object B”. It returns true if the objects have collided and false otherwise. This command can be used as an alternative to the collision stack approach.

New command added named “phy set collision state”. It is used to enable or disable collision and response. It takes two parameters with the first being the object ID and the second being the state. Use a state value of 0 to disable collision and response and 1 to enable collision and response.

An alternative ray cast command has been provided. It is called “phy ray cast” and takes 6 parameters. The first three parameters are the origin of the ray and the final three are the world space coordinates for the target of the ray. This command will return a value of 1 if the ray intersects an object. An extra version of this command is provided that takes an additional parameter. The parameter controls what kind of objects are targeted in the ray cast. Use 0 for all objects, 1 for dynamic objects and 2 for static objects.
[b]
pdq
18
Years of Service
User Offline
Joined: 20th Jul 2006
Location:
Posted: 3rd Dec 2007 23:13
Mike I posted this up a while a go but was not able to get a response.

Here is my code below in an attempt to create a "skinned" ragdoll:



I used the aiko.X model I got from AI tech demo. I made fixed joints for simplicity. Now the actual ragdoll works. The problem is assigning aiko.X to the ragdoll

Problems:
1st the mesh gets distorted.
2nd the mesh simply does not deform to the ragdoll.

Some questions about the code:



Do I use objBIP01 since that object is supposed to be the parent of the rest of the skeleton?



Do I use "0" for the mesh assignment?

Any help, especially anyone who has working code would be great!!

Along these lines, will you provide another "skinned" ragdoll character?


Thanks Mike.
Redmotion
21
Years of Service
User Offline
Joined: 16th Jan 2003
Location: Mmm mmm.. Marmite
Posted: 4th Dec 2007 00:22 Edited at: 4th Dec 2007 00:24
This is great news, Mike, thanks.

Could the ray cast and other collision commands also return the world co-ordinates of the collision also? It would be good for getting sparks and puffs of dust etc to appear in the right place.

DP Bugs i've come across are:-
- Particles disappear when you view the from a particular angle. They be facing away from the camera at certain angles.
- I was having trouble with some objects not attaching to their physics bodies and remaining stuck at their initial position, even though the physics object was working correctly. Not sure if this got fixed in the last update.
- Could never get rag dolls to work as the workflow was not explained in the docs. Its easy to make a rag doll object but near impossible to link it to a character-type mesh (as discussed in the previous post.)

Check out The Grand Machines! & Black Mesa: Source <- vote @ www.moddb.com
Airslide
20
Years of Service
User Offline
Joined: 18th Oct 2004
Location: California
Posted: 4th Dec 2007 06:02
The raycast command change is EXACTLY what I needed. Can we also get collision detection with character controllers? One of the main problems I was having at one point was telling if the player was on the ground, which is really simple if I just use Sparky's spherecast.


Vote today and play the games!
Agent Dink
20
Years of Service
User Offline
Joined: 30th Mar 2004
Location:
Posted: 4th Dec 2007 07:14
Yay, these fixes and additions will be great Mike! Can Dark Physics support cylindrical collision meshes without having to generate a mesh (as that process seems very buggy as of now, sorry dont have any examples).

Also, you mentioned force fields, would these be defined as attractors / repellers?

I look forward to this, good luck

BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 4th Dec 2007 10:42
I posted and lost everything I wrote (my PC keeps clearing the cookies )

In an nutshell..what is the "response" in the collision functions?
And yes, cylinder Rigid Bodies would be fantastic if they are available. They are more useful than the "pill" shaped RB, because they don't fall over!

Mike Johnson
TGC Developer
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 4th Dec 2007 12:46
Thanks for the comments. Will look into the things mentioned.

Been adding new collision commands and also spent a short while on force fields. Here is a small example of some commands:



This code will create a force field, set it to use cartesian coordinates, set a force on the X axis, build the force field and finally add two boxes. The first box is the area where the force is active. The second box excludes a small zone from the force. In this particular example I had a stack of boxes and they get thrown over to the left and then pile up. Works quite well.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 4th Dec 2007 13:15
What exactly do you mean by force field? Is it a point which repels objects by applying a force as they get closer? Or is it a "one hit" thing that you might use for explosions? And could it be used for a wind force, for example, with a constant value across an entire scene?

Mike Johnson
TGC Developer
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 4th Dec 2007 13:39
Force fields are defined as a set of shapes. Inside these shapes you can have certain forces being applied. For example, imagine you have a scene of size 100 x 100 x 100. If you wanted to create a wind effect you can make a force field, give it a box shape of size 100 x 100 x 100 and give it a force in a certain direction. At runtime you can increase or decrease this force.

As another example you can create a rigid body and attach it to a force field, move this rigid body to a certain location and fire it off to cause an explosion.

You could also use these effects to create some kind of ultra powered weapon that can gather up a collection of objects and fire them in a direction.
Redmotion
21
Years of Service
User Offline
Joined: 16th Jan 2003
Location: Mmm mmm.. Marmite
Posted: 4th Dec 2007 16:25 Edited at: 4th Dec 2007 16:26
So, if I'm guessing right you could make an area in the level where gravity suddenly flips upside down... bit like Super Mario Galaxy (or sideways for a wind tunnel.) Nice.

Looking forward to the soft bodies stuff too. It would be nice to be able to create these from an object/mesh.

Check out The Grand Machines! & Black Mesa: Source <- vote @ www.moddb.com
Agent Dink
20
Years of Service
User Offline
Joined: 30th Mar 2004
Location:
Posted: 4th Dec 2007 16:29
Could you use these forcefields to support gravitational forces on mini planets? I have a game idea that requires many miniature planets all in the play field at once and simulating gravity on them by hand would be hard. If these forcefields do something like that, they would be a real lifesaver.

RalphY
20
Years of Service
User Offline
Joined: 6th Sep 2004
Location: 404 (UK)
Posted: 4th Dec 2007 17:37 Edited at: 4th Dec 2007 17:38
Could you add create cloth from object/limb/mesh if it hasn't already been added?

Cheers

Oh boy! Sleep! That's when I'm a Viking! | Super Nintendo Chalmers!
kaedroho
17
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 4th Dec 2007 20:11
Yay! ive been waiting for the forcefields for a while and i decided to use sparky raycasting, i can switch back now. Thanks Mike

pdq
18
Years of Service
User Offline
Joined: 20th Jul 2006
Location:
Posted: 4th Dec 2007 21:42
Also will rigid bodies from limbs be enabled as is quoted below from the Dark Physics documentation?


"In this example program an X model is loaded and each limb is represented as a rigid body box. This is useful for situations where more complex set up are required to handle collision in a more appropriate way."
Mike Johnson
TGC Developer
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 5th Dec 2007 10:33 Edited at: 5th Dec 2007 10:33
Here is an example of how a force field can work:

* built a stack of cubes
* made a kinematic sphere
* attached a force field to this and made it like a magnet
* move the spheres around with the arrow keys



This is the main code for it:



It works really well and I'm sure lots of effects can be created. I'd say it's possible to do gravity effects and wind tunnels etc. All looks very promising.

Attachments

Login to view attachments
Mike Johnson
TGC Developer
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 5th Dec 2007 10:42
Also just to let you know I made changes to the particle system. Was unable to replicate the problem reported whereby particles vanished but altered it so this should not happen. I also updated the continuous collision detection code - it will now work with spheres.
david w
18
Years of Service
User Offline
Joined: 18th Dec 2005
Location: U.S.A. Michigan
Posted: 5th Dec 2007 12:09
Have you fixed the problem where the collision data does not follow a static mesh if repositioned?

Load object "mymesh.x", 1
position object 1,100,100,100
phy make static mesh 1

the collision data does not always update to the correct position. We have been doing a work around this for some time, where you make the object and set its position/rotation/scale in a 3d modeler and then load it, because Dark Physics does not update the rigid body collision data.

Because of this we can no longer use clone object/instance object.

The funny thing is it works fine for dbp primitives and meshes that are made natively in dbp, just not for meshes created outside dbp.

This is a very serious problem.

Thank you.
Mike Johnson
TGC Developer
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 5th Dec 2007 12:29
david w, can you either post or send me an example of this problem. Thanks.
Redmotion
21
Years of Service
User Offline
Joined: 16th Jan 2003
Location: Mmm mmm.. Marmite
Posted: 5th Dec 2007 15:46
I experienced a similar problem during the DP compo, see my post here:

http://forum.thegamecreators.com/?m=forum_view&t=90622&b=15

It may have been fixed in a patch so I will try to recreate it and post the file - it may take a day or so though.

Check out The Grand Machines! & Black Mesa: Source <- vote @ www.moddb.com
Agent Dink
20
Years of Service
User Offline
Joined: 30th Mar 2004
Location:
Posted: 5th Dec 2007 16:09
Not to be an idiot, but you have still left unanswered, do we get cylinder primitives in the near future ^_^

Forcefields look awesome, appear to be just what I want! Can't wait!

Mike Johnson
TGC Developer
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 5th Dec 2007 16:21
Agent Dink, checking the documentation to find out about cyclinders. Will let you know when I find out.
Kendor
21
Years of Service
User Offline
Joined: 31st Jan 2003
Location: Malta
Posted: 5th Dec 2007 16:38 Edited at: 5th Dec 2007 16:38
Mike, for the problem mentioned by david w, you can find an example here.

1. Fixed joints are not deleted



2. Phy clear does not delete joints.



Theory is when you know something, but it doesn't work. Practice is when something works, but you don't know why.
Programmers combine theory and practice: Nothing works and they don't know why.
Agent Dink
20
Years of Service
User Offline
Joined: 30th Mar 2004
Location:
Posted: 5th Dec 2007 18:31
Thanks Mike!

bosskeith
18
Years of Service
User Offline
Joined: 5th Dec 2005
Location:
Posted: 6th Dec 2007 01:46
This is great news.
I would like to see a return value for whether or not joints are intact.

joint broken(joint#)

example of usage

if joint broken(enemyweaponjointID)=0 then gosub enemyfiresAI

Mike Johnson
TGC Developer
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 6th Dec 2007 11:06
Kendor, fixed the problem with meshes today. Your example code now works fine with only one change - an error message is now displayed by the runtime whenever you attempt to move a static rigid body by using "phy set rigid body position".
Mike Johnson
TGC Developer
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 6th Dec 2007 11:11
Joints will now delete properly. You won't get to see the effect properly in Kendors example due to the way the objects are positioned. If you want to check it open the simple joints combination demo and add this in:



When the space bar is pressed the two objects being used will collapse.
Mike Johnson
TGC Developer
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 6th Dec 2007 11:15
The command "phy clear" will now remove joints.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 6th Dec 2007 12:33
This is a nice log of what's being updated, thank you

Mike Johnson
TGC Developer
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 6th Dec 2007 13:39
Agent Dink, no specific option for cylinders in the SDK. Maybe it might be worth trying to create a cylinder that closely matches your object and then pass this into Dark Physics as a convex mesh.
Mike Johnson
TGC Developer
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 6th Dec 2007 13:46
New command added "phy get joint state". It will return 0 when the joint is not being used, 1 when the joint is simulating and 2 when the joint has broken. To test it edit the fixed joints example and first increase the break limits on joint 1 to 100, 100. If you don't do this it will break straight away. Now add this code into the main loop:

Mike Johnson
TGC Developer
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 6th Dec 2007 13:51 Edited at: 6th Dec 2007 13:51
Other new commands include getting more information back about collisions taking place. This screenshot shows all the contact points when the two boxes collide:



And here is the code used:

Attachments

Login to view attachments
Master Xilo
18
Years of Service
User Offline
Joined: 8th Sep 2006
Location: Bern, Switzerland
Posted: 6th Dec 2007 13:51
Things that would be cool for new version:
- soft bodies
- make cloth from object
- a working example with a skinned ragdoll object
- bug fixes
- fluids without hardware (that's possible for the SDK)
Redmotion
21
Years of Service
User Offline
Joined: 16th Jan 2003
Location: Mmm mmm.. Marmite
Posted: 6th Dec 2007 16:14
Great stuff on the collision points info, Mike. This is like christmas for physicsophiles!

I have one more question - and its the same as Xilo, is there a specific reason why you can't release the fluids commands to work without the hardware?

Check out The Grand Machines! & Black Mesa: Source <- vote @ www.moddb.com
Mike Johnson
TGC Developer
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 6th Dec 2007 16:33
Not yet looked at fluids. Will do so in the next few days. If it all works out well then we'll have software fluids in the update.
Agent Dink
20
Years of Service
User Offline
Joined: 30th Mar 2004
Location:
Posted: 6th Dec 2007 17:27 Edited at: 6th Dec 2007 17:29
Quote: "Agent Dink, no specific option for cylinders in the SDK. Maybe it might be worth trying to create a cylinder that closely matches your object and then pass this into Dark Physics as a convex mesh."


Alright, thanks Mike.... Bah. I was trying to do this with my project, but it seems that generating a cylindrical mesh is buggered. I've used box meshes and it works beautifully (well, for boxes, I need a cylinder to represent my objects perfectly as, well, they are cylinders, and there are a good bit of them) but when I generate a collision mesh from a cylinder it makes the physics very erratic and almost completely uncontrollable as if it's not generating the collision mesh properly... I'll do some tests and see if I can get you some code to check it out with. Thanks for looking into it, and all the other updates sound wonderful, I look forward to this update

Redmotion
21
Years of Service
User Offline
Joined: 16th Jan 2003
Location: Mmm mmm.. Marmite
Posted: 6th Dec 2007 17:54
Agent Dink, Dynamic convex meshes would be the most obvious route, like Mike says. Is this what you are using to substitute cylindrical meshes at the moment? Is it a DBPro cylinder or an imported mesh?

Check out The Grand Machines! & Black Mesa: Source <- vote @ www.moddb.com
lukas
18
Years of Service
User Offline
Joined: 22nd Dec 2005
Location:
Posted: 6th Dec 2007 18:53
softbodies...fluids...mmhmm would be so great to have these things in the update
Will the softwarefluids look like those in the example which comes with the physx driver or perhaps better?
Agent Dink
20
Years of Service
User Offline
Joined: 30th Mar 2004
Location:
Posted: 6th Dec 2007 18:55 Edited at: 6th Dec 2007 19:14
@Redmotion, yes, I'm using dynamic convex meshes. And yes, the mesh I'm using for the collision mesh is an imported model.


EDIT: I slightly retract my statement about them being nearly uncontrollable. That was with earlier tests using a differently triangulated cylinder mesh. Using the current triangulation method on my cylinders gives better results, but they are still very different than the box meshes I was using before.

Obviously the two will react differently, but the the box meshes seem to come to rest alot better, they don't slide around all over the place or bounce erraticly and most importantly they never seem to intersect and get locked together like the cylinder meshes do (yes I have toyed around with all the various restitution, skin width, and friction settings).

Mike, I may e-mail you a link to download my project later, it's too big to post as a code snippet here and there's media involved, so I don't much feel like remaking the project without it... I'll see what the zipped up file sizes look like and I'll let you know. I'll send the various cylinder meshes I have tried so you can see the varying results.

Again, love the updates, keep 'em coming

Kendor
21
Years of Service
User Offline
Joined: 31st Jan 2003
Location: Malta
Posted: 6th Dec 2007 19:55 Edited at: 6th Dec 2007 19:55
Thanks Mike!

One last thing, since we are talking about dynamic meshes, a couple of months ago, I think in May, I've sent you an email regarding dynamic meshes being created as flipped objects in the physics representation (see pic). Still don't know if it is a bug or not, since other dynamic objects work. Should I send it again?



Theory is when you know something, but it doesn't work. Practice is when something works, but you don't know why.
Programmers combine theory and practice: Nothing works and they don't know why.

Attachments

Login to view attachments
Mike Johnson
TGC Developer
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 6th Dec 2007 20:18
Kendor, please can you send the example again. I will take a look tomorrow.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 6th Dec 2007 21:49
The debugger Z-Axis is "back to front". By default, you will be looking in the positive Z-direction in DB Pro, and the negative Z-Direction in the debugger. It's very confusing at first

Kendor
21
Years of Service
User Offline
Joined: 31st Jan 2003
Location: Malta
Posted: 6th Dec 2007 22:11
Email sent.

Quote: "The debugger Z-Axis is "back to front". By default, you will be looking in the positive Z-direction in DB Pro, and the negative Z-Direction in the debugger. It's very confusing at first "


But that should not affect the collision between objects, right? As you can see from the picture, the object in DBP is sinking into the ground , while in the debugger it collides as it should.

I have attached the media and exe, if someone wants to see the problem. Remember to run the visual remote debugger prior running the exe.

Theory is when you know something, but it doesn't work. Practice is when something works, but you don't know why.
Programmers combine theory and practice: Nothing works and they don't know why.

Attachments

Login to view attachments
David iz cool
19
Years of Service
User Offline
Joined: 21st Sep 2005
Location: somewhere lol :P
Posted: 6th Dec 2007 23:58
mike can u give us a character controller that can jump please?

thats all i want.
Mike Johnson
TGC Developer
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 7th Dec 2007 12:53
Fixed the program that Kendor sent. Was a problem with the way dynamic meshes were being handled.

Also tested a program from Redmotion. Looks like that is fine now as well.
Chenak
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 7th Dec 2007 15:52 Edited at: 7th Dec 2007 15:54
Character controllers definately need better commands, the displacement stuff is just needlessly over complicated.

A position character controller command is needed for certain, as well as rotation and movement commands such as move up, down, left, right etc. Otherwise it is just easier to set everything up yourself with a dynamic body and applying forces to move it around making character controllers redundant.

Collision options for the controller would be good to add too since kinematic objects seem to have the ability to send the heaviest of objects flying around.

Are the make cloth from object commands going to be added? Also if the particles commands were as extensive as the particle and cloth plugin commands I would be very happy
Master Xilo
18
Years of Service
User Offline
Joined: 8th Sep 2006
Location: Bern, Switzerland
Posted: 7th Dec 2007 19:05 Edited at: 8th Dec 2007 01:21
BUGS:

All with example code (fly around using keys)

phy get collision normal force x(yz) ( )
doesn't seem to work/exist


phy get collision friction force x(yz) ( )
doesn't seem to work/exist


culling
only rigid bodies that are made of instanced objects will still get culled correctly


load rigid body mesh
doesn't work for instanced objects (but make rigid body box etc. works)

returns a fatal error but

retruns a physics error

load rigid body mesh
doesn't load anything
I attached an example for that.
Main code section:

load object "box.x",2
phy make rigid body dynamic mesh 2,"boxphy.phy"
phy delete rigid body 2:delete object 2

load object "sphere.x",2``#######################replace this with "box.x" and also the physics collisions will be different
phy load rigid body dynamic mesh 2,"boxphy.phy"

Attachments

Login to view attachments
Lucy
17
Years of Service
User Offline
Joined: 19th Apr 2007
Location: Roanoke, VA USA
Posted: 11th Dec 2007 21:02 Edited at: 11th Dec 2007 21:03
A few things I'd like to see...

Axis specific movement and rotation, or more to the point allowing the restriction of movement only on certain axes.

Axis specific drag and similar settings.

Support for the hardware's brownian motion.

Support for vehicles with arbitrary numbers of wheels. One, two, three, five, six... Four is such a restrictive number.

That's features, but one thing I'd like to see is a much better example of vehicle dynamics. While I was able to get all the power sliding and whatnot going and dumped an open source example on the forums, I'm not that great with logarythms and whatnot, and not many people are, so I can't really calculate realistic sliding.

I don't know if it's a DBPro issue or a DarkPhysics issue, but it seems nearly impossible to get both vehicle sliding going and making a vehicle not slide sideways when sideways on a hill. Or slideing in any direction when the brake is on.

(Edit) Oh right, and it would be nice to be able to load matrices in to DarkPhysics.

When the power of love overcomes the love of power, the world will know peace.
Mike Johnson
TGC Developer
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 12th Dec 2007 13:18
Master Xilo, I have made a new collision demo. It shows how to use functions such as phy get collision friction force x. I have also solved the issues with culling. Also added a file exist check when loading dynamic meshes so you won't get a crash anymore.
Master Xilo
18
Years of Service
User Offline
Joined: 8th Sep 2006
Location: Bern, Switzerland
Posted: 12th Dec 2007 21:25 Edited at: 12th Dec 2007 21:30
Quote: "Also added a file exist check when loading dynamic meshes so you won't get a crash anymore. "


I got a crash because i tried to apply a loaded mesh to an instanced object.

Quote: "load rigid body mesh
doesn't work for instanced objects"


like:

clone object 2,1
phy load rigid body dynamic mesh 2,"x.phy"


works, but

instance object 2,1
phy load rigid body dynamic mesh 2,"x.phy"


Can you add add the possibility to "attach" loaded rigid body dynamic meshes to instanced objects?

EDIT:
Thanks for solving the culling problems and for reparing the get collision force commands.

Login to post a reply

Server time is: 2024-11-24 20:56:38
Your offset time is: 2024-11-24 20:56:38