Results 1 to 10 of 87

Thread: Space Shooter Game Editor

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #27
    PGD Staff / News Reporter phibermon's Avatar
    Join Date
    Sep 2009
    Location
    England
    Posts
    524
    Ok so your basic issue is synchronizing the animation of sprites, that may of been added at any time during the animation of the others.

    There are many ways you could do this (although unless you have two co-dependant animations I can't see why you'd want this) but rather than incrementing every single sprite for the next frame of animation, how about you group the same sprites together or sprites that have the same number of frames? IE:

    SpriteGroup1_FrameNumber = 3

    for I := 0 to SpriteGroup1_SpriteCount-1 do
    Spites[I].CurrentFrame = spritegroup1_framenumber;


    That way you can ensure that for animations of the same speed/number of frames, that they are always rendered on the same frame, regardless if one was added halfway thru the animation cycle.

    Now as far as synchronzing animations of different lengths, why? scheduling so they start at the same time will mean that at some point, you'll have something that should be on screen, but isn't because it's waiting for the start of the next cycle.

    if you have animations of different lengths that you wish to synchronize, then you should scale the frame-rate of one of the animations so they both take the same amount of time to run.

    --

    I'm currently extending my 3D animation lib with better interpolation between animations. Here's an example to get you thinking :

    Walk animation -15 frames - 0.8 second cycle from left foot to left foot. actual movement Speed = 3
    Run animation - 20 frames - 0.4 second cycle """ actual movement Speed = 5

    So how do you smoothly interpolate the skeleton between frames so you can blend walk into run and visa versa?

    The trick is (other than other artist/bone related stuff to make animations that will blend well) that you scale both
    animations at the same time. so if walk has an anim cycle of 0.8, and run 0.4, then halfway through the blend, both animations are scaled so they both have a cycle of 0.6 and a speed of 4 (exactly half way between the two).

    So it doesn't matter where in the animation you start running or walking, it'll always be able to interpolate fairly well.

    --

    As far as sprites are concerned, what's so offputting about the non synchronized animations? if you created a forest you want all the trees to sway in sync?

    Like I say, unless your animations are co-dependant and require sync (two sprites throwing a ball at each other) then you should probably not bother.

    Oh and if you absolutely must sync different length anims so they start on the same frame, then just add dummy frames to the shorter one so it's the same number of frames. yes that'll use slightly more more memory but you'll save yourself a whole bunch of code. Combine that with grouping of sprites
    Last edited by phibermon; 11-01-2013 at 01:17 PM.
    When the moon hits your eye like a big pizza pie - that's an extinction level impact event.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •