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.

Newcomers DBPro Corner / Help with object animations not working right

Author
Message
Bago
16
Years of Service
User Offline
Joined: 7th Jan 2008
Location:
Posted: 12th Aug 2011 11:42 Edited at: 13th Aug 2011 03:07
My test game used dark physics thats why I am attaching all code and media with the compiled exe file in zip format. Since animation coding is the same withn or without dark physics it shouldn't be a problem. It is a 3rd person shooter so animations will be highly visible.

I tried doing my animations with "play/loop object objno, startframe, endframe" with "set object speed objno, speed" but the animations always played after the action. e.g. walking while holding down the key it plays the animation after you stop holding down the key and of course the object has long stoped moving.

I chose to go with setting the object frame and increasing the frame with the main game loop which is set to 60 fps. The only problem is the model does have excessive frames as it was made with 3ds max and for each frame in the program it has 160 in darkbasic pro. This is why when I increase the frame number it is by 160.

I so far have walking animation (same one for all 4 directions) working. When I try to animate jump, fall or jumpstrafe left/right suddenly darkbasic pro is not using the correct start frame numbers and it doesn't matter to what I set start frame at it plays a set chunk of animation till the end frame number.

My objects animations frame numbers:
0 Idle
0-6400 walk (wsad)
6560-9760 jumpstrafe right (double press d)
9920-13120 jumpstrafe left (double press a)
13280-15200 jump (e)
15360-16000 falling

Controls:
wsad - move
double tap wsad - strafe jump (only a,d have animations)
e (need to hold it down a bit not just tap) - jump
q - switch camera mode from auto lock to free look


Can anyone help me fix this or help redo the entire animation system I so far have to something that works, any help would be appreciated.

Bago

Attachments

Login to view attachments
Kezzla
16
Years of Service
User Offline
Joined: 21st Aug 2008
Location: Where beer does flow and men chunder
Posted: 12th Aug 2011 13:17
your animations worked fine on my machine.

do you have all the latest drivers installed?

Sometimes I like to use words out of contents
Bago
16
Years of Service
User Offline
Joined: 7th Jan 2008
Location:
Posted: 12th Aug 2011 16:07
I do have the latest of all drivers but I use Darkbasic Pro 7.7 Release Candidate 7 because of the problems windows 7 service pack 1 created.

http://forum.thegamecreators.com/?m=forum_view&t=180294&b=1

What version do you use?
Did you recompile the exe file or use the one in the downlaod?

Thanks

Bago
Quisco DaLuse
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: USA
Posted: 12th Aug 2011 17:11 Edited at: 13th Aug 2011 14:58
16,000 animation frames? Wow, that is a ton and a 1/2. If I have over 1000 animation frames on a model it is a lot. Perhaps you could redo the model so that the frames total 500 or less.

The player always points to another robot, which is continually animating. The player's animations are so slow, it does not appear that they are working, but they are. Actually, the falling variable was TRUE and would not allow the animation to work. I remmed out the falling = TRUE references and it allowed playeranimation to equal 2. I had to set the object speed of the player to like 2000 to see it animating (it still was too slow at that rate, but I could see it).

Another suggestion is to assign the start / stop keyframes to a variable. For example, WalkStart = 0 : WalkEnd = 6400. These work great when using TYPE variables.
Kezzla
16
Years of Service
User Offline
Joined: 21st Aug 2008
Location: Where beer does flow and men chunder
Posted: 13th Aug 2011 01:39
I used the exe provided.

I have windows xp and am using darkbasic pro 7.6

I didnt notice any lag on my system

I have
1 gig of ram
1 gig gforce video card
dualcore 2.4ghz processor

kezzla

Sometimes I like to use words out of contents
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 13th Aug 2011 02:57
I use 3DMax and panda exporter and the model has one keyframe per frame. I remember time ago I had a plug-in.. Quest3D exporter that use to do that. This plug-in export a object with just 100 frames in 3DMax with 16000, but I remember that you could adjust the frames. I'll check that for you.


Cheers.

I'm not a grumpy grandpa
Bago
16
Years of Service
User Offline
Joined: 7th Jan 2008
Location:
Posted: 13th Aug 2011 03:30 Edited at: 13th Aug 2011 03:32
I decided it would be a good thing to list controls on the first post, you can have free look by default its set to lock on target (Q key to switch).

