Register - Login
Views: 91467565
Main - Memberlist - Active users - Calendar - Wiki - IRC Chat - Online users
Ranks - Rules/FAQ - Stats - Latest Posts - Color Chart - Smilies
05-26-18 04:23:31 AM

Jul - SM64 Hacking (Archive) - Animation Commands Hacking (Geeky Stuff!) New poll - New thread - New reply
Next newer thread | Next older thread
VL-Tone
Member
Super Mario 64 forum moderator
Level: 51


Posts: 93/621
EXP: 973258
For next: 40680

Since: 07-27-07

From: Montreal, Canada

Since last post: 270 days
Last activity: 23 days

Posted on 09-21-07 06:45:11 AM; last edit by VL-Tone on 09-21-07 09:51 AM Link | Quote
As many experienced TT64 users found out, when you try to apply behaviors from an enemy to a different model, you usually end up with an epileptic and glitchy character. For example, applying the Goomba Walk behavior to MIPS the rabbit result in the mutant rabbit you've seen in the TT64 2007 demo patch.

The reason why it happens is that the animated rotation values are applied to the wrong joints, and if the model you use has more joints than the behavior animates, the rest will end up pointing up to unrelated values in RAM, which creates seemingly random glitchy movements in the remaining joints.

I used to think that the relation between the behavior and model was hard-coded in the ASM behavior functions, and thus would be hard to modify or transfer from one model to the other.

But I found it's not quite the case since rstewart215804 found a very interesting command used in behavior scripts.

The command is 0x27. I updated my "decompiled" behavior script document to reflect this new find.

http://homepage.mac.com/qubedstudios/SM64Behaviors.txt

[27] [26] [00 00] [05] [00 61 6C]


[0]= 0x27 is the command byte.
[1]= Always 0x26?
[2,3]= Always zero, unused?
[4]= Bank number.
[5,6,7]= Offset of the animation data in the bank.


The 0x27 command points to animation data which is usually found in the same bank where the related model polygon data is (most of the time, it's just after the polygon data for a given model).

I don't know the exact format of this data, but it often includes jump offsets so the data is not linear, and I assume it's structured in a hierarchy fitting the model body part structure.

If you want to take a look at this animation data, and maybe try to find more about its format, here's how to find it:

Let's take the Goomba animation data as an example.

The "Goomba Walk" behavior pointer is 1300472C.

The behavior script bank (0x13) is loaded from 00219E00 in ROM. So 00219E00 +00472C= 0021E52C.

You can use the SM64Behavior.txt document to look it up.

Here's the Goomba Walk behavior script from the document:
ROM Addr: 0021E52C Hex Behav: 1300472C

Description: Goomba Walk
21E52C/00472C 00 05 00 00
21E530/004730 11 01 20 49
21E534/004734 1E 00 00 00
21E538/004738 27 26 00 00 08 01 DA 4C
21E540/004740 2D 00 00 00
21E544/004744 30 00 00 00 00 28 FE 70 FF CE 03 E8 03 E8 00 00 00 00 00 00
21E558/004758 0C 00 00 00 80 2F F4 08
21E560/004760 08 00 00 00
21E564/004764 0C 00 00 00 80 2F F9 6C
21E56C/00476C 09 00 00 00


You can see that the 0x27 command is found at 21E538 in the ROM.
27 26 00 00 08 01 DA 4C


It means that the animation data is found at offset 0x01DA4C in bank 0x08.

Where is bank 0x08? You'll have to use TT64 to find out.

Open a ROM in TT64, and load a level where you can put Goombas, it could be Bob-Omb Battlefield, but let's use Castle Ground in this example, which as most of you know can also contain Goombas.

So load the Castle Grounds level if it's not already loaded.

Set the Commands mode to Expert and click on the "0x17 Copy Data to RAM Bank" line in the command menu.

Set the mode to Hexadecimal by clicking on the appropriate checkbox.

Look at the 0x17 commands list. The 12th line is "012 i h08 h00A8181C".

If you click on it, you can see that in this levelbank 0x08 is loaded from data found in ROM, starting at 0x00A8181C and ending at 0x00AAA40C. The important number here is 0xA8181C, since it's the begining of the bank in the ROM.

If you add 0x01DA4C (Goomba animation data offset) to 0xA8181C, you'll end up with 0xA9F268, and this is where the animation data entry point is in an extended ROM.

Looking at 0xA9F268 in the ROM with an hex editor, the first four bytes you can find are 08 01 DA 34.

Hmm... 08, what a coincidence, it's the bank number we're at! 01DA34 is indeed a valid offset inside this bank. To make it easier to find where it is in the bank data without having to add 0xA8181C each time you encounter an offset in bank 08, what you can do is copy all the data from 0x00A8181C to 0x00AAA40C and paste it into a new empty document (in your hex editor). That way you can easily find an offset in bank 08 just by looking at the address column on the left.

Like I said, I don't know much about the actual format there. Outside of the offsets, which seems to make the data jump around the place in that bank, there are some sequence of data which seem to be series of angles.

If you want to help cracking the format, and have previous ROM hacking experience, this could be your starting point.




But let's get back at the 0x27 command level, since we don't know the animation data format.

By swapping around 0x27 commands in behavior scripts, we can do very very interesting things...

Let's say we want to make a MIPS rabbit that acts like a Goomba.

Start with a freshly extended ROM.

In TT64, in Castle Grounds, select a butterfly. Make sure you're in the Expert Paramater Bar mode so you can see the Model ID and Behav params. (That's just below the Activate Level Select check box).

