Anda di halaman 1dari 5

Universal Concepts Guide

Tutorial by Mr.Curious 8-2018


Tools by Son of Persia

To avoid redundancy in each individual tool tutorial I will explain some of the universal concepts that apply
to each of the tool sets included in this release. Most of the tools run on the simple concept of translating
the byte arrays from the RE4 files into a .txt file for us to edit with a text editor. There is also the option of
using an .obj file to translate some of the coordinates instead of using the .txt file for this purpose.

One of the most common functions of the tools included in this release are the way that the files are
extracted. With most of these tools when we use the extract.bat file there are two files that are generated
inside a working directory which is named after the name of our RE4 file. Most tools extract the RE4 file
into 2 working files:

1 - .txt file
2 - .obj file

The reason for these two separated files was to make editing the locations of trigger zones easier by
using .obj files. While we can still use the .txt file by itself to edit RE4 files, it is often much easier to use a
3D model for some parts of the editing process. In the instructions that follow I will explain common
scenarios when working with the 2 files together.

Why use a .txt file?


Before we get into details about how this file works let us first understand the way these tools were
developed. Before there were any kind of tools for RE4UHD modders had to HEX edit the raw files to
change their functions in game. As many of us modders did this we took many notes about which bytes
changed certain functions. As our research progressed we realized that we could pass this information
onto talented developers like Son of Persia who would then be able to take the raw data and develop
tools that would essentially HEX edit the files for us while giving us a basic interface to do so with added
functionality and ease of use. The .txt file is just this; it is a HEX editing tool interface.

Understanding the extracted .txt files


If we observe the extracted .txt file from any of the files there are usually a few universal concepts that
apply to each of these, the first of which is the EntryCount. This is named different things, depending
which RE4 file type we are dealing with. Other variations of this include EffectCount, ItemDataCount,
LightCount etc. Despite the difference in name, the function of this parameter is the same; to count for
each ‘Entry’ that is in the text file. One ‘Entry’ in the .txt file essentially consists of an entire array of
bytes that is responsible for a set of values that affect one thing (an effect, an item, a light etc..)
The EntryCount offset is usually at the top of the .txt file (or very close to the top).

Special feature in the .txt files


Most tools will allow a # to be used to allow commenting. Anything that follows a # character will not be
read by the tools. This is useful for when we need to make notes about a specific entry.

Understanding the extracted OBJ files


With most of the new Son of Persia’s tools we are able to extract .obj files. These 3D model files are
usually comprised of several layers each of which contains either of 2 types of models:

1 - Eight sided polyhedrons


These .obj files are polyhedrons that act as a 'triggerzone for the event(s) we are editing. These are
usually square or rectangular shaped areas that trigger some kind of event once the player enters their
area.

Many files that are used to trigger events in the game have what we call 'TriggerZones' which basically
put are areas of space that are defined by numerous combinations of XY and Z values. These
triggerzones are almost always 4 point polyhedrons consisting of:

4 sets of XY coordinates (four corners)


2 sets of Z coordinates (upper and lower boundaries)
put together we can make a 3d shape which constitutes a 3d polyhedron.

Here is an excerpt from an AEV tool tutorial I wrote for RE4UHD which briefly describes triggerzones. The
values you see below are in DEC format which is used by the tools developed by Son of Persia for the
RE4UHD version, but is only a translation of the raw data.

In the photo above we see in r101 the tirggerzone in yellow that triggers the AEV Message event with the
burning policeman. When the player walks into this area the Message file is loaded. We can edit this area
with the .obj file that is generated with some of the tools.

2 - Single polys

In the photo above we see several polys used by an EFF .obj model to handle the placement of some
effects.

These triangle shape polys simply serve as XYZ coordinates for a particular model with the right sided
vertice acting as the functioning coordinate. We use these polys to determine the location of anything that
only requires XYZ coordinates, such as effects & lights. These type of polys are also used for setting ITA
& ETS coordinates.

How the .txt file and .obj files work together


Now that we know what the .txt file and .obj file do individually, let us take a look at how they work
together. As noted above it is possible to edit an RE4 file with an extracted .txt file alone, but not with
the .obj file alone as there is always other data that is required besides coordinates.

It is VERY IMPORTANT to know that the amount of Entries in the .txt file must match the amount of
layers in the .obj file as each layer of the .obj file corresponds to the entry in the .txt file. This is why
the .obj layer names are always numbered (take note that the entries are not numbered). Note that we
can edit the names of the .obj layers in 3dsMax at the end of their names, but must not change the
headers of the layers name which include the numbers. This keeps the tools from being confused about
which layer is assigned to which entry. Please note that if the amount of layers in the .obj file is
inconsistent with the amount of Entries in the .txt file then the tool is likely to hang or crash.

Adding & Deleting .obj Layers & .txt File Entries


If we have added or deleted any .obj layers in 3dsMax then we need to also edit the corresponding
entries in the .txt file. For example if there are 17 layers in 3dsMax this means that there should also be
17 entries in the corresponding .txt file.

Example: (for this example we are using the ETS tool)


If we delete layer # 2 in 3dsMax then we would also need to delete entry number 2 in the .txt file… Also
we would have to rename any layers in 3dsMax before exporting as there would be a error in the name
structure order.
In this example we have deleted layer #2 in 3dsMax therefore the list would be like so:

EntryCount = 4

# Entry 0

Model_ETM_Number = 0x0
Model_ETS_ID= 0x0
ModelScale_X = 1.000000
ModelScale_Y = 1.000000
ModelScale_Z = 1.000000
ModelRotation_X = 0.000000
ModelRotation_Y = -0.000000
ModelRotation_Z = 0.000000
ModelTranslation_X = 384.264008
ModelTranslation_Y = 6405.573242
ModelTranslation_Z = 4200.000000

