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.

AppGameKit Classic Chat / agk 3d limb and animation system using code [wip]

Author
Message
SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 13th Jun 2014 02:47 Edited at: 30th Jul 2014 15:34
I have written some new function comands that will help people create 3d animations and limbed characters.

These comands will work with agk v1 and v2.


comand list: so far... not in any order



i will post more examples soon...


here is the source example using animation


http://www.smotion3d.com/downloads/objexample1.zip


source code file objects_include.agc


3d point in space
14
Years of Service
User Offline
Joined: 30th Jun 2009
Location: Idaho
Posted: 13th Jun 2014 21:37
I want to see more of this it looks intresting. I have tried to find a bone editing system to use but have not found one.

Developer of Space Chips, pianobasic, zipzapzoom, and vet pinball apps. Developed the tiled map engine seen on the showcase. Veteran for the military.
SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 13th Jun 2014 22:34 Edited at: 24th Jun 2014 04:56
edit: fixed smooth frame code

SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 14th Jun 2014 02:03
ok so i just added 2 more commands for this week

-loadobj(object,filename$)
hey doesnt the command loadobject do the same?? Nope! Mine loads it into an array at the same time so you can edit it.

-adjustobjectpivot(object,filename$,x#,y#,z#)
now this command does not work without a filename as it needs to look at the raw data of the file to adjust,save, then reload it.

but works realy good!!

more commands coming such as addlimbtree,detachlimbtree,deletelimb....then some animation stuff and a new object format that will save and load objects with limb objects and their animations...



SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 23rd Jun 2014 13:52 Edited at: 23rd Jun 2014 13:56
alright! the animation commands now work and are smooth but currently you will need to use a capped frame rate. if someone would be so kind to show me a small chunk of code to get it based on frame rate that would be great!

the chunk of code to look at is here:


what adjusts the playback movement is this code line...
atkey#=atkey#+objects_playing#[object1,4]

so if you know how to adjust that value based on framerate that would be great!

the movement is based on percent. 1.0 = run 100% as fast as it can
to make it move slower 0.01 would be smooth and slower.
I will post an example animation today with a smooth character running.

SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 23rd Jun 2014 15:34 Edited at: 24th Jun 2014 04:51
ok here is the example animation code I just wrote up this morning.....completely smooth animation using code...

the code source looks like this but you will need to download the attached file



edit: attachment deleted and new one is posted below and also first post

SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 24th Jun 2014 04:08
I found an error with my limb number calculations while coding a cloneanimatedobject command.

I will post a fix for this asap and release some new commands to go with it.

SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 24th Jun 2014 04:50 Edited at: 24th Jun 2014 05:45
ok so now that I have fixed the glitch.... I've been able to run a performance test.
it looks like 10 to 20 animated models on the screen is optimal for most devices. now this is fine of coarse because your game will just recycle them for new enemies or characters to appear.
it also depends how many verts your characters or animated models are using.
what I have seen so far though is very promising so I will be using this in my zombie game that I was working on.

edit: I just made a huge performance boost to it and now I can run 50 to 60 of these on my pc. if im using my tablet its still ruffly around that 20 mark but I will see what I can do to boost it more.
updated download on first post
download the new source and testcode from first post above

I made two new commands

-positionobject2(object,limb,x,y,z)
-rotateobject2(object,limb,x,y,z)

these 2 new commands only modify the array data and that's what sped up the animation code *3.

the trick is that you only update the object once per sync....not a whole bunch of times as your just losing processing time

SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 24th Jun 2014 05:04 Edited at: 24th Jun 2014 05:47
here is an image of what the source example is.

basically you have 20 devil cats fully animated and running around the screen smoothly at different speeds.

check it out

the new source posted is now 50 however you will need to change that value smaller to test on your portable devices

Attachments

Login to view attachments
29 games
18
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: not entirely sure
Posted: 25th Jun 2014 18:50
This is very cool, very impressive.

I take it you're going to make a full animation editor?

What basic principle are you using for the animation, I couldn't quite pick it out of your code?

The two basic methods I came up with was:

Interpolate between a start and end position and rotation

or

calculate the velocity of each limb based on the start and end point and the time it takes to get there (this is what I'm using as I found it easier to transition between different animation loops).

I was also wondering if the V2 tweening commands could be used. I've not investigated them fully (too busy playing around with the bloom shader)so I'm not sure how this would work.

SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 25th Jun 2014 19:03 Edited at: 25th Jun 2014 19:05
I have it setup so you can transition between frames as a percentage.
so depending on your playback speed, it calculates what the values should be between frames.
basically I can position an object at key frame 0.1 which would be 10 percent of the transition from frame 0 to frame 1.0
I do however want to fix the speed of animation playback to be based on the timer() and current frame rate. I may need some help with that.

I will be updating this again later tonight!
-added the ability to play your animation backwards
-tweeked speed
-added instanceanimatedobject() which is better on memory

next week I will be adding a transition code to allow a person to transition from 1 animation to another oh! also to beable to save animations and rig setups for easy loading back in.

Yup I will be making an animation editor to follow!

Weave
AGK Bronze Backer
17
Years of Service
User Offline
Joined: 26th Sep 2006
Location:
Posted: 25th Jun 2014 23:29
And there was you saying you were`nt a developer...lol

Dude thats awesome!
SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 25th Jun 2014 23:53 Edited at: 27th Jun 2014 02:36
haha... I just ment that I was not one of the guys coding agk...lol!

I have an awesome update...

-animation transitions is now a new command.

check out this source and I will separate it from my project later to break it down and to help people use it

mainloop:


I posted the main comands so far on the first post with the new source code

download here----------------------------------------->

Attachments

Login to view attachments
SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 28th Jun 2014 06:04
ok I have the final code completed for the plugin....everything done from here on will be by request.
I will be updating the source this week when I get a chance.

you can now rig a character... animate it.... save it as a single animated object file... load the file in with animation/linkage intact exactly how you saved it and with textures if they where applied with an optional setting.
its like having darkbasic classic commands but being able to save the object+animation+linkage and load it all back in as one command.

Im now going to work on an animation editor. This will make it very easy for people to use in there games. But if your old school then ya can rig and setup animations and linkage with my new functions.

now your source code could look as easy as this:




very nice and neat!

SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 2nd Jul 2014 17:32 Edited at: 2nd Jul 2014 17:37
and here is example 2



and source...
http://www.smotion3d.com/downloads/objexample2.zip


edit: ok some information...
If you have created and saved an animated model file it was not setup to beable to load in / edit / then save again. However this is an easy command i could through in if requested.

i can make a new command that will load it in for the perpose of editing and saving again....easy enough

SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 4th Jul 2014 17:20 Edited at: 4th Jul 2014 17:23
ok here is my final example for showcasing this code...feel free to use and modify.

this shows a complete setup of all 1's character animations.



this source has been updated with a frame glitch i noticed from the other 2 examples so extract the objects_include file from this one.

http://www.smotion3d.com/downloads/hockeyplayer.zip

edit: oh! please do not use my hockey guy in any games as he is being used in my new release of Ice Brawlers for ouya!

SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 4th Jul 2014 17:37
and the video for those lazy to download...



SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 5th Jul 2014 03:18 Edited at: 5th Jul 2014 04:45
ok i found a quick bug while coding....

under this function...

change this code:


to this code:


basicly after an animation transition it was possible to report an object not playing if it still was.

this code correction should fix the getobjectplaying(id) command to work more accuratly

edit: as i go along i continue to find a few minor errors... i will post a fix once i think i caught them all

29 games
18
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: not entirely sure
Posted: 5th Jul 2014 18:13
Cool hockey player.

Quote: "I have it setup so you can transition between frames as a percentage"


So, for example, if the angle of a limb is 30 degrees at the first frame and the second 75 degrees at the second frame, then when the animation plays, 30% would 43.5 degrees ( 43.5 = (75-30)*0.3 + 30 ).

I take it the to play the animation then, you step through increments of percentage, say 2% per loop of the code or 5% if you want to the animation to run faster.

SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 5th Jul 2014 20:01
yup its just a change in percentage of flipping through the animation. if you want slower then change the percentage jump smaller.

also what i have done is set it so that frame rotations are an almost infinate amount and are not bound by 360 deg.

so if my base frame rotation was 45 deg... and my second frame was -1000.0 then it would calculate that between the 2 frames it would need to rotate the object around actualy several times in a left direction before it hits the next frame marker. If it was a positive value then it would be turning right several times...or oppisite direction anyways.

doing it this way makes it easier to figure out what direction the animation should be turning.

I just fixed up the animation transitions this morning. Instead of transitioning to a new animations start frame it now transitions to startframe+1 so the new animation starts in a perfect manner.

I will post the new source later today. Then i will make some help docs for it so people can start using it

SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 7th Jul 2014 05:52
This is awesome! My current work in progress using this animation code for a real game!

check it out! Once its uploaded


SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 26th Jul 2014 01:39 Edited at: 26th Jul 2014 01:56
ok so i think the full plugin is complete. I can deffinetly add more functions if needed.

would anyone like a proper help system built for the new commands?
What would be the best way to impliment it?

source plugin code file:


let me know what you think i should use for a help system... im thinking html will do the trick.

some user notes:
-20 limbs max
-30 animation frames can be set
-100 x animated objects max (but could be adjusted)
(this uses ids 1-100 )
-must call initialize_objects() before using any commands.
-when saving an animated object and reloaded... its not setup to make further mods to save it again.
(however if requested i could easily add it in)
-animation speed is based on percentage change
(1.0 is 100% and 0.01 is 1%)
-you must call updateobjectanimation(object1) or updateobject(object1,limbcnt) to actualy update the objects before syncing.


thats the most of what ya need to know for now and i will figure out what to do for the help system and examples for each command.

DennisW
15
Years of Service
User Offline
Joined: 15th Jun 2008
Location: Ohio
Posted: 28th Jul 2014 14:33
I would love to see a help file on this and how to start using your plugin. looks pretty exciting to me. I hope to see more detail in the coming days on some help files or a quick start guide.

Great Work

Dennis

Ham and Eggs Breakfast
The Chicken was involved the Pig was Committed
AGK Community Tester
SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 28th Jul 2014 21:08
Ok I will see about putting an html help system in place with example usage.

Its really easy to use this and it even saves the 3d limbed character with animations created for easy loading in with 1 command.

I also coded in animation transitions which is awesome and again is called with a single command.

Give me a night or 2 to put this together.

This is usable for both agkv1 and v2

DennisW
15
Years of Service
User Offline
Joined: 15th Jun 2008
Location: Ohio
Posted: 28th Jul 2014 21:27
That's great SoftMotion I am looking forward to it.

Ham and Eggs Breakfast
The Chicken was involved the Pig was Committed
AGK Community Tester
SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 29th Jul 2014 06:22 Edited at: 30th Jul 2014 15:35
give me a few days to create some example code.

SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 30th Jul 2014 15:31
ok i have posted a new help text on the first post.

let me work on the examples now and i will upload them.

DennisW
15
Years of Service
User Offline
Joined: 15th Jun 2008
Location: Ohio
Posted: 30th Jul 2014 16:27
OK sounds great Thanks

Ham and Eggs Breakfast
The Chicken was involved the Pig was Committed
AGK Community Tester
SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 5th Aug 2014 15:56
hey dennis....or anyone else interested. what would you like for an example code?

let me know what type of example you would like to see providing its not crazy huge and i will write it up for ya.

i could make a simple robot that runs around.... anything you want is your choice...

Jack
19
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 24th Aug 2014 06:50 Edited at: 26th Aug 2014 22:50
Hello SoftMotion
You have done an awesome work here!

I think it would be a great idea to make a snippet for animation.
How to build a model from limbs objects and how to animate it


[/url]
SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 26th Aug 2014 06:38
will do!

i will also update the source code.

I probably will not get around to this till sunday or monday this long weekend.

SoftMotion3D
AGK Developer
18
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 27th Sep 2014 18:55 Edited at: 27th Sep 2014 19:20
ok so i have completely updated this for use with agk v2
download the sample file below....

Im not going to overwrite the first post as that one works with agkv1 tested.
This one i had to change to using local variables etc...



information:

-I modified the way models are loaded and saved. Now the loader can detect if the models exist so it does not need to re create the obj files if they exist. This has increased load time incredibly over android. If you would like to see this plugin in action it can be seen on this video:

https://vimeo.com/107203755

**Im now working on an animated model maker to simplify creating 3d animated models even easier.**


and download ----------------------------------------------------->

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-04-27 01:38:52
Your offset time is: 2024-04-27 01:38:52