How to make a dog breed for P4 from scratch

A quick intro

All Petz content can contain code (behaviour) as well as resources (images, text, lnz etc). Basically they're all DLLs.

To make content like breeds and toys, the Petz devs would have been working with header files and a lib file. These would contain info about the classes and functions of the main executable. My PetzHeaders project is a reconstruction of these files. You can use PetzHeaders to create new content for the game in the same way that the original devs would. (Though PetzHeaders currently only contains a small subset of the Petz classes.)

In order for the main Petz executable to be able to understand content files, any content including code must export the following functions which the main executable looks for:

As long as we export these functions, we can make new custom DLLs that interact with the main executable.

Get PetzHeaders

Download all the files in my PetzHeaders repo. If you're not used to GitHub, you can do this by clicking the green Code button near the top of the screen and clicking Download ZIP.

Make sure the files are unzipped and somewhere accessible on your computer.

Get Visual Studio Community

You can get Visual Studio here. I'm using the 2019 version but settings should be roughly the same in newer versions.

You'll probably have to sign up for a Microsoft account or some gubbins. Make sure you get the free Community version.

Start a DLL project

You need to create a new DLL project in Visual Studio.

Visual Studio should come with templates to set this up for you. Look for one called "Dynamic-Link Library (DLL)" or similar. Make sure you're creating a Windows C++ DLL project.

Name your project whatever you want your breed to be called (e.g. if you want to create, name your project MyCoolDog). This saves a bit of config later.

Set up your project config

Once your project is created, go to Project > Properties (or right-click your project, NOT your solution, in the Solution Explorer in VS and select Properties).

If the config window that pops up says Solution anywhere in the heading/title, this is the WRONG config.

Set the Configuration dropdown to All Configurations. Set the Platform dropdown to All Platforms.

Set the following:

Advanced > Target File Extension: .dog

C/C++ > General > Additional Include Directories: the full path to your PetzHeaders folder (e.g. C:\My Documents\PetzHeaders)

Linker > Input > Additional Dependencies: the full path to the PetzHeaders Petz 4 lib (e.g. C:\My Documents\PetzHeaders\Petz 4.lib)

Linker > Input > Module Definition File: Source.def

Add your breed code

The easiest way to do this is to copy the files from my example.

Dog breed example

Take the .def, .cpp and .h files from this example and put them into the source folder for your project. You DON'T need to copy the PetzHeaders files into your project.

Attempt to build the project now, without any changes (see the Build and Pray section). If you see errors at this point, you've done something wrong in the previous steps.

Rename the .cpp and .h files to your breed name.

Your new source files won't immediately appear. You must right-click Source Files in the VS Solution Explorer and Add Existing Items.

Note that the .h file should appear under Header Files rather than Source Files. This is fine!

Go into the .h and .cpp files in VS and rename SighthoundSprite to whatever you want (e.g. LabradoodleSprite).

You probably won't have to touch the .h file from this point on.

Go to YourBreedSprite.cpp. The bit you're probably interested in is ConstructGenome. Fiddle with the values and traits here as much as you like. Note that you can access the complete raw genome here. Try using Reflet's Pet File Breakdown to understand what chromosome/allele does what!

Set up lnz, scp etc

The easiest way to do this is:

Note that you still need to have a unique breed ID.

Now when you build your breed, it will automatically have everything from the .res file included in it.

You need to go through your cpp file and make sure all the lnz and scp paths are updated. In my example file the paths are like "\ptzfiles\dh\dh.lnz". You need to update these to use the two-letter acronym of your res file, e.g. Alley Cats are ac, dachshunds are dh, sheepdogs are sd...

Build and pray

At the top of VS, next to the green play button, are two dropdowns which probably say Debug and x64 right now. Switch these to Release and x86/win32.

Go to Build > Build Solution in VS or hit F6.

If all goes well, you will get a .dog file in the Release folder of your project. (Note that there are two Release folders - you want the outer one.) You'll also get some other files but you can ignore these.

Copy the .dog file to your Dogz folder. (If you build a lot you might want to write a script to copy this file and run it as a Post-Build Event; I leave this as an exercise for the reader...)

Run the game. If everything worked you will have a new dog breed in the Adoption Center. If something didn't work, the game will blow up or you won't see your new breed.

Good luck!