Outerra forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Download Outerra Tech Demo. Unofficial Outerra Discord server, MicroProse Discord server for OWS.

Pages: 1 [2] 3 4

Author Topic: Character Animation  (Read 65659 times)

patmarrnc

  • Full Member
  • ***
  • Posts: 136
Re: Character Animation
« Reply #15 on: November 22, 2017, 11:38:20 pm »

Thanks Andfly, for sharing the results of your experiments with character animation. Also, thanks for your gracious willingness to help others. I agree that studying existing scripts and props is probably the best way to learn. But I find that there is always a dead end, a missing bit of information that stops  me cold.

For example, in studying the files related to the mercenary... I see all of the anim files, but I don't see any clue about how to activate them.  (update: aha! the scripts are in another folder! OK, one more piece to the puzzle found...)

I just downloaded your dancing girl, your swimming fish, and your island so I can try to understand what you've done in each case. Thanks again for making the results of your labor available to others. You are a good person, and I appreciate that.

« Last Edit: November 22, 2017, 11:47:10 pm by patmarrnc »
Logged

andfly

  • Sr. Member
  • ****
  • Posts: 347
Re: Character Animation
« Reply #16 on: November 23, 2017, 04:48:31 am »

 :) :) :)
Logged
I do not know the English language. I use Google Translate. I hope it's all understandable.

patmarrnc

  • Full Member
  • ***
  • Posts: 136
Re: Character Animation
« Reply #17 on: November 25, 2017, 01:06:47 pm »

I found the answer to my own question about Poser:
Yes, when an FBX made in Poser which is saved with animation is imported into Outerra, the .ANIM file is created. Now that I know how to do that much, I will redirect my learning curve to understanding how to call the ANIM files from a script. Fortunately, there are a bunch of scripts to study.

My achilles heel is in having no understanding of javascript at all.  I think once I wrap my brain around the way keystrokes are being collected and processed to call anim files and rotate joints I'll be on my way.  So much to learn, so few brain cells.
« Last Edit: November 26, 2017, 07:13:46 pm by patmarrnc »
Logged

andfly

  • Sr. Member
  • ****
  • Posts: 347
Re: Character Animation
« Reply #18 on: November 26, 2017, 06:55:56 pm »

Some brief clarifications ...

The mercenary's character does not have a script.
I think it's programmed by a code section embedded in the engine.
In fact ... if you define "character" any other model, at the time of "spawn" appears the mercenary in its place!

The "script" folder holds a couple of old files (leftovers of old versions of Outerra) that I believe have been left to cause the curiosity of the modders and concern some untreated topics in the WIKI, including animation.

Unfortunately, there is not a " bunch of scripts to study " that contain  commands to use "anim" files.
For what I know there are only BRACHIOSAURUS AGONY, BABY BRACHIOSAURUS, MEGALODON and ALIEN PALM of the "Forgot Island" package.

Do not confuse Java with Javascript. They are very different things!
Javascript language is very simple, at least for basic use.
With a simple web search you can find a handful of manuals to download for free, even in Pdf.
I learned so!

regards,   ;)
Logged
I do not know the English language. I use Google Translate. I hope it's all understandable.

patmarrnc

  • Full Member
  • ***
  • Posts: 136
Re: Character Animation
« Reply #19 on: November 26, 2017, 07:15:26 pm »

thanks for the clarification, Andfly. I appreciate your help.
Logged

fly77

  • Outerra Master Modder
  • Hero Member
  • *****
  • Posts: 1761
Re: Character Animation
« Reply #20 on: October 06, 2018, 03:54:30 pm »

Interesting. I have tried to use the javascript to control movements of a character and while it works I found it is quite difficult to "mathematically program" complex movements . eg. a character that rides and steers a bicycle by using joint rotations/positioning. I feel moving bones "by hand" to the correct position in blender should be easier. 
So I wondered how can one instead create an animation in blender and then import it into outerra. I tried with a simple blender file ( a cylinder having 3 bones along its axis), creating 3 keyframes in the blender timeline (60 frames long) acting on the bones in pose-mode. Then exporting as fbx and importing into outerra as fbx..however outerra allways crashes and only makes a objectdef and a mtl file, no pkg or animation file. What is the correct procedure ?
below are the blender fbx export settings (default) and the outerra fbx import screen as well as the log file of errors. By the way in blender the rotational transformation coordinates of keyframes are set by default as quaternion WXYZ. Don't know if this has any importance.

