The Daily Click ::. Forums ::. Klik Coding Help ::. .jpeg animation coding help
 

Post Reply  Post Oekaki 
 

Posted By Message

Spiriax



Registered
  25/05/2005
Points
  277
4th December, 2010 at 17:18:42 -

So, I am trying to make a Tekken 6 Throw Break Trainer. A trainer to break throws on reaction from Tekken 6 the fighting game.

The whole animation is divided into .jpeg pictures, which is in the same folder as the application.
50 pics for Idle animation, 249 for the throw when you fail to break it, and another 249 when you succeed to break it.
I haven't ripped the pictures from the game myself, another guy did from the Tekken community. At first I thought having video files played inside MMF would be
the best method, but displaying pictures is no doubt better because then you have the best control for exact frames when you can break, exact speed on the animations you want, etc.

I'm having a lot of problems with this. First, I'll explain how I have coded it now:

The Idle animation pictures is named like this:
"1_000000.jpeg"
"1_000001.jpeg"
"1_000002.jpeg"
and so on...

To display these pictures inside MMF, I have a Picture object displaying them, so I don't have to import every picture into MMF (oh god that would be tedious).
Then I have two String objects. One of them has 250 paragraphs, and every paragraph is 3 digits to show every .jpeg picture:
"000"
"001"
"002"
...all the way up to 249. Let's call this string "String 1".

Then, the other string object is the string object that tells the Picture object what picture to show. This is "String 2".
My events for the Idle animation is this:

---------------------------------

Global Value A = 0
* String 1 : Next paragraph
* String 2 : Set alterable string to : "1_000" plus string$( "String 1" ) plus ".jpeg"

Always
* Picture Object : New picture : string$( "String 2" )

Paragraph( "String 1" ) = 50
Global Value A = 0
* String 1 : Set paragraph 1

---------------------------------

Now, as long as Global Value A is 0, the Idle animation is playing over and over, and I only need 50 frames for showing the Idle animation.

Here comes the big problem: MMF is animating the pictures TOO SLOW! Frames Per Second on my application is set to 60, but still it plays it too slow.
Even if I set the FPS to 1000, it still plays the animation just as slow.
I want the animation to play in the same speed as in the game Tekken 6: 60 frames per second!

I tried adding Fastloops to the events but it wouldn't work, and I don't really understand how loops function anyway.

I hope my method of doing this was understandable, and I hope an MMF coding guru can give me a solution.
What I want is a way to display the pictures animated into MMF with an efficient way to set speed on the animation.

Thanks!

 
n/a

Don Luciano

Heavy combat pancake

Registered
  25/10/2006
Points
  380

VIP Member
4th December, 2010 at 17:26:51 -

Mmf has a good importer, you can easily add multiple pictures in it with import as animation, if they are numbered like this walk1, walk2, walk3 etc... it will add them properly as an animation. It would not take long to import it all.

Edited by Don Luciano

 
Code me a sausage!

Spiriax



Registered
  25/05/2005
Points
  277
4th December, 2010 at 17:36:40 -

Oh yeah... I found the Import function in the animation of an Active object. Never used it before.
And I can import ALL of the pictures?!

Now I don't have to store the damn pictures in the same folder as the application either!

THANKS!

Edit: I want to edit my first post that it is solved so more people don't have to give their input, but I can't.

Edited by Spiriax

 
n/a

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1970

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
4th December, 2010 at 18:10:28 -

I'm not at all sure about this, but I believe when you import images, MMF will effectively convert them to bitmaps - meaning the filesize could be pretty huge with that many frames of animation.

If that is the case, you'd be better off storing the images as .png files, and then importing them at runtime.

Unfortunately, you couldn't load frames one at a time, as that would be very slow (as you've already found out).
You could however, use the active object's "load frame" function, and load all the frames into memory at the start of the game, and then it would be able to display them much more quickly. I believe there's an extension that does something similar - "animated picture" extension maybe?

 
n/a

Spiriax



Registered
  25/05/2005
Points
  277
4th December, 2010 at 19:59:55 -

Yeah, I noticed, after only the Idle animation my application was 400 mb. :S

Thanks, I'll see what I can find!

 
n/a

Don Luciano

Heavy combat pancake

Registered
  25/10/2006
Points
  380

VIP Member
4th December, 2010 at 23:10:53 -

400 mb? That's immpossible... how many frames are there? 5000?

Edit: Are you using mmf or mmf2? I guess mmf. Because i have no idea how would that happen in mmf2.

Edited by Don Luciano

 
Code me a sausage!

Jon Lambert

Administrator
Vaporware Master

Registered
  19/12/2004
Points
  8235

VIP MemberWii OwnerTDC Chat Super UserI am an April FoolSSBB 3265-4741-0937ACCF 3051-1173-8012360 Owner
4th December, 2010 at 23:41:39 -


Originally Posted by Don Luciano
400 mb? That's immpossible... how many frames are there? 5000?

Edit: Are you using mmf or mmf2? I guess mmf. Because i have no idea how would that happen in mmf2.

They're JPEGs. Of a PS3/Xbox 360/PSP. They'd have to be pretty high quality to make an effective trainer app like he wants, so they'd be pretty large in size.

 
Sandwich Time!Whoo!

JoyCheck & KeyCheck Widgets
For easy implementation of customizable joystick and keyboard controls.
http://www.create-games.com/download.asp?id=8364

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1970

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
4th December, 2010 at 23:42:30 -

