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 GDK / Add animation data from multiple sources using dbAppendObject

Author
Message
Core2uu
16
Years of Service
User Offline
Joined: 15th Mar 2008
Location: Saskatoon, SK, Canada
Posted: 18th Mar 2008 03:23
OK so I'm using the dark matter pack whose models contain multiple files each with it's own animation... (sorry for my bad language, obviously I'm new)...

I've found using the dbAppendObject only lets you load animation data from one file into an existing object... I want to append more animation data from multiple files into one object...

Does anyone know how this is achievable?
Or some simpler way because there must have been some point for TGC to make animations on separate files in dark matter packs...

~~Core2uu~~
jinzai
18
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 18th Mar 2008 08:40 Edited at: 18th Mar 2008 09:13
What you do is append again with the next file as the filename. Load the first one, and then use a loop to append to that. Change the filename at the bottom of the loop, and it will load as many as you want. You should end up with 135 frames for the human models. The valid frame numbers are a little odd. I will edit this post with a bit of DBPro code to show you what I mean.

About the snippet:
It uses a global array of strings to access the names of the files. You provide the function with the path and filename, up to the part where it differs, which is where the animation is named. Here is the array being dimmed, near the top of my code:

dim DM_AnimsPeople(6) as string

Then, I initialize the strings in the array, like this:

DM_AnimsPeople(0) = "Static.x"
DM_AnimsPeople(1) = "Idle.x"
DM_AnimsPeople(2) = "Move.x"
DM_AnimsPeople(3) = "Attack1.x"
DM_AnimsPeople(4) = "Impact.x"
DM_AnimsPeople(5) = "Die.x"

To load an entire set of DMI animations, I get an object ID, and pass the path and partial filename in, like this for example:

jzLoadDarkMatterHumanXModel('C:/Program Files/Dark Basic Software/DarkMATTER/Models/DB/People/German/H-German-', objnum, 3)

This is the function:


Now, I removed some code in there, because I store the frame numbers in a custom UDT that is inappropriate for this demonstration, and I am modifying the code anyway. You could easily store off the frame numbers, but I am just about to give them to you. When you are done loading, you should have 135 frames, at least with the ones I've tried, anyway.

As nearly as I can work out in my slow and pig-headed manner, the frame numbers for DMI animations are:
idle 5 - 25 /3, 2 is better
move 32 - 50 /6
attack 54 - 72 /4
impact 76 - 84 /3
die 85 - 112 /6

The last column is the speed I use when playing, or looping them. I use an interpolation of 10, and the models animate pretty well, even when looping the walk animation. The Soviet guy has a small tic at the end I can't seem to lose that...the Germans march along very well. That MP-40 is a real bullet hose!

One thing about the move animation...I think that there is a transition from idle to moving that you run...maybe you let the idle spill into the move, and then restart it at 32. (You see, you are supposed to run them yourself, using set object frame. You can use a time value, and it is automatically interpolated for you; its very slick, actually!)
Core2uu
16
Years of Service
User Offline
Joined: 15th Mar 2008
Location: Saskatoon, SK, Canada
Posted: 19th Mar 2008 00:18 Edited at: 19th Mar 2008 01:20
So to change that DBPro snippet you gave me to C++ syntax... Pretty much all I have to do is change "append object" to dbAppendObject... Other than that the syntax is relatively the same right?

EDIT: Ok.. so the syntax is NOT the same... Can you give a few basic language conversion pointers... such as what to replace "dim" with in c++? 'Cuz I tired and I am lost...

~~Core2uu~~
Core2uu
16
Years of Service
User Offline
Joined: 15th Mar 2008
Location: Saskatoon, SK, Canada
Posted: 19th Mar 2008 05:48
Test post: Ignore this...
If this comes up before my last post I'll know the last one didn't come through...

~~Core2uu~~
jinzai
18
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 20th Mar 2008 00:26 Edited at: 20th Mar 2008 00:38
Arrays of variable length strings are pretty messy. I would recommend that you create a function in c, and make the names local variables. Its somewhat inefficient, but its easy:

char staticName[] = "Static.x";

Or, you could just tack the appropriate name on there in the code, depending on the loop variable, like this:

switch (loopvar)
{
case 1:
sprintf(szbuffer, "%s%s", filename, "Move.x");
.
.
.
default:
sprintf(szbuffer, "%s%s", filename, "Static.x");
}

A somewhat better, yet more advanced way is to use C++ string class vectors. I don't think you want that just yet.

vector<std::string>animnames;

animnames.push_back("Static.x");

Something like that, but...it is more than most here want to deal with for a game.
Core2uu
16
Years of Service
User Offline
Joined: 15th Mar 2008
Location: Saskatoon, SK, Canada
Posted: 20th Mar 2008 06:26
All right Jinzai... Thanx... This makes a bit more sense...

But one question... I still think it would be WAY if there the whole model including animations (ESPECIALLY animations) into one file, it would be less confusing and painless...

Because unless I'm missing something it obviously requires a lot more time and coding... Because I already have good enough working code setup with collision detection and everything... except this multi-anim-file thing is really making it confusing... I guess I could try to implement the above suggested things by you, but I think until i become a little more c++ savvy, it is better to leave out the confusing stuff and use other 3d models with which I only have to deal with one file...

But nonetheless I'll keep you above post in mind...

~~Core2uu~~
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 24th Mar 2008 19:53
Stick to it - because I hated C++ at first and stuff eventually started to click - now I REALLY LIKE IT and I can do ALOT with it.

Hang in there.

My Favortie tutorials are here:http://www.cplusplus.com/doc/tutorial/

Good Luck!

Login to post a reply

Server time is: 2024-11-20 05:33:40
Your offset time is: 2024-11-20 05:33:40