Code: [Select]
[1006/224315:INFO:package_explorer.html?name=package%20inspector(379)] File dialog loaded...
21:43:19.808 FATAL: (c4e) [1006/224319:INFO:package_explorer.html?name=package%20inspector(382)] dir: H:/blender-workfolder/, file: test.fbx, path: H:/blender-workfolder/test.fbx
21:43:19.826 INFO: [fbx_importer] Creating FBX importer..
21:43:25.390 FATAL: (c4e) [1006/224325:INFO:package_explorer.html?name=package%20inspector(229)] on_node_selected
21:43:25.390 FATAL: (c4e) [1006/224325:INFO:package_explorer.html?name=package%20inspector(231)] on_node_selected e.ctrlKey = false is_bone = false
21:43:28.253 FATAL: (c4e) [1006/224328:INFO:package_explorer.html?name=package%20inspector(229)] on_node_selected
21:43:28.253 FATAL: (c4e) [1006/224328:INFO:package_explorer.html?name=package%20inspector(231)] on_node_selected e.ctrlKey = false is_bone = false
21:43:43.446 WARNING: Widget "_blank" name already exists! (generating new name"name_003")
21:43:43.499 FATAL: (c4e) [1006/224343:INFO:package_explorer.html?name=package%20inspector(412)] FBX log is loaded...


« Last Edit: October 06, 2018, 05:19:43 pm by fly77 »
Logged

patmarrnc

  • Full Member
  • ***
  • Posts: 136
Re: Character Animation
« Reply #21 on: October 06, 2018, 08:03:44 pm »

A while ago I made a car with driver and "sort of" animated the driver. To some extent his hands follow the steering wheel when the car turns. Likewise I made a little space ship with pilot and a motorboat with driver, all of which are minimally animated. When I'm at my other computer, I'll put them on dropbox for anybody who wants to see how it works.

I should mention, none of these are Poser animations. I just separated any parts that need to move (like the arms and head) and declared them to be joints during the import process (after the usual positioning of the rotation points in Blender before exporting.) Here is one video  showing how the porsche looks with a driver:



Update:
here's a link to a dropbox folder that has a few OTX files I used for animations.  Everything here is offered "AS-IS", there are many problems with the models, but for my purpose of using them as props in animation they worked "well enough"
 
https://www.dropbox.com/sh/vm5o2k9ie6fh1bf/AACL15mZ6Pb-D6gd6DMHdHSPa?dl=0

The cartoon copter and space scooter are not programmed to take off from a runway. For my purposes, I just spawned them high in the sky then shot my footage as they glided back to earth.

The boat  worked well in the old Outerra, but after the latest version it tends to rise and fall too much, sometimes coming out of the water and sometimes going under water. I'm not a javascript programmer, I just blindly tweak other people's code until it works or breaks.  This boat is somewhere in between.

The porsche, speedboat, cartoon copter and space scooter all  have a driver who moves his head and arms somewhat when the vehicle turns. Scripts show how that minimal motion was accomplished.   The space scooter also has a very bright single headlight (L toggles off and on) so it can search the terrain for whatever life form the story requires.  Drivers are modelled in the style of characters used in the MUVIZU animation program.

The folder also includes a couple of log cabins, some park signs, a few tents, a picnic pavilion, several crude campers, a picnic table and some other accessories in case anybody wants to create a state park. 


There are also two stone bridges that have collision added so cars can drive across them and boats can go underneath them.  They work pretty well when you place them on a river that is the right width for the bridge.  The trick is to make a smooth transition between the road and the bridge. (otherwise the vehicle will stop when it hits the mismatch between the road and the bridge. )  The road editor can be used to align the height of the road with the height of the bridge.

« Last Edit: October 06, 2018, 10:58:54 pm by patmarrnc »
Logged

fly77

  • Outerra Master Modder
  • Hero Member
  • *****
  • Posts: 1761
Re: Character Animation
« Reply #22 on: October 07, 2018, 03:42:07 am »

Thanks a lot for the numerous models. A good source of inspiration as well. Your tutorial vidoes are great as they are very basic and getting the basics is the hardest part. I started modelling thanks to your video tutorials in fact. So if you ever find some new stuff to explain in a video I think it will be welcome by everybody. For the animations I have seen the video and the characters in the models. They are quite simple animations indeed. Unfortunately I require a more complex animation for my bicycle driver: feet should follow moving pedals exactly (or allmost) and hands the bike handlebar while steering. I got the pedals allmost right with some sin and cosine functions to calculate the thigh and shin angles in time except that sometimes they go out of sync . Hands following the steering bar is more complicated and I still don't give up but having experienced these difficulties I got interested in pre-baked animations made in blender. as the time evolution of the bones in blender through keyframes also follows some kind of mathematical function of time (e.g. linear variations of positions and rotations between keyframe bone coordinates) I'll try if I can use keyframe coordinate data from blender to define the time evolution of bone joints  in the javascript using some linear interpolation in between. If it works it should be easier to program complex animations using the javascript file but using coordinate info from a blender animation.
Logged

patmarrnc

  • Full Member
  • ***
  • Posts: 136
