From The Mana World
Revision as of 03:51, 11 June 2007 by Uo4Elp (talk | contribs)

cheap diazepam cheap xenical nokia ringtones qwest ringtones zanaflex online diazepam online verizon ringtones free motorola ringtones order lortab prozac online ericsson ringtones but ortho cheap cyclobenzaprine cheap celexa free ringtones phentermine free cool ringtones cheap prozac free qwest ringtones cialis online sprint ringtones nexium online real ringtones sagem ringtones tracfone ringtones free nokia ringtones free punk ringtones mp3 ringtones sony ringtones ativan online but hgh free midi ringtones alltel ringtones cheap flexeril sony ericsson ringtones motorola ringtones vicodin online free tracfone ringtones buy soma levitra online free motorola ringtones cheap didrex cheap sildenafil pharmacy online online zoloft online hydrocodone online free sony ringtones cingular ringtones viagra buy paxil ambien online buy lortab order hydrocodone vigrx online cheap ativan hgh online sildenafil online buy viagra ortho online nextel ringtones lisinopril free funny ringtones free sony ericsson ringtones buy vicodin hydrocodone order ativan mono ringtones clonazepam levitra free sprint ringtones cialis online sony ringtones cheap levitra zanaflex online phentermine celexa online ultracet online wwe ringtones free sharp ringtones buy norco soma online cheap ultracet free cingular ringtones cheap adipex cheap xenical cheap albuterol cheap tenuate cheap ortho free music ringtones sagem ringtones cheap lisinopril meridia online cheap propecia cheap vigrx cheap diethylpropion cheap albuterol mp3 ringtones meridia online free ringtones cheap ultram soma online cheap lortab cheap sildenafil free nextel ringtones cheap lorazepam free funny ringtones diethylpropion online free ringtones funny ringtones cingular ringtones cheap soma nokia ringtones clonazepam online zyban online clomid online buy prozac online valium order lisinopril meridia online buy tramadol sharp ringtones free midi ringtones flexeril online real ringtones celexa online zoloft online free nextel ringtones ericsson ringtones free music ringtones mtv ringtones order ultram buy valium viagra online lorazepam online cheap cialis cheap phentermine buy nexium samsung ringtones cheap norco meridia online sprint ringtones buy rivotril order carisoprodol carisoprodol online cyclobenzaprine online free qwest ringtones free qwest ringtones cheap fioricet verizon ringtones punk ringtones cheap hoodia pharmacy online online tracfone ringtones tramadol cheap rivotril tramadol online didrex online cheap fioricet music ringtones cheap albuterol free nokia ringtones buy viagra buy alprazolam buy xenical pharmacy online online free funny ringtones order zanaflex free ericsson ringtones cyclobenzaprine online adipex online cheap xanax free alltel ringtones free qwest ringtones ultram online sonyericsson ringtones free samsung ringtones cheap lortab free mono ringtones free samsung ringtones zyban online cheap celexa free funny ringtones wwe ringtones cheap rivotril but clomid buy fioricet buy hgh cheap lipitor cheap hoodia clonazepam online cool ringtones tenuate online cheap vicodin real ringtones free sonyericsson ringtones buy hoodia buy tramadol nextel ringtones cheap alprazolam ambien online

This article contains information for Programmers working or interested in working for The Mana World

Introduction

The point of this article is to bring communication and several mechanism related issues together. Currently some loose suggestions about certain specific problems exist in other articles, which should be linked from here. This article should become a replacing coherent piece, readying us for implementation of the system in both server and client.

Articles currently replaced by this article:

A sketch of the situation

Situation-sketch.png

This sketch implies several things:

  • Pixel coordinates are used instead of tile coordinates
  • We choose ovals to describe the collision area of beings, which are 4:3 to accomodate for a camera which in theory watches the scene at a 45 degree angle
  • Map obstacle layer definition doesn't change
  • Pathfinding could still be based on map coordinates being collisions (but would be nicer if more smooth)

Important is to think about how this connects to the incoming and outgoing messages about being movement (see below) and how hit and collision checking is done (see pixel based players in a tile based world and realtime action combat protocol).

Finally we need of course to determine what the server will do each tick. Specifically how will we manage to keep down being movement related CPU usage while still having smooth and responsive being movement on the clients? Some things discussed:

  • Like eAthena, we will not take dynamic collisions with other beings into account on the server. This keeps down complexity, while at the same time solving problems with getting stuck because of a monster that is in the way or because of an annoying mob of players.
  • The server will only do tile-based pathfinding and collision detection. This should be enough to verify the player move and to estimate the position.

Communication

Client-server

From client to server, we've so far been agreeing on sending the target coordinates and some flags about how to get there (walk, run, jump, ...). This will be sufficient for both mouse and keyboard player control. However, two things I want to note about using this message:

  • A change in only direction cannot be communicated. I suggest we use a separate message for it, because I do think it is relevant.
  • No being ID is communicated, so this message assumes the client is in control over a single being (the player character). When we want to allow clients to control multiple beings (like a herd or a player's pets), we'll need to introduce a new message for this. I think this is ok.

The following message definitions follow the naming convention used in defines.h in the tmwserv module. The last two are a proposal for later and don't have to be implemented now.

0x0260 - PGMSG_PLAYER_MOVE         { W x, W y, B flags }
0x0270 - PGMSG_PLAYER_CHANGE_DIR   { B new_dir }

0x0280 - PGMSG_BEING_MOVE          { D beingId, W x, W y, B flags }
0x0290 - PGMSG_BEING_CHANGE_DIR    { D beingId, B new_dir }

The W stands for a word and is a 16-bits integer. The maximum pixel coordinates are thus 65535, which makes 2048 tiles our maximum map dimension. A 2048x2048 map takes 16 MB per layer, so this seems like a reasonable limit.

Server-client

Many beings are moving around on the map and it has been suggested to pack these updates in a single message towards the client in order to save on overhead. Also, we keep relying on pathfinding at the client in order to keep traffic low.

0x0202 - GPMSG_BEINGS_MOVE         { [ D beingId, W cx, W cy, W tx, W ty, B flags ] * }

The number of being updates in the message can be determined by the message length, since a single being update has a fixed size. For each being it gives the ID, the current coordinates, the target coordinates and the flags about how the being is moving.

Use case: client -> server -> clients

  • The client initiates a move, either by keyboard or mouse. The above PGMSG_PLAYER_MOVE is sent to the server with the target coordinates. The player will start moving along a locally calculated path instantly.
  • The server verifies the move by calculating a path from the current player coordinates to the target coordinates. The path will be calculated based on the tile grid and only takes into account map collisions, and the start and end will be adjusted to the pixel coordinates. The sole purpose of this is so that the server can verify that the move is possible, how long it takes and estimate where the player should be with reasonable accuracy.
  • When a valid move, the server communicates it to all clients that are near in its original form (with the same target coordinates that it received itself). This happens as part of a GPMSG_BEINGS_MOVE message.
  • The clients receiving this message will calculate a detailed path to the target coordinates and start moving the being along it. When the original position included in the message is too different from the current position of the being on the client, a quick correction is done before calculating the path.