So, here is how the demo data work:
We have all seen a string of data that look like this: 21:365733|52346544|3454364|0
The data is read like so:
Code: Select all
The number at the beginning, in this case 21, is the number of total frames in the demo.
Each set of numbers between the lines, such as |34534532|, are the actions taken in a 7 frame section.
The way this number is created by the sum of values given to each action that takes place in these 7 frames.
The values given to each action (jump, left, right and holding a jump for the next frame) were determined by Metanet. They used simple exponential formulas to make them.
Let’s say we want n to go 2 frames to the right then jump and keep holding jump and traveling right for 3 more frames then for the last 2 frames we want to let go of jump and pull back left. Here is how that would be done in the demo data.
First you should figure out what buttons are being held in each frame:
(Note: for a hold of a jump, I am going to denote that as "Hold")
Frame 1: Right
Frame 2: Right
Frame 3: Jump, Right
Frame 4: Hold, Right
Frame 5: Hold, Right
Frame 6: Left
Frame 7: Left
Ok, now that we know what is going on in each frame we would look at my handy dandy excel file that is attached with all of the values in it, and find the values for each of these actions.
Frame 1: A right in the first frame has a value of 2
Frame 2: A right in the second frame has a value of 32
Frame 3: Now jumps with holds are a little different, you must figure out what frame you jumped in and how many frames you held for and that is one specific value. A jump in the 3rd frame and 2 more frames of hold has a value of 281600. A right in the 3rd frame has a value of 512.
Frame 4: since we have already accounted for the jump and holds we need only worry about the right, and a right in the 4th frame has a value of 8192.
Frame 5: same as frame 4 but, a right in the 5th frame has a value of 131072.
Frame 6: A left in the 6th frame has a value of 1048576.
Frame 7: A left in the 7th frame has a value of 16777216.
Now that we have the value of each action in each frame we need to sum the values in each frame.
Frame 1 Total: 2
Frame 2 Total: 32
Frame 3 Total: 282112
Frame 4 Total: 8192
Frame 5: Total: 131072
Frame 6: 1048576
Frame 7: 16777216
Now that we have the total of each frame add it all together for the code for these 7 frames.
Total: 18247202
That is now the code for those 7 frames that will have the ninja run 2 frames right then jump to the right for 3 frames and then pull back left for 2 frames. To actually use this you will put it in to this format.
7: 18247202
The only problem with that is usually the ninja is placed a ½ snap from the bottom so it takes a few frames for him to fall to the ground where he can do stuff. So to make this demo work we would need to do nothing for, let’s say 7 frames to make things easy. Now our demo data would look like this.
14:0|18247202
Now that you know how to make a demo here is some information on how all of this data came to be and works.
Once you look at my tables in the excel doc you will see a bunch of jump tables and a theoretical hold value table and this is just to save you time adding up all of those numbers, but technically even though you can just start holding a jump without jumping the hold value for each frame was implemented in the game.
Metanet gave a base value to each of the 4 actions you can do (Jump, right, left, and hold) in the first frame. Jump = 12, right = 2, left = 1, and hold = 4. Then to calculate the value for each action in the next 6 frames the base number was multiplied by 16 for each frame after the first. So a jump in the 3rd frame is 12*16*16 = 3072
*Key for Excel Chat*
0 - no action/buttons pressed
Jump - Jump key pressed in that frame
Hold - Jump key held from a previous jump
Right - Right movement key pressed
Left - Left movement key pressed
Code - The value for a specific action and frame.
*Disclaimer*
1) I know absolutely nothing about programing, I figured out all of this through trial and error, so if something is wrong please don't freak out. Instead feel free to correct me and I will make the necessary changes.
2) I use Excel 2007 version on Windows XP, and when I save it tell me that some of the formatting may not be compatible with old versions, so if it looks all screwed up to you please tell me and I will try to fix it. Although I don't really know how I would.