Re: Character Animation
« Reply #23 on: October 07, 2018, 09:34:31 am »

Andfly has shown that is it entirely possible to make complex animations entirely with javascript... but it isn't for the faint of heart.  The upshot of this approach is that it is entirely programmable

The other approach is to create keyframe style animations in another program like poser or blender, then bring the animation into Outerra. But the problem with ANIM file animations is that you would need a separate animation for pedalling, not pedalling, turning to the left, turning to the right, driving straight etc.  I could never solve the problem of swapping between different ANIM files to change the character's actions.  I know it is possible because the army character in Outerra uses a variety of different ANIM files for different actions. I never managed to figure out how the script made a different ANIM file the active animation. My scripts always played the first ANIM then exited the loop.

About a year ago I spent considerable time trying to figure out how to create keyframed animations that worked consistently. At the time I wrote down the steps, because I have a terrible memory.  If I can find my notebook I will post the step by step procedure for creating such animations and importing them into Outerra.  But be aware that what I have learned is not enough to animate a cyclist.  Maybe if some other people start working with keyframe style animations, one of us will crack the code and figure out how to use multiple ANIM files in the same model.
Logged

fly77

  • Outerra Master Modder
  • Hero Member
  • *****
  • Posts: 1761
Re: Character Animation
« Reply #24 on: October 07, 2018, 01:47:20 pm »

Such a tutorial will be very useful to stimulate us to do more animation for outerra. What i am going to work on is to export only the animation F-curve data from blender and use them in "andfly style" javascript programmed animation. In this way the best of both worlds could be combined.
Logged

patmarrnc

  • Full Member
  • ***
  • Posts: 136
Re: Character Animation
« Reply #25 on: October 07, 2018, 03:18:31 pm »

Here are the notes I took when going thru the trial and error procedure of trying to make ANIM files work in Outerra:

1) use a keyframe based animation program to create a simple animation sequence. (I used Poser, but there are many such programs that work basically the same way. DAZ is a free one that also works, and I think Blender works too)

2) Export as DAE. This preserves the animation.

3) At this point you might be able to import directly into Outerra using the Collada importer... but I imported the collada file into Blender then exported as FBX so I could use the FBX importer. I don't remember if I had to declare anything as bones during the import process. I know this is necessary if you plan to rotate bones with JavaScript, but I don't remember doing this with Poser animations.  Such animations might include hundreds of tiny axial motions, and declaring each moving part would be confusing. I'm pretty sure I didn't declare bones. You might have to experiment with both approaches.

4) the ANIM file is created by Outerra during the import process.

5) of course, you need to recreate all of your textures in Outerra's preferred format


here's a link to an OTX of a deer with 3 different ANIM files used, but each one appears in the menu as a separate model. I never could make it programmable so the animations could be changed by keystrokes


https://www.dropbox.com/s/p8jnw7w6haa2vzr/DEER_DAE.patmarrnc.otx?dl=0

script shows how a single ANIM file can be activated. It would be great if somebody with more javascript knowledge could help us to create a way to swap an array of ANIM names in and out of activity programmatically. If we could solve this problem, it would be a breeze to create really complex and programmable animations in Outerra.  Based on the army character, I have to think it is already possible.


Logged

patmarrnc

  • Full Member
  • ***
  • Posts: 136
Re: Character Animation
« Reply #26 on: October 07, 2018, 03:20:08 pm »

Such a tutorial will be very useful to stimulate us to do more animation for outerra. What i am going to work on is to export only the animation F-curve data from blender and use them in "andfly style" javascript programmed animation. In this way the best of both worlds could be combined.

please share whatever you discover! What you are doing is very interesting!
Logged

fly77

  • Outerra Master Modder
  • Hero Member
  • *****
  • Posts: 1761
Re: Character Animation
« Reply #27 on: October 07, 2018, 06:07:09 pm »

OK. For the moment I just now solved the error that outerra gave me when importing a blender animation. Instead of directly exporting the animation through blender as fbx I found that if I export it as collada (.dae) file and then use autodesk fbx converter http://download.autodesk.com/us/fbx/2013/FBXconverter/index.html?url=files/GUID-4EACEBC7-E3C5-491C-B516-54AEEEF08B7A.htm,topicNumber=d30e369 to convert it to fbx then outerra imports correctly the file creating a package .pkg and animation .anim file. Also I can spawn the animation using andfly's Brachio_anim.js script but if I try to add a second .anim file I can spawn either one or the other but I was not able so far to switch between the two as I lack understanding of the animation commands (apparently defined here     https://github.com/Outerra/anteworld/blob/master/include/ot/animation.h            and    here     https://github.com/Outerra/anteworld/blob/master/include/ot/animation_stack.h )
« Last Edit: October 07, 2018, 06:10:48 pm by fly77 »
Logged

