TOY ADJECTIVES

In Petz, a pet is able to discern certain characteristics about any toy it encounters. Is it round? Fuzzy? Soft? What color is it? Things like that. But how does this happen? Let's take a look.

What's a Toy File, Really?

This may seem like a strange question at first, but it's critical to know before we start peeling back the layers. All resources -- toys, breeds, playscenes, etc -- are actually portable executables. In simpler terms, they contain executable code, just like the game does. They're DLL files in disguise that the game can talk to and call functions from.

When you pull a toy out of the toy closet, the game has to create a new instance of that toy. To do this, the game calls various functions in the DLL (toy file) so the toy can be properly initialized with all of its unique properties.

This brings us to the topic of a toy's "adjectives".

The Actual Adjectives

Essentially, adjectives are a data structure in memory consisting of 37 values, one after the other. How do we know which one is which? Well, the values are in a specific order. They are as follows:

Type, Chrz, Toyz, Prop, Part, 3D,

Color, Flavor, Size, Mass, Friction,

Tasty, Edible, Fatty, Liquid, Drug,

Medicine, Aphrodisiac, Discipline, Chew,

Tug, Density, Thickness, Soft, Fuzzy, Round,

Bounce, Swatty, Pretty, Vain, Paint, Groom,

BadNoisy, NiceNoisy, Flies, Mouselike, Rideable

Note that Type, Density, and Thickness ALWAYS have a value of 6, 50, and 0 respectively. It's part of the data structure. All other values start at -1, which means it's "turned off".

The only cases in which this does not apply are the Beach Ball and Balloon toys changing the Density, as well as the Stick and Driftwood toys changing the Thickness.

Color is a value between 0 - 11, which correspond to:


White, Black, Red, Green, Yellow, Blue,

Purple, Pink, Orange, Brown, Gray, and No Color.

Friction and Density seem to be the most prominent in actually affecting a toy's physics. Low density toys will float to the ground, high friction toys will basically teleport to their new location if they are bumped by a pet.

A toy can choose to assign values to as many or as little adjectives as it wants. If the toy does not assign a value to a specific adjective, the value remains -1. So for example, the Duo Ball does not need to assign a value to the "Aphrodisiac" trait because it doesn't apply.

Finally, there's two types of adjective assignments a toy will do. The first type I call "hardcoded", where the game just pushes a value for a given adjective and that's what gets written every single time. The second type, however, is a bit more involved. To make a long story short, the game is generating a random number within a specific range for an individual instance of the toy. So, a bouncy ball may generate a random number between 90 - 100 for its "Bounce" adjective. This makes each individual instance of a toy slightly different!

Can We Hex These?

If you're proficient enough with a hex editor, disassembler, and x86 assembly... Yes.

Basically, these values aren't stored in a neat little table inside the file. They're part of the code. The values for these adjectives are operands used in tandem with machine instructions.

reflet can have little a opcode.PNG

That's right, I'm talking about good ol' machine code.

The code on the left is the Blue Dog Food Bowl's adjective initialization function.

Now, when trying to make sense of compiled code, you'd either have to be mad or masochistic to solely look at machine code. Thankfully, a disassembler can interpret that code and show us a more human-friendly version. However, actually hexing these adjectives requires you to manually alter the opcodes in a hex editor. And there's limits to how much code you can change! You can "take away" instructions (via replacing them with nop instructions), but you can't add extra bytes in there because that will break literally everything else. The only way around this would be to do some pretty intense hacking work on the file... A process me and the lovely Soliloquy are trying to perfect, so we can write a tool to do it!