Claudiu Persoiu

Blog-ul lui Claudiu Persoiu

Archive for 8 June 2010

The 3d web with HTML5

without comments

Last week-end I was surfing the Web wandering why there isn’t any 3d done in JavaScript. A ridiculous question in a hot afternoon.

My question was born from the idea that the first stage in 3d evolution was done in 2d, basically representing 3d objects using the existing 2d ways.

Of course I came across my first answer: a 3d shooter game directly in the browser, done by Ben Joffe!

It is at least impressive!

Beside this find I immediately came across some other 3d games in JavaScript that are not using tags like canvas, but this results are not very impressive because of a simple reason: speed!

Before HTML5 the speed of displaying elements in the browser was a very big issue. Is well know that one of the slowest components of the browser is the DOM, especially in Internet Explorer. When it comes to the canvas a huge difference is visible in the good way, the multitude of the objects on the stage are not coordinated using the DOM but rather just displayed in a true graphical element.

While I was opening my computer today I was thinking why doesn’t anyone make a game at least like Duke Nukem 3D? Of course the browser will not become just yet a platform that can compete with XBOX for games ant that’s normal… I don’t even know how did I come across this, but it was just like something in my universe drown me to something truly impressive:

Quake 2 directly in the browser, using JavaScript!

At the beginning I thought that they cheated, they’ve used WebGL, not just the 2d popular canvas. But the result is truly impressive, and this standard will probably be available as an HTML5 specification, which means it will be available on at least a part of the browsers.

Even though they’ve used GWT, the resulting code is still JavaScript, so this can be made just using JavaScript!

Where did the hole idea of 3d in browsers came from? I’ve read about 2 years ago about some efforts in this direction, and they ware based on VRML. But VRML exists as a standard since 1994 and I haven’t seen anything¬† impressive yet. I even have a VRML book that is full of dust in a shelf. The biggest issue was that there was no native support for it.

The new perspective is absolutely innovative, because is a bridge between the browser and the 3d hardware. So if one day we will have 3d in our browsers it will be done this way!

Written by Claudiu Persoiu

8 June 2010 at 10:35 PM

Posted in Browsers,JavaScript

Tagged with , ,

Unknown runtime error – Internet Explorer with InnerHTML – another meaningful error

without comments

I was working the other day on a new JavaScript game for the games section. Like the majority of the developers (like the statistics show) I’m using FireFox for developing. But as the game reached the testing faze it was time to see if it was working properly in Internet Explorer.

To test in Internet Explorer is a real pleasure, basically you see an error and then you hope that you’ll find the source.

Of course there was an error, one full of meaning as usual:

Unknown runtime error??? WTF??? If he does not know how should I?

The piece of code that was generating the error was:

canvas.innerHTML = '';

Where canvas was a variable which was storing an document.getElementById(‘canvas’), and the id canvas was from:

<table border="0" cellspacing="0" cellpadding="0">
<tbody id="canvas"></tbody>

Looks wrong? well is not because at that point I was testing other games which are using the same thing with no trouble, even in IE.

I’ve tried it in IE 6, of course with the same result.

It looks like this error appears on elements like table, tbody, p and others.

To finally fix the issue I used instead of a tbody, a div tag in which I’m adding the elements and the issue was gone.

What is interesting is that this issue does not always appear for a specific tag!

Thank you Microsoft for this meaningful error messages that are so full of logic!

Written by Claudiu Persoiu

6 June 2010 at 2:20 PM