Divicus MMOGame [Updated 11-April-2013]

Divicus MMOGame

Some of you might remember the video my co-worker Nader Sleiman put up some months ago (April or so),
showing an early testing video, but I will create a new thread where I can post our recent development progress.

The game we are working on is a server/client game which should support a high number of players per server.
In order to do so, the sizes of messages needs to be kept to a minimum while still keeping the game hack-safe,
which is a tough issue to tackle, which makes it all the more interesting to develop.

The intentions is to make it an applet game, available from a website.

You will notice from the pictures that we have not yet focused so much on graphics and interfaces as I believe
the most important thing is to have a good ground to stand on, both in regards to game flow and networking.

Login (simple virtual database for now)
Caching (server / client)
Player movement
Player projectiles
NPC movement
Damage to NPC/Players
Region synchronization
Procedural loading of regions/entities
Levelling up
Simple weapon handling (no visual)
Server side combat handling
Inventory handling
Equipment handling (ItemMasks limits where items can be put)
Global ground items
Dynamic skill attributes
Special abilities item interface
ItemInterface masking

Online client
Works whenever client/server is at same version,
sometimes I’m working alot on the server side,
then slight differences might occur and it will be unavailable
until client has been updated again.

Recent screenshot


And finally, I must say that working with JME is delightful, everything is behaving just as I’d like it to (touch wood).
Hopefully this game will be open for testing rather sooner than later.

Over and out,


Ok uploaded a stable client version to the webserver now.

You might notice a slight delay when moving over regions at the moment,

due to the fact that worldobjects (trees) are not optimized and is using

a pretty high poly model at the moment.



A simple temporary server monitor which allows to easily monitor the world along with its

entities and their movements. A handy NPC spawner is also used during testing.


This is how the game looks currently, everything being networked to look the same

for all active players.


For an understanding of how the project is structured, I will show you the project setups.

Most of you will get a good idea of what contains what and what each package represents/is used for.

Essentially the entire project is divided into three parts,

Common: Everything and anything both server and client needs to have information about,

for example network messages, caches and entity definitions.


Server: The server application, connecting all the clients together and managing the backend game

environment (no physics)


Client: The client application, representing the virtual world as pictured by the server.



In order to understand how the procedural region loading works, I’ll illustrate it with an image.


The green grid is region borders and white is tiles.

At any point of time, no more than 9 regions will be loaded, once you move to a new region, the non-neighbors

will be culled out and new region data will be recieved from the server.


looking good, keep up the good work! and thanks for the detailed information

I look forward to seeing your progress :slight_smile:

+1 for the concept and +1 for the background-information. Looks promising.

Nice. Looks like a lot of fun playing around with, even at this point. Good luck.

Cool! All the best with this.

For anyone who wants to try it out in its current state, I’ll be hosting the server over night.

Please let me know what you think and give me suggestions for improvement.

And if you find any particular bugs, such as exceptions or failure to synch please let me know.

The applet loader might be problematic at times, if so just reload the page (:x)

Divicus MMOGame - Client Applet

Edit: Oh and you create the account as you login at the moment.

Urr noticed something bad about objects when crossing regions after restructuring the entity add/update methods.

Doesnt recognize that it already knows about it and requests update from server.

Ah well more work for tomorrow :).

Do you plan to release later only as applet or also with webstart?

Applets cause problems if you use a 32bit browser (and most are) and a 64 bit java.

Also i personally wouldn’t want to install a 32bit and change the default path, as then everything else will use it as well.

why is ur site, hosted on a runescape botting site :?

@EmpirePhoenix said:
Do you plan to release later only as applet or also with webstart?

Applets cause problems if you use a 32bit browser (and most are) and a 64 bit java.

Also i personally wouldn't want to install a 32bit and change the default path, as then everything else will use it as well.

Probably applet only, and for the 32/64 issue, you would just install 32 bit jre plugin for chrome, no need to change the path, and it should be loading using 32 bit java.

@wezrule said:
why is ur site, hosted on a runescape botting site :?

