NetworkDesign: Difference between revisions
Content deleted Content added
imported>Hendrik Brummermann |
imported>Javydreamercsw m Updated links to point to Git repository instead. |
||
| (44 intermediate revisions by 4 users not shown) | |||
Line 1:
{{Navigation for Marauroa Top|Internals}}
{{Navigation for Marauroa Developers}}
Please note: This page explains the low level network communication. You
==Messages==
Marauroa uses messages to communicate between client and server. The messages sent from the client to the server are prefixed with C2S and the ones sent from the server to the client use the prefix S2C.
Each message is implemented in its own Java class in the package marauroa.common.net.message. You can lookup up the details about every message in the [http://
There are for different client states of the game: connected, logged in, in game, logged out. Depending on the state different messages are valid:
Line 18:
The login process is a bit complicated because of security requirements. Don't be scared, just follow it step by step.
Onces the TCP connection is established the clients requests the RSA public key from the server using [
The client now computes a nonce (a random number) and sends its hash as byte array to the server in a [
Almost there: The client has now all the information it needs to actually send the [
The [
If the username/password combination, however, is correct then the Server must send a [
{{br}}
Line 33:
[[Image:messages-loggedin.png|thumb|Selecting a character and transmitting world meta data.]]
The logging in stuff was complicated. But luckily things are getting much easier now. After the login completed successfully the server sends a [
Directly afterwards a [
Now the client picks one of the offered characters. Games that do not support multiple characters can pick the one that matches the account name. The choice is transmitted to the server using a [
The server will check the selected character and reply for a [
If the selection, however, was successful, a [
{{br}}
Line 50:
==== Regular Messages ====
The [
The message is composed of:
Line 65:
The client sends [
Line 72:
Perceptions are about dynamic content. But most games have some static data, too. Like maps, tilesets, sounds. The RPManager keeps track of situation in which the client might need some of this static data. A common case is the movement of the client from one zone to another.
If the RPManager detects such a situation, it will offer the new content to the client using a [
The clients replies with a [
If the clients has acknowledged the need for content to be transfer, the server sends a [
==== Actions ====
Actions are commands sent from the client to the server using a [
{{br}}
Line 89:
If the player is in some kind of combat it is often desirable to prevent him from saving his live by logging out. Therefore the client sends a logout request to the server and the game server can decide whether to accept or reject it. Of course the user can close the client window or force a disconnect of his Internet connection. But in these cases he will simple stay in a game unattended until the timeout anyway.
The clients indicates that it wants to finish the session by sending a [
The server can reply with a [
{{br}}
Line 105:
* Timestamp (4 bytes)
This header is followed by message specific data. Have a look at the [
==Network Manager==
Line 156:
[[Category:Marauroa]]
{{#breadcrumbs: [[Marauroa]] | [[Navigation for Marauroa Developers|Internals]] | [[NetworkDesign|Network Design]] }}
| |||