• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

OTS Guide - open source documentation and guide for newcomers

Hello everyone,

Our OpenTibia community is 12 years old now and a lot has changed. Over the years, a lot of resources have been released, tutorials posted and different OTS engines (distributions) created.

This makes it increasingly hard for a lot of folks, whether newcomers or not, to navigate make sense out of it. It's especially clear when you're new to programming. A lot of experienced members have programming background, either doing it as a hobby or doing it professionally in adult life. I'm sure that a lot of OTLand members have learned enough programming/technology that they chose IT as a path in life due to the influence OT had on them.

However, not everyone has been with us so long to observe consecutive TFS (The Forgotten Server) versions be released. A lot of scripts, maps and items are not compatible with each other and it may be hard to figure out why. Why is a particular version of AAC not working with the engine you downloaded? Why should you compile a TFS executable yourself and why is it needed on Linux? Why do people even use Linux?

To answer all such questions as much as possible, we decided to create a coherent (if not comprehensive) guide. It's aimed at newcomers and long-time users who would like to understand more about some technical aspects of OpenTibia. We still have a lot of valuable tutorials in Tutorials (https://otland.net/forums/tutorials.477/) but they try to explain many different ways of doing many different things, not all of them compatible with each other.

The goals for the OTS Guide is to:
  • Explain/Support TFS 1.X
  • Encourage use of OTClient
  • Explain basic details (do not assume any prior knowledge)
  • Document some not-well-known advanced details in clear way, such as OTBM, OTB format, protocol details
There are multiple ways to contribute to the OTS guide and contributions are open to everyone, although they should follow predefined goals and final decision belongs to the Staff on what to merge/include:
We plan to reward good technical contributors with the membership in Support Team group that includes Premium perks and more.

The OTS Guide itself is powered by GitBook (https://www.gitbook.com) and you can find it here: Introduction - OTS Guide (https://docs.otland.net).
 
Great step forward! That’s something that this community was lacking! Im pretty sure this will look neat once it’s completed!
 
Awesome to see some official OTLand work still going on. The OTS Guide should prove incredibly useful to OT newcomers.
 
Great! Its about time we start to get some proper documentation going. :)
 
Good job guys. I'll try to contribute to this when my time frees up.
 
Would a guide how to backup your Linux OTS via Rsync/FTP to a remote server and schedule backups via crontab be of interest to this book, or is that not really what it is about? If not I'll just post it in the Tutorial section on forums once it's done :)
 
Would a guide how to backup your Linux OTS via Rsync/FTP to a remote server and schedule backups via crontab be of interest to this book, or is that not really what it is about? If not I'll just post it in the Tutorial section on forums once it's done :)
I think that any guide/advice about server management would be helpful to everyone. The more knowledge we share, the more people will come because they won't have to spend half the time looking for resources on how to do certain stuff.
Think about this docs as a book about running own OTS, not just creating and last page ends on "run .exe/sh, the end".
 
Would a guide how to backup your Linux OTS via Rsync/FTP to a remote server and schedule backups via crontab be of interest to this book, or is that not really what it is about?
Like @oen432 mentioned, yes, it certainly is in scope. It would be on the slightly more "advanced" side and we certainly need to get content that leads up to this part as well but it's very welcome.
 
I'm sure that a lot of OTLand members have learned enough programming/technology that they chose IT as a path in life due to the influence OT had on them.

I really appreciate the community for the influence they had in my life, today I graduated in IT and this choose was because I learned to enjoy programming in a fun way, playing.

Thanks OTLand, you taught me that when we do what we like, it's fun to work with.

But talking about the topic, I'll try to contribute when I have a free time.
 
That's awesome idea but I think it should cover wider areas, lot of tutorials about mapping/spriting its outdated, I think there is no tutorials about design things (quests, areas etc). Also there is a lack in tools for ot dev, e.g. Remere's Map Editor is old and buggy, maybe we could even try to get some funds from community to make it better and more stable?

Ah, and since otservlist.org is only supported OTS list by Otland, it should be updated...
 
That's awesome idea but I think it should cover wider areas
You are free to contribute content in any category, we'll find a way to organize it.

