Evolution of the Internet

Many moons ago, in the span of software development, I had built out a quick template of code using the latest and greatest frameworks at the time. This chapter in time was a set of java based frameworks to build a web application. In the need to know circle, I was using Spring for dependency injection, hibernate for object relational mapping, Java Server Faces 1.2(JSF) for controller/view with Primefaces for pretty view. That was the year 2011 so we are talking old school.

Since that time, JSF has gone to version 2.2. That is to be expected as APIs evolve. The only thing is this evolution portends another end to a model view controller framework. Developers went through a renaissance to separate the view from the controller even more. The reason for this acceleration was mobile devices. Mobile devices forced developers to think of the user interface as needing to be flexible to run on a minimalist screen size and at the same time look good on a desktop size browser. Yes, new word of the day became “Responsive Design”.

JSF was going to be the new darling in late 2010 allowing developers to drop components on a page to wire up a form or website and bind it to data models. Development of interactive websites were going to be much faster to develop. Redhat, who acquired JBOSS application server, and even started its own implementation to the JSF specification creating Richfaces. Yeah! More rich components to make awesome websites faster.

Yeah, that was a short lived experience as Richfacess hit an end of life June 2016 (RIP). Like I said in the beginning “many moons ago” is really short in software development land.

What happened is that with Jquery, aka javascript on steroids, and AJAX (more steroids for javascript). Developers realized they can let the User experience(UX) teams focus on the interface and make AJAX calls to the servers and not be bothered about doing a re-deployment of the application server.

This brings us to a point where web pages simply interact with application servers by making REST based calls. Developers only have to make REST services that mobile browsers, desktop web browsers, or even other applications can interact with business services. The internet has expanded once again from just being web pages. This allows it to go beyond to other devices and services running in smart devices.


Overlap2d Project setup

Overlap2d is a nice little alpha project as of this writing that allows designers and developers work together to put together games leveraging libGDX, Box2d. The goal is to show how to create a new project using the libGDX wizard and then make the necessary configuration changes to the project to incorporate the Overlap2D runtimes, which are not yet available as a library dependency as of this time. Welcome to alpha land!

Some key things to notes. The following assumes that Java SDK 1.7 is installed. LibGDX libraries, and Overlap2d runtime are downloaded. If the project is going to use Android get the latest SDK. One of the first things, especially if using the latest version of libGDX there are changes to use gradle builds. These steps demonstrate LibGDX version 1.3.1. This is newer than the Overlap2d runtime project dependency at this time.

First step is to use the LibGDX project wizard gui to create your project. In the Overlap2d tutorial there is more information. For this example we will build the desktop and android subprojects.

Once libGDX project setup runs and builds the subproject folders copy the Overlap2D runtime to your project as a sub project. The folder structure looks something like this:
Project structure

The next steps are to make adjustments to the main project and sub project build.gradle files. The first build.gradle file to edit is the overlap2d-runtime-libgdx-master subproject that was just copied into the project. The change in this file is to change the dependency for libGDX to the current version of libGDX. Change the line with gdxVersion=’1.2.0′ to gdxVersion=’1.3.1’. The result change looks like this:

ext {
    gdxVersion = '1.3.1'
    box2dlightsVersion = '1.2'
    reflectasmVersion = '1.10.0'

Go to the main top level project folder and edit the settings.gradle file. The settings.gradle tells the gradle build to include the runtime environment. When running multiple Overlap2d dependent projects in the same eclipse workspace and each project has an Overlap2d runtime dependency this can be configured in a couple of ways. This configuration steps assumes that each project has a subproject of the overlap2d runtime in them, therefore the compile project name is different to allow eclipse to import it without saying “the project dependency already exists”.

Add to the settings.gradle, the reference name  to the overlap2d and the subproject file information and save it. The complete file looks like this:

include 'desktop', 'android', 'core','Overlap2dSideRuntime'
project(':Overlap2dSideRuntime').projectDir = new File(settingsDir, 'overlap2d-runtime-libgdx-master')

Notice that the directory name of the Overlap2d runtime is kept the same. Just the project name reference is different.

Open the build.gradle in the same top project folder. There are two sections that need to change. The android and core project references need to be changed to include some dependencies for compiling.

In the “android” project dependencies section, add the box2d dependencies needed for the Overlap2D runtime, since Overlap2D is built against box2d version 1.2. The line being added to the dependencies for the android project is:

compile “com.badlogicgames.box2dlights:box2dlights:1.2”

The android project section change result looks like this:

project(":android") {
    apply plugin: "android"

    configurations { natives }

    dependencies {
        compile project(":core")
        compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
        compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi-v7a"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86"
        compile "com.badlogicgames.box2dlights:box2dlights:1.2"
        compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86"

The project “core” in this same file needs to also have reference to box2dlights version 1.2 and add in dependency to the Overlap2d runtime this example shows the renamed the project for compile as described in the settings.gradle mentioned above to the Overlap2d runtime subproject in the workspace:

project(":core") {
    apply plugin: "java"

    dependencies {
        compile "com.badlogicgames.gdx:gdx:$gdxVersion"
        compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
        compile "com.badlogicgames.box2dlights:box2dlights:1.2"
        compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
      compile project(":Overlap2dSideRuntime")

The final step is to import the new project into Eclipse. Make sure that eclipse has the gradle plugin. Then for the workspace select File > Import. In the import dialog, select Gradle > Gradle Project. In the “Import Gradle Project” dialog select the root folder of this project, and then click “Build Model”. This will then load the project and sub projects into the dialog. Select all the projects, and then select finish.

Eclipse Import

That should import all the projects. You can test running the desktop application and get the badlogic example, and you should be able to also build the android APK.