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
|
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 1971
|
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
|
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
|
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 1971
|
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 1971
|
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 1971
|
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 1971
|
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
|
Spiriax
Registered 25/05/2005
Points 277
|
8th December, 2010 at 17:01:56 -
I really appreciate your help, Sketchy!
That gave me a bit more insight, but I am already aware of one problem that would arise if we were to use that method. The images are actually named so it is always the same amount
of numbers:
"1_000001.jpeg"
"1_000010.jpeg"
"1_000100.jpeg"
etc..
But with that expression, MMF would want to load the file "1_000000100.jpeg", and not "1_000100.jpeg". I think we would need to place some more conditions to check
how many frames has already been loaded into the animation.
If this would work, it would indeed be a really nice solution. But shouldn't I be able to just do this?
Start of Frame
> Load Frame: Apppath$+"1. J6/1_000000.jpeg" into Frame 0
> Load Frame: Apppath$+"1. J6/1_000001.jpeg" into Frame 1
> Load Frame: Apppath$+"1. J6/1_000002.jpeg" into Frame 2
> Load Frame: Apppath$+"1. J6/1_000003.jpeg" into Frame 3
etc..
Surely it's a little more hassle (still WAY better than I was doing before) but as long as it works?
n/a
|
Jon Lambert Administrator
Vaporware Master
Registered 19/12/2004
Points 8235
|
8th December, 2010 at 18:39:44 -
At first glance you might think he messed up, but you'll notice that he actually called for the 6 rightmost characters of that string (which is made up of 6 zeroes and then the value) so that instead of getting "1_0000001.jpg" you get "1_000001.jpg" (6 rightmost characters of 7-character string "0000001" are "000001").
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 1971
|
8th December, 2010 at 18:44:43 -
Actually, I made sure the problem you mentioned would NOT arise.
Allow me to explain further...
The first part of the filename ("1_000") never changes, because there are less than 1000 images.
The next part is always 3 digits long, even if the value of the loopindex is only 1 or 2 digits long.
So what we do first is add a couple of zeroes on the front, in case the loopindex is only one digit long.
"00" + str$( LoopIndex )
As you suggested, that could give us the following strings of different lengths: "001" or "0010" or "00100".
However, we then use "right()" to remove all except the last 3 characters.
right$( "00" + str$( LoopIndex ), 3 )
That would give us the following strings of equal length: "001" or "010" or "100".
Putting it all together:
"1_000" + right$( "00" + str$( LoopIndex ), 3 ) + ".jpg"
That gives us: "1_000001.jpeg" or "1_000010.jpeg" or "1_000100.jpeg".
Adding a line of code for each image would be insane.
EDIT: Nevermind, Jon just explained it already - thanks Jon
Edited by Sketchy
n/a
|
Spiriax
Registered 25/05/2005
Points 277
|
13th December, 2010 at 20:39:10 -
Thanks Sketchy (and Jon ^^)!! It all makes sense now.
Sorry for my late reply, but from the beginning I couldn't make it work (I think it was because I put ".jpg" when it was indeed jpeg, or vice versa!),
but now it works just swell.
Now I can easily make a good throw break trainer! Thanks guys!
n/a
|
|
|