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.

Work in Progress / XenoPhysics - A Havok Wrapper for DarkBasic Professional

Author
Message
marlou
15
Years of Service
User Offline
Joined: 17th Jan 2009
Location:
Posted: 11th Jan 2010 03:08
And please dont forget about the GDK version of XenoPhysics(Havok)..^^
Hehe..Thanks in advance..^^

When a person has nothing but a dream, can he dare to dream.
ShaunRW
DBPro Developer
16
Years of Service
User Offline
Joined: 7th Jan 2008
Location: Brisbane, Australia
Posted: 11th Jan 2010 04:50 Edited at: 11th Jan 2010 04:54
I'm sure he wont forget.

Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 11th Jan 2010 06:30
Haha, I will definitely not forget to let the Dark GDK users in on this. It isn't quite as much of a rush for me since technically you guys can use Havok natively, but the DBP and DGDK versions will be released at the same time. Do not worry.

ShaunRW
DBPro Developer
16
Years of Service
User Offline
Joined: 7th Jan 2008
Location: Brisbane, Australia
Posted: 12th Jan 2010 03:07
Yeah, if you GDK guys want havok why don't you just use the real thing?

marlou
15
Years of Service
User Offline
Joined: 17th Jan 2009
Location:
Posted: 12th Jan 2010 07:07
Quote: "Yeah, if you GDK guys want havok why don't you just use the real thing?"


Actually i tried but got stuck..Havok overrides the C++ new operator with their own..

When i was creating a hkpWorld ,hkpShape and other hkClasses i get an runtime error on their HKPALLOCATOR.
Any ideas why that happens Xarshi? I get errors with the allocators of Havok..

When a person has nothing but a dream, can he dare to dream.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 12th Jan 2010 10:53
Looks like I might need to postpone the release date for my WIP as this could improve on the DarkPhysics setup in several ways...

That being the case I'm still smiling!! Hope this works out and doesn't come too expensive...

Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 12th Jan 2010 12:50 Edited at: 12th Jan 2010 12:52
Quote: "When i was creating a hkpWorld ,hkpShape and other hkClasses i get an runtime error on their HKPALLOCATOR.
Any ideas why that happens Xarshi? I get errors with the allocators of Havok.."

My guess would be that it was initialized incorrectly, but I'm not sure.

With that being said, Havok does take a bit of work to get up and running, as well as some annoying conversions from vector3 rotation to quaternions and back. Other than that, the xeno start command has about 40 lines of C++ code underneath it. The character controller is ungodly with how much code went into it, hah.

Quote: "That being the case I'm still smiling!! Hope this works out and doesn't come too expensive..."

Well, it'll be free!

ShaunRW
DBPro Developer
16
Years of Service
User Offline
Joined: 7th Jan 2008
Location: Brisbane, Australia
Posted: 12th Jan 2010 14:35
Quote: "Well, it'll be free!"

Yeah, i can't afford it.

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 12th Jan 2010 14:47
Quote: "Well, it'll be free!"

In that case I accuse you of being TOO nice...

Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 13th Jan 2010 00:25
Quick Update

I've been researching Havok's actions that come with it as well as trying to see what actions you can create yourself. I'm fairly confident that these will prove to be a very useful asset to this plugin. One action that caught my eye was the "hkpReorientAction" action. This action will attempt to make a rigid bodies local up vector matches the worlds up vector. This would be used, for instance, to flip a vehicle.

Here's a list of actions I'll implement in this plugin:


I'm debating whether or not to add a wind vortex action into the plugin. I may or may not. But the explosion action would be something that would be better implemented since it is a derivative of the hkpWind class. That's about it for now, I'll try to have a nice little shiny demo of these actions for you all soon. I'm currently taking finals, but I'll work on the stuff as much as I can this week. So maybe by Friday or Saturday I'll have a demo. Maybe.

Grasmann
16
Years of Service
User Offline
Joined: 1st Sep 2008
Location:
Posted: 13th Jan 2010 00:57
Thats just a great work you do

I cant wait to use this XD

I thought about the functionality of such a plugin
and what I would like it to be able to.