Quote: "
Another suggestion is to assign the start / stop keyframes to a variable. For example, WalkStart = 0 : WalkEnd = 6400.
"


I have tried setting differnet Start frame and end frame integers but I didn't do them seperate for each animation, I will try this out. I will try out Types to see if they work better and may keep the coding a little more organised.

Quote: "
If you want, I can re-rig and animate the model in Milkshape and significantly reduce the animation frames. Let me know.
"


Currently I am only using quickly made place holders just to try and get the base code done for a game idea. I would need to find a more perminate solution to the excess frames when I am no longer using place holders. Thanks for the offer though.

Quote: "
I use 3DMax and panda exporter and the model has one keyframe per frame.
"


I use 3ds max 2012 32 bit with panda exporter. I can't remeber exactly what version but I downloaded the exporter at leaset a month ago so it could still be the latest version. It would be nice to have the 166 frames I actually created the model with instead of 26560 frames. In the panda exporter I do set the fames from 0 (start) to 166 (end) yet it still does this.

Bago
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 13th Aug 2011 03:57
I have to check if I can do it in 3DMax...now I got your object working in just 29 frames and the animation is complete...take a look if that is what you need.

Cheers.

I'm not a grumpy grandpa

Attachments

Login to view attachments
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 13th Aug 2011 04:18 Edited at: 13th Aug 2011 04:19
Now I have got your object with 120 frames...and you will have to set object speed to 10 or around 10 .Let me know if it works to you.


Cheers.

I'm not a grumpy grandpa

Attachments

Login to view attachments
Bago
16
Years of Service
User Offline
Joined: 7th Jan 2008
Location:
Posted: 13th Aug 2011 04:40 Edited at: 13th Aug 2011 07:11
Chafari

The model plays a bit fast even with "set object speed 5, 1" so a timer to change frame would be needed. The animation doesn't play very smooth but that could be the way I animated the character.

I found an option I missed in the panda exporter. The animation sampling rate which I think adds the frames between key frames for smoother movement, it was set at 20 and now changing it to 6 I reduced it in 3ds max from 166 frames to 44 frames and it is still smoothly animated. This at least gives me 7040 frames in darkbasic pro from 26560 frames. If I only take key sequences it isn't very smoothly animated and also chops out some animation parts because they possibly have too few key frames in sections. I still need to then learn to new frames for each animation. I've attched the less frames model but I still am trying to get its frames down in darkbasic pro.

Bago

Attachments

Login to view attachments
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 13th Aug 2011 04:49
Ok ...now it is a question of exporting and check. As you know, we can adjust speed aswell in Dbpro, and we can adjust the differents speed deppending on the animation we want (walk, run, jump etc.)

Cheers.

I'm not a grumpy grandpa
Bago
16
Years of Service
User Offline
Joined: 7th Jan 2008
Location:
Posted: 13th Aug 2011 06:35 Edited at: 13th Aug 2011 11:34
After testing my lessened frames model to find its frames it still has 26560 frames, so that option when exporting didn't help. I didn't see the post where you added the 120 frame model, I forgot to refresh the page. I am wondering what you are using to reduce frames like another program?

I found a glitch in my code for animation :



So it was a self caused problem not realising I missed setting playeranimationframe when I set the objects frame. Now strafe left/right animate properly, it possible its the same mistake for my other animations I made.

Jump animation now works too.
Falling will unanimate with:



But since deltaVerticalVelocity# will = 0 two times it's noticeble. It goes to 0 first when not jumping or falling (means on the ground), the other time is when going from jumping (being in the + number range) to falling (going from + to 0 then into -). I'm having problmes thinking up with a better way to stop animating falling.

I also noticed with this the character looks like it floats up and down stairs and sloped surfaces.

EDIT: Ok all animation problems are solved. I've attached the updated code with media.

Attachments

Login to view attachments
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 13th Aug 2011 13:13
Quote: " I didn't see the post where you added the 120 frame model, I forgot to refresh the page. I am wondering what you are using to reduce frames like another program?"


Yes of course ,the merit is not mine but this little program Deep exploration...a model converter that can adjust the frame rate.

I uploaded it post above. Here it is again. The animation goes from 0 to 119 frames, and it works fairly smooth.

Cheers.

I'm not a grumpy grandpa

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-11-24 02:48:41
Your offset time is: 2024-11-24 02:48:41