• 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!

Basics from server.

Bolmack

Member
Joined
Mar 7, 2015
Messages
91
Reaction score
6
Hello, well im already at my 4rth month of work in my server, and already figured a lot of things like server, spr and items editor, mapping and tons of things, i just started studying university on an IT carreeer, and in four of my courses im looking programation, so can you tell me guys wich languages is tibia using? i saw it in xml, but idk what language are lua files, and in wich language are modal window working cause i havent find any modal window tutorial, also the OTclient, if some1 can help me whit those answers that would be really great, thanks!
 
@Thexamx xD well sorry if it was a dumb question im new programing just made my first project on c++

Then, everything is made in c++ but lua and xml files? i mean the full client is c++?
 
Here is a tutorial on Modal Windows:
https://otland.net/threads/how-to-modal-windows.225398/

I believe the Engine is coded in C++ (TFS 1.X / TFS 0.4 etc)
The Data Pack part is Lua (Globalevents/Creaturescripts/Action scripts/ etc)
The Website mainly uses PHP/HTML (could be more depending on how nice you want to make it)
Ofcourse the database, MYSQL queries, is used in all of the 3 parts above.

I'm also not the best person to answer this question as I have no formal education in computer science but from my experience in OT servers this is what I've been able to understand thus far, I hope it was helpful. If I'm wrong or inaccurate in some areas hopefully someone with more knowledge can come and correct me.
 
Damn, thanks thats really helpfull @imkingran was looking for a tutorial like that like 3 days couldnt find it, and well then im good starting to learn c++ gotta get a lot of knowledge.
 
@Thexamx xD well sorry if it was a dumb question im new programing just made my first project on c++

Then, everything is made in c++ but lua and xml files? i mean the full client is c++?
Most source files have an extension that give you an idea of the supporting language.
Examples:
Code:
*.sql -- uses sql language aka Structured Query Language
*.c   -- uses c language
*.cpp -- uses c++ language
*.php -- uses php language aka Hypertext Preprocessor
*.java -- uses java language
*.js -- uses javascript scripting language
*.html, *.htm -- uses HTML aka Hypertext Markup Language
*.css -- Cascading Style Sheet
*.xml -- EXtensible Markup Language
*.lua -- uses lua scripting language
Please note, although they use that language they can also contain code from other languages.
 
Damn, thanks thats really helpfull @imkingran was looking for a tutorial like that like 3 days couldnt find it, and well then im good starting to learn c++ gotta get a lot of knowledge.
OTClient and TFS 'engine' is in C++, because of high efficiency.
C++ requires compiling and restarting server/client everytime you make even little change, so it would be stupid to use only C++, because everytime you edit little NPC script for test, you would restart RL map server which can take even 50 seconds.
That's why TFS and OTClient uses LUA language. It's much simplier language, but it got two important features:
1. You can 'reload' LUA code when program is running! - You can edit some LUA script, type in game '/reload npc' and it will reload all NPCs LUA code without restarting server.
2. You can 'send something' from C++ to LUA and get return to C++! - Some player die on server, server wants to remove his 'exp/skill/items', but before it send this player ID and his killer ID to LUA function 'onPrepareDeath'. If that function return 'false', server will stop execution of 'death' and let player live :)
(example: https://otland.net/threads/restore-...ills-everything-when-die.236548/#post-2284420 )

So C++ take care about database/network communication and LUA which is easy to understand and edit take care about 'logic' of game.
 
@Gesior.pl Wow perfect example to make me undestand a few more, so in you point number 2 you say i can make something in c++ and convert it to lua? or am i wrong xD
I mean that these 2 languages can communicate with each other, not convert C++ to LUA or LUA to C++ (every programing language at end convert to 'machine code', but it's not easy to write one program in more then 1 language, but it's possible to write program in C++ and LUA, that's why we use it).

You use in LUA function:
PHP:
Game.startRaid('demons')
and it starts C++ function:
https://github.com/otland/forgottenserver/blob/master/src/luascript.cpp#L4392
PHP:
int LuaScriptInterface::luaGameStartRaid(lua_State* L)
{
  // Game.startRaid(raidName)
  const std::string& raidName = getString(L, 1);
  Raid* raid = g_game.raids.getRaidByName(raidName);
  if (raid) {
    raid->startRaid();
    pushBoolean(L, true);
  } else {
    lua_pushnil(L);
  }
  return 1;
}
It executes some advanced calculations [that we want to work fast, so we wrote them in C++, not LUA] like: raid->startRaid(); - start raid, spawn monsters etc.
and then return to LUA some 'answer':
If raid with name you send exists and started, it return boolean true:
PHP:
pushBoolean(L, true);
If raid with name you send does not exist, it return nil ('nil' is special LUA value which means 'nothing', if you use it in 'if' that will works like 'false'):
PHP:
lua_pushnil(L);

So your LUA script send to some C++ function parameter 'demons' and received answer, if raid started.
You can use LUA code like that:
PHP:
local raidNameToSend = 'demons'
local returnedValue = Game.startRaid(raidNameToSend)
if(returnedValue) then
  print('RAID STARTED!')
else
  print('WRONG RAID NAME :( ')
end
 
OMG! cool thanks to good im learning c++ xD so i know how to summon objects and thats incredible how you can summon .LUA scripts damn so amazing, you helped me a lot to understand, now i gotta check some .LUA reservaated words to get a better understanding of its codes.

And another thing, the client, is it made whit c++ too? and how do i compile an Otclient whit any c++ compiler like codeblocks?
 
OMG! cool thanks to good im learning c++ xD so i know how to summon objects and thats incredible how you can summon .LUA scripts damn so amazing, you helped me a lot to understand, now i gotta check some .LUA reservaated words to get a better understanding of its codes.

And another thing, the client, is it made whit c++ too? and how do i compile an Otclient whit any c++ compiler like codeblocks?
OTClient is made in C++ too (big part network and all 'graphic rendering engine'), but it was designed to be 99% LUA configurable/programable. Even part of network is already moved to LUA (protocol login - all network packets you send and receive to get list of characters is in LUA). Every part of screen and every window is fully configurable from LUA and OTUI (very simple OTClient programing language to define windows position/content), so you can change everything without editing C++ code.

For me CodeBlocks tutorial worked without problems:
https://github.com/edubart/otclient/wiki/Compiling-on-Windows

but if you got CodeBlocks/Visual Studio 'libraries' from 'TFS 1.0 compile tutorial' installed on PC, there is one conflict that I described here:
https://github.com/edubart/otclient/issues/670
 
Back
Top