Some kind of physic based, performance saving glue
object to limb
would be useful. So for example you
can create a weapon, maybe a shield or something,
a helmet and so on and glue it to your ragdoll to
release it later as a physical object.
It would also be cool if those glued objects where
able to bounce a bit or something like that for
example a weapon on the back, grenades on a belt.

Or for my kind of games the possibility to cut ragdolls
in parts with one command
would be great. This command
could include the texture numbers for the cut-area as a
parameter, maybe in different optional parameters to
texture different texture stages if shaders are used.

I dont know how much work that would be but It would be
cool to have such features.
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 13th Jan 2010 01:16 Edited at: 13th Jan 2010 01:17
Well, I haven't had much time to research Havok's ragdolls. I'll definitely be doing that, although truth be told I wish I had set up an environment in which I could test more easily. Everything except for vehicles I learned via programming a first person shooter in C++ with Irrlicht. But still, Ragdolls will most likely be a difficult concept to get down with 100% how I imagine it, but I'm sure it'll be doable. Oh, and actually Havok provides the ability to cut ragdolls apart. As well as have the cut parts animate still. It has some pretty nifty features, but I'm not sure how to implement them all as of yet. That will come soon, even if it has to be in its own plugin (since ragdolls are part of havok animation). That would mean there would be a plugin called XenoAnimation though. It might happen like that. We'll see.

Edit - I also forgot to mention that Havok lets you attach rigid bodies to ragdolls. So attachments are doable.

WickedVixen
17
Years of Service
User Offline
Joined: 28th Mar 2007
Location: New Brisbane, Utopia Prime, VGC GHQ
Posted: 13th Jan 2010 17:44
I can't wait!
This plug-in will definitely make my deep space RPG idea come together a little faster. The Havok physics had been something I wanted to implement, but didn't have any idea how. :/

Now, we can all use it for whatever we need it for! Xarshi, keep up the good work!

For a naming scheme: "xeno ..." is already being implemented. Could you use "xena ..." for the Havok Animation plug-in? Just a quick thought...

[/url]
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 13th Jan 2010 18:38
Quote: "For a naming scheme: "xeno ..." is already being implemented. Could you use "xena ..." for the Havok Animation plug-in? Just a quick thought... "

Yes xeno is being implemented, but the commands will not interfere so it won't really matter too much.

Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 14th Jan 2010 04:12
Quick Update

I've finished implementing gravity point functions. It's a small but useful command set which works quite well. I'll be implementing other actions soon enough as well.

I've also realized I had not added in commands to delete things. This of course was not good. I have implemented them though, as I didn't realize. I guess as a side effect though, I've watched a total of 74 hours of Stargate SG1 since halfway through this project... and now I really want to make a stargate game.

Airslide
20
Years of Service
User Offline
Joined: 18th Oct 2004
Location: California
Posted: 14th Jan 2010 04:23 Edited at: 14th Jan 2010 04:24
Quote: "... and now I really want to make a stargate game."


Don't do it - it never goes anywhere, trust me

Quite eager to get my hands on this. Out of curiosity, is there anyway to adjust the scale of the simulation? As of now you say 1 unit = 1 meter. Is it possible to change this at all?

Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 14th Jan 2010 04:30
Quote: "Don't do it - it never goes anywhere, trust me "

So it's been tried before, eh?

Quote: "Quite eager to get my hands on this. Out of curiosity, is there anyway to adjust the scale of the simulation? As of now you say 1 unit = 1 meter. Is it possible to change this at all?"

Well, yes and no. You can have boxes be as large as you want, but it is recommended to have you scale everything to 1 unit = 1 meter. Havok performs more accurately at that scale.

ShaunRW
DBPro Developer
16
Years of Service
User Offline
Joined: 7th Jan 2008
Location: Brisbane, Australia
Posted: 14th Jan 2010 08:13
Any plans on releasing a demo yet?
I really can't wait.

kaedroho
17
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 14th Jan 2010 10:22
Ive sent him the source code to the main BlitzTerrain demo. Hopefully he will get round to adding some physics into it and show you guys a XenoPhysics + BlitzTerrain Demo!

ShaunRW
DBPro Developer
16
Years of Service
User Offline
Joined: 7th Jan 2008
Location: Brisbane, Australia
Posted: 14th Jan 2010 16:17
Woohoo, even better. looking forward to it

KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 14th Jan 2010 17:41
Quote: "...adding some physics into it and show you guys a XenoPhysics + BlitzTerrain Demo!"


HAPPY DANCE!!!
HAPPY DANCE!!!
HAPPY DANCE!!!

My son wants to make a monster truck game, and we're both chomping at the bit to get our hands on these two packages together.

Can't wait..

Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 15th Jan 2010 05:32
Well, I had a little time today so I finished gravity points. Pretty much great fun. Think of a super gravity gun, where it not only affects one object, but forms a sort of black hole at a certain point. The next demo I'll get to work in this will be the terrain demo, then I'll be implementing a vortex world action which will be exciting itself. I think I'm going to make a physics puzzle game when all this is finished, mixed with a bit of combat as well.

ShaunRW
DBPro Developer
16
Years of Service
User Offline
Joined: 7th Jan 2008
Location: Brisbane, Australia
Posted: 18th Jan 2010 11:16
Haven't heard anything in a few days. Hows it going Xarshi?

Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 18th Jan 2010 18:03
Sound's good, but unless you can change the size of both dynamic and static rigid bodies it's no use to me. I do hope you add those commands, or even a 'recalculate rigid body scale' to make the physics object match the visual objects size?

Can these be added? Either
'Recalculate Rigid Body Scale'
or
'Set Rigid Body Scale'

I really want this functionality for my game engine!

Good work anyway!

My signature is NOT a moderator plaything! Stop changing it!
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 18th Jan 2010 18:31
Quote: "Haven't heard anything in a few days. Hows it going Xarshi?"

It's going slowly at the moment.


Quote: "Sound's good, but unless you can change the size of both dynamic and static rigid bodies it's no use to me. I do hope you add those commands, or even a 'recalculate rigid body scale' to make the physics object match the visual objects size?"

I'm not sure any physics engine has that. It would require building the rigid body over again. I can add it in I guess, but it would just be rebuilding the rigid body.

Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 18th Jan 2010 18:34
Quote: "but it would just be rebuilding the rigid body."

That's fine. It doesn't need to be real-time, just once on loading of the visual object will suffice!

It's just that DarkPhysics allows the scaling of a static object before the rigid body is created, but not dynamic objects.

It's just so I can, for example, create a wall and set it as a static object, then change the size of the wall. Or get an x object and rescale it so it fits with the scale of the game.

My signature is NOT a moderator plaything! Stop changing it!
N3wton
15
Years of Service
User Offline
Joined: 3rd Jun 2009
Location: Leeds, UK
Posted: 18th Jan 2010 19:21
Quote: "That's fine. It doesn't need to be real-time, just once on loading of the visual object will suffice!

It's just that DarkPhysics allows the scaling of a static object before the rigid body is created, but not dynamic objects.

It's just so I can, for example, create a wall and set it as a static object, then change the size of the wall. Or get an x object and rescale it so it fits with the scale of the game."


why not delete the rigid body, scale the object, then make a new rigid body?

unless i misunderstood what youve said?

yours
N3wton

Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 18th Jan 2010 19:31
I could do that for static objects, but that's only half the problem. Scaling doesn't work at all for dynamic objects.

My signature is NOT a moderator plaything! Stop changing it!
N3wton
15
Years of Service
User Offline
Joined: 3rd Jun 2009
Location: Leeds, UK
Posted: 18th Jan 2010 19:34
hmmm...

Delete rigid body
scale object
clone object
delete original object
make rigid body on new object

or

Delete rigid body
scale object
save object
delete object
load object
make rigid body

dunno if they would work, just some suggestions

p.s. this dll still looking to be released for the end of this month?

yours
N3wton

Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 18th Jan 2010 19:35
Quote: "I could do that for static objects, but that's only half the problem. Scaling doesn't work at all for dynamic objects."

The same problem would exist if I did this in the plugin unfortunately. There is no real way around this regretfully.

Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 18th Jan 2010 19:43
Ah crap.

I just tried deleting the rigid body and recreating it but it didn't work. I don't really want to delete the visual object though. I suppose I'll give it a try.