Click on the menu icon for the Model ID param, and select MIPS as the model(Model ID 100). Then, click on the menu icon for the Behav param, and select the Goomba Walk behav (18220).

Click on Save. Try the ROM in your favorite emulator.

Ok so while MIPS acts like a Goomba, it's all glitched and mutant...



That's because the game applies the animation data from the Goomba (the 0x27 command found in its behavior script) to the MIPS model, and its body part hierarchy simply doesn't match.

Let's try to fix that with what we know now...

Take another look at this document: http://homepage.mac.com/qubedstudios/SM64Behaviors.txt

We try to find the MIPS behavior script.
Here it is:
ROM Addr: 0021E2FC Hex Behav: 130044FC

Description: MIPS Rabbit Behavior
21E2FC/0044FC 00 04 00 00
21E300/004500 11 01 04 09
21E304/004504 27 26 00 00 06 01 57 24
21E30C/00450C 10 2A 00 02
21E310/004510 1E 00 00 00
21E314/004514 23 00 00 00 00 32 00 4B
21E31C/00451C 10 05 00 00
21E320/004520 0C 00 00 00 80 2F 84 90
21E328/004528 08 00 00 00
21E32C/00452C 0C 00 00 00 80 2F 8D AC
21E334/004534 09 00 00 00


Ok, so MIPS' animation command is 27 26 00 00 06 01 57 24.

Looking at the Goomba Walk behavior script:
21E538/004738  27 26 00 00 08 01 DA 4C

We see that the Goomba Walk animation command is at 21E538 in the ROM.

Open the ROM you just modified, go at 21E538, and replace 27 26 00 00 08 01 DA 4C with 27 26 00 00 06 01 57 24. Save the changes.

Load the ROM in the emulator, go to Castle Ground... Oh! That's better, MIPS is no longer a mutant, and he acts like a Goomba!



The only thing is that he seems to be stuck in his "idle" animation routine while he walks, instead of his walking animation, so he looks like he's sliding, while looking around. He does have a different animation when he starts running toward you, and it's pretty funny. It's not perfect but it's still much much better than the mutant version.

But there's a big problem. We've now modified the Goomba Walk behavior script so that it uses the MIPS animation. What happens if you put a Goomba in Castle Ground using this ROM? Well he'll be glitched...

