The time has come to, finally, release 3D TOMB II, the DOOM-like in 4k of JavaScript I initially made for the5k 2004.
The whole game now weighs 4003 bytes, all files included. The controls are X,C to strafe, SPACE to fire, the arrows to move around. And here is a downsized screenshot:
/!\ Due to a bug in Safari and Gecko's handling of the zIndex, the game doesn't work as expected in Safari, FireFox and co. But it works like a charm, on a semi-recent computer, in IE and Opera.
Hope you'll enjoy it.
Tyberius Prime
Maniac (V) Mad Scientist with Finglongers
From: Germany Insane since: Sep 2001
posted 07-01-2007 23:49
Amazing .
Good work, as always, poi!
Guess the graphics are so block like due to the filesize limit?
Is there any way to make turning quicker? I get eaten by something behind my back and it takes forever to turn around .
Tyberius Prime: Nothing bite you in the back. The enemies are a bunch of gentlemen, they don't attack intruders in the back. Honest. As for the speed of the turn, I'll look into that. It's easy to tweak, but I have to check how that effects the gameplay.
reisio: the 'K is undefined' thing happen when you press a key before the script gets unpacked. But that's not an issue. The real problem is/was that FF's rendering engine don't process Float zIndex. See below.
zavaboy: there's not much I can do about the look back into the room thing. As for the other pb, in which browser was that ?
I just found what was wrong with the zIndex. The spec says a z-index is an Integer*. IE and Opera are too kind to web developers here and allow float values. Grr, I'm so gonna file a bug when I arrive at work! To my defense I didn't investigate the issue thoroughly as Gecko was dead slow anyway. That doesn't hinder the fact that I hate doing such n00b mistakes
3D TOMB II will be updated soon and now seems to work correctly, although still slowly, in FF.
*: But again, the CSS spec doesn't specify what to do when given a Float : should it round it, floor it, ceil it, use the default/inherited value ? what's the expected behavior ? Stupid loosy spec.
Done. Same size and now works correctly, although still slowly, in FireFox.
Suho1004: Thanks. They're not exactly zombies. They are mummies, and by 'freaking lasers', I meant they have evil eyes. Literally. They stare at you and Bam!
The spec says a z-index is an Integer*. IE and Opera are too kind to web developers here and allow float values. Grr, I'm so gonna file a bug when I arrive at work! To my defense I didn't investigate the issue thoroughly as Gecko was dead slow anyway.
Could you be more specific? Maybe we can find a workaround. (I just don't understand what you're describing yet)
reisio: Thanks for the offer. I already fixed my abuse of the z-index.
The issue was that the CSS 2.1 specification of z-index says it must be either auto, inherit, or an integer value. It doesn't specify what to do when given an "invalid" value such as a string, a length ( a float followed by a unit, e.g. em, ex, pt, ... ), a float ...
In 3D TOMB II, when I compute the size and distance of the entities ( items and creatures ), I get a float. I was using this value as is to set the z-index of the entities because it's always worked fine in IE and Opera ( the only browsers were the game is really playable anyway ). These two seem to round the float value. But Firefox and Safari are more strict here. All I had to do to fix the issue was to cast the float to an integer, and tweak the code a bit to make sure the compressed size remains the same so I don't have to edit the FAQ and other pages mentionning the file size