UClient - Trying to be More than Isometric

by Karsten-Olaf Laux

This heading might sound strange to many of you, but after I have described what uclient is and what you are able to do with it, I will explain in short terms how uclient works. So at the end of this article you will probably understand the words "more than isometric".

UClient is one of many clients being developed for Worldforge; as part of the demo release it is meant to be a client for the QServer2 gameserver. The gameworld is presented neither in a real three dimensional nor in a plain two dimensional way, but in a mixture of both usually called isometric perspective. Diablo and Jagged Alliance are games which use this type of graphic engine. The client/server pair QServer2 and UClient enable you to login to a gameserver somewhere in the internet and either to take over control of an existing character or to create a new character. When you are controlling a character, you may walk or run around in a small house with a garden in front of it and meet other player characters. Press '8' on your numpad once to start walking; if you press it again, your character will start to run. Pressing '2' will slow down and '5' lets your avatar stop immediately. You may use '4' and '5' to change the heading. Note that you have to use the numpad keys.

If you want to chat, you have to move down the mousepointer to the bottom in order to enable the input line. Type in your words and finally press enter; the text will appear on the screen of all players nearby. It will stay there for about twenty seconds. Furthermore you may make screenshots of the display by pressing the "Print" key on your keyboard.

The protocol between QServer2 and UClient is not highly optimized, but we managed to reduce the needed bandwidth to about 1K/s, thus playing over a 33600bps modem works quite fine. The server sends about five updates per second, but UClient updates the screen up to a maximum of 50 times per second, so it has to calculate the positions of the characters between two server updates by itself. The current implementation works quite well, however the higher the connection lag gets the more jumpy the character movements become. This issue is not as easy as it seems, because there is always a time lag between server and client. So for example if your character walks, it moves 20 pixels per 200 miliseconds, furthermore lets assume a connection timelag of 100 miliseconds, which is quite realistic. When you are walking and press stop, the appropriate command reaches the server 100ms later. The server calculates your new position, which is obviously 10 pixels away from the position where you pressed stop and then transmits this position back to the client. Finally the client gets this position update another 100ms later, but meanwhile the character has moved another 10 pixels, so it has to jump back 10 pixels. You might imagine the situation if the lag becomes even bigger. The gamedata sent by QServer2 is organized in entities, every unit in the game is an entity, for example a character, a tree, a part of a wall, etc. Every entity has it's own position in the virtual 3D gameworld. UClient tries to figure out in which order the entities have to be blit to the screen, so that everything looks correct. Since it calculates with 3D vectors, UClient is more a 3D client, which renders the gameworld to a fixed isometric perspective. The current implementation is far from perfect but for simple maps it works with sufficient precision.

The current aim in UClient's developement is to divide the code into more or less independant modules, which may be seperately worked on.