Saturday, November 30, 2013

Java EE Architecture with Firebase

The architecture for our game probably would be different from a typical Java EE architecture (displayed below) due to of firebase. 



A typical Java EE application architecture

There are a few technique how to do asynchronous communication between clients and server (Websockets, AJAX).

The basic usage of Firebase is on client tier (JS), in this scope we don´t need Data Tier and Bussiness Tier from image above. We can only post HTML page with JS to client and then everything is let on clients web browser. At first user log in (firebase support simply login) and then only communicate with firebase.

In our project is nessesery server synchronization, so that  there is Firebase like a serial bus.
1, choice - firebase like a serial bus and main datastorage. Server reads from queue (first firebase) and counts using date from firebase. Then push data to second firebase for showing at client.
Here could be a typical Java EE architecture, but there is a problem with asynchronous getting data from firebase. Solution is waiting for data - that will be very slowly when you will need a lot of diffrent data from firebase for counting (solution should be a DTO).
The another solution is change architecture a little bit. Before Service layer add new layer, which prepare data for service layer. So service layer use dao layer only for create, update, delete.

2, choice - server reads from queue but counts from his local data (in-memory,rdbms) which it reached from firebase callbacks before. This is very efficient concept. But it dont be using scaling of firebase. And my master thesis is about firebase.

I decide to use the first choice. And data from firebase load and write throught prepare data/service/dao tier.

Sunday, November 17, 2013

Isometric front-end

My topic for master thesis is Firebase. But for displaying data we have to deal with front end. It is possible to use some table for displaying output data. But it will be much more prettier to use isometric engine.

There are a lot of isometric engine. Some of them are for free and the others for purchase.
http://www.isogenicengine.com/
http://craftyjs.com/
etc...

https://code.google.com/p/jgen/ - there is not very good documentation and it doesn´t work in all major browsers.
http://www.prelude-prod.fr/demo/pp3diso/ - very simple, but there are some limitation (described at projekt page)

For our project the most suitable seems to be Sheetengine (dynamic loading, rendering with zoom, etc.).
There is a documentary on home sites as well as a project crossyard with tutorial for developers.

We will need to change engine for showing textures:
For anyone else needing textured base sheets, I changed line 738 in sheetengine.js to the following:
if(basesheet.img) {
  ctx.drawImage(basesheet.img, 0, 0, basesheet.width, basesheet.height);
} else {
  ctx.fillRect(0,0,basesheet.width,basesheet.height);
}

Sunday, November 10, 2013

We publish source code on GitHub.com

You can find it here. There is the first commit with initial source code and some hello TTDMMO page.
There was a little issue with setting commiter in NetBeans. The solution is to add lines below to your local .git/config file. 

[user]
    name = lastuvka
    email = xlastuvka@gmail.com

There was also created new action (specific in nbactions.xml) for deploying frontend on WildFly 8.0.

<?xml version="1.0" encoding="UTF-8"?>
<actions>
    <action>
        <actionName>CUSTOM-deployToJBOss</actionName>
        <displayName>deployToJBOss</displayName>
        <goals>
            <goal>jboss-as:deploy</goal>
        </goals>
    </action>
</actions>

Thursday, November 7, 2013

Which IDE with WildFly?

In our project we will use a WildFly 8.0 server. It can be downloaded from here.  there is not "Getting started" for 8.0 because it´s a Beta version. However you can use a manual for AS 7.0. There is how to run server or create new user (admin).
The question is, whether use command line + NetBeans, eclipse with JBoss Tools or JBoss Studio to deploy our project.

For deploying we will use plugin for maven jboss-as.

Process throw the command line is clear. Above is manual to start server and maven plugin jboss-as. When you go to the directory with project and run command mvn package jboss-as:deploy (next time you can run command mvn jboss-as:deploy to redeploy) and in browser (localhost:8080/your-app/) you should see your app.

JBoss Studio
You can download it here. It´s based on Eclipse. So the using of WildFly here is very similar to using it in Eclipse with JBoss Tools plugin. Eclipse will be probalby better for us because it is much more general.

Eclipse
How was meantioned above, there is JBoss Tools plugin for eclipse. For starting server and deploy click on Run as... -> Run on Server. There is also plugin for GWT, thats why we will propably decide to use this.

The result of this article is use IDE as usually because the work is faster with known enviroment than the new one. Deployment is almost same. :)

Wednesday, November 6, 2013

Let´s start!

Our plan (and our master thesis) is to create a MMO game based on the same princip as Transport Tycoon.