Big Bad World of Exercise: Backend Design

From EQUIS Lab Wiki

Jump to: navigation, search


Overview

The goal is to build a server component for The Big Bad World of Exercise, using C# (and its built-in LINQ database connector), MySQL, and JANUS.

The server program utilizes a number of JANUS time streams. These are objects that can be polled for their values in the present, past, and even in the future (through extrapolation) and anything in between (through interpolation). It uses these streams to represent entities, and client avatar positions. In using these, the data can be easily synchronized and communicated across the server and its clients.

Generally, the clients would send their avatar positions to the JANUS time streams, and those values would then be retrieved by the server. Using these coordinates, the server could then query the database for all the world entities that are relevant (seen or close to) the avatars, and put them into JANUS entity streams that correspond to each client. In this manner, each client could easily access the entities that are relevant to them.

This overview of a typical network cycle is represented in the diagram below:

Network.png

Regarding the classes at work in the network cycle, we need to take a closer look at the image below:

Server.png

Server

The server contains a working screen resolution (ScreenResolution), all of the client avatar positions (AvatarPositions), and a list of each relevant entity set (GlobalEntitySet).

It is able to add entities to the MySQL database (addFullEntity), generate the coordinate number of the zone an avatar is in (auraPos, more on that in Interest Management below), and using this is then able to generate the pixel coordinate range of its interest zone (topLeftInterest and bottomRightInterest being the bounds of the zone). It can also save entities that are already in the database (saveEntity), and backup the database into an XML file (saveDatabasetoXML). saveGenericList and saveEntityArgList are used for the purposes of reading an XML file into the database.

The main method is used to put everything together into a working server program.


entity

LINQ allows a C# program to load and refer to database records as objects. In this program, the entity class is the C# object representation of the EntityDatabase conceptual schema. As such it contains within it all of the fields of the database table that we use to store entities.

Other

GhostStream and EntityStream are examples of the different kinds of time streams that JANUS uses to represent data. GhostStream is used to keep track of the angle and coordinate positions of each of the client avatars. Both streams communicate with StreamServer, which is the core component of the JANUS program.


Finally it is important to define what is a "relevant set" for a client. In an online game world it is important to send a client only the objects that it needs, in order to maintain an ideal level of memory and network efficiency. In order to accomplish this we use a Square Tile Interest Management Algorithm, which partitions the game world into zones. The server retrieves all entities within the zones that are considered "of interest" to the client's avatar. That manner is demonstrated in the image below:

InterestManagement.png