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
MartinS
18
Years of Service
User Offline
Joined: 15th Dec 2005
Location: Rochester, NY
Posted: 1st Jul 2007 18:14 Edited at: 1st Jul 2007 23:20
Hi all,

I just got Dark AI! Well sort of, anyway. I've paid for it, but the download hasn't been 'approved' as of Sunday (Today). :/

Anyhow, I was wondering how I would go about implementing DAI into my game whilst still keeping my physics library in the game. Any help on any physics library is greatly appreciated, although Newton-specific code is extra cool.

Thanks,
G2L

P.S. Sorry if this has been asked before - for some reason the search box isn't working properly.

EDIT: Dark AI has been 'approved'! Downloading now...

TGC, you have superb service. I purchased DAI this morning, it's here now, and on a Sunday! Let me offer you my utmost thanks.

There are 3 types of people in the world. Those who can count, and those who can't.
sp3ng
18
Years of Service
User Offline
Joined: 15th Jan 2006
Location:
Posted: 2nd Jul 2007 14:46
in the DAI manual it says to let the physics system handle object locations and to update the AI system with those locations

e.g (psuedocode)


like that


Add Me
MartinS
18
Years of Service
User Offline
Joined: 15th Dec 2005
Location: Rochester, NY
Posted: 2nd Jul 2007 15:13
@sp3ng: Thanks for the response. I did see the manual, but it puzzled me. From what you've posted and from the manual, I didn't see how the Dark AI, erm, does anything. It's kind of hard to explain, but do you see my meaning?

Oh and I know Cash Curtis II uses DP and DAI in his game; anyone know how he does it?

G2L

There are 3 types of people in the world. Those who can count, and those who can't.
JerBil
19
Years of Service
User Offline
Joined: 8th May 2004
Location: Somewhere along the Z axis...
Posted: 2nd Jul 2007 22:23 Edited at: 2nd Jul 2007 22:25
AI or DP can move objects, so you don't want them to fight each other.
Here I add a space ship to the enemy AI with a zero flag so the AI
won't physically move it, and set the AI position at the ship's starting position.



Then, in the main loop, the AI does move it's internal position, but I update the ship's physical position to the AI position using DP.



Since the AI does not account for the Y axis, I have set the ship's Y position in the sky with Py#+60.

What we have then is DP and AI working together with AI driving the position, but DP doing the actual moving.

Ad Astra Per Asper
MartinS
18
Years of Service
User Offline
Joined: 15th Dec 2005
Location: Rochester, NY
Posted: 2nd Jul 2007 22:33
Thanks Jerbil. Do you know how I could do that with Newton?

G2L

There are 3 types of people in the world. Those who can count, and those who can't.
JerBil
19
Years of Service
User Offline
Joined: 8th May 2004
Location: Somewhere along the Z axis...
Posted: 2nd Jul 2007 22:52
Sorry, I don't but you could check to see if Newton has commands that do the same kind of thing, and some of the other guys here would know.

Ad Astra Per Asper
MartinS
18
Years of Service
User Offline
Joined: 15th Dec 2005
Location: Rochester, NY
Posted: 2nd Jul 2007 23:11
@Jerbil: I'll check the help files, thanks.

G2L

There are 3 types of people in the world. Those who can count, and those who can't.
MartinS
18
Years of Service
User Offline
Joined: 15th Dec 2005
Location: Rochester, NY
Posted: 6th Jul 2007 09:54
Okay, after 3 days I haven't found anything in the help. Does any Newton user know how I could achieve what JerBil was saying?

Quote: "
Then, in the main loop, the AI does move it's internal position, but I update the ship's physical position to the AI position using DP.


"


Except in Newton.

Thanks in advance!
G2L

Coming soon...
Cash Curtis II
19
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Corpus Christi Texas
Posted: 6th Jul 2007 11:19 Edited at: 6th Jul 2007 11:21
Newton is sorely lacking in some very necessary features to make this work. Newton doesn't have a character controller, and it doesn't allow you to create one because you can't just position a physics body somewhere, like you can with a DP kinematic object.

I use Dark AI+Dark Physics in Geisha House, and I did as well in my Dark Physics compo. They work nicely together, if you code it right.

1. Using Character Controllers:
Character controllers aren't positioned, they're pushed. When using Dark AI, you want the controller to go where the AI says it is. So, you update your AI first. You point the character controller in that direction, push it the entire distance between the two points, then rotate it back to the AI Y-angle, as reported by Dark AI.

