OTS Guide - open source documentation and guide for newcomers

Don Daniello

/root
Staff member
Administrator
Joined
Apr 11, 2008
Messages
3,515
Best answers
15
Reaction score
928
Location
Proland
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).
 

Amiroslo

Legendary OT User
Joined
Jul 28, 2009
Messages
6,693
Best answers
5
Reaction score
694
Great step forward! That’s something that this community was lacking! Im pretty sure this will look neat once it’s completed!
 

xNMExReject

Well-Known Member
Joined
Oct 31, 2009
Messages
21
Best answers
0
Reaction score
0
Awesome to see some official OTLand work still going on. The OTS Guide should prove incredibly useful to OT newcomers.
 

Znote

<?php echo $title; ?>
Staff member
Global Moderator
Premium User
Joined
Feb 14, 2008
Messages
6,609
Best answers
187
Reaction score
1,332
Location
Norway, Oslo
Great! Its about time we start to get some proper documentation going. :)
 

Syntax

Developer
Joined
Oct 10, 2007
Messages
2,835
Best answers
0
Reaction score
193
Location
Texas
Good job guys. I'll try to contribute to this when my time frees up.
 

Damon

Check my status to contact me :)
Joined
Mar 26, 2011
Messages
6,090
Best answers
1
Reaction score
1,849
Location
Germany
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 :)
 

oen432

Veteran OT User
Joined
Oct 3, 2014
Messages
441
Best answers
7
Reaction score
418
Location
Poland
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".
 
OP
Don Daniello

Don Daniello

/root
Staff member
Administrator
Joined
Apr 11, 2008
Messages
3,515
Best answers
15
Reaction score
928
Location
Proland
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.
 

keilost

Premium User
Premium User
Joined
Aug 4, 2012
Messages
63
Best answers
0
Reaction score
12
Location
Brazil
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.
 

Kuzyn

Veteran OT User
Joined
Dec 19, 2009
Messages
1,295
Best answers
1
Reaction score
327
Location
Gdansk, Poland.
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...
 
OP
Don Daniello

Don Daniello

/root
Staff member
Administrator
Joined
Apr 11, 2008
Messages
3,515
Best answers
15
Reaction score
928
Location
Proland
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.
 

Gesior.pl

Mega Noob&LOL 2012
Joined
Sep 18, 2007
Messages
2,014
Best answers
19
Reaction score
1,011
Location
PLand
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.
 

hellboy

Excellent OT User
Joined
Apr 6, 2008
Messages
411
Best answers
3
Reaction score
62
Location
getPlayerTown (getCreatureByName("Hellboy"))
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:
 

Togu

Active Member
Joined
Jun 22, 2018
Messages
262
Best answers
1
Reaction score
124
Location
Brazil
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:
OP
Don Daniello

Don Daniello

/root
Staff member
Administrator
Joined
Apr 11, 2008
Messages
3,515
Best answers
15
Reaction score
928
Location
Proland

Steve Albert

Banned User
Joined
Dec 9, 2018
Messages
267
Best answers
13
Reaction score
102
I would like to help but i have very little knowledge so anything i could write would be incomplete.
 

Togu

Active Member
Joined
Jun 22, 2018
Messages
262
Best answers
1
Reaction score
124
Location
Brazil
I'd like to start documentating classes and methods but I couldn't create another section like Lua Functions section.
 

Krysin

New Member
Joined
Mar 10, 2019
Messages
8
Best answers
0
Reaction score
5
I appreciate the material and would recommend adding information regarding how to migrate from localhosting to a dedicated server or VPS. Thanks!
 
Top