Giter Club home page Giter Club logo

quakemonkey's Introduction

What is quakemonkey?

Quakemonkey is an implementation of the snapshot protocol used in the successful Quake 3 engine, built on top of the existing jMonkeyEngine networking framework. In short, this UDP-only protocol sends partial messages to each client in order to save bandwidth. These partials are created from the difference at byte level of the current message and the message that was last received by the client. For a more detailed overview, see this webpage.

Quakemonkey makes your life easier, because you don’t have to figure out for yourself which values in your gamestate have changed and create partial messages for each to save bandwidth. You can just send a big gamestate message, and quakemonkey will take care of the rest.

Features

Because the snapshot mechanism is implemented at byte level – i.e. when the messages are serialized to a byte buffer – no modifications to your messages are required to use quakemonkey in your existing code. It just works!

Summary:

  • UDP-only: fast connections
  • Delta messages: smaller packages
  • Byte-level deltas: invisible to user
  • No need to split up master gamestate
  • Built on top of existing framework
  • Easy way to check if client is lagging

Example code

The following shows how to use quakemonkey in your code. For a full example, see the example directory in the git repository.

Server code:

DiffClassRegistration.registerClasses();
myServer = Network.createServer(6143);
diffHandler = new ServerDiffHandler<GameStateMessage>(myServer);
myServer.start();
diffHandler.dispatchMessage(myServer, Filters.in(myServer.getConnections()), newMessage);

This should look like the code you already have. The only thing that changes is that a ServerDiffHandler is created and that the message you want to follow the quake protocol is broadcast by diffHandler.dispatchMessage.

Client code:

diffHandler = new ClientDiffHandler<>(myClient, GameStateMessage.class);
diffHandler.addListener(this); // register listener for GameStateMessage

The client code is even easier: instead of registering a listener for the class GameStateMessage in the client class directly, this is done through the ClientDiffHandler.

quakemonkey's People

Contributors

benruijl avatar

Stargazers

Ali-RS avatar

Watchers

Ali-RS 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.