As you may know, we are publishing our games in two formats, Applets and Webstart. Applets works in a similar fashion as a Unity or Flash applications does, you open the web page and the game loads inside it. Webstart applications starts as a desktop application, outside the browser.

In this post we will explain how we deal with Java Applets. One thing we didn’t like about applets is that they starts as soon as you visit the page, sometimes you want to visit a game page only to see some information or read comments, etc.

We created a workaround for that, it consists in showing a game’s screenshot with a text “click to play” and whenever a player clicks on it, the game is started.

Implementation

Our solution consist in a css with the styles to show the screenshot with the text and a javascript with the logic to change the screenshot with the Java Applet.

First we have styles to show the text over the screenshot and highlight it whenever the user moves the mouse over it.

Style:

.play {
	display:block;
	position:relative;
	-moz-opacity:0.80;
	opacity:0.80;
}

.play span {
	-moz-opacity:0.60;
	opacity:0.60;
	display:block;
	position:absolute;
	top:225px;
	z-index:100;
	width:100%;
	color: white;
	font-size: 80px;
	text-align: center;
}

.play:hover span {
	-moz-opacity:1;
	opacity:1;
	display:block;
	position:absolute;
	top:225px;
	z-index:100;
	width:100%;
	color: white;
	text-align: center;
}

Then, we have some javascript to create the screenshot div dynamically, and to replace it with the applet tag when the user clicks on it, or send the user to install the needed version of Java if he hasn’t installed yet.

Javascript:

var requiredVersion = '1.6.0_10+'
	var width = "640"
	var height = "480"
	var screenshotUrl = "floatingislands03.jpg"

	var url = "launch-applet.jnlp";
	var attributes = { code:'org.newdawn.slick.AppletGameContainer',  width:width, height:height} ; 
	var parameters = {jnlp_href: url}; 

	var isRequiredVersion = deployJava.versionCheck(requiredVersion);
	var text = ""
	var callback = ""

	if (isRequiredVersion) {
		text = "Click to play"
		callback = "startGame()"
	} else {
		text = "Click to install Java"
		callback = "installJava()"
	}

	var screenshotDivHtml = "<div id=\"screenshot\" class=\"play\" onclick=\""+callback+"\" style=\"width:"+width+"px; height:"+height+"px; background-color:white;\">";
	screenshotDivHtml += "<span style=\"color:black;\">"+text+"</span>";
	screenshotDivHtml += "<img id=\"screenshotImage\" src=\""+screenshotUrl+"\" alt=\""+text+"\">"+"</img>";
	screenshotDivHtml += "</div>";

	var appletElement = document.getElementById('applet');
	appletElement.innerHTML += screenshotDivHtml;

	function startGame() { 
		var screenshotElement = document.getElementById('screenshot');
		var appletElement = document.getElementById('applet');
		appletElement.removeChild(screenshotElement);
		var oldwrite = document.write;
		var newHtml = '';
		document.write = function (str) {
			newHtml += str;
		}
		deployJava.writeAppletTag(attributes, parameters); 
		document.write = oldwrite;
		var realAppletElement = document.getElementById('realApplet')
		realAppletElement.innerHTML = newHtml
	}

	function installJava() { 
		deployJava.installJRE(requiredVersion);
	}

Also, we will need to add two divs to the html to make the javascript to work.

Html:

That’s all, if you want to take a look at a working example, click here.


Again, as we did for Ludum Dare 17 and Ludum Dare 18 Jam, we decided to participate in Ludum Dare 19 (and possibly to the Jam too). The theme for this Ludum Dare was Discovery.

In this case, only one game was made in time for the compo, the name is Discover the Name, follow the link to see a description, play the game, watch a gameplay video or make comments if you want. Development time lapse and source code will be available soon.

There is also a page dedicated for the game here.

Hope you enjoy the game.


The second Humble Indie Bundle is released, this time containing: Braid, Cortex Command, Machinarium, Osmos and Revenge of the Titans, all DRM free and for Windows, Mac and Linux.

As well as the first HIB, you can pay as you want. The money you pay goes for the developers, for charity (Electronic Frontier Foundation and/or the Child’s Play Charity) and for the HIB itself, you decide how much for each one.

By the time this post was written, they had a revenue of $470,446.62 made in only one day. They have 6 days left to keep making money.

Here is the HIB promo video:

Go and buy it!


Today was the date limit for the contest we talked about some posts ago, and we can say JSnakes one of the contestants.

Sadly, we are not satisfied with the current state of the game, there are a lot of mechanics we wanted to try but we could not implement them because of serveral reasons. However, one of our main objectives was to at least enter the contest, so that we could establish contact with other developers.

The game version for the contest is on this link, you can try it if you want. That version is not going to change if we keep working on the game.


As we mentioned on the previous post, we were integrating JBullet to JSnakes, well, now all game objects behaviours are based on the use of that physics engine.

We have a video showing how it looks by now:

With the physics engine working, we have a lot of new possibilities.

Some examples of new mechanics are pushing other players to keep them from taking food.

There are many ideas to try, some people told us to make the snakes destructible and add some weapons, those seem like interesting ideas and could be the next things to work.

Some other aspects of the game we were working were:

  • We changed the game screen resolution and made the game world resolution independent.

  • We added a camera based on the Dassault camera.

Right now, we are working on adding some obstacles to the game and test interaction with them.

Remember, you can play the latest stable version here, or the latest unstable version here.