Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 06 Mar 2008
Offline Last Active May 31 2014 06:58 PM

Topics I've Started

Distributed multiplayer server pattern

18 March 2014 - 09:00 AM

Hey networking people, this may sound like an mmo question, and yes maybe it is, but I am doing it for science! Or at least considering it a project for next semester at my University.


You can skip the next three paragraphs if you just want to go to the question :)


So.. I'm very interested in alternative networking models especially the ones that don't trust their users! Recently I've been looking into ways of distributing (massive) multiplayer rpg servers. The current model I'm working on is based on splitting slow "macro" events from the faster "real time"  events. I categorize the two by whether other players care or not. With the exception of chat, where people usually care, but a delay on a second or two shouldn't matter (maybe I'll leave that out and add a dedicated chat server (but not important now)).


Macro: Inventory management and skill management are not important in the faster aspects of the game, meaning users can do their changes locally, and later (1-3 seconds) sync with the macro server. This doesn't work too well with consumables, as their effects are usually needed asap. Therefore I want to add a tiny inventory to the real time part of the game - think Project Zomboid, where eating an apple takes less than a second if your'e holding it, but if it's in you backpac you need a second or two to unpack it first.


Real time: this is where the game is running. Every player have their active abilities, stats, current hp/enegy, and a few quick items such as weapon, consumables and other usable equipment. The point about only having a tiny inventory is that this the inventory in general is unnecessary information for the server, and I would rather keep the player footprint as small as possible.



And now to the interesting part. I would like to distribute the real time servers to the clients (who I do not trust). The idea is to have the clients do the real time actions and keep players in sync, but still be as stupid as I can possibly make them. What I want to do is to let the client servers report the game state to a trusted master server every x seconds. The master server will then verify (or pass randomly selected states on to a verification server) and calculate the next actions for the client server.


The actions from the master server should be instructions for what the client server must do. This should be in the form of direct instructions mixed with a state machine for individual interactive objects/AI. This could be in the form of "the seed for the random gen is xx + package id", loot for all dead creatures, if (creature reaches 30% life) {it will flee}


I am planning to use some message signing so the client server can't lie to the master server about the actions of individual players.


My question is whether this has been done before (or rather links to games/people who have done this or similar before)? And what you generally think of the idea?


I would also greatly appreciate links to article of not so similar models, if you think it would be to use for me.



Error on "<=" in code block

02 October 2012 - 01:52 AM


I have just discovered that <= breaks my code blocks:
(source lang="csharp") if (x <= y) (/source)
[source lang="csharp"]if (x <= y)[/source]

Is this just me? I am using latest version of Chrome on Win7

My Nordic Game Jam 2011 game!

01 February 2011 - 09:51 AM

Hey I just skipped a night to make this game with my team, at Nordic Game Jam :D

We made a pretty cool two player maze game, where one player has to find the way through the maze, while the other has to keep the flash light on, by playing a small mini game.
Although it is intended as a two player game, it can be done alone :)

There is a fixed version, where we have updated the native LWJGL files, to work on Win64 and Linux (Mac and Win32 worked fine before). Nothing but the game engine has been changed though.

Enjoy :D

How many UDP ports should I use?

22 January 2011 - 06:06 AM

Hey all

I'm currently coding a reliable UDP network library, with a Diablo 2 like game in mind. I am also certain that my library, would be suitable for a small fps. But what I don't know, is how to manage my UDP ports on the server. Right now it uses one UDP port for everything. Would it be a good idea to distribute each client to its own UDP port? then I can "connect" the ports to their client (Do I get an advantages of that, I'm using Java and the nio package).

How many clients would it generally be a good idea to have connected to a single port?

Also I'm using a master server to make punch through, so I don't need to reserve specific ports to the game, I'll just let the OS give me whatever is available.

[java] My texture loader code is ugly!

25 October 2009 - 04:38 PM

Hey I've written my own texture loader for lwjgl. It works perfectly well, but I really don't like it :/ so does any of you guys know a better way to load an image, and save it into an int array (or a ByteByffer), without using any libraries other than whats in the jre, and without I need to write loaders for the specific file types? the part of the code, that I would like to rewrite:
Image img = Toolkit.getDefaultToolkit().getImage(path);

// make sure to load the image before continuing
// necessary for remote images
MediaTracker mt = new MediaTracker(new Panel());
mt.addImage(img, 1);
try {
} catch (InterruptedException ex) {
	Log.error(path.toString() + " could not be loaded");

// get the nearest power of two values
int width = powerOfTwo(img.getWidth(null));
int height = powerOfTwo(img.getHeight(null));

BufferedImage bimg = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);

// this is the part i really don't like!
// isn't there an other way to go from Image to int array?
bimg.getGraphics().drawImage(img, 0, height - img.getHeight(null), null);
int[] rgbaArray = new int[width * height];
bimg.getRGB(0, 0, width, height, rgbaArray, 0, width);

hope anyone can help :)