andfly

  • Sr. Member
  • ****
  • Posts: 347
Re: Character Animation
« Reply #28 on: October 08, 2018, 12:14:27 pm »

I am absolutely convinced that the use of pre-packaged animations in a graphics program (blender or 3ds Max) is much cheaper, in terms of speed of execution, rather than the definition of the bones of a model as a "joint" and the command of their movement with Javascript code.

It seems to me that the animation contains (already calculated) the coordinates in which to show the model's meches and their appearance deformed by the movement, while the movement commands through the script call up routines in order to define the deformation of the meches in real time and therefore require more "work" from the GPU.

But ... getting "beautiful" animations is not as easy as it might seem ...
It is not enough to put one foot after another ... there is a small amount of refinement necessary to create a "realistic" movement that is discovered only when the first tests are started ...
To find out that, in the laboratories of software-house video games, and in film studios, it is preferable to record the movements of real actors in black suit  and white balls in the joints reveals the difficulty of this work.
Of course, our ambitions are amateur, so we suppose we managed to create enough animations for our purpose.
The next step is to import the animation into Outerra.

From my tests I think it is important that the model has a UNIQUE armature and that all the bones have a common origin (and they are all linked together).
It's also important that the animation stays within 200-250 frames (longer animations have always caused me a loading error).
By building the FBX (I have kept the default settings in Blender) you should get a file that can be successfully interpreted by the FBX importer of Outerra.
(An eventual passage in the "Autodesk Fbx Converter" can help).

Browsing through the "hero.js" file (program "script" folder) I learned the commands to insert one or more animations on the Outerra stack and execute them.
A rock that I could not overcome is the possibility to delete the stack to enter a new animation and continue to alternate the animations to get different and appropriate movements.
Perhaps a more in-depth study could solve even if ... at this point ... a little bit of indications from angrypig would definitely be more useful ...

Now, however, I would like to deepen the other animation system that can be used in Outerra: the definition of the bones of an armature as a "joint" and the command of movements using the "rotate_joint" and "move_joint" methods of the geomob.
I consider this system to be hugely broader than the use of pre-constructed animations.
Being amateurs, therefore unrelated to the need for professional speed performance, we can afford to explore the use of this method that offers us the ability to program every type of movement and adapt it to any kind of circumstances!
I imagine a program in which there is a function for each bone to move ... this function limits the movement of the bone within the physiological limits of the joint (as in reality) ... receives incoming values ​​(and is recalled) from the function of movement of the bone on which it depends ... possesses (possibly) a short neural sub-routine that refines, over time, the coefficients of the movement choosing the most efficient ones based on experience ...
All dreams, of course, easy to propose but much less easy to achieve, yet ... full of enormous charm.

But it is precisely the possibility that offers Outerra to be able to achieve something like this and the consideration of being able to "play" with these ideas without the apprehension of having to produce "professional results" that leads me to think that this method of "total programming" it would have to be explored and deepened more in the pre-constructed (more limiting) method of animations.
 ::)
Logged
I do not know the English language. I use Google Translate. I hope it's all understandable.

patmarrnc

  • Full Member
  • ***
  • Posts: 136
Re: Character Animation
« Reply #29 on: October 09, 2018, 09:47:06 am »

well said, Andfly! 
Your animations are in a class by themselves! They are neither animation for the sake of a game or for the sake of video recording... your animations are like living art!  I can't even imagine how anyone could do what you have done with Outerra... but you keep doing it over and over!  Thanks for all the help you have freely given to other learners (like me)

As I see it, there are 3 uses for animation in Outerra:
1) The artistic background animations created by Andfly (totally programmed, but not necessarily controlled by the user)
2) Game play animation (totally controlled by key strokes)
3) Video animation (not controllable, but suitable for passing shots of multiple models that can be edited later into the scene you want)

type 3 is easily achieved with ANIM style animation. The magic is in the animation software, so this approach requires the least learning curve. It is also easy to create a separate model for each movement, record snippets of each animation, then assemble many animations into a single scene later in a video editor.  This is basically what I do. I'm not trying to make games or scripts with accurate audio. For my purposes it is much easier to add whatever audio I need in the video editor, where I have total control of it.

type 2 is harder because the user is responsible for creating every aspect of the animation, from model to script. But Most movement boils down to simple motion in one direction or the other... either linear or rotary motion. Once the user understands how to create and control simple movements (like a turning head or moving arm) then it boils down to constraining the movement and making it look more natural.

Type 1... pure magic! I am at a loss for words here, and I'm not the right person to offer an accurate evaluation of the skills required to do what Andfly does. The term "Renaissance Person" comes to mind, as the process is a mixture of art and science

Logged
Pages: 1 [2] 3 4