Very, very nice! Possible feature: would it be possible to generate unique individual links a la pastebin? 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…
MineCraftWebGL
51–59 of 59 posts
Re: MineCraftWebGL
#52Earlier quoted context omitted.
This exists in Firefox as of 14, currently in Aurora, so this will be in a stable release in a few weeks. 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.
The reason would be security-related, as usual. I take it you deal with the clickjacking potential, and the potential for deliberate annoyances?
Re: MineCraftWebGL
#53Earlier quoted context omitted.
That's an extremely simplistic look at the problem. The issue isn't looking at the keyboard, it's the extra mental effort of doing the keymapping every time you run into a new application which has stupid defaults that don't take alternative layouts into account.
That is true. Wouldn't mapping specific keys (physical, on the keyboard) to actions/events better than mapping actions to the characters pressed? I thought that was how things worked now. 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.
Re: MineCraftWebGL
#54Earlier quoted context omitted.
If you wanted to generate the same terrain, then you could save a particular seed for the random function which could be appended to the url. That wouldn't include all the player made modifications to the terrain but it would give people the same world.
How would you generate which seed to use?
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.
Re: MineCraftWebGL
#55Earlier quoted context omitted.
How would you generate which seed to use?
The seed could be generated using the default random function of your platform without specifying the seed (the default seed is likely based on some timestamp component). 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.
Re: MineCraftWebGL
#56Earlier quoted context omitted.
The arrow keys are usually at the right of the keyboard, next to the mouse, which makes playing with two hands awkward. You also need to move the hand on the keyboard to push pretty much any other key, which makes it difficult to do other actions (reload, open inventory, sprint, etc.) Of course the better solution is to give the player the choice...
> You also need to move the hand on the keyboard to push pretty much any other key - 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.
Re: MineCraftWebGL
#57Earlier quoted context omitted.
The seed could be generated using the default random function of your platform without specifying the seed (the default seed is likely based on some timestamp component). 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.
But the terrain wasn't generated using an rng, it was generated by the user placing and deleting blocks.
This is used frequently in Minecraft for players to share interesting maps which have randomly generated.
Re: MineCraftWebGL
#58Earlier quoted context omitted.
But the terrain wasn't generated using an rng, it was generated by the user placing and deleting blocks.
If you read my first comment in this thread, I stated that by recording the seed it would allow you to save the terrain generated by the game not any modifications or alterations a user added to it with their own block placement. This is used frequently in Minecraft for players to share interesting maps which have randomly generated.
Re: MineCraftWebGL
#59There is more interesting discussion on the ~7 months passed HN thread: http://news.ycombinator.com/item?id=3376620