Coder Social home page Coder Social logo

mazewar's Introduction

Introduction
============
This implements a client-server Mazewar game. 
Additionally, the MSocket class can be used to 
induce errors, such as adding delays and reordering packets.


Architecture
============
The server starts and listens on some port.

When a client contacts the server, the server spawns a 
ServerListenerThread. Server.java defines the MAX_CLIENTS constant 
that determines the maximum number of clients that join.

When the expected number of clients have contacted the 
server, the server spawns a single ServerSenderThreads, that broadcasts 
the name and location of all the clients (this requires that names
must be unique).

When an event happens, it is sent to the server. The server
stamps the event with a global sequence number and broadcasts to all 
hosts.

The client and server communicates using MSockets, and MServerSockets
which are analogous to Sockets and ServerSockets. MSockets are 
constructed by passing a host address and port. MSockets expose two 
main methods, readObject and writeObject to read and write objects, respectively. 

The MSocket can reorder packets and add delays based on 
3 constants defined in MSocket.java, namely DELAY_WEIGHT, DELAY_THRESHOLD, 
UNORDER_FACTOR. Errors are added both on sending and receiveing packets.


Making and Running
==================
To make the project run
make

To run the server:
</path/to/java/>java Server <listening port>

To run the clients: 
</path/to/java/>java Mazewar <server host> <server port>


mazewar's People

Contributors

karimfawzyg avatar mattmarji avatar

Watchers

James Cloos avatar  avatar  avatar

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.