I learned java from playing around with that.

so your the person who ruined runescape for me as a kid! :frowning:

@perfecticus said:
Urr noticed something bad about objects when crossing regions after restructuring the entity add/update methods.
Doesnt recognize that it already knows about it and requests update from server.

Ah well more work for tomorrow :).

Was setting bad names on the WorldObject entities causing the worldmanager not to recognize that the object had been added previously.
Should no longer re-add the same objects when running over region borders.

@wezrule said:
so your the person who ruined runescape for me as a kid! :(

Hehe if you would like to blame it on one person, sure.
The main reason why it went down was due to the free bots though, which anyone could use without limitations (cough chinese gold farmer companies).

Been tearing my hair for so many hours today over nifty.

Implementing a log in screen was simple enough and done yesterday,

but getting this chat window to work just got ahead of me.

Struggled trying to find examples all over the web to no prevail.

Seemingly the builds are substantially different, rendering the examples hard to understand.

Anyhow after several hours I finally managed to make a simple Chat appstate. Hurray!

Next up is a dummy equipment inventory!


Simple elements are used with backend using ScreenController to manage the states of each control.


[xml]<?xml version=“1.0” encoding=“UTF-8”?>

<nifty xmlns=“http://nifty-gui.sourceforge.net/nifty.xsd


xsi:schemaLocation=“http://nifty-gui.sourceforge.net/nifty.xsd http://nifty-gui.sourceforge.net/nifty.xsd”>

<!-- +++++++++++++++++++++++++++++++++++++++ -->

<!-- load default styles and controls -->

<!-- +++++++++++++++++++++++++++++++++++++++ -->

<useStyles filename=“nifty-default-styles.xml” />

<useControls filename=“nifty-default-controls.xml”></useControls>

<!-- +++++++++++++++++++++++++++++++++++++++ -->

<!-- start screen -->

<!-- +++++++++++++++++++++++++++++++++++++++ -->

<screen id=“chat” controller=“com.divicus.client.appstates.ChatState”>

<layer id=“layer” childLayout=“center”>

<panel id=“dialog” style=“nifty-panel” childLayout=“vertical”

width=“340” height=“150” align=“left” valign=“bottom”


<panel childLayout=“vertical” height=“80%” align=“left”


<control name=“label” width=“100%” id=“chat_line0” align=“left”

valign=“bottom” textHAlign=“left” height=“14” />

<control name=“label” width=“100%” id=“chat_line1” align=“left”

valign=“bottom” textHAlign=“left” height=“14” />

<control name=“label” width=“100%” id=“chat_line2” align=“left”

valign=“bottom” textHAlign=“left” height=“14” />

<control name=“label” width=“100%” id=“chat_line3” align=“left”

valign=“bottom” textHAlign=“left” height=“14” />

<control name=“label” width=“100%” id=“chat_line4” align=“left”

valign=“bottom” textHAlign=“left” height=“14” />

<control name=“label” width=“100%” id=“chat_line5” align=“left”

valign=“bottom” textHAlign=“left” height=“14” />


<!-- Text input -->

<panel childLayout=“horizontal” width=“100%” valign=“bottom”>

<control name=“textfield” id=“text_input”></control>

<control name=“button” id=“send_button” label=“Send”>

<interact onClick=“sendMessage()” />








[java]package com.divicus.client.appstates;

import com.divicus.common.game.components.constants.player.MiscCommand;

import com.divicus.common.game.components.definitions.entities.PlayerDefinition;

import com.divicus.common.networking.messages.chat.ChatMessage;

import com.jme3.app.Application;

import com.jme3.app.state.AbstractAppState;

import com.jme3.app.state.AppStateManager;

import com.jme3.input.controls.ActionListener;

import de.lessvoid.nifty.Nifty;

import de.lessvoid.nifty.controls.Button;

import de.lessvoid.nifty.controls.Label;

import de.lessvoid.nifty.controls.TextField;

import de.lessvoid.nifty.input.NiftyInputEvent;

import de.lessvoid.nifty.screen.KeyInputHandler;

import de.lessvoid.nifty.screen.Screen;

import de.lessvoid.nifty.screen.ScreenController;

public class ChatState extends AbstractAppState implements ScreenController, ActionListener {

private static GameState gs;

private Nifty nifty;

private static TextField textInput;

private static final int CHAT_LINES = 6;

private static Label[] chatLines = new Label[CHAT_LINES];

private static Button button;

private static String message;

private static boolean send;

public ChatState() {


public ChatState(GameState gs, Nifty nifty) {

this.nifty = nifty;

this.gs = gs;







public void initialize(AppStateManager stateManager, Application app) {

super.initialize(stateManager, app);



public void update(float tpf) {


if (send && message != null && message.length() > 0) {

PlayerDefinition player = ((PlayerDefinition) gs.player.def);

String tempMessage = message.substring(0, message.length() < 30 ? message.length() : 30);

appendMessage(player.getPlayerName(), tempMessage);

gs.getClient().send(new ChatMessage(player.getPlayerName(), tempMessage));


send = false;




public void onAction(String action, boolean pressed, float tpf) {

switch (MiscCommand.getCommand(action)) {

case ENTER:

if (pressed) {

if (textInput.hasFocus() && textInput.getText() != null) {



} else {









public void onStartScreen() {

textInput.getElement().addInputHandler(new KeyInputHandler() {


public boolean keyEvent(NiftyInputEvent inputEvent) {

if (inputEvent == null)

return false;

System.out.println(inputEvent + " " + inputEvent.getCharacter());

if (inputEvent.getCharacter() == NiftyInputEvent.SubmitText.getCharacter()) {

if (textInput.hasFocus() && textInput.getText() != null) {




return true;


return false;





public void bind(Nifty nifty, Screen screen) {

textInput = screen.findNiftyControl(“text_input”, TextField.class);

for (int i = 0; i < CHAT_LINES; i++) {

chatLines = screen.findNiftyControl(“chat_line” + i, Label.class);


button = screen.findNiftyControl(“send_button”, Button.class);





public void onEndScreen() {



  • Sends a message to the chat area


    public synchronized void sendMessage() {

    message = textInput.getText();

    System.out.println("Sending message: " + message);

    if (message != null) {

    send = true;



    public synchronized void appendMessage(String author, String message) {

    Label line = chatLines[CHAT_LINES - 1];

    if (line.getText().isEmpty()) {

    line.setText(author + message);

    } else {

    for (int j = 0; j < CHAT_LINES - 1; j++) {

    chatLines[j].setText(chatLines[j + 1].getText());



    line.setText(author + ": " + message);



    public void stateAttached(AppStateManager stateManager) {


    nifty.fromXml("Interface/chatcontrol/chat.xml", "chat");



    public void stateDetached(AppStateManager stateManager) {






    Over and out

Recorded a simple video of current progress.

Disabled NPC movement as I’m still uncertain how I’m going to manage it.

The program I used to record caused the fps to drop alot, hope you still

get an idea of how it works atm.

The gameplay is very sandbox mode at the moment as you can see by the stat attributes

incrementation and the rate of levelling.



Been messing around with nifty a bit and started to build up an inventory.

Currently draggin/dropping/moving/swapping works.

Also been working a bit on the map and thinking about how I swiftly can build it up and modify it.

Currently using photoshop to build heightmap/alphamap using the slice feature to split them

into smaller region pieces.

Getting some small issues at region borders when not using flat landscape, unsure how to solve that.

Tested loading a large map instead of smaller regions, but not sure if its the way I want to go.

Using a kind of terrain grid structure atm.


A little status update.

Work the past week:

  • Went back to single terrain quad for map

  • Implemented a placeholder map with height

  • Implemented inventory + equipment (networked actions)

  • Statistics for character (attributes)

  • Level progression statistics

  • Started working on a minimap

  • Playing around with particle emitters for effects

Next on list:

  • Ground items

  • Dynamic stat attributes

  • Additional work on current content

Current visuals