You supposed to, at this point, manually position the AI body to the new position of the controller since the real position might be different than the place that it was supposed to go. The same thing applies not just to Physics, but to collision as well. However, this does not work! Each and every time you reposition the AI manually, Dark AI reports that the entity is moving, even though it's really not. So, your character will never do anything except for animate walking, based on Dark AI feedback. I reported this as a bug and it was confirmed, but nothing has been done about it.

Easy to work around. I only manually update the AI position if the AI position and the real position are more than the height of the model apart. Mine are 60 units tall, so if they are more than 60 units apart, I update the AI pos to the real one. Simple and it works. By the way, use 2D distance checks.

2. DP without a character controller:
Admittedly, Dark Physics has a few issues. As a rigid body simulator, it can't be beaten. All of the extra things seem to be a bit broken. Particles stink, collision feedback is lame, cloth isn't usable, and character controllers aren't really any good. However, since DP rocks as a rigid body simulator, it's easy to set up your own character controller system.

I use two boxes, a controlBox and a pushBox. The controlBox is a regular primitive box, the size of the character. It is not a physics body, it is set up with Sparky's collision. I can position it wherever I like without any problems, and my gravity works perfectly on it. I use Sparky's sphere-casting to provide sliding collision so that it won't run into anything that it shouldn't, especially buildings and characters.

Inside of that box I place a smaller box, offset from the ground and smaller than both the controlBox and the sphere-casting radius. This box is there to push aside rigid bodies that you're walking over. Anything big you'll slide around, anything small you'll push aside. Flying debris will also bounce nicely off of you. Works great. I use DP commands to manually position the pushBox at the controlBox's location each loop.

I use the same Dark AI method that I described above. It actually has nothing to do with the physics, and everything to do with the collision.

3. Newton
Sorry, I tried REALLY hard to make this work. The good folks on Newton Wrapper Hill had no advice for me to make the character controller work. I was using a rigid box with an upright joint. I could apply forward force to make it move forward. The problem was rotational force. I couldn't make the damned thing act right, no matter how much friction or how little rotational force I added it would start spinning like a top. Then when I pushed it forward it would act retarded. Maybe you'll be able to figure it out, but it sure didn't work for me. If you do get it to work then you'd use the same method that I use for the character controller.

Good luck.


Come see the WIP!
MartinS
18
Years of Service
User Offline
Joined: 15th Dec 2005
Location: Rochester, NY
Posted: 6th Jul 2007 15:35
@Cash Curtis II: That's a really elaborate reply! Thanks for taking the time to help. It seems that Dark Physics is really the tool I need, and Newton... isn't. I'll try to get it to work, but I have to say there is very little support for it anywhere. You've really helped explain the whole situation to me, thanks again.

Like I said before, DP is now the way to go, but it might take a while to get there. That'll mean a new computer as well... everything about my current one is seriously out of date!

Thanks again!
G2L

Oh, have a beer: . It's on me.

Coming soon...
Cash Curtis II
19
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Corpus Christi Texas
Posted: 6th Jul 2007 15:49
Glad I could be of help. I didn't post code since you're not using Dark Physics so it wouldn't really help you at this point. Repost when you're ready if you need help, but it shouldn't be too hard if you use the method that I am.

Quote: "Oh, have a beer: . It's on me"

Thanks, I'm there


Come see the WIP!
MartinS
18
Years of Service
User Offline
Joined: 15th Dec 2005
Location: Rochester, NY
Posted: 6th Jul 2007 16:03
Hey, I just found an explanation on how to use Dark AI and Newton in conjunction by lucas w.
Quote: "darkai & newton:

load the AI mesh, assing darkAI to this object.
make a sphere and scale it as an ellipse, assign newton to this ellipse.

in your loop build body matrix at the DarkAI Object position and assign the ai body to this matrix.

the newton body will automatically adjust the invicible dbpro object which was assigned to the body to the correct position.

now when you have the newton body at the ai entity position, you can easily check for collision by getting the x and z velocity of the newton body, and you can cast a newton raycast to check if the entity is standing on the floor, or if it is standing in a hole, where it will be supposed to fall down."


As expected, I can't make any sense of it. But some code might spark a fuse in my brain. Can you help?

@Cash Curtis II:
Quote: "Quote: "Oh, have a beer: . It's on me"
Thanks, I'm there "
You're welcome.

Coming soon...

Login to post a reply

Server time is: 2024-05-04 04:20:43
Your offset time is: 2024-05-04 04:20:43