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

Can someone explain what compiling is?

I still don't get it

lol, come one, try to read it. Even my younger brother at 10 age would understand it :p
TFS is open source, when you download it from github you just download the sources.

But you need to execute the server, right? You can't execute it without a starter.
Then you compile the sources INTO a starter.
 
You know when you run your programs? Well, those are compiled programs.
It means that you pick everything, the code, classes, blablabla and you compile it in 1 executable.

Since TFS is open source it means you can change the executable itself. So imagine that instead of showing your server, you change it to print rabbits. THAT IS THE POWER OF OPEN SOURCE MANN.
 
This is not so obvious to someone who sees interpreted logic (HTML, LUA, etc) all the time.

@ OP:
The text you can read (C and C++ program source that you can edit in Notepad, LUA scripts, HTML, etc etc) doesn't actually run unmodified on a computer. At some point between saving the file and getting it to run on a system, the text (this is usually called "source" or "source code") has to be either modified into a program that the system can run directly, or processed by a "middle-man" so it can do its job for you.

(an aside: C and C++ (C plus plus) aren't the same programming language, but they are quite closely related from a purely technical perspective - in the case of OT, and for discussion of compiling etc, they are similar)

There are several varieties of this process. In OT:

The C code is processed by a special program called a C compiler, which takes the source and makes an executable program (on windows that will be an .exe file, and may include some .dlls). These files can be loaded into operating system memory and executed directly (that's what happens when you double-click on a .exe from the Windows "file explorer" or via a shortcut)

Note that compiling is done once, then the output can be executed over and over without any further preparation.

On the other hand, each operating system has its own specific format for executable programs, so you have to compile the source once for each operating system. A program compiled for Windows cannot be used on a Unix/ or Linux system or vice-versa - e.g. a copy of a Windows .exe is useless on a Linux system .

Both C and C++ have to be compiled (along with a lot of other languages).

LUA (and PHP, JavaScript,HTML) are different to C/C++. They don't have to be compiled in advance.

Using LUA as an example (but the same is true for other script languages): For LUA, the text file (e.g. a .lua fila) is loaded into a LUA runtime (which is a C program, compiled for the specific operating system you're running on) , and the LUA runtime dynamically turns what it finds in the .lua file into something the operating system (Windows, Unix, Linux, etc) can work with. This process is called "interpreting", to distinguish it from compiling.
Note that interpreters don't necessarily dynamically create an intermediate format like what you find in an .exe file - the details vary and it can get complicated :)

The advantage with languages like LUA is that they are easier to work with: coding is easier than compiled languages, and the same script source (the .lua file) can be run on different operating systems (because the LUA runtime handles all the OS dependencies) which is convenient. OTOH there are things that are inefficient and some that are impossible with LUA.

I actually know a lot about IT, and not so much about OT, but now you know the difference between compiling and interpreting, as far as I know this is true about OT:
  • The OT server is all C and/or C++ code, and has to be compiled for the operating system it runs on
  • There are components that the LUA scripts interact with that are coded in C/C++, and packaged with the OT server (these are sometimes called "C functions" in the forums)
  • As you've surely seen there are lots of LUA scripts which are called by the OT server. They don't have to be compiled - the server knows how to find them and process them with the LUA runtime

In case you want to know: AFAIK the LUA runtime is built into the OT server, so you don't "see" it. The server is "told" which scripts to run either because it's hard-coded in the server's C-code, or specified in server configuration files like the big .xml file(s) that define creatures etc.


Last point. IT is complicated, and this is just a tiny corner. I haven't explained the whole picture, and there are exceptions to what I said. One example: from this perspective, Java and C# are "hybrids" - they have characteristics of both compiled and interpreted languages. OTOH the best way to learn this kind of thing is to understand 80% what you're working with right now, and when you've got it all figured move on. You don't have to know everything about IT to compile and run an OT server, make maps, or modify LUA scripts for OT :)
 
Last edited:
Back
Top