Quote: "The same problem would exist if I did this in the plugin unfortunately. There is no real way around this regretfully."

Poop. Not a good answer. I guess I need a plugin which scales an object and saves it out, then I can load that one in.

My signature is NOT a moderator plaything! Stop changing it!
KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 18th Jan 2010 19:59
Quote: "It's just that DarkPhysics allows the scaling of a static object before the rigid body is created, but not dynamic objects."


Is that a flaw with DarkPhysics or DBP?

RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 18th Jan 2010 20:28
Id guess its the same issue with repositioning objects without forces. Things in the real world don't get "positioned" as they move, that'd be teleporting, without any forces. The same goes for scaling things, they don't just "get" bigger, they create and require forces to grow.
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 19th Jan 2010 01:43
Wait, you want to scale the rigid body before you create it? Or whilst it is already created? It will already be able to be scaled before it is created, but not afterward since that would of course have problems.

Daniel wright 2311
User Banned
Posted: 19th Jan 2010 03:55
cool cant wait, i cant finish my game with out this. im still waiting for your relise.

ShaunRW
DBPro Developer
16
Years of Service
User Offline
Joined: 7th Jan 2008
Location: Brisbane, Australia
Posted: 19th Jan 2010 09:37
Quote: "cool cant wait, i cant finish my game with out this. im still waiting for your relise."

Same as me.

Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 19th Jan 2010 16:30 Edited at: 19th Jan 2010 16:41
Quote: "they don't just "get" bigger, they create and require forces to grow. "

Imagine a balloon though? Physics can't model that.

Quote: "Wait, you want to scale the rigid body before you create it? Or whilst it is already created?"

Both. Objects can be scaled before you set them up as static rigid bodies, but not afterwards and dynamic bodies can't be scaled at all, which is a major issue.

Again, this functionality is required for a level editor which requires the ability to scale, rotate and translate objects.

My signature is NOT a moderator plaything! Stop changing it!
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 19th Jan 2010 16:50
Quote: "Imagine a balloon though? Physics can't model that."


Newtonion physics can't but other types can

RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 20th Jan 2010 05:42 Edited at: 20th Jan 2010 05:44
I dont understand Mobbius, why can't you just recreate the physics body everytime the object is scaled? I understand Dark Physics has bugs with deleting physics bodies, but thats dark physics, I doubt the Havok wrapper will have the same issues. Assuming Xarshi is including the ability to delete physics bodies (which I cant see him not including), you'd just check when the user re-scales the object, then delete it's physics body and recreate it based on the new size. Whats so hard about that?

Im working on a "level editor" as well and this is what I plan to do.

Id imagine you'd also be able to work in some forces with the scaling system. Just get a percentage as to how much bigger the object is being scaled, then apply this percentage to an arbitrary force and then apply this force to all objects colliding with the newly scaled object, making the force direction going from the centre of the object towards the collision point. All of this can be done with Dark Physics, first checking for object collision, then getting the collision point, then adding a local force to the object hit. Im sure you could use some sort of a force field in DP to achieve a similar effect as well.
revenant chaos
Valued Member
17
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Robbinsdale, MN
Posted: 20th Jan 2010 06:18
Mobiius - In my project I am able to scale an object (either static or dynamic), then successfully create it's rigid body by:

1)loading/creating the object
2)scale the object
3)make a mesh from the object
4)delete the original object
5)re-create the object from the mesh
6)delete the mesh
7)apply textures to the object

The new object will have retained the scale you specified, so it's rigid body will match. Too bad there isn't any way to scale an existing rigid body in real-time.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 20th Jan 2010 10:01
I use this code to scale the object using it's vertex data (from David W), maybe scaling it this way will work better than the native scale command?:


Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 20th Jan 2010 12:24
Quote: "why can't you just recreate the physics body everytime the object is scaled?"

I tried. No joy. But I still can't scale dynamic objects at all! Not even once just after loading.

Quote: "In my project I am able to scale an object (either static or dynamic), then successfully create it's rigid body"

