Introduction

posted in trill41 for project ABx
Published August 28, 2018
Advertisement

A game server written in C++ from scratch. The game client uses Urho3D.

Current Features

  • Uses a single TCP stream for the game protocol. This is not a shooter or action game, more like a classical online RPG.
  • Database back-end is currently MySQL (PostgresSQL and ODBC is also implemented).
  • Instanced world.
  • Encrypted Game and Login Protocol.
  • Spawn any number of server which may have heavy load (game, file server) even on different hardware.
  • Local (map), Guild chat and whisper is currently working, even across different game server.
  • Static objects are directly loaded from Urho3D's scene files.
  • Navigation using Recast/Detour.

ETA

In 100 years.

Credits

Server

Client

Terrain

I have been playing around with terrains and heightmaps. Creating heightmaps from bitmaps is very easy, color values basically correspond to altitude values. So you can generate an array with width * height elements with the height values, and with some simple calculations you get for every possible world position (x, z) the height (y).

But at the moment it seems the server heightmap is slightly different to what Urho3D generates ;(: Video

Finally this is fixed, the character sticks now exactly to the terrain.

Cluster

What we see here is a ABx server cluster. Since the server is built as a set of micro services it is easy to make a cluster.

abschema.png.134b3fbd976225ff065b53769549b3ce.png

abcluster.thumb.jpg.4b7d16c36d360b57f6bdc4c23a70309d.jpg

The screenshot shows three clients where one is connected to a different game server (Sun Shine) and whisper (blue) and guild (green) chat is still working (cross server chat).

All the communication is done via TCP/IP so each server can be on different hardware. The login server is also some sort of load balancer since it redirects the game clients automatically to the game server with the least load.

Data Server

The Data server provides data from the database server and caches it. It also acts as thread-safe inter-server shared memory.

There can be only one data server. It is the central point to which all other servers connect, and get their data from. This makes it possible to spawn any number of game server and they all share the same data.

File Server

The file server is a simple HTTP server providing files and other information. The client may connect to it from time to time and download data.

There can be any number of file servers. Usually you may want to have file servers in different regions, and not on the same machine. A file server does not need much resources, just bandwidth.

Login Server

Used by the client to login, create accounts and manage characters.

It also tells the client to which Game and File Server to connect. The client can query this server for available game server so it can connect "manually" to a certain game server.

There can be only one login server, since all clients connects to this server. However, there is an optional TCP (Layer 4) load balancer/proxy server (ablb), which makes it possible to have several Login Servers.

Once the client is authenticated, the connection to the login server is closed.

Game Server

The game server simulates the games. There can be any number of game servers, but if they run on the same machine, the game servers must listen on different ports.

Since all game server connect to the same data server, all game server share the same data. Because this game is designed to have an instanced world, several game server instances appear to the player as one game server. It is even possible to change the game server with a simple menu click.

Message Server

This one is for inter server communication, for example to deliver messages from a player to another player on a different game server.

It is also used to push notifications (e.g new mail) to the player.

1 likes 2 comments

Comments

jbadams

Another Urho user, we have a couple here - how have you found it to work with?

I hope your project will take less than 100 years! :)

August 31, 2018 10:58 AM
trill41

Oh, Urho is awesome! It's really easy to use, has everything I need, the code is very clean, even I can understand it. In my opinion one of the best "Code-First" Engines out there.

Well, I think the 100 years is a realistic estimation (although I'm not good in estimating things). It's just huge, and I lack most of the required skills (Story, 3D modelling, animating, texturing, sound/music), I'm just a programmer.

Thanks for your comment :)

August 31, 2018 11:37 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement

Latest Entries

Advertisement