Author Topic: Animated be-build model  (Read 4541 times)

Idanwin

  • Guest
Animated be-build model
« on: 22 December 2008, 22:02:06 »
Would it be possible to make a be-build model play depending on the speed at which it is build (1% done = 1% of frames) because i've got animated models that should go faster when more units work on it. And stop animation when no one is working on it.

~Idanwin
« Last Edit: 9 January 2009, 09:43:15 by Idanwin »

ZaggyDad

  • Guest
Re: Animated be-build model
« Reply #1 on: 26 December 2008, 19:17:18 »
Nope. But that's definitely a good idea. You should file it in the bugzilla.

daniel.santos

  • Guest
Re: Animated be-build model
« Reply #2 on: 29 December 2008, 09:20:23 »
I also wouldn't mind multiple be_built models, so if you have 3 models, then when it's from 0-32%, it uses the first model, from 33% to 65%, the second, etc. Please do file it.  I wont be wrangling any bugs until I get back though (around the 6th).

ZaggyDad

  • Guest
Re: Animated be-build model
« Reply #3 on: 29 December 2008, 15:58:32 »
But it should also be ably to do animations, not just separate models (i.e. if the building is 1/4 through, and it has 100 frames (yes, I know that's crazy, but this is just an example), then it would go to the 25th frame.).

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Animated be-build model
« Reply #4 on: 30 December 2008, 01:51:09 »
Or at least a way to make the model have a different model when not being worked on.
Such could be used for normal models too! Suppose we have a battle machine that loses parts of its armor and stuff as it loses HP? Or a jelly that becomes smaller as it gets weaker. A skeleton that cracks as it weakens... The possiblities are endless!
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

Idanwin

  • Guest
Re: Animated be-build model
« Reply #5 on: 31 December 2008, 19:11:39 »
It will get very heavy (lots of files)
Maybe two graphic versions of Glest(and GAE).
A low quality and a high  quality.
(only different models/fewer models/lower Q textures/...)

But it would make Glest a lot better-looking.

~Idanwin

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Animated be-build model
« Reply #6 on: 1 January 2009, 22:17:51 »
I'm not saying that GAE needs these models, but it would be nice for such a feature. Suppose we also allow other file formats for texture, such as jpg (very low filesize) for when we need no alpha. In fact, the parts that need alpha can be there own texture, while jpg can cover everything else.
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

Ayrin Greenflag

  • Horseman
  • ****
  • Posts: 188
    • View Profile
    • http://www.lostinn.com/ayrin
Re: Animated be-build model
« Reply #7 on: 6 January 2009, 11:29:36 »
i like the idea of partial models (building or wounded) but it's right we need an option for disable those animations for lower systems

daniel.santos

  • Guest
Re: Animated be-build model
« Reply #8 on: 7 January 2009, 11:21:36 »
Quote from: "Ayrin Greenflag"
...but it's right we need an option for disable those animations for lower systems
whoa! you're getting ahead of yourself here!!

Ok, first off, I took Idanwin's suggestion as meaning a be_built animation sequence that plays and repeats, like walking or something.  I failed to acknowledge that however and tacked on my additional idea, which was to allow more than one "model" or "animation sequence" (one for partially done, etc.).  Now here's what I'm thinking is possible
  • A single be_built animation that loops or forward/backward loop (as proposed for 0.3 animations)
  • One or more static or animated sequences, and once progress reaches a certain point, the next sequence is displayed (like frame work, framework with some stuff, and mostly finished)
  • An animation that's played one time over the entire period of the build, so it slowly morphs from it's start to it's finish.
  • Lastly, a hybrid combination of both 1 and 3 -- this one is 2x the CPU intensity and involves tri-polar  (instead of bi-polar) interpolation
Also, remember that the 0.3.x animation specification allows for multiple simultaneous animations (models) to be played on top of each other.

Now to explain item 4 better, I'll use an example, taking simultaneous playback in mind.  However, this is very pie-in-the-sky, so don't take #4 very seriously yet.  Let's say that you have a be_built animation where you have miniature angle-like beings flitting about creating said structure.  So animation #1 is the angles that has some 15-ish frames where these creatures flap their wings, do some assembly and then move to another location and do some more and this loops every 10 seconds or so.  Then animation #2 is the actual structure as it's being built, it doesn't loop, rather it plays out slowly over the build period -- it starts with a foundation and then a frame stretches up, followed by the gradual building of walls.  So animation #2 is pretty straight-forward and since we're playing it slowly and interpolating between frames, we can probably get away with 5 to 8 frames and have it look pretty descent.

But I don't want the angles building in the same place all of the time.  Thus, I will actually create 4 sets of these 15-frame animations.  It will play animation 1a up until 25% completion is reached, then 1b until 50%, etc, but it will actually morph between the frames of 1a and 1b until it reaches 25%, then it begins morphing between 1b and 1c.  So in this example, the angles will be building around the areas that animation #2 is stretching into, giving it a more realistic look, while minimizing the actual number of frames needed.  Animation sequence 1a will be the angles flitting about near the ground and 1b will be them flitting about at the top of the structure (so it looks like they are building the frame), then 1c will bring them back down to the ground and 1d will take them back up to the roof again (just as an example).

The only thing I can think of to make this #4 idea any better is just bone-weighted skeletal animation, but we don't have that feature in yet (I really want to see it though). With skeletal animations, there is a drastic reduction in memory used and animation file sizes, because we only need to store the models once, and then the skeletal movements are actually very small amounts of data.

John.d.h

  • Moderator
  • Airship
  • ********
  • Posts: 3,757
  • I have to go now. My planet needs me.
    • View Profile
Re: Animated be-build model
« Reply #9 on: 7 January 2009, 22:38:44 »
Quote from: "daniel.santos"
An animation that's played one time over the entire period of the build, so it slowly morphs from it's start to it's finish.
That would only be good if the animation can speed up when more than one unit are working on the building, and stop when nobody's working on the building.  Otherwise, your builder could get killed and the structure would keep getting built.

Ayrin Greenflag

  • Horseman
  • ****
  • Posts: 188
    • View Profile
    • http://www.lostinn.com/ayrin
Re: Animated be-build model
« Reply #10 on: 7 January 2009, 23:22:20 »
right we need a check of percentage builded as in old games as deuteros :)
if isn't possible to do it with a animated single file we can do with different files but i supose it will keep more memory

divineauthority

  • Guest
Re: Animated be-build model
« Reply #11 on: 8 January 2009, 21:59:46 »
Quote from: "daniel.santos"
The only thing I can think of to make this #4 idea any better is just bone-weighted skeletal animation, but we don't have that feature in yet (I really want to see it though).

So do I :P

Is there any way of playing a certain frame of an animation? Or is there no record kept when Glest interpolates (correct word?) the animations at the start of a game?

daniel.santos

  • Guest
Re: Animated be-build model
« Reply #12 on: 12 January 2009, 20:53:59 »
Glest performs interpolation/morphing/lerping (i.e., "linear interpolation") at run time, during the world updates not when it loads models at game start.  Linear interpoluation is a process where we go vertex by vertex and calculate a point x% of the way between point one and point 2.  So if point 1 is a |3, 8, 2| and point 2 is |4, 8, 10| and you are 50% of the way between these two frames, then the linear interpolation would yield the vertex |3.5, 8, 6| -- that is what it is at the most basic level.  g3d files that contain an animation (like a guy walking) may only contain 8 frames or so, but it will lerp (or morph) between those frames to smooth out the animation.  skeletal animation has a similar CPU cost, but has a lower memory cost because you only store the model (it's verticies) in memory once whereas Glest's mechanism stores the model multiple times, even 40 or more.

But back to your guest, no, Glest does not.  Part of the GAE 0.3 specification does call for more advanced animation capabilities however (excluding skeletal animiation), see this message for info on that.  The ideas here are basically to allow cut & paste of frames (even part way between two actual animation frames) and other features to allow greater utilization of existing models & animations and greater flexibility in animation playback.  In the end, the skeletal animation is a must however and will probably solve some other problems I'm facing with swayable objects (trees that blow in the wind, etc.).  So I may reconsider some of these proposed specifications in leiu of just implementing skeletal bone-weight animation (mostly, I'm referring to the "swayable" objects, mentioned elsewhere in the above referenced thread).