• 0
Sign in to follow this  
Followers 0
fourxhackd

Overview of Ragnarok Online Server Development

Question

Introduction

I'm planning to write a guide to Ragnarok Online development that begins with the big picture of server development, and transition into more detail through a series of carefully selected newbie questions to guide our path.

I'll be providing extended reading materials (other people's guides, relevant tools) relevant to the current topic.

Table of Contents

  1. How is this guide different
  2. Expectations
  3. Learning RO development the best way
  4. Who are we and what do we know?
  5. What do we see in games?
  6. High-level overview of Games
  7. Mid-level overview of Hercules

 

How is this guide different?

The guide will read less like a technical document that tells you "what to do". It will read more like a novel that walks through the questions a newbie would ask, just like when a newbie is on an adventure and exploring the unknown. 

So don't be afraid of the unknown, or the difficult challenges ahead. That's where we're going (there's more EXP there), and we'll find treasure and grow stronger that way!

Expectations

This guide works with the following assumptions:

  • The target audience is a thirteen year old who has no computer science background at all (Or at least, the guide will explain things very simply to make sure even thirteen year olds could do it).
    • Software development terminologies will be given two things:
      • (a) an Explain Like I'm Five years old explanation; and
      • (b) links for deeper reading.
  • The target audience has never coded, or scripted before.
  • The target audience has played other games.
    • Preferably online games and RPGs such as World of Warcraft, DotA 2.
    • The other games will be examples I will use when explaining certain topics.
  •  

Learning RO development the best way

Here are a few suggestions to make your RO development experience less frustrating and much, much more pleasant:

  • Have an interest in playing RO and wanting to have an RO of your own.
  • Have a little bit of patience and diligence to read about how things work.
  • Have commitment to keep your eyes on what you want to accomplish.
  • Cherish every victory no matter how small (e.g. make this npc talk, make this item give +99 LUK instead of +1 LUK). Every victory is a victory.
  • Be open to experiencing things that you do not know.
  • Have the humility to acknowledge what you cannot do and what you do not know, and to ask for help when you are lost.
  • Have the humility, respectful reverence to the forum leaders who spare some of their valuable time not only to educate and teach you what they know, but also who contribute to building RO servers for free (open source development).

Who are we and what do we know?

We begin with what all gamers know: we like to play games.

What are games that you are actually familiar with? I know I've played RO back in 2003. I played counter strike a decade ago, I tried out Gunbound and Runescape, I played Adventure Quest (Flash game). I even enjoyed writing in Gaia Online, doing role-play in forum threads. During my stay in the university (2011-2018), I played loads of DotA 2 and it showed me what competitive/professional gaming looked like, showing me the depth of gaming that I haven't seen before. I played shooter games like Overwatch, PUBG, Destiny 2, and different kinds of games from Steam like Project Zomboid and Stardew Valley.

The reason why I bring up different kinds of games is because this is our shared or common knowledge. It is what unites you and me, two strangers in the internet. Our common love for playing RO and playing games in general.

So now that you've gotten to know me a little better, we now ask the question: How does a person transition from a gamer into a game developer?

 

What do we see in games?

Scenario

It's 8PM and you are at your house. You just finished having dinner, and are now about to start playing in your favorite RO private server. You go to your computer, you open up the game's patcher. You find some updates. "New game content!" you think to yourself. You go to the website to read about the changes: It might be changes to the items, buffs to your favorite RO class, or changes to the map, or new NPCs and events and dungeons! Your RO finishes updating, and your game begins.

 

What happened?

We begin our journey into game and server development with terminologies. 

 

Terminologies? Why do I have to memorize these things?

We have to know what we call things to make sure we understand each other. If you don't understand me, you will not learn. If you get confused, you will get lost. If you do not know the terminology for the things you are having a problem with, you won't know how to say what your problem is.

  1. Game Website - This is the website where you go to learn how to install a private RO server, read about game changes and news, and interact with other people in the community through forums.
  2. Patcher - This is the tool that you use to make sure you're updated. Otherwise, you'll encounter outdated game information, problems, and worst case scenario: crashes.
  3. Game Client - This is the runnable program that you are in when playing the game. For example TalonRO.exe, or AeRO.exe.

patcher.PNG.b7c1dc4c33f09f822589c89ba49d3ffd.PNG

From the perspective of a gamer, these are all the areas where they interact with a game provider:
They use the website to download the installer. The patcher updates the game. They run the game to play.

 

website.thumb.PNG.2dd8040b54d3237d52302888530a95f3.PNG

 

High-level overview of Games

What is a client?

Simply put, a client is an application or a program that communicates with a remote system called a server. These terminologies are used when under a system that follows a client-server architecture

 

Alright, so what is a client and a server architecture?