And what happens when you go to Bob-Omb battlefield in this ROM? It crashes... That's because the Goomba Walk behavior script now relies on the animation data from MIPS, which is expected to be found in bank 0x06. But in other levels (except inside the castle) bank 0x06 in RAM doesn't contains the MIPS polygon data and its animation data, it contains some other bank.

So when swapping 0x27 commands, you really have to know what you're doing. You must be sure that the content of the bank which is referred by this 0x27 command will always be present in levels where this behavior script is used. Always work on backups, don't try to experiment with this on the only copy of your masterpiece TT64 mod.

Also, if you're a n00b and try swapping 0x27 commands, don't come here to complain that it crashes your ROM.

Because of all these potential issues, it would be hard to integrate any fool-proof method of editing the 0x27 commands in TT64.

A way to get around some of these problems would be to extend bank 0x13 (the behavior script bank) and duplicate existing behavior scripts to create new ones that could be only used in a particular level. Still, managing all this would end up being very complicated.

Eventually, managing and editing behavior scripts and animation commands will be possible in TT64, but certainly not soon.
NintendoMasters
Member
Level: 21


Posts: 51/84
EXP: 48360
For next: 1583

Since: 08-06-07


Since last post: 10.0 years
Last activity: 9.0 years

Posted on 09-21-07 12:18:24 PM Link | Quote
Is it possible to change this for different levels individually? If so is it possible to put into TT64 beacuse that would be really good.
Deleted User
Original user deleted
Level: NaN


Posts: 8/-8234
EXP: NaN
For next: 0

Since: 07-26-07


Since last post: 10.0 years
Last activity: 8.0 years

Posted on 09-22-07 09:46:54 PM Link | Quote
That is definitely something I'll never understand. But still, I'm happy to see that some people are more nerdy than me! xD
Anywho, nice finding, VL!
OOnet
Random nobody
Level: 8


Posts: 3/9
EXP: 1694
For next: 493

Since: 08-14-07

From: France

Since last post: 9.0 years
Last activity: 9.0 years

Posted on 10-04-07 09:46:56 AM Link | Quote
it's very impressive !! I'll try it right now, it can be very interesting to add this function into tt64 because hex editing is so boring...
Royal
50
Level: 18


Posts: 10/59
EXP: 28201
For next: 1696

Since: 10-18-07

From: Brazil

Since last post: 10.0 years
Last activity: 10.0 years

Posted on 10-18-07 07:27:32 PM Link | Quote
OMG!! toooo much math!! lol....
like he sayd: hex editor is boring... i prefer stay with the mutant MIPS....

its more cool!!
darkflame917
Random nobody
Level: 5


Posts: 2/3
EXP: 323
For next: 206

Since: 10-15-07

From: Irrelevent,Irrelevent

Since last post: 10.0 years
Last activity: 10.0 years

Posted on 10-18-07 08:24:44 PM Link | Quote
I agree hex editing is boring and takes waaaaay too long in my opinion; can't wait for the toad's tools version; it will save me a ton of time when i get around to that aspect of my mod.
Royal
50
Level: 18


Posts: 16/59
EXP: 28201
For next: 1696

Since: 10-18-07

From: Brazil

Since last post: 10.0 years
Last activity: 10.0 years

Posted on 10-18-07 08:52:38 PM Link | Quote
i try dont get in these troubles... but some time i get then and PUM! i stuck in it... all that cuz i dont know what to do with the HEX, or some thine i know, but it take much time, so i give up and go fix some outher bugs....
Kathulis
Random nobody
Level: 4


Posts: 1/2
EXP: 175
For next: 104

Since: 10-21-07

From: USA

Since last post: 10.0 years
Last activity: 10.0 years

Posted on 10-21-07 12:12:43 PM Link | Quote
Alright, I am a total newb, and new to this fourm, and really no idea what I am doing most of the time in toad's tool. When I found this thread, I started to try it in toad's tool 64. I was having fun, until I got to to the part where I had to Open the rom, in order to change the behavior from a MIPS to a goomba walk.

