12.07.2015 Views

Implementation of a Peer-to-Peer Multiplayer Game with ... - DVS

Implementation of a Peer-to-Peer Multiplayer Game with ... - DVS

Implementation of a Peer-to-Peer Multiplayer Game with ... - DVS

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

A Source Code ExtractsA.1 Simulation: <strong>Game</strong> Main Code#include Listing A.1: simnode.cpp#include "anyoption.h"#include "event.h"#include "irrlichtdev.h"#include "implgameinstance.h"#include "irrlichttimer.h"#include "bstimer.h"#include "groupnetworkengine.h"#include "cuspclientservernet.h"#include "p2networkengine.h"#include "simpleai.h"// startNode() function exportextern "C" {void startNode(const char* peerAddr , const char* gatewayAddr);}struct MainContext{IrrlichtDev* device;<strong>Game</strong>Instance* game;<strong>Game</strong>Timer* timer;EventManager* eventMgr;NetworkEngine* networkEngine;<strong>Game</strong>AI* ai;};MainContext(): device(NULL), game(NULL), timer(NULL), eventMgr(NULL),networkEngine(NULL), ai(NULL) {};void connectCallback(bool result , void* userData){assert(userData);MainContext* ctx = (MainContext*) userData;if (result) {// gameprintf("Init game...\n");ctx ->game ->init(ctx ->device , ctx ->timer , ctx ->eventMgr);A Source Code Extracts 87

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!