|
Post by Reflet on May 19, 2022 13:54:30 GMT -5
Greetings! I figured I would post this in more places as I'm sure many people who aren't in the Petz Hacking & Modding discord would find it interesting. This is the product of many, many, many hours of work and reverse engineering so I really hope you all enjoy <3 Anyone is free to use this information as they see fit, all I ask is that you credit me and/or link to the document! [Google Docs]
|
|
|
Post by lobb on May 25, 2022 4:57:29 GMT -5
This is seriously awesome, thank you for sharing!
Does this mean we could make our own custom icons for breeds?
|
|
|
Post by Reflet on May 26, 2022 18:26:50 GMT -5
This is seriously awesome, thank you for sharing! Does this mean we could make our own custom icons for breeds? That's what the game code appears to do. The value is checked in the function PetzIcons::GetIcon. All regular dog and cat breeds appear to have 1 (binary 00000001), and all pigs and bunnies appear to have 25 (binary 00011001). No idea why the logic is coded to work this way lol For the record, pigs and bunnies have a special section in their breedfile titled "Bitmaps" that contains the star icon. Edit for tech details: it's a 19 x 18 bitmap @ 8 bits per pixel. Background is white and star is black.
|
|
|
Post by stancymckatt on May 29, 2022 13:19:28 GMT -5
Ooohhh... Thanks for this! I'll have to stick it on my tablet to read ASAP! :-)
|
|
|
Post by Kalium on Jun 4, 2022 12:38:38 GMT -5
Amazing stuff, this is really exciting. I've been nosing through some of my petfiles to follow along, though I think I may be counting wrong in some areas. Probably my rusty misunderstanding of hex and endianess. But I think I'm getting there. Maybe I'll write another parser... though I gotta fix the issues with the existing one I did for SCPs...
Anyway I got counting on a Dane with a particular oddity. I adopted him in P3 and transferred him to P4 after he'd learnt some tricks in P3. In P4 he seemed to lose them all and the ability to learn tricks - he just stares at the treat and does random actions now. I wonder if I could work out what's going on with this. His treat training modifier is 0, so he should attempt tricks... maybe it's something else hidden in the file.
|
|
|
Post by Thor on Jun 4, 2022 23:11:42 GMT -5
Anyway I got counting on a Dane with a particular oddity. I adopted him in P3 and transferred him to P4 after he'd learnt some tricks in P3. In P4 he seemed to lose them all and the ability to learn tricks - he just stares at the treat and does random actions now. I wonder if I could work out what's going on with this. His treat training modifier is 0, so he should attempt tricks... maybe it's something else hidden in the file.
I can answer this question since I've been working on trying to fix this. When you import petz from a different version, the game does not automatically update this section to the newer version 😅 You can fix it by hand-- just copy the entire trick section of a pet from the version you are importing to and paste the entire thing over the old pet's section. If you want to actually translate each trick, you'd have to use this chart: docs.google.com/spreadsheets/d/1XQGlaAgr6Z7N4bdN7MAnxRqSkje1g4GHKf5SmW5gMAs/edit#gid=1429459875 I was trying to write a program to fix this stuff but I'm distracted by irl stuff so I keep pausing haha.
|
|
|
Post by Kalium on Jun 5, 2022 9:38:04 GMT -5
Oh neat! I'm a bit apprehensive of editing .pet files, comes from being old enough to remember when touching them in a hex editor was a Big No, but I'll await your utility. I didn't know it was a known issue.
All it does so far is extract a bunch of numbers and strings (and so far only for P3/4 1st gen pets without unborn children/dependants) but I thought a high level human readable version of all this stuff would come in handy. Or at least be fun to code up. Though in fairness this is just building on everyone else's work, it's the people who dig up this info in the first place and build things that aren't just file readers who are the real heros here.
Some things I noticed: - I guess the ball limit is hardcoded here, anyone know where this 512 max number is set? I guess some function adds it in when creating a pet. I'd love to see some breedfiles break past this number. - I found 17 slots total when parsing out the clothing, at least 17 was the number I had to put in to make it move smoothly onto the next section. I guess some are going unused here? Do P5 petz have a smaller number of slots overall or just a smaller number in use? - The notes for the affinity descriptors state that the unknown values are all 32 bit integers, but that made the parser overflow to the next section. It did work when I converted the last one to an 8 bit integer but of course I don't know if that was the right call to make. - come to think of it I'm not sure if I made a big assumption putting them all down as unsigned?
Anyway feel free everyone to play about with this and break stuff.
|
|
|
Post by Reflet on Jun 5, 2022 16:11:22 GMT -5
I guess the ball limit is hardcoded here, anyone know where this 512 max number is set? I guess some function adds it in when creating a pet. I'd love to see some breedfiles break past this number. Probably will be very difficult to change. I'm researching the graphics rendering right now and 512 is hardcoded all over the place. I found 17 slots total when parsing out the clothing, at least 17 was the number I had to put in to make it move smoothly onto the next section. I guess some are going unused here? Do P5 petz have a smaller number of slots overall or just a smaller number in use? It's possible I made a mistake, but it's been awhile since I last looked at that section... I remember when I wrote PetFlux I had to add a sizeable number of bytes to the section for P3/4 format. I will double check. The notes for the affinity descriptors state that the unknown values are all 32 bit integers, but that made the parser overflow to the next section. It did work when I converted the last one to an 8 bit integer but of course I don't know if that was the right call to make. - come to think of it I'm not sure if I made a big assumption putting them all down as unsigned? You are right, I made an error in the documentation. My own AssociationMatrix parser lists it as a byte lol Signed/Unsigned would not make a difference in the width of the value. Thank you for the feedback :3 if you could please credit me/link to my document in your parser's readme, I would really appreciate it ^_^ nice work so far!
|
|
|
Post by Penny @ Just Dandy on Jun 5, 2022 20:22:07 GMT -5
Oh my goodness, this is amazing!!! How did you even figure this out? My favorite parts:
- treat training modifier... lol I love how there's something that determines how quickly they grasp the concept of tricks. Do you know if this varies by breed? Is it linked to personality values at all (Intelligence, Independence, etc.)?
- very interesting that some of the unborn child info is stored in the mother, but not everything! Does that mean everything else gets added when the pet is born? And would you be able to add in the unborn child info to a non-pregnant pet and trick the game into giving a non-pregnant pet a baby?
- the knowledge that petz keep a record of individuals they've encountered has been out for a while (I think from you lol), but it's so interesting to see how it's all laid out!! Do the Affinity Descriptors keep track of a pet's opinion of the petz they've met? Is this why my two boys refuse to stop hating each other? XD
|
|
|
Post by Kalium on Jun 12, 2022 7:49:43 GMT -5
Thank you for the feedback :3 if you could please credit me/link to my document in your parser's readme, I would really appreciate it ^_^ nice work so far!
no problem, all done!
I've done some more updates to the parser since, it now maps out most of the important data for 1st gen pets without children (getting those to work is going to be a lot more work, I'm sticking to the basics for now). I'm trying to improve the trick knowledge section and could use some clarity about how tricks/flavours are listed. I'm getting that first all the chicken tricks are listed, then beef, and so on, and inside those individual flavours they're listed by gesture - three toy tricks, three up tricks, and so on, except for the catnip which has one of each. My question is how does that work with the sweet flavour? This is my current output for sweets:
Are the extras just space fillers or, judging by counting the amount of unknown slots, can you have two more trick slots per gesture for sweets?
Another one: in the sprite chromosomes and descriptors, it looks like there's an extra allele right at the end, just after the four unknown alleles. Any idea what it's for or just a fifth unknown? It's in use, here's the value from my test dog's sprite descriptor:
Thanks again for everything. My goal is to map the whole thing out and hopefully have an easy to read web based parser (the textfile output is starting to get unwieldy) so I will probably be back with a billion more questions, these are just the ones puzzling me for now.
|
|
|
Post by Thor on Jun 12, 2022 12:05:33 GMT -5
I did a lot of research lately into the trick data in a .pet file so I'll see if I can answer your questions on the trick data. Just to confirm, when you say flavor "Sweet" you mean flavor 5 (flavors start at 0, so 0 is chicken, 1 is beef, etc). So this is the 6th flavor in the trick section of that .pet file? I've never observed extra data after flavor 5 in my exploration of the trick section. And I wrote a program that heavily modified the trick section to replace tricks with data I wanted.... my program would have done weird stuff if there was extra data there that I didn't account for. Kalium , in your program, do you see the data for the next trick flavor (flavor 6 is catnip)? I'm wondering if the data got mixed in from the previous section?
|
|
|
Post by Kalium on Jun 12, 2022 13:12:44 GMT -5
As far as I can tell it's the correct data, if it wasn't parsing them correctly then everything after the trick data would come out garbled. I'm going by Reflet's observations that trick slots 76-100 are for the sweet flavour, which would give 25 slots, more than the 15 for most flavours or the 5 for catnip. But it's hard to be sure because the data isn't labelled with the gesture or flavour, that has to be inferred by the position it's in.
I've just pushed the current version of the parser to the remote repo if you want to take a look.
|
|
|
Post by Thor on Jun 12, 2022 13:36:55 GMT -5
Interesting and weird! Edit: Oh I see according to Reflet's document, Flavor 6 (Catnip) has 101 to 105. Huh. I'll do more testing to see if this is true but I didn't notice that Catnip had less trick slots. I'd love to see the output of the integers to your program just to see if the data read is correct? KaliumYou can use the integers found here to figure out the plan id and action id: docs.google.com/spreadsheets/d/1XQGlaAgr6Z7N4bdN7MAnxRqSkje1g4GHKf5SmW5gMAs/edit#gid=1429459875My way of parsing did not account for Flavor 5 being a larger section.... I just literally read 5 integers, assigned the 1st to be plan, second integers is action, 3rd is direction, 4th is angle and last integer is association. Then repeat that in a loop. Here's the output of me parsing the Trick section of my dog Leo (from Petz 4): Flavor 0: 106 562 563 -1 40 106 562 563 -1 10 100 560 -1 -1 10 103 545 -1 -1 10 103 545 -1 -1 10 103 535 -1 -1 100 103 548 -1 -1 10 103 570 -1 -1 10 103 546 -1 -1 100 102 555 -1 0 100 102 558 -1 64 10 102 574 -1 64 10 102 554 -1 0 100 105 4 -1 -1 10 105 4 -1 -1 10
Flavor 1: 101 -1 -1 -1 10 100 560 -1 -1 100 101 -1 -1 -1 10 103 531 -1 -1 70 103 536 -1 -1 10 103 531 -1 -1 100 103 548 -1 -1 10 103 547 -1 -1 100 103 551 -1 -1 10 102 574 -1 64 10 102 572 -1 64 10 102 574 -1 64 10 102 571 -1 -64 10 102 574 -1 -64 10 102 571 -1 -64 10
Flavor 2: 106 562 563 -1 10 100 560 -1 -1 40 101 -1 -1 -1 10 103 567 -1 -1 10 103 540 -1 -1 10 103 543 544 -1 100 103 547 -1 -1 10 103 550 -1 -1 100 103 549 -1 -1 10 102 555 -1 0 10 102 558 -1 64 10 102 572 -1 64 10 102 554 -1 0 40 102 571 -1 -64 10 102 571 -1 -64 10
Flavor 3: 101 -1 -1 -1 10 101 -1 -1 -1 10 101 -1 -1 -1 10 103 564 -1 -1 10 103 569 -1 -1 10 103 569 -1 -1 10 103 570 -1 -1 10 103 570 -1 -1 10 103 570 -1 -1 10 102 571 -1 64 10 102 572 -1 64 10 102 574 -1 64 10 102 571 -1 -64 10 102 572 -1 -64 10 102 572 -1 -64 10
Flavor 4: 101 -1 -1 -1 10 101 -1 -1 -1 10 101 -1 -1 -1 10 103 569 -1 -1 10 103 565 -1 -1 10 103 565 -1 -1 10 103 566 -1 -1 10 103 570 -1 -1 10 103 570 -1 -1 10 102 571 -1 64 10 102 571 -1 64 10 102 571 -1 64 10 102 571 -1 -64 10 102 574 -1 -64 10 102 572 -1 -64 10
Flavor 5: 101 -1 -1 -1 10 106 562 563 -1 70 101 -1 -1 -1 10 103 540 -1 -1 70 103 533 -1 -1 10 103 533 -1 -1 10 103 570 -1 -1 10 103 570 -1 -1 10 103 566 -1 -1 10 102 559 -1 64 100 105 3 -1 -1 10 102 574 -1 64 10 102 571 -1 -64 10 102 552 -1 0 100 105 4 -1 -1 10
Flavor 6: 101 -1 -1 -1 10 101 -1 -1 -1 10 101 -1 -1 -1 10 103 565 -1 -1 10 103 565 -1 -1 10 103 565 -1 -1 10 103 570 -1 -1 10 103 570 -1 -1 10 103 573 -1 -1 10 102 571 -1 64 10 102 574 -1 64 10 102 571 -1 64 10 102 571 -1 -64 10 102 574 -1 -64 10 102 574 -1 -64 10
Flavor 7: 101 -1 -1 -1 10 101 -1 -1 -1 10 101 -1 -1 -1 10 103 569 -1 -1 10 103 565 -1 -1 10 103 568 -1 -1 10 103 570 -1 -1 10 103 570 -1 -1 10 103 573 -1 -1 10 102 574 -1 64 10 102 571 -1 64 10 102 574 -1 64 10 102 574 -1 -64 10 102 572 -1 -64 10 102 572 -1 -64 10 If what you say is true, then I'd see Flavor 6 and 7 would be offset by 10. But they are not? The trick sections there are very normal. Plan id 101 is always Fetch toy. I even wrote a program that changed the tricks in the Up slot to be tricks I wanted to see what the tricks were and that worked perfectly. Nothing was offset by 10..... For fun, I decided to read the next "10" 5 integer sections assuming they were trick data and got the following: 99 49 52 0 0 0 3 0 100 -202289436 6881281 33554432 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Which is not trick data. I'd love to see the data you output with your program (I just don't have time to look at your program right now but I could check it out later)
|
|
|
Post by Kalium on Jun 12, 2022 13:58:58 GMT -5
Interesting, yours does look more like legit data than mine.
My own parser is similar. Once it reaches the start of the trick data, it grabs 5 32-bit integers and assigns them as yours does, ID, associated action, direction, angle, and association. It does this a total of 120 times as per Reflet's notes that there's 120 slots, then moves on to the biorhythm data, and so on for everything else in the file.
So at this point I have an array of 120 trick slots. I then slice up that array into smaller arrays, again using Reflet's notes for the position. So the first fifteen are the slots for the chicken treats, then we have the beef treats, then fish, and so on. From then on I look through each flavour array, assuming the first three slots are toy tricks, the next three are up tricks, and so on, apart from the catnip which just has one of each.
Mine seems to look a lot like yours, only difference is I parsed them all as unsigned ints so you get a lot of 4294967295, which I assume corresponds to your -1 values. I apologise for the length, my output is very verbose:
|
|
|
Post by Thor on Jun 12, 2022 14:09:33 GMT -5
So using a catnip flavor treat I downloaded from gyiyg 's website, I trained Leo to do Nose Balance (toy), Cartwheel (up), and Wave (down). Here's the relevant trick section that changed: Flavor 6: 106 562 563 -1 40 101 -1 -1 -1 10 106 562 563 -1 10 103 545 -1 -1 100 103 534 -1 -1 10 103 565 -1 -1 10 103 550 -1 -1 70 103 547 -1 -1 10 103 548 -1 -1 10 102 571 -1 64 10 102 574 -1 64 10 102 571 -1 64 10 102 571 -1 -64 10 102 574 -1 -64 10 102 574 -1 -64 10 As you can see, action ID 562 is Nose Balance. Action ID 545 is Cartwheel. And Action ID 550 is Wave. I think that each flavor is always made up of 15 tricks. I don't think there's any gesture that has more or less than 15. Unless someone has contrary evidence? Edit: You're doing Petz 3 right? I was confused why your numbers were off haha. Using Petz 3 section here: docs.google.com/spreadsheets/d/1XQGlaAgr6Z7N4bdN7MAnxRqSkje1g4GHKf5SmW5gMAs/edit#gid=0Anyway if you can see, Petz 3, 99 Play ID is Fetch. I'm not sure why your Action ID isn't set in your data??? Edit Edit: Oh its -1 😅 I didn't realize wahahaha sorry! Gesture: Unknown Plan ID: 99 Associated action: Not set Direction: 4294967295 Angle: 4294967295 Association: 4294967295
Gesture: Unknown Plan ID: 99 Associated action: Not set Direction: 4294967295 Angle: 4294967295 Association: 4294967295
Gesture: Unknown Plan ID: 99 Associated action: Not set Direction: 4294967295 Angle: 4294967295 Association: 4294967295
Gesture: Unknown Plan ID: 101 Associated action: 520 (breed SCP action ID) Direction: 4294967295 Angle: 4294967295 Association: 4294967295
Gesture: Unknown Plan ID: 101 Associated action: 520 (breed SCP action ID) Direction: 4294967295 Angle: 4294967295 Association: 4294967295
Gesture: Unknown Plan ID: 101 Associated action: 521 (breed SCP action ID) Direction: 4294967295 Angle: 4294967295 Association: 4294967295
Gesture: Unknown Plan ID: 101 Associated action: 534 (breed SCP action ID) Direction: 4294967295 Angle: 4294967295 Association: 4294967295
Gesture: Unknown Plan ID: 101 Associated action: 533 (breed SCP action ID) Direction: 4294967295 Angle: 4294967295 Association: 4294967295
Gesture: Unknown Plan ID: 101 Associated action: 533 (breed SCP action ID) Direction: 4294967295 Angle: 4294967295 Association: 4294967295
Gesture: Unknown Plan ID: 100 Associated action: 542 (breed SCP action ID) Direction: 4294967295 Angle: 0 Association: 0
Flavor: Catnip
Gesture: Toy Plan ID: 100 Associated action: 540 (breed SCP action ID) Direction: 4294967295 Angle: 0 Association: 0
Gesture: Up Plan ID: 100 Associated action: 540 (breed SCP action ID) Direction: 4294967295 Angle: 0 Association: 0
Gesture: Down Plan ID: 100 Associated action: 539 (breed SCP action ID) Direction: 4294967295 Angle: 0 Association: 0
Gesture: Left Plan ID: 100 Associated action: 539 (breed SCP action ID) Direction: 4294967295 Angle: 0 Association: 0
Gesture: Right Plan ID: 100 Associated action: 543 (breed SCP action ID) Direction: 4294967295 Angle: 0 Association: 0 And if you see all of the Catnip tricks are Plan ID 100 which is to perform a left or right trick.
|
|