NetworkDesign: Difference between revisions
Content deleted Content added
imported>Hendrik Brummermann No edit summary |
imported>Hendrik Brummermann No edit summary |
||
Line 4:
{{Likely Outdated}}
Please note: This page explains the low level network communication. You don't need to bother with these implementation details if you want to use Marauroa to write a game. We document the network design anyway for contributor to Marauroa itself. And it is helpful for people porting Marauroa to other programming languages.
==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
There are for different client states of the game: connected, logged in, in game, logged out. Depending on the state different messages are valid:▼
=== State connected ===▼
[[Image:messages-connected.png|thumb|Messages used to securely login.]]▼
=== State logged in ===▼
[[Image:messages-loggedin.png|thumb|Selecting a character and transmitting world meta data.]]
=== State in game ===▼
[[Image:messages-game.png|thumb|Messages sent while the game is active.]]
=== Logging Out ===▼
[[Image:messages-logout.png|thumb|The client sends a logout request and the server accepts or denies it.]]
== Basic idea behind Networking ==
Line 95 ⟶ 122:
That is the basic idea of the Network Manager; however, the manager gets a bit more complex as a result of the need to support Server to Client messages that are bigger than one UDP package. Note that the manager just sends the stream of packets once and doesn't confirm if any of the messages are received. Please refer to [[NetworkDesign#UDP_Packet_Format | UDP Packet Format]] for more info about it.
▲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 a java class in the package marauroa.common.net.message. You can lookup up the details about every message in the [http://stendhal.game-host.org/hudson/job/marauroa_HEAD/javadoc/marauroa/common/net/message/package-summary.html javadoc]. If you want to port Marauroa to another programming language, you will need know how the message are serialized exactly. The easiest way to learn that is to look at the [http://arianne.cvs.sf.net/viewvc/arianne/marauroa/src/marauroa/common/net/message source code] of the readObject() and writeObject() methods.
▲There are for different client states of the game: connected, logged in, in game, logged out. Depending on the state different messages are valid:
▲== State connected ==
▲[[Image:messages-connected.png]]
▲== State logged in ==
▲== State in game ==
▲== Logging Out ==
| |||