Code documentation: Difference between revisions

From FreeAllegiance Wiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 22: Line 22:
== ZLib and Utility libraries ==
== ZLib and Utility libraries ==
== IGC library ==
== IGC library ==
<div style="display:inline; float:right;"><gallery widths="220px" heights="220px" perrow="1">
 
Image:IGCInterfaces.png|Class Diagram]
</gallery></div>
IGC stands for Internet Game Core. It's the game logic libray (API) and it's shared between clients and servers.
IGC stands for Internet Game Core. It's the game logic libray (API) and it's shared between clients and servers.


Line 33: Line 31:
It is called every [[ticks]] on the server and it's propagated in the various IGC object lists and update their states according to the game logic.  
It is called every [[ticks]] on the server and it's propagated in the various IGC object lists and update their states according to the game logic.  


<div style="display:inline; float:right;"><gallery widths="220px" heights="220px" perrow="1">
Image:IGCInterfaces.png|Class Diagram
</gallery></div>
When the game needs to create a new object, instead of instancing the object from scratch, the IGC library usually provides a 'template' for this object. The template holds several attributes that are used are initial values for the corresponding attributes of the new object. There can be many different templates for a given object type, the game must tell which template to use when creating an object. This how there can be different [[factions]] with different [[stations]], [[ships]] and [[weapons]].
When the game needs to create a new object, instead of instancing the object from scratch, the IGC library usually provides a 'template' for this object. The template holds several attributes that are used are initial values for the corresponding attributes of the new object. There can be many different templates for a given object type, the game must tell which template to use when creating an object. This how there can be different [[factions]] with different [[stations]], [[ships]] and [[weapons]].
For example, the class representing active missiles is ''CmissileIGC'', it uses the ''ImissileIGC'' interface and a new missile is initialized from a chosen CmissileTypeIGC (ImissileTypeIGC interface).
For example, the class representing active missiles is ''CmissileIGC'', it uses the ''ImissileIGC'' interface and a new missile is initialized from a chosen CmissileTypeIGC (ImissileTypeIGC interface). Check the IGC classes diagram for the list of all IGC interfaces including the template ones.


All these templates are stored in static lists of IGC objects and since they are statics, they're not transmitted between the server and the clients but instead are stored into what we call a [[core]] file. So a server only tells a client the core file name the game uses and the client will load it from its local artwork folder instead of receiving it over the network.
All these templates are stored in static lists of IGC objects and since they are statics, they're not transmitted between the server and the clients but instead are stored into what we call a [[core]] file. So a server only tells a client the core file name the game uses and the client will load it from its local artwork folder instead of receiving it over the network.

Revision as of 14:17, 17 May 2008

Allegiance Code Documentation


Overview

The key components of Allegiance are:

The client - Allegiance.exe the server - AllSrv.exe and the UI tool AllSrvUI.exe the lobby - AllLobby.exe

In a typical configuration, there are many servers and clients which connect to a single lobby. A server can host many games at once and a client can join only one server and one game at a time. The lobby is the central communication place where servers announce themselves (and the games they're hosting) and where clients can find, join or create games on a choosen server.

These keys components share many lines of code thru the use of common libraries. The most notable ones are the messsaging API library which is built on Microsoft DirectPlay and the IGC library which handles the game logic.

AllegOverview.png

Edit.png
Stub This article is incomplete

This is an article about a topic that should be covered in more detail by the FreeAllegiance Wiki, but is lacking in content.

You can help by improving it!


ZLib and Utility libraries

IGC library

IGC stands for Internet Game Core. It's the game logic libray (API) and it's shared between clients and servers.

IGC is accessed with of a set of hierarchical abstract classes (interfaces) that hold all the game objects (ships, stations, sectors,...) and their current properties (position, speed, ...).The top interface is ImissionIGC which represents a game. ImissionIGC is implemented in the CmissionIGC class (src\Igc\missionigc.cpp). It holds lists of all other objets (ships,stations,...) and provides methods for accessing them. These lists are all implemented with template classes (Slist_utl<> and Slink_utl<> which can be found in the Utility library).

The most notable method of ImissionIGC is the the 'Update' member method. It is called every ticks on the server and it's propagated in the various IGC object lists and update their states according to the game logic.

When the game needs to create a new object, instead of instancing the object from scratch, the IGC library usually provides a 'template' for this object. The template holds several attributes that are used are initial values for the corresponding attributes of the new object. There can be many different templates for a given object type, the game must tell which template to use when creating an object. This how there can be different factions with different stations, ships and weapons. For example, the class representing active missiles is CmissileIGC, it uses the ImissileIGC interface and a new missile is initialized from a chosen CmissileTypeIGC (ImissileTypeIGC interface). Check the IGC classes diagram for the list of all IGC interfaces including the template ones.

All these templates are stored in static lists of IGC objects and since they are statics, they're not transmitted between the server and the clients but instead are stored into what we call a core file. So a server only tells a client the core file name the game uses and the client will load it from its local artwork folder instead of receiving it over the network.

Since both server and client share the IGC code, there is the need for them to react differently when a change occurs. For instance, when a ship is destroyed, the client will need to draw the ship explosion while the server will not need to do this but instead it will propagate that event to the other clients (are at least all the clients which need to know about that explosion). So both client and server are 'consumers' of the IGC library.

Consumers of the IGC library must implement the IsiteIGC interface in order to called upon game state changes. The server implements it in the FedSrvSiteBase class and the client in the BaseClient class. We can view the IsiteIGC interface as an event callback function sets. Understanding how this works is the main step of understanding the whole IGC library.


Edit.png
Stub This article is incomplete

This is an article about a topic that should be covered in more detail by the FreeAllegiance Wiki, but is lacking in content.

You can help by improving it!


WinTrek - Allegiance Client

clintlib

graphic engine

effect engine

sound engine

FedSvr - Allegiance Game Server

The AGC Library

Lobby - Allegiance Lobby Server

Tools

XMunge

Pigs

mdlc

For how to use see mdlc.