SimPE Resource Editing
Contents |
Introduction
If you want to understand more about how the Sims 2 works behind the scenes, then understanding the file formats used internally as well as how they link together is important. While the Sims 2 visibly only has very few formats (Sims2Pack, .package etc), internally it uses very many. Each of these internal formats has a different meaning, and way of using it and is linked differently. When you start modding the Sims 2 you will use a tool called SimPE to view and edit the packages you create. There are lots of these Internal Formats - SimPE calls them resources. Getting started with modding for the Sims 2 does not (these days) require you to understand these raw formats as SimPE provides a more friendly view of these formats/resources.You will see the various types of resources in your package shown in the left hand pane of SimPE - the Resource Tree. Each type has a number beside it showing how many resources of that type are in the package you are looking at, and if you select one of the types, the Resource List pane will display a list of those resources. Depending on the type of resource the Plugin View tab that will be populated with the contents of the resource you next select from the Resource List, will provide a different editor suitable for looking at and editing the resource in question.
You will no doubt get to know the resources by their four character names, BCON, BHAV, GMND etc. and the longer more descriptive name also shown by SimPE for each resource type, but it worth knowing that each resource also has a hexadecimal number as its type - you will see if it you switch to the Resource tab (see picture below) when you have a resource selected. This may be the only time as a new modder you may ever come across the hexadecimal number which is the type of the resource - SimPE shows you these resources by name which is far more friendly.
Resources
There are a few common things to say about resources regardless of their type.
Type
We have mentioned the Type already which is represented by a hexadecimal number, and a friendly name.
Group
Each resource has a value for Group. If you are making a stand-alone package, for example a new object cloned from an existing one, your Group value will be 0xFFFFFFFF. This indicates that the group is contained within this package. If you browse through the objects.package file you will see many different values for resources in there, with items that are part of the same object sharing a group value, or items in a specific semi-globals section sharing a group value. If you have a package that updates one of these resources and keeps its original group value (instead of changing it to 0xFFFFFFFF) you have made a package that will be considered global mod. You will also see resources with a group value of 0x1C050000 - these are also resources in your package and are the scenegraph resources.
Instance
Each resource has a unique value to identify it - this is the instance. Scenegraph resources have an instance value that uses both the Instance (High) and Instance values, but other resource types have a zero Instance (High) value. Is this accurate?
Some instance values have special purpose - for example the STR# resource, others you assign yourself as you create new resources and refer to them in other places.
The non-scenegraph resources follow a specific scheme for the numbering.
Resource classification | Numbering |
---|---|
Primitives | 0x00xx |
Globals | 0x0nxx |
SemiGlobal | 0x20xx |
Package | 0x10xx |
Compressed
The Compressed field indicates whether the resource being examined has been processed with a compression algorithm. If you select "yes" and then save the file, that particular resource will usually be compressed. It is not necessary to "commit" for the compression to take effect.
Note that compression will only occur if SimPE computes that compression will result in a saving in filesize. It is not advisable to select several resources at once and then select "yes" on one of them - this will generally result in file corruption. Each resource must be compressed individually, although the file does not need to be saved until you are done.
SimPe will automatically create a "directory of compressed files" if the package contains any compressed resources.
SceneGraph
Spread among the game files are groupings of related data about some game object that are organized into collections called the SceneGraph. These tell the game, for example, how to link a texture to a mesh, or object data to the materials, etc.
You can track through the different parts for a SceneGraph by following the File Links.
There is more information about the scenegraph located in the Modding Infocenter
Manipulating Resources
A right mouse button context menu exists on the Resource List pane allowing you to manipulate the resources found there. If you want to grab a particular resource from another object (or directly from one of the main game packages) you can use "Extract..." from the context menu. This will save the resource as a file wherever you choose to save it. You can then use "Add..." to bring it into a different package, or drag the previously saved file and drop it onto the Resource List. If you extract a number of resources at once, SimPE will create an XML file represented all of them and you can drag that to the Resource List to add them all into your package at once. You can also clone resources that are already in your package.
Object Errors
An object error, more commonly known as the "jump bug"(when not in debug mode, a sim resets when encountering an error, thus "jumping"), occurs usually when there are problems with a behaviour. Some object errors however, are harmless and would go un-noticed if you weren't in debug mode. Debug mode will inform the user that an error has occurred and log a stack trace. These logs are vital to solving bugs in both behaviour mods, and problems with the original game.
List of object errors: Sims_2:Object_Errors
Making global mods for the Sims 2
When you make a package that edits part of the game (rather than a new stand-alone package) you override the Maxis resources creating a global mod. When two packages try to update the same Maxis resource, they will clash. Load Order comes into play in resolving such clashes.
This section of the Wiki was originally produced when the various file formats were being decoded and there is a lot of information about the actual bits and bytes of these formats that have ultimately formed the basis for tools such as SimPE to hide them from the average modder editing these resources.
This section of the Wiki is currently undergoing some updates with the plan being that the original decoded information about the file formats are retained under the hexadecimal number topic and the four character name topic which currently redirects you to the same is used to describe the resource type in terms of how you would use it, understand it and edit it from SimPE - with a link to the decoded information too, to tie them together.