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 / Play or loop animation function, dbPlayObject and dbLoopObject commands are broken

Author
Message
Mr Bigglesworth
16
Years of Service
User Offline
Joined: 4th Mar 2008
Location:
Posted: 6th Jun 2011 05:19 Edited at: 6th Jun 2011 05:20
Hey, the commands for playing and looping a 3D models animations are currently broken and do not work (thanks to the new update). I know that dbSetObjectFrame works, so I was wondering if you could somehow make a function that has a varible and increases in equal time.
Here is an example in C++ pseudo-code

It would loop and play the animation.
I have tried a couple of things and they just made the program crash.

Any help would be much appreciated.
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 8th Jun 2011 21:52 Edited at: 8th Jun 2011 21:54
Writing an animation function is easy, the problems start when you want to animate more than one object at different frame-changing speeds. Here is a quick example that can animate one object (or several but all at the same speed).



For animation you need timing, to determine when to change the frame. Here it is done in the main loop. To measure elapsed time, you need to store the time value when the frame was last changed. However, this program stores that info in one place for all objects. It is not very probable that all objects will look good when they animate at the same speed. Maybe one should animate faster, one slower. That means that you need to store different prevTime and frameTime values for each animated object.

In a bigger program you probably already have classes: player class, enemy class, etc. The timer values should be class member variables and "animateObject" should be a class function, that receives the current timer value as a parameter. Then, comparing the timer values and deciding whether the frame should be changed will be done inside the class.

If you don't use classes, arrays or vectors should be used to store different timer values for each animated object.

So, this is not a full implementation but it shows you in which direction to start.
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 8th Jun 2011 23:25
I have made an example with a class as well. The initialization of the objects is of course primitive, but it shows how the animation works.

Mr Bigglesworth
16
Years of Service
User Offline
Joined: 4th Mar 2008
Location:
Posted: 9th Jun 2011 05:03 Edited at: 9th Jun 2011 05:37
Thanks for the help
Neotron
14
Years of Service
User Offline
Joined: 21st Jul 2010
Location: I am in an underworld , making a E.Army
Posted: 10th Jun 2011 19:55
Also can someone also explain the command :

Does this code even exist in October 2010. Because it doesn't work for me.

Allah is the best!
May he forgive me and the extremist MOD who removed my sign.
No offence don't remove it. Plz , PEACE!
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 11th Jun 2011 15:05
I don't think that command exists at all. If you make a search for SetObjectFrame in the Dark GDK source code that is currently on googlecode, no such command shows up in the search results. Only these show up:

dbSetObjectFrame(int iID, int iFrame);
dbSetObjectFrame(int iID, float fFrame);
dbSetObjectFrame(int iID, float fFrame, int iRecalculateBounds);
Neotron
14
Years of Service
User Offline
Joined: 21st Jul 2010
Location: I am in an underworld , making a E.Army
Posted: 11th Jun 2011 15:44
So is there any way to control bones\limbs separately?

Allah is the best!
May he forgive me and the extremist MOD who removed my sign.
No offence don't remove it. Plz , PEACE!
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 11th Jun 2011 16:31 Edited at: 11th Jun 2011 16:50
I think it's only possible with the limb rotation commands.

I'd like to return to the previous topic for a while, and post an improved object animation method, in case someone is interested.

The problem with the animation function I posted above is that it's constrained by the FPS value, because the object cannot possibly animate faster than the time elapsed between two refresh loops. The method is also a bit inaccurate, since the time elapsed will never be exactly equal to frame time.

I was looking for a solution where you can control how many frames the object animates in one second. This way, it can animate in real-time with different FPS values, and can animate fast even if the FPS is low - at the price that it will skip some frames. Here is the code.



EDIT: The function could be further optimized by sending the function the elapsed time and not storing prevTime within every object.
Mr Bigglesworth
16
Years of Service
User Offline
Joined: 4th Mar 2008
Location:
Posted: 11th Jun 2011 19:53
Thanks for your help.
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 11th Jun 2011 22:28
Neotron: maybe I found the function you searched for, see my post in your other thread! The function name is SetFrameEx.
taylor design
16
Years of Service
User Offline
Joined: 28th May 2008
Location: Germany
Posted: 11th Sep 2011 01:37
dbTotalObjectFrames returns always 0 for me. Anyway I got it working somehow, but as I devolped the code (did not change the object load routine o.O) it does not work for now??!! This might cause the problems with dbPlayObject and dbLoopObject. Hmm
taylor design
16
Years of Service
User Offline
Joined: 28th May 2008
Location: Germany
Posted: 11th Sep 2011 01:40
I switched from Release to Debug Compile. The result is, in debug mode dbTotalObjectFrames works for me, in release not. Gonna check the settings.
lllll venom lllll
13
Years of Service
User Offline
Joined: 12th Oct 2011
Location:
Posted: 18th Oct 2011 04:53
all junk code shure some of it might work but u dont need any of that code thats way to much you should just add a timer and it replay the image once again dark gdk is garbage code

envy
Mr Bigglesworth
16
Years of Service
User Offline
Joined: 4th Mar 2008
Location:
Posted: 18th Oct 2011 06:25
Quote: "all junk code shure some of it might work but u dont need any of that code thats way to much you should just add a timer and it replay the image once again dark gdk is garbage code"

You do need that code, we aren't talking about images, we are talking about 3D animations. DarkGDK is not garbage, I would like to see you program a DirectX wrapper/2D-3D Engine and have it out perform DarkGDK.
MRPdeveloper
14
Years of Service
User Offline
Joined: 28th Sep 2010
Location: Australia
Posted: 12th Nov 2011 04:45
give me the game creator team and i will, that simple.

the dark gdk code is crap and anyone that programmed with dark gdk for many years knows the collisions with other libraries, memory leaks, drawing problems, limits, no support. the list goes on, the reason for this is all lack of interest you cant create something amazing or decent if ur not interested in what your doing. And frankly TGC dont care about dark gdk they like dark basic pro more then dark gdk, and even dark basic pro will survive fine becuase its open source and changed by the public always being fixed while dark gdk sits here getting old with the massive fans it has slowly moving onto raw direct x starting thier own
MRPdeveloper
14
Years of Service
User Offline
Joined: 28th Sep 2010
Location: Australia
Posted: 12th Nov 2011 04:49
u could always buy the addon for smooth animations, thats prob why they removed it so people would buy it, i was thinking why dont we just keep the old animation.h/.lib and use that becuase it should have the function that exists. else i will prob move back down to the older version, there is also a problem with dbZWriteOnce() not existing i needed it for making sure fog and shadow colours dont clash without it my shadows are same colour as fog just another bug i guess which wasent broken before

Login to post a reply

Server time is: 2024-11-19 06:44:49
Your offset time is: 2024-11-19 06:44:49