I did two things that didn't work
I opened the rom in toad's tool,
I opened the rom and started to play Mario 64.

Alright, so this is my newb question, I have an exteneded rom, and I don't know how to open it to get the source part. Once I get that I should be in the clear.

If this has been adressed before could someone kindly link me the page?

I use a mac OSX 10.3.9 and I use sixtyforce .8

Thanks in advance
Royal
50
Level: 18


Posts: 49/59
EXP: 28201
For next: 1696

Since: 10-18-07

From: Brazil

Since last post: 10.0 years
Last activity: 10.0 years

Posted on 10-21-07 03:08:29 PM Link | Quote
humm.... you mean you want know the address of things in ROM?? just select the object and in the left-botom part will say the address for the object.
Kathulis
Random nobody
Level: 4


Posts: 2/2
EXP: 175
For next: 104

Since: 10-21-07

From: USA

Since last post: 10.0 years
Last activity: 10.0 years

Posted on 10-21-07 03:38:35 PM Link | Quote
Wait, will that allow me to get to the long list of commands.
For example the :

ROM Addr: 0021E2FC Hex Behav: 130044FC
Description: MIPS Rabbit Behavior
21E2FC/0044FC 00 04 00 00
21E300/004500 11 01 04 09
21E304/004504 27 26 00 00 06 01 57 24
21E30C/00450C 10 2A 00 02
21E310/004510 1E 00 00 00
21E314/004514 23 00 00 00 00 32 00 4B
21E31C/00451C 10 05 00 00
21E320/004520 0C 00 00 00 80 2F 84 90
21E328/004528 08 00 00 00
21E32C/00452C 0C 00 00 00 80 2F 8D AC
21E334/004534 09 00 00 00
and edit it?
Royal
50
Level: 18


Posts: 50/59
EXP: 28201
For next: 1696

Since: 10-18-07

From: Brazil

Since last post: 10.0 years
Last activity: 10.0 years

Posted on 10-21-07 05:33:42 PM Link | Quote
ohh, im srry, but HEX is not with me... try PM VL-TONE or a friend thats you know is good with HEX, but me....
VL-Tone
Member
Super Mario 64 forum moderator
Level: 51


Posts: 113/621
EXP: 973258
For next: 40680

Since: 07-27-07

From: Montreal, Canada

Since last post: 270 days
Last activity: 23 days

Posted on 10-22-07 02:13:34 AM Link | Quote
Kathulis: You need an Hex Editor to edit those commands. TT64 will not edit 0x27 commands, and won't until 2009.

For the Mac you can download HexEdit at http://hexedit.sourceforge.net/. But since you don't seem to even know what an Hex Editor his, doing this might prove to be hard for you. You should start by learning more about it, experiment by yourself, maybe ask some questions on some other forums, but the SM64 Hacking forum is not the place for such basic questions.

Royal:

I've been really busy these last few days and couldn't spend much time moderating in here.

During that time, you sure posted a lot of things here... I hate to sound mean, but the majority of what you posted are short, hard to read phrases that contribute nothing to the forum. And while I understand that English is not your first language, you really have to do something about the way you write. Please use proper capitalization and punctuation. Start phrases with capital letters, and write "that's" instead of "thats", and avoid over-using internet slang like "cuz" and "srry".

If you read/write spanish, I recommend going to http://www.emudesc.net/foros/nintendo-64/ which has a very active and vibrant TT64 users community. You'd be more happy there...

I'm sorry to see this thread derailing like that, I would've hope that smart people would come here to contribute their findings related to animation command hacking, instead of people wasting space and time saying how they don't understand that stuff.
Metal Knuckles

Level: 10


Posts: 7/17
EXP: 4391
For next: 23

Since: 08-26-07

From: Burlington, VT

Since last post: 10.0 years
Last activity: 5.0 years