Close. 548
I think "load frame" is the way to go...

 
n/a

Spiriax



Registered
  25/05/2005
Points
  277
5th December, 2010 at 12:44:07 -

Yes, this is one screenshot:

http://img43.imageshack.us/img43/2841/1000000t.jpg

It is 140kb in size but if I import it to MMF the size gets 10x larger.
I can though resize the whole animation, it doesn't need to be that big, and also I can lower the amount of colors too.

But keeping it at a reasonable size is only the FIRST problem, because I noticed importing pictures to Active objects'
can be pretty darn buggy. Sometimes it gets stuck and only imports like 10% of all the pictures I want, and no matter
how many times I try to import it only imports a couple of pictures... and then I keep trying until the program crashes.

I found what I think you were talking about Sketchy, it's "Animated Picture" and it has a "Cache picture" function. I stumbled upon
it earlier but found that it would be very tedious selecting all the pictures one by one (instead of naming paragraphs to 001, 002, etc..) but it seems
I'll have to endure.

 
n/a

Spiriax



Registered
  25/05/2005
Points
  277
5th December, 2010 at 14:03:48 -

Now I have made the Idle animation, and with the "Animated Picture" it runs really smooth! And the size of the
application won't be huge, only the pictures!

The problem though is this... and I only made the Idle animation yet:

http://img149.imageshack.us/img149/2172/loltedious.png

First cache in every picture, and then show the picture according to a value, only 50 pictures so far but it will have to store
hundreds of pictures later.

EDIT: FUCK!!! The bridge in the background jumps if I put only 50 frames as Idle, it seems I have to put ALL 250 pictures into
the Idle animation as well. :S

Edited by Spiriax

 
n/a

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1970

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
5th December, 2010 at 14:50:10 -

That really doesn't look like the way forward...

There must be a way to get the "load frame" option working for an Active object.
Have you tried splitting the frames between several animations, or even several different objects?
There might be a limit on the maximum number of frames per animation, or perhaps even the maximum memory an Active can occupy.

 
n/a

Spiriax



Registered
  25/05/2005
Points
  277
6th December, 2010 at 01:03:08 -

Oh yeah, I found a "Load Frame" in the Event Editor, never tried that either. I seem to be able to choose one picture only, not a whole animation.
Even if I specify several pictures in expression, it doesn't work (then it shows nothing), and I tried loading several pictures to the same animation but different directions. Then when I
switched directions nothing happened.
But maybe it works well if I create one active object for every frame I need, and then load each frame on them. If that would work I only have to place timed "Reappear" and "Make invisible" events.
Gonna try that out and see how it works.

 
n/a

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1970

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
6th December, 2010 at 02:28:20 -

That's what I've been talking about.
The expression only loads one image at a time, but you can use a fastloop to load them all in sequence.

Something a bit like this...
Load Frame: Apppath$ + "images/" + Str$( LoopIndex("LoadImages") ) + ".jpg"

IMPORTANT:
The load frame expression only let's you replace existing frames - so if an animation only has one frame, that's all you can load.
However, you can create 500 frames that are just 1 x 1 pixels in size, and that won't add to the filesize (use copy & paste, and it shouldn't take too long). Then you replace them at runtime.

 
n/a

Spiriax



Registered
  25/05/2005
Points
  277
7th December, 2010 at 20:50:17 -

Gonna try this out now...

So I create one Active object for every frame that I need, and I make them 1x1 in size.

I'm sorry but I understand absolutely nothing from that expression. I put it into the expression box and I could press OK lol!

The "images/" part is a folder, right? And I don't understand ( LoopIndex("LoadImages") :S
And under what condition does this action go on? Start of Frame or On Loop?

 
n/a

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1970

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
7th December, 2010 at 21:58:12 -

Short version: It doesn't work for me, due to what looks like a bug in MMF2 - but it's worth trying (MMF2 is a bit buggy on my computer)

Long version: Keep reading...


No.
You make ONE active object, and make it 1x1 in size.
You then copy the current frame 500 times. That gives you one active, containing a "stopped" animation with 500 frames - all 1x1 in size.

If the active only had 1 frame to begin with, you'd only be able to load 1 frame - so what we just did was to make room for all 500 frames.

Now you use a fastloop to load the images, using the "load frame" action - found under Active -> Animation -> Load Frame.


+ Start of Frame
-> Start loop "Load Frames", X times

// where X is the number of frames in the animation.


+ On loop "Load Frames"
-> Active: Load frame...

// filename:
Apppath$+"Images/1_000"+Right$("000"+Str$(LoopIndex("Load Frames")), 3) + ".jpg"

// load frame:
LoopIndex("Load Frames")


That's assuming you have a main folder containing:
* your game file
* plus another subfolder called "Images", which contains all the images.

Apppath$ gives us the path to the main folder (incl. the slash at the end).
+"Images/1_000" adds on the subfolder name and the fixed part of the filename.
+Right$("000"+Str$(LoopIndex("Load Frames")), 3) gives us a 3-digit number - eg. "1" becomes "001"; "10" becomes "010".
+.jpg just adds the file extension on the end.


Unfortunately, I just tried it, and there seems to be a problem - if you set the frame number to anything but "0", it won't load anything.
This appears to be a bug, but maybe someone else knows something I don't...
You could ask on the clickteam forums and they might be able to tell you.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click