Git Product home page Git Product logo

egp405replication's Introduction


Assignment 4: Replication
EGP-405-01
By David Jordan
Due 11/7/2016


To accomplish the replication, I chose to follow the slides by setting up a Replication Manager, equipped with a Linking Context and Object Creation Registry, to help automatically serialize/deserialize object states. The abstract GameObject class has virtual methods for serialize and deserialize, so subclasses (Archer and TownHall) are responsible for serial/deserializing themselves, given a bit stream and linking context. I also implemented RPC, using an RPC Manager. The single RPC I made is SpawnObject ('SPWN'), which takes a game object as a parameter. Clients can send SpawnObject RPCs to the server, where the game objects then get created, through the RPC's function.

The server program is what sets up the initial game state, creating the town hall and archer objects. Whenever a client connects, the server sends them a replication packet containing the entire game state. It also responds to RPCs in replication packets received from its clients.

A replication packet is a list of replication actions (either state-replication or RPC), which is terminated by a invalid action identifier. By having a list, multiple object states and/or RPCs can be sent in a single packet.

The client program will connect to the server, then receive a replication packet containing the entire game state. It will then ask for the name of a town hall to create through an RPC called "Spawn Object". After the RPC is executed on the server, another replication packet is broadcasted to all clients, updating their states after a new object was spawned. Lastly, the client disconnects after 1 second and prints its state, also outputting its state to a file called 'state.txt'.


NOTE: I decided for the names:
  'TownHall' instead of 'TownCentre'
  'Human'    instead of 'Werewolf'
  'Undead'   instead of 'Vampire'
  
  

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.