Posted on 10-22-07 08:13:32 AM; last edit by Metal Knuckles on 10-22-07 11:16 AM Link | Quote
I understand your guide, I'm just a little confused as to what it does to the edited objects.

So while switching the hex values changes the behavior of objects, it doesn't actually change the object itself, right (For example, the bunny is effectively still a bunny in regards to it's properties, being a non-damaging object Mario can pick up, it simply has a different moving pattern)? If it does, and I were to change Bowser to use a Goomba's behavior, does that mean that he would meander around until spotting Mario and then simply charge him? While on that, would his properties even be the same anymore, or would he be destroyed my jumping on or punching him?

Please forgive the complete lack of any knowledge in regards to Mario 64 hacking.
VL-Tone
Member
Super Mario 64 forum moderator
Level: 51


Posts: 117/621
EXP: 973258
For next: 40680

Since: 07-27-07

From: Montreal, Canada

Since last post: 270 days
Last activity: 23 days

Posted on 10-24-07 03:14:22 AM Link | Quote
Originally posted by Metal Knuckles
I understand your guide, I'm just a little confused as to what it does to the edited objects.

So while switching the hex values changes the behavior of objects, it doesn't actually change the object itself, right (For example, the bunny is effectively still a bunny in regards to it's properties, being a non-damaging object Mario can pick up, it simply has a different moving pattern)? If it does, and I were to change Bowser to use a Goomba's behavior, does that mean that he would meander around until spotting Mario and then simply charge him? While on that, would his properties even be the same anymore, or would he be destroyed my jumping on or punching him?

Please forgive the complete lack of any knowledge in regards to Mario 64 hacking.



In TT64 you can see that each 3d object in a level have two main attributes, the Model ID, which decides which polygon model is used, and the Behavior pointer, which decides which Behavior script is used for this particular object.

Behavior scripts are pretty small by themselves, you can see the Goomba script and the Mips script in the first post of this thread, they're pretty small. That's because the magic happens somewhere else.

0x0C commands refer to ASM code that makes the model move and react in certain ways. The 0x27 command on the other hand, refers to some other data that defines animation sequences for body parts.

If you simply apply the Goomba behavior to MIPS using TT64, MIPS will behave like a Goomba (charging Mario when he sees him) but since the 0x27 command in the Goomba behavior script was meant to control a Goomba, there will be a mismatch between the model and animation sequences, resulting in a glitchy MIPS animation.

What the hack I described does, is changing the 0x27 command in the Goomba behavior script so that it uses the 0x27 command from MIPS behavior, thus keeping his body intact instead of glitchy. It's not perfect because the wrong animation sequence may be triggered by the ASM code (he leans forward instead of running), but at least the body parts are not rotating at random, instead following animation sequences that are designed for MIPS.

Keep in mind that animation sequences are purely cosmetic. This MIPS will act exactly like a Goomba, you can squash it and you can't pick it up. Think of it as a Goomba disguised as MIPS. And that's the answer to your question.

The fact that a Goomba is damaging and you can't pick it up, and its moving patterns are all part of the ASM code.

If you can pull this hack on Bowser (and it may well be working...) he will behave and react exactly like a Goomba, and you'll be able to stomp him. Again, it would be just like a Goomba had put a Bowser disguise.

How about some of you guys try it?



Metal Knuckles

Level: 10


Posts: 13/17
EXP: 4391
For next: 23

Since: 08-26-07

From: Burlington, VT

Since last post: 10.0 years
Last activity: 5.0 years

Posted on 10-25-07 05:29:11 PM Link | Quote
It works for the most part. I managed to replace King Bob-omb with a large Goomba using Wiggler's behavior while using the correct animations, as well as replacing Goomba's and Bobomb's behaviors. The only exceptions I've found off the bat are Mario, who's animation data I can't find, and Bowser, who Toad'sTool won't even let me change the behavior patterns of or have a list to edit the model ID from.

