Navigation Menu

Skip to content

[How To] Track Maps

Joseph Bingham edited this page Aug 21, 2020 · 2 revisions

Track Maps

A good map tracker is arguably the blood of a great Open-Tibia server based on the official map (a.k.a. an RL map). It can aid in the development of a 99%* accurate Open-Tibia server; from the map, and spawns, to the name of items, and even what is written on signs.

Traditional map trackers would create the map while you walked around in game by parsing map packets that came through its proxy. This is fine, but has two distinctive issues:

  1. It adds unwanted latency. Not only does the proxy itself add a small bit of latency, but the act of parsing every server packet and then creating an OTBM from the map packets adds even more latency.
  2. If there's an issue in the parser, the OTBM that was created may be inaccurate and you would need to re-track that area.

TibiaAPI addresses these two issues with the Record and Extract apps. The Record app does exactly as its name implies, it records your session into an OXR file. It doesn't parse any packets, it doesn't create an OTBM, it only records all, decrypted packets sent between the client and game server. These OXR files can then be used with the Extract app to create, or extract, an OTBM file. If there's an issue in the parser, it can be addressed, and any recordings can then be used with the Extract app again.

* A lot of Open-Tibia servers, based on the official servers, will claim a 100% accurate map, spawns, etc., but, without the official files from CipSoft, this is just not possible. Even with a good map tracker, and a team of highly-skilled developers, at best you can achieve 99% accuracy.

Record a Session

In order to create a recording (OXR), you need to configure your client to connect to TibiaAPI's proxy. If you're connecting to an Open-Tibia server, you can check out this guide. You can follow the same guide for connecting to official servers, the only difference is that you don't need to supply the loginWebService when starting the proxy.

Next, run the Record app from your favorite command-line interface (Command Prompt, PowerShell, Terminal, etc.). There are various parameters you can pass on the command-line when running the Record app:

  • --tibiadirectory=<path> - This parameter will tell the Client object to look for the client version and .dat file from the specified path. This is useful if connecting to an Open-Tibia server. By default, it uses the default path of the official Tibia client on that operation system.
  • -t=<path> - Shorthand for --tibiadirectory.
  • --port=<port> - This parameter will tell the proxy to listen to login attempts on the specified port. Port 7171 is the default.
  • -p=<port> - Shorthand for --port.
  • --login=<address> - This parameter will tell the proxy to forward login data between the client and the specified web address. This is useful if connecting to an Open-Tibia server. The official login service web address is the default.
  • -l=<address> - Shorthand for --login.
  • --loglevel=<level> - This parameter tells the Logger to log at the specified level; error, warning, info, debug, or disabled. Default is error.
  • --logoutput=<output> - This parameter tells the Logger where to log any log lines; console or file. Default is console.

Once the Record app is running, you can start your modified client and login like normal. The OXR file for a session can be found in the Recordings folder in the same directory as the Record executable. The naming format of an OXR file created by the Record app is Year_Month_Day__Hour_Minute_Second.oxr (in UTC time). When you're done recording, you can type quit into your command-line interface and hit enter/return (you can stop the Record app in other ways, but you may lose data). Note that by doing this, the proxy will close and you will be logged out of the client; so make sure you're in a safe place before doing so.

TibiaAPI's proxy is capable of handling character switching, and even logging out and back in. It has even been tested to work with casts on Open-Tibia servers.

Extract an OTBM

Now that you have a recording, you can use the Extract app to make an OTBM file. Like the Record app, you'll want to run the Extract app from your command-line interface because you'll need to pass various parameters to it; specifically --recording=<path>, --map, and possibly --otb=<path> (you can pass --help to see all the parameters and their use). Use --recording=<path> to specify the path to your recording(s), use --map to specify that you want to extract the map from that recording, and you'll need to use --otb=<path> to specify the path to your items.otb file. You will see progress in the console from the Record app; which recording it's extracting from, that it's extracting map data, and then when it's done. The Extract app will automatically terminate once it's completed.

About Custom items.otb

If you're not aware, Open-Tibia uses both server IDs and client IDs; every item must have a server ID and a client ID. Client IDs are the IDs the client uses for a particular item (e.g., gold coin is 3031). While server IDs must be unique, client IDs do not. This means that you can have multiple items with the same client ID. In order to convert objects (tiles, walls, items, etc.)[client IDs] on the map from the recording into the IDs that your server uses (server IDs), the Extract app has to map client IDs to server IDs. However, if you have multiple server IDs mapped to the same client ID, the Extract app can't reason which should be used so it always uses the first instance it finds.

If you haven't figured it out yet, that means when you load the created OTBM file in RME you may see objects that are "wrong". However, these objects are not "wrong", it's just that the client ID for these objects is being used for multiple server IDs and the "right" one can't possibly be chosen for each individual case. There are a few ways you can fix this:

  1. Manually; open the created OTBM file in RME and convert the wrong objects to the correct ones.
  2. Don't reuse client IDs. If your reuse of client IDs is because of custom items, try giving those custom items server IDs that are beyond official ones.
  3. Use 1:1 IDs; all server IDs should match their respective client IDs. If you're trying to create an "RL map" server, then you probably won't have custom items anyway. But, if you do, start their server IDs at a high number (e.g., 60000) to avoid clashing with official items.

Note that, if you have multiple server IDs mapped to the same client ID, the Extract app will log a warning message in the console.