Imagine the following: You go to a restaurant to eat dinner. When you sit down, the waiter comes to you. The waiter is who you talk to and interact with so that the kitchen knows what food to cook for you. The waiter who takes your order and makes sure you are having a good time is the client. He is the interface between you and the kitchen. The kitchen which  deals with the inventory of goods and making sure that chefs are doing the processes to produce food is the server.

You can have multiple clients (e.g. TalonRO.exe distributed to different players across the world) that connect to one server. That in a nutshell is a client and server architecture.

 

What does a client-to-server interaction look like?

The illustration below is a very simplified illustration of a client-server architecture. This means that a client 

The server (on the left) and the client (on the right) communicate with each other. That is how the game works.

  1. Green - When it comes to accessing a game website (which is actually a web server) requires a web client or web browser like Google Chrome or Mozilla Firefox.
     
  2. Orange - When your patcher is running, it asks the question "Are there any new updates?" specifically to a patch server, which has a master list of patches. It's like how a customer in a restaurant asks "What can I order?" and the client tells them "This is what the kitchen can cook".
     
  3. Blue - When your game connects to the server, it not only can ask questions (e.g. "What is my player's level and stats?") it can also tell the server what to do (e.g. "Move my player to prontera X and Y location). The client interfaces between you (the player) and the server.
     

5c19151f30e7c_HighleveloverviewofHercules.thumb.png.a90d8e982dbae5755a94c704efc73f51.png

That's the high-level overview of how games work. It's a combination or orchestration of fast-paced conversations between people (players on clients) and machines (servers that allow players to play together). There are machines in between to facilitate all of these complicated processes.

Keywords: Port forwarding

 

One example of a machine that facilitates people playing together is Hercules, or rAthena. These are game servers that follows a specific set of rules or instructions that dictate what is expected when RO clients connect to RO servers.

 

What do you mean by "follows a specific set of rules or instructions"?

A protocol is a set of specific rules or instructions. Having a set of specific rules or instructions makes sure that we follow the same rules.

 

For example, if we play the game Rock Paper Scissors (roshambo, bato bato piks), we need to know the following rules:

  1. You're supposed to make a choice of either Rock or Paper or Scissors. You only choose one.
  2. You're supposed to make a choice after counting 1, 2, and 3.
  3. Rock is represented as a closed fist.
  4. Scissors is represented with two fingers (index and middle) extended.
  5. Paper is represented with five fingers extended.
  6. Rock beats Scissors. Paper beats Rock. Scissors beats Paper.

When we learn about the rules and follow them, we can play Rock Paper Scissors. Two players can then follow the rules, understand each other, and agree as to who won the game.

If players did not follow the rules ("1, 2, 3 - Suddenly, a player shows Fire which he says beats Rock Paper and Scissors!") then people would be confused, feel cheated, and things will not work. There will be misunderstandings.

 

When it comes to game servers, we need a set of rules to follow as well. The protocol is the set of rules for how the server and the client will communicate. If your game server and your client does not follow the same protocol, they will have misunderstandings and they will not work.

An example of protocols in RO development is the use of the following port values: 5121, 6121, 6900. If you don't have a client that talks to the server at the expected port, your server will be confused and will not respond to any requests.

An example of protocol is the agreement on which packet version to use. If you use the wrong packet version, your server will not understand the packets being sent by your client.

 

Relevant Keywords: Packets, PACKETVER, Compiling, Ports

 

We talked about an example of machines that facilitate processes to enable multiple people to play together (MMORPG). An example of this is Hercules, which we look into more detail below in the following post.

Edited by fourxhackd
Added more pictures for visual learners

Share this post


Link to post
Share on other sites

4 answers to this question

  • 0

Reserving this post.

Table of Contents

  1. Server side development
  2. Source code and what it means to compile
  3. Server configuration and customization
  4. NPC Scripting
  5. Source code editing

Mid-level overview of Hercules

The illustration below shows a more detailed view of the server (left) and the client (right). As you can see, it is OVERWHELMING, especially for a thirteen year old.

So listen to me first when I say I want you to focus on the left side, which is the server side aspect of RO development.

5c190e7a507f5_MidleveldetailofHerculesclientserverarchitecture.thumb.png.6f0ad843c419b7ed6c291b0cee93e1be.png

 

Server-side development

On the left side, we will be focusing on the server-side development. We begin at the top most part of the server-side, which begins with the source code.

What does "Source code" mean?

 

Quote

By source code, we mean the .c files that can be found in the src/ folder.

The quote above and below is lifted from my own writings regarding Compiling and source code in the Hercules Wiki.

 

Source Code and what it means to Compile

Analogy (Language when traveling)

You are a Filipino. You know the language Filipino as your main language. When you study in school and university, you learn the language English and Spanish. When you travel visit Korea, you learn a little Korean too. You are becoming more and more adaptable wherever you go. You can go to Europe, Spain, Korea, etc. 

When you go to South Korea, you think of ordering food because you will eat. First, you think in Filipino "Gutom ako" which means "I am hungry" in English. So you get your Language Book for Koreans and say the korean counterpart which is 나 배고파 (na baegopa). By speaking Korean, you are understood by people in Korea.

 

Parallelism in RO Development

In RO Development, your source code is your main language. In your head, when you are thinking, that is the language that you hear when you think. In the example above, the source code is Filipino. I, fourxhackd, think in Filipino. When I have something I want to share in the forums of Hercules, I translate my understanding into the language necessary for you the readers, so that you will understand me.

 

Changing from Filipino to English is called translation.
Changing from source code to executable code is called compiling.

 

Translation is necessary because not all people are Filipino, or English. Some are Korean, some are French, Chinese.
Compilation is necessary because not all machines are Windows, or Unix. Some are OSX, Ubuntu, Fedora, etc.

 

Because there are Language Books or Dictionaries for Filipino, we can perform translation from Filipino to another language (e.g. to English).
Because there are Compilers for the C Programming Language, we can perform compiling from C Source Code to Runnable Executable Files (e.g. for Linux).

 

Because we already know what ideas we have in our minds that we want to share, and because we have dictionaries, we are able to adapt and talk to people in different countries.

Because Hercules shared with us the source code for RO server development, and because we have compilers, we are able to deploy RO server development code for any environment.

 

Given the above analogy and explanation, I hope that you understand better what the words "source code" and "compile" mean, and why they are important. We will continue now with the assumption that you understand compiling source code, and that you will be able to follow different kinds of guides available throughout the forums/knowledge-base. Now that you understand it better, we can conclude this section by saying the following:

Review the diagram at the top of this post again. Through compiling, we can produce produce the server executable programs (map, char, and login) from the source code.

 

Extended Reading

 

 

Server Configuration

We will now continue to talk about configuring your server. This is the bottom part of the left side of the diagram.

I will not go into too much detail on this, since configuration is pretty much straightforward and well documented.

The only advice I have is to read the documentation already provided! Go to your hercules_server_folder/doc and read everything! Read all the comments that your wise masters have left behind for you.

It is my opinion that configuring and customizing the server is the simplest part of RO development, for the simple reason that you need only change one value to another. Do not be afraid to test something out, and to bring it back if it doesn't work. It is okay to make mistakes.

For example, in conf/map/battle/exp.conf:

// Rate at which exp. is given. (Note 2)
base_exp_rate: 100

// Rate at which job exp. is given. (Note 2)
job_exp_rate: 100

If you are not sure what 100 means, then first read the documentation above.

//=========================================================================
// Battle (Experience) Configuration File
//=========================================================================
// Note 1: Value is a config switch (true/false)
// Note 2: Value is in percents (100 means 100%)
// Note 3: The max level of classes is stored in the exp table.
//         See files db/exp.txt and db/exp2.txt to change them.
//=========================================================================

Note 2 means that value is in percent, and that 100 means 100%. Now you understand!

Now that you understand, try making it 200. See the difference. Then make it 10000. Test it out. Find out for yourself.

It is important to think critically: "I wonder what will happen if I change this". Think. Test. Understand. That will build your confidence that you know what you are doing.

 

 

NPC Scripting

NPC Scripting is a type of server configuration, except that it focuses solely on NPC scripts. Just like my advice in general server configuration, read the documentation!

Open hercules_server_folder/doc/script_commands.txt and read the whole document until it has been ingrained in you. 

In school, you are forced to read text books to understand math, or science. However, we cannot apply it immediately in the world to understand the value of math and science.

In RO development, you CAN read text books (like the script bible) to understand NPC scripting. Unlike math and science, your understanding of scripting can BRING TO LIFE new NPCs into the world. Celebrate this new found power of creation!

 

Unfinished

This guide is not yet finished. I'll be writing about it in more detail soon.

Edited by fourxhackd
Copied from first post.

Share this post


Link to post
Share on other sites
  • 0

Reserving this post.

Topics

Client side development.

Client side data and resources.

Client side tools.

Hexing, patching, configuring your own client.

Edited by fourxhackd

Share this post


Link to post
Share on other sites
  • 0

Reserving this post.

Topics

Networking.

Ports, port forwarding.

IP Addresses.

Packets. Packet versions.

Edited by fourxhackd

Share this post


Link to post
Share on other sites
  • 0

Reserving this post.

Topics

Secondary topics.

Open source development.

Contributing to rAthena or Hercules.

External links to other important concepts in RO dev.

Link to another thread, to gather data: a poll about what are difficult topics that lack documentation.

Edited by fourxhackd

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0