This isn't a post to request for help, by the way. I'm just doing this for the sake of seeing what happens.
Stevoisiak
Member
Level: 36


Posts: 7/283
EXP: 294912
For next: 13198

Since: 11-22-07

From: New York, Long Island

Since last post: 8.0 years
Last activity: 1.0 years

Posted on 12-17-07 03:13:11 PM Link | Quote


Load the ROM in the emulator, go to Castle Ground... Oh! That's better, MIPS is no longer a mutant, and he acts like a Goomba!








Can you post a video of it moving?
Ratchetfan19
Member
Level: 17


Posts: 10/50
EXP: 21907
For next: 2836

Since: 11-20-07


Since last post: 5.0 years
Last activity: 4.0 years

Posted on 12-17-07 05:23:18 PM (last edited by Ratchetfan19 at 12-17-07 05:24 PM) Link | Quote
All the object does is scoots along the ground with the goomba footstep sounds as MIPS scoots along. Think of a scenario where MIPS is getting pushed from behind by an invisible man and doesn't even notice.
Stevoisiak
Member
Level: 36


Posts: 9/283
EXP: 294912
For next: 13198

Since: 11-22-07

From: New York, Long Island

Since last post: 8.0 years
Last activity: 1.0 years

Posted on 12-17-07 05:45:31 PM Link | Quote
Originally posted by Ratchetfan19
All the object does is scoots along the ground with the goomba footstep sounds as MIPS scoots along. Think of a scenario where MIPS is getting pushed from behind by an invisible man and doesn't even notice.


I'd still like to see it. I'd also like to see how this is set up.
BMF54123

Rhea Snaketail
Slightly frazzled...
Level: 134


Posts: 347/5851
EXP: 28234858
For next: 352116

Since: 07-03-07

From: Neither here nor there.

Since last post: 2 days
Last activity: 1 hour

Posted on 12-18-07 12:58:24 AM Link | Quote
Originally posted by Stevoisiak
I'd still like to see it. I'd also like to see how this is set up.

Why not follow the directions in the first post, then?
Kenshi
Member
Level: 20


Posts: 4/75
EXP: 40590
For next: 1849

Since: 09-15-07

From: NY

Since last post: 2.0 years
Last activity: 2.0 years

Posted on 01-04-08 09:35:24 PM Link | Quote
you guys are right, about mario into peach. I actually tried this thing and something else. I was currently trying to edit mario's animations to match peach but it didnt work. well...sorta

mario has 2 legs!!lol well he does but peach doesn't. She has a robe but no legs. Mario has 2 halves to his torso. The first half is called torso and second called thigh. Peach has robe 1, robe 2, dress bottom 1, dress bottom 2. mario has torso, left thigh, left lower leg. so how can i match this because he not only has 2 legs (which makes it so when i put the robe on he is using it as his new foot) but that it moves smoothly.

my idea is what i used to do a while ago while i was a hacking noob. I was playing around with x y z coordinates when trying to find out how vl-tone did his mario into luigi made up hack. (not made up but you know what i mean) and i ended up moving marios arm so he would walk and the arm would be floating next to him.

i could move his body parts to make the animation of at least a still person peach would look good. but my guess is that the animations would all look screwed up because they would think he was floating and yeah its a lot. Well tell me what you guys think i should do. I think maybe changing mario into yoshi will be way easier. so im going to do that. I just need to replace something on mario like his glove or piece of his arm for his tail so it moves...
Next newer thread | Next older thread
Jul - SM64 Hacking (Archive) - Animation Commands Hacking (Geeky Stuff!) New poll - New thread - New reply




Rusted Logic

Acmlmboard - commit 5d36857 [2018-03-03]
©2000-2018 Acmlm, Xkeeper, Inuyasha, et al.

36 database queries, 5 query cache hits.
Query execution time: 0.165321 seconds
Script execution time: 0.036388 seconds
Total render time: 0.201709 seconds
Memory used: 1310720