Archive for December, 2010

Games as Applets

Thursday, December 30th, 2010

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 = "
"; screenshotDivHtml += ""+text+""; screenshotDivHtml += "\""+text+"\""+""; screenshotDivHtml += "
"; 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.

VN:F [1.9.22_1171]
Rating: 5.0/5 (2 votes cast)

Ludum Dare 19

Monday, December 20th, 2010

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.

VN:F [1.9.22_1171]
Rating: 5.0/5 (1 vote cast)

Humble Indie Bundle #2

Wednesday, December 15th, 2010

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!

VN:F [1.9.22_1171]
Rating: 5.0/5 (2 votes cast)