# Entry 1

Model_ETM_Number = 0x3
Model_ETS_ID= 0x1
ModelScale_X = 1.000000
ModelScale_Y = 1.000000
ModelScale_Z = 1.000000
ModelRotation_X = 0.000000
ModelRotation_Y = -0.000000
ModelRotation_Z = 102.655107
ModelTranslation_X = -10849.040039
ModelTranslation_Y = 6771.605957
ModelTranslation_Z = 0.000000

# Entry 2 (if this object layer # 2 in 3DsMax is deleted then we should delete this entry also)

Model_ETM_Number = 0x3
Model_ETS_ID= 0x2
ModelScale_X = 1.000000
ModelScale_Y = 1.000000
ModelScale_Z = 1.000000
ModelRotation_X = 0.000000
ModelRotation_Y = -0.000000
ModelRotation_Z = 179.994691
ModelTranslation_X = 6539.638184
ModelTranslation_Y = 6422.441895
ModelTranslation_Z = 0.000000

# Entry 3 (this entry should be renamed ‘Entry 2’ although it will not matter if we do not. We
should rename this entry so that we remember that it corresponds with our new layer #2 in
3DsMax as the tool simply counts each entry in the order that it is listed in the .txt file.

Model_ETM_Number = 0x3
Model_ETS_ID= 0x3
ModelScale_X = 1.000000
ModelScale_Y = 1.000000
ModelScale_Z = 1.000000
ModelRotation_X = 0.000000
ModelRotation_Y = -0.000000
ModelRotation_Z = 6.076894
ModelTranslation_X = 4035.912109
ModelTranslation_Y = -8500.353516
ModelTranslation_Z = 902.000000

In this example we would have to rename all layers that come after the deleted layer ETS_object_2.

We must do this because the tools work in numerical order. The tool reads the front of the object layer
name and associates it with the order of entries in the txt file. This concept is universal for all of Son of
Persia's 2018 tools that use .txt and .obj files.

The same concept applies to adding new entries. It is best to simply add new entries at the end of the
.txt file and to have their corresponding .obj layer named to the last layer number in 3dsMax. This way
we do not have to rename a whole bunch of layers and entries. The best way is to simply copy the last
existing .obj layer in 3dsMax, rename it, and then move the layer model to the position we want. The
same method can be used for .txt entries. Simply copy the last existing entry in the.txt file, rename it, and
edit the parameters while remembering to always update the EntryCount to match the amount of
entries. Once this process is complete we are ready to repack.
WORKING WITH THE OBJ FILES
As explained above many of the tools from Son of Persia generate 3D models for us to use as references
for coordinates. Unless we have a frame of reference these files are useless so it is important for us to
create a frame of reference beforehand.

To do this when editing trigger zones (or placement models for lights, effects, items etc) we should always
first import the .obj file of the SAT file. This will give us the basic shape & boundaries of the room we are
dealing with and help us understand where everything is located.

In the 2 photos above we see how using the extracted SAT file (r103) can be useful for a frame of
refference when dealing with other files. In the photo on the right we have only the extracted SAT file obj
imported, while on the left we see both the SAT .obj file AND the EAR .obj file together.

In my experience it is best to import the SAT obj to its own layer in 3dsMax and then freeze it so that it is
not moved around by mistake. Also, we should set the layers to be seen in the viewport as 'wireframe' to
make it easier to see & manipulate overlaying shapes.

Problematic Polyhedrons
For whatever reason when dealing with triggerzone models there are situations where some polyhedrons
will not work effectively in game to trigger our desired event. If this happens the best method to remedy
this is to simply delete the polyhedron and copy one from a functioning layer and paste it into a new layer.

Problematic Polygons
If for whatever reason the coordinates generated by a polygon model do not match the desired area it is
possible the wrong vertice was chosen as the active node. To avoid this try to keep all three vertices of
the polygon relatively close to each other and always keep them at the same height (z coordinate).

The reason for this possible issue is that while moving the polygon from its original location we can often
lose sight of which vertice is the right angled vertice which is the default vertice used by the tools for the
coordinates.

Tips and Tricks


If we are dealing with recreating multiple polygons that are to be used for similar things (such as recurring
lights or effects) the easiest way to add new polygons is to copy/paste existing polygons and simply
rename them. This is also effective is maintaining the z position if we have multiple models at the same
height.

Another helpful trick is to use the RE4UHD-Default_Stage-Project_001 (if you are using 3ds Max). This
file was prepared for you to include the basic needed layers when stage modding, as well as a DMY
texture model that can be used to avoid problems with the stage TPL file. See the SMD tutorial for more
information on this.

EXPORTING & REPACKING


Once we have edited the parameters of the entries in the .txt file and placed the models of their
corresponding .obj layers into the positions we want, the next step is to export all the layers to the .obj file.
Simply select all layers in 3dsMax and export to obj file , overwriting the originally created .obj file in our
working directory. Once this is done and we have saved all the data in our .txt file, simply use the
repack.bat file of the tool to create a new RE4 file. After this the process is as simple as copying the
newly created RE4 file into our working UDAS/DAT folder and repacking.

This concludes the Universal Concepts Tutorial. Hopefully by now we have a general idea of how the tool
sets operate. Please refer to the individual tutorials that were written for each tool for more detailed
information about the specific parameters for each tool.

Happy Modding!

Mr.Curious
12 - 2018
https://www.youtube.com/user/kalamalkakid/
http://residentevilmodding.boards.net/user/5592