1. If you are going to register on XLNation, please make sure you do not use a proxy server.
    If you use a proxy server your registration will most likely get blocked due to spammers and hackers using proxy servers to hide their real IP address.

    If your using your home or work IP address and have not received your registration email, check your spam folder.
    PLEASE DO NOT ASK TO HAVE YOUR ACCOUNT DELETED IF YOU HAVE POSTED IN THE FORUM! If so we do not delete accounts due to the mess it can make on the forum.
    Dismiss Notice
  2. Please see the following thread for more information
    XLN's future is looking bad

Tutorial Modder's Lesson One

Some basic step to produce your first mod.

  1. XL Nation Staff
    There are a lot of people who want to learn modding, but don't know where to start.
    Here is some basic steps to build your first mod.
    In this first tutorial, we will removing trees around the highway interchange.

    Tools

    So, let's start with the tools. Basically, there are two popular tools available for modding:
    1) PakUnPak from generation city http://www.generation-city.com/citiesxl/pakunpak/Download.php
    2) Okeanos's Packer and Unpacker
    Both tools have their advantages and disadvantages.


    For the purpose of this tutorial, we will use the first tool, PakUnPak.
    Please download the tool and install it.
    The tool has the following interface:
    [​IMG]

    Intro

    Before we start modding, let me explain how the mod work.
    A mod will have an file extension of .patch
    It is placed in the following folder:
    C:\Program Files\Focus Home Interactive\Cities XL 2011\Paks\
    [​IMG]
    If you look at the content of the pak folder (as in the picture above), you will see there is a lot of file in there already.
    These file with the file extension .pak is the original data for the game.
    To make a mod, we need to extract those data and make some changes to it.
    After that, we need to repack the data into a .patch file.

    Extracting the game data

    Now, our file job to getting those data from the .pak files.
    We can do this by using the PakUnPak tool.
    But before we do this, we need to move out all the .patch file from the pak folder.
    This is because we need to get the original data, not the modified data that stored in .patch files.
    The PakUnPak tool will unpack everything in the folder, including the .patch files.


    After you have move out the .patch files, we can start unpacking the files.
    In PakUnPak tool, select Tools > Uncompress all Cities XL
    [​IMG]

    [​IMG]

    As you can see in the picture above, we are asked for the location of the pak folder. It should be
    C:\Program Files\Focus Home Interactive\Cities XL 2011\Paks\
    The Destination is the folder that the data will be unpacked to. You can select any folder you like.
    Then, hit the "Uncompress" button. This program will run for some times.

    File system of data

    [​IMG]
    After you unpack all the game data, you will see the "data" folder. That is the root folder of the data.
    If you have time, you can explore the content of each sub-folder.
    I will probably post another tutorial on the content of each folder.
    In fact, there is so many thing there and I only know some of the basic.

    Making first mod

    Now we have everything we need, let's start making our first mod!
    As you can see in the picture below, there are some trees besides the highway interchange.
    We will remove those trees. For simplicity, we will make this change for the default road pack only.
    [​IMG]
    The file that manage the layout of this interchange is located in
    data\design\layout\road\echangeur\
    Where is a file called "b_echangeur03_t4_base.layout".


    As a start, we need to make a bunch of folders in another place. These folders should have the same structure as the folders in data folder.
    So, inside our mod folder, we have the following folder structure:
    data\design\layout\road\echangeur\
    Then we will need to copy the "b_echangeur03_t4_base.layout" file from the original folder to this newly created folder.
    So now the file is located at the following place:
    Your_new_mod\data\design\layout\road\echangeur\b_echangeur03_t4_base.layout

    Now, let's open the .layout file using notepad. You can see a lot of data inside there. The file is actually written in XML language.
    Let's scroll down the file until we see the tree entries (as shown in the picture below).
    To delete the tree, we just need to delete all this tree entries.
    [​IMG]
    [​IMG]
    We will save the file after we delete those tree entries.
    Now, we are ready to create the mod. Excited?
    We will return to PakUnPak tool to do this.


    The modding tool is on the top section of the PakUnPak tool.
    The source folder is the "data" folder that containing your new mod (the .layout file that you have edited should be inside this folder)
    The output file is the location of the pak folder together with the name of your name.
    For example: C:\Program Files\Focus Home Interactive\Cities XL 2011\Paks\first_mod.patch
    Now, we hit the Compress button [​IMG]

    [​IMG]
    [​IMG]
    Congratulation! Your first mod is successfully made.
    If we have selected the correct folder for the output file, your mod should be in the pak folder already.
    Now, run the game and see the effect!


    As you can see in the picture below, all the trees has gone.
    [​IMG]
    Thank you for attending this tutorial.
    If you have any problem, please feel free to ask me. [​IMG]
    ZaxZ likes this.