Ah, and since otservlist.org is only supported OTS list by Otland, it should be updated...
It's not "supported". It merely has a board here. Other projects could possibly have a board here as well.
 
I saw there 'lua_functions'. I think there should be one page with list of classes and methods, but methods description and examples should be on different page for each class: lua_functions_game, lua_functions_player, lua_functions_town etc.
If we put everything on one page, it will be totally unreadable and some old PCs may freez.
 
I saw there 'lua_functions'. I think there should be one page with list of classes and methods, but methods description and examples should be on different page for each class: lua_functions_game, lua_functions_player, lua_functions_town etc.
If we put everything on one page, it will be totally unreadable and some old PCs may freez.

Nice idea. Maybe we should update TFS wiki and link to it?
Examples:


Code:
Description: N/A
Parameters:
[LIST]
[*]creature - No description
[/LIST]
Returns: N/A
Example:
 
Guide for newcomers developers 👍
Guide for newbies scriptkids 👎

One question, why dont write commented function headers on source codes?
Something like:
Code:
/************************************************************
* FUNCTION: Create Loot
* RECEIVES: A container that is the dead monster corpse
* RETURNS: Nothing
* DESCRIPTION: When a monster dies, a loot and a loot message
*              is generated considering the RATE_LOOT on
*              config.lua and the stamina of the player.
*              After that, the corpse starts decaying.
*************************************************************
void MonsterType::createLoot(Container* corpse)
{
    if (g_config.getNumber(ConfigManager::RATE_LOOT) == 0) {
        corpse->startDecaying();
        return;
    }

    Player* owner = g_game.getPlayerByID(corpse->getCorpseOwner());
    std::string autolooted = "";

    if (!owner || owner->getStaminaMinutes() > 840) {
        for (auto it = info.lootItems.rbegin(), end = info.lootItems.rend(); it != end; ++it) {
            auto itemList = createLootItem(*it);
            if (itemList.empty()) {
                continue;
            }

            for (Item* item : itemList) {

                //check containers
                if (Container* container = item->getContainer()) {
                    if (!createLootContainer(container, *it)) {
                        delete container;
                        continue;
                    }
                }

                if (owner && owner->getAutoLootItem(item->getID())) {
                    g_game.internalPlayerAddItem(owner, item, true, CONST_SLOT_WHEREEVER);
                    autolooted = autolooted + ", " + item->getNameDescription();
                }
                else if (g_game.internalAddItem(corpse, item) != RETURNVALUE_NOERROR) {
                    corpse->internalAddThing(item);
                }
            }
        }

        if (owner) {
            std::ostringstream ss;
            std::string lootMsg = corpse->getContentDescription();
            if (autolooted != "" && corpse->getContentDescription() == "nothing") {
                lootMsg = autolooted.erase(0, 2) + " that was auto looted";
            }
            else if (autolooted != "") {
                lootMsg = corpse->getContentDescription() + " and " + autolooted.erase(0, 2) + " that was auto looted.";
            }

            ss << "Loot of " << nameDescription << ": " << lootMsg;

            if (owner->getParty()) {
                owner->getParty()->broadcastPartyLoot(ss.str());
            }
            else {
                owner->sendTextMessage(MESSAGE_LOOT, ss.str());
            }
        }
    }
    else {
        std::ostringstream ss;
        ss << "Loot of " << nameDescription << ": nothing (due to low stamina)";

        if (owner->getParty()) {
            owner->getParty()->broadcastPartyLoot(ss.str());
        }
        else {
            owner->sendTextMessage(MESSAGE_LOOT, ss.str());
        }
    }

    corpse->startDecaying();
}

A wiki for OTClient would be really cool too.

If somebody creates a wiki for otland/otclient I can make some pages like "How to set a single server protocol", "How to change skills names", "How to remove options from configuration menu", etc
 
Last edited:
I would like to help but i have very little knowledge so anything i could write would be incomplete.
 
I'd like to start documentating classes and methods but I couldn't create another section like Lua Functions section.
 
I appreciate the material and would recommend adding information regarding how to migrate from localhosting to a dedicated server or VPS. Thanks!
 
Back
Top