Creating a mesh from an object does not retain its textures and there is no way of copying the texture information from the original object to the newly created one. (And I don't know how to include per face texturing and UV scaling/rotating in real-time using DBP code)
I had thought of this method for my vertex scaling code. (Which bring me nicely on to.....)

Quote: "I use this code to scale the object using it's vertex data"

That only work if each polygon is separate, creating duplicate vertices. The best way to resolve this is by turning it into a mesh first, then see my above point.

I suppose I'll give this plugin a try using some of the above techniques, but it needs to be finished first! lol I can't design a game engine based on technology which hasn't been released yet! I'm not Microsoft! lol

My signature is NOT a moderator plaything! Stop changing it!
revenant chaos
Valued Member
17
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Robbinsdale, MN
Posted: 20th Jan 2010 16:07
Quote: "Creating a mesh from an object does not retain its textures and there is no way of copying the texture information from the original object to the newly created one."


Yes there is.
1) Loop through the object's limbs, and either store the object's texture (image) IDs or their filenames in an array (using Limb Texture() or Limb Texture Name())
2) Make a mesh from each of the object's limbs
3) Delete the original object
4) Re-Create the object from the meshes (using Make Object and Add Limb)
5) Apply the textures from the data in the array
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 20th Jan 2010 17:21 Edited at: 20th Jan 2010 17:21
Quote: "5) Apply the textures from the data in the array "

This only works if one limb has 1 texture. What if, for example, a limb has 2 textures?
Does this system work for this?

My signature is NOT a moderator plaything! Stop changing it!
revenant chaos
Valued Member
17
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Robbinsdale, MN
Posted: 20th Jan 2010 17:51
Quote: "What if, for example, a limb has 2 textures?"
That isn't possible as DBpro would automatically consider each different material as being a different limb.
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 20th Jan 2010 18:11
Quote: "That isn't possible as DBpro would automatically consider each different material as being a different limb. "

So by reading each limb and getting the textures it should work then?

My signature is NOT a moderator plaything! Stop changing it!
thenerd
15
Years of Service
User Offline
Joined: 9th Mar 2009
Location: Boston, USA
Posted: 20th Jan 2010 23:58
yeah, probably. actually, with the version I have of the DLL, I have to do that, it crashes unless I convert the object to mesh and back again.

I can't wait until this is stable and released...

Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 21st Jan 2010 01:34
Quote: "yeah, probably. actually, with the version I have of the DLL, I have to do that, it crashes unless I convert the object to mesh and back again.

I can't wait until this is stable and released..."

Haha, yeah, that's fixed in the version I have laying around here. Right now I'm debating on where to go next. I was going to add in explosions, but I'm not sure anymore as I'm fairly confident you people are intelligent enough to figure it out. I need to do constraints now actually. Then triggers. Then I'll, I hate to say this, make an alpha release I think. So soon you guys will be able to play around with this.

Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 21st Jan 2010 22:15 Edited at: 22nd Jan 2010 23:46
Hi Xarshi, that fix that you are talking about above, it may be related to a problem I am having.

I am creating a physics plug-in(physX) for DGDK, when I make a physics triangle mesh from an object I have loaded from x file(I am using the tank model you get free) it is upside-down, if I create a mesh from it(reducing it to one mesh) then create an object from this mesh, then pass this new object into my 'make triangle mesh' command it is the correct way up.
Do you know what causes this? did you have same problem? if so, what did you do to fix?
though I have a workaround, its ugly and I wouldn't be able to sleep at night if I left it like this.
Any help would be much appreciated, thanks.



EDIT: Never mind, it turned out it was not upside down, the limbs were not being positioned locally, think I got it fixed now, phew.
Daniel wright 2311
User Banned
Posted: 22nd Jan 2010 12:42
Quote: "Id imagine you'd also be able to work in some forces with the scaling system. Just get a percentage as to how much bigger the object is being scaled, then apply this percentage to an arbitrary force and then apply this force to all objects colliding with the newly scaled object, making the force direction going from the centre of the object towards the collision point. All of this can be done with Dark Physics, first checking for object collision, then getting the collision point, then adding a local force to the object hit. Im sure you could use some sort of a force field in DP to achieve a similar effect as well. "


thats sounds solid to me

Login to post a reply

Server time is: 2024-11-24 19:04:13
Your offset time is: 2024-11-24 19:04:13