MineCraftWebGL
danielribeiro.github.com
danielribeiro.github.com
Is there any reason why it couldn't work if it were implemented like full screen mode (displaying a message telling the user to press escape to reclaim the mouse)?
Edit: Actually it looks like this is being worked on after all – http://dvcs.w3.org/hg/pointerlock/raw-file/default/index.htm...
It's like building a car starting with the frame.
God speed to whoever is fighting the good fight on those frigging w3c boards.
Still it would probably be fairly easy to add support for it to this and replace the annoying click-drag camera movement when possible.
It also exists in recent Chrome versions, however it seems to be disabled by default for some reason, but you can enable it in the flags menu.
No reason why this cool site can't use it on those browsers, there are lots of demos on the web that do. Mouse lock is very important.
Firefox 14 is scheduled for release on Tuesday.[1]
[1] https://wiki.mozilla.org/RapidRelease/Calendar#Future_branch...
[1] http://news.softpedia.com/news/Firefox-15-to-Fix-All-Common-...
It's enabled at least for the Chrome Store/NaCl apps, since it did that to me for Bastion and/or From Dust.
Only works in Chrome for now, if you enable it in chrome://flags. You don't even need to be in full-screen mode, at least on the latest version.
Pull request is here: https://github.com/danielribeiro/WebGLCraft/pull/1
Page at http://ricardobeat.github.com/WebGLCraft/, press C to enable mouse lock. Aiming doesn't work very well...
Needless to say that it is highly impractical… Why not bind the arrow keys?
Of course the better solution is to give the player the choice...
- cost of binding arrow keys: ~0
- benefit to non-wasd compatible layouts: ∞
(did you know that my keyboard can actually move to where arrow keys are comfortably used, or that left-handed and right-handed-who-use-their-mouse-on-the-left-because-it-makes-sense-with-a-numpad-and-makes-RSI-bearable people exist? ;-)
Binding both the arrows and WASD is a good idea.
Usually yes, but not if you're using your left hand for the mouse as I've recently switched to do. At a bare minimum both WASD and arrow keys should be enabled.
But yes, reconfigurability is by far the best solution.
Just a "generate link button" that stored all the current values of the variables and spit out a link like:
http://danielribeiro.github.com/WebGLCraft/7vDq0hGh
Though I suppose for pastebin et al. those are just database links. There is too much data here to store it in the actual url string itself :(Maybe just an export/import to json button then?
I would use this, like, immediately to share designs and pattern ideas with friends.
Also possible tweak: I just built a very tall tower and jumped off. But it doesn't quite "feel" like Minecraft gravity over long distances. The acceleration or maybe just the terminal velocity feel too slow.
That wouldn't include all the player made modifications to the terrain but it would give people the same world.
You would then take the value the default random function gives you and feed it into the overloaded constructor which allows you to specify the seed.
That way you could still record the seed's value which was used to generate your terrain.
This is used frequently in Minecraft for players to share interesting maps which have randomly generated.
Minecraft's terrain generator does a couple of passes (last I read about this, things may have changed) that generates cave systems, the surface level topography, forests, etc. http://notch.tumblr.com/post/3746989361/terrain-generation-p...
Still, definitely a cool project.
EDIT: Even so, most OSes now make it relatively easy to switch layouts based on country, so I feel as though my point still stands.
The problem is that the physical layout is unchanged, so you need to memorize the keys...
Nobody using Dvorak will want WASD as movement controls for a game for example, but they will most likely want to use the same keys, right?
The problem is, only the keyboard hardware knows where the keys are physically located. The OS knows the layout and could probably expose the QWERTY-equivalent keys, which would be sufficient for not-too-exotic keyboards, but I don't know if that is available to applications in a way that is sufficiently portable for browsers to expose it.
Chromium seems to expose this to Pepper plugins; here is the bug for making it an experimental js api: https://code.google.com/p/chromium/issues/detail?id=119362 Getting the lowlevel keycode is nonportable (I didn't find the implementation, but found switch cases and fallbacks if it doesn't exist). Conversion to a portable usb-hid-equivalent keycode is left as a stub in the patch that introduced the Pepper feature.
There is more interesting discussion on the ~7 months passed HN thread: http://news.ycombinator.com/item?id=3376620
[1] http://metaphysicaldeveloper.wordpress.com/2011/12/20/implem...
[1] https://bugzilla.mozilla.org/show_bug.cgi?id=644389
[2] http://www.altdevblogaday.com/2012/06/18/bringing-simd-accel...
Modern matrix libraries like glMatrix
https://github.com/toji/gl-matrix
use typed arrays effectively to do very fast matrix and vector math in JS. A modern JS engine can transform such code into something very efficient, more than fast enough to do things like even first person shooters.
(not trying to be a dick, I mean, at least to your libraries and tools question: it is all there)