https://github.com/benruijl/quakemonkey
An implementation of the Quake 3 network code for jMonkeyEngine. This extension builds on top of the original Message protocol.
https://github.com/benruijl/quakemonkey
Last synced: 7 months ago
JSON representation
An implementation of the Quake 3 network code for jMonkeyEngine. This extension builds on top of the original Message protocol.
- Host: GitHub
- URL: https://github.com/benruijl/quakemonkey
- Owner: benruijl
- License: mit
- Created: 2012-08-08T17:52:25.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2014-01-17T08:36:40.000Z (almost 12 years ago)
- Last Synced: 2023-03-11T02:48:05.031Z (over 2 years ago)
- Language: Java
- Homepage:
- Size: 145 KB
- Stars: 14
- Watchers: 3
- Forks: 7
- Open Issues: 2
-
Metadata Files:
- Readme: README.textile
- License: LICENSE
Awesome Lists containing this project
- Awesome-JMonkeyEngine - QuakeMonkey
README
h1. 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":http://fabiensanglard.net/quake3/network.php.
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.
h2. 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
h2. Example code
The following shows how to use quakemonkey in your code. For a full example, see the _example_ directory in the git repository.
h3. Server code:
bc. DiffClassRegistration.registerClasses();
myServer = Network.createServer(6143);
diffHandler = new ServerDiffHandler(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@.
h3. Client code:
bc. 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@.