Bitbucket is a code hosting site with unlimited public and private repositories. We're also free for small teams!

Close

Halfblock

Halfblock is a Minecraft-a-like implemented in the browser using modern, HTML5 technologies:

  • WebGL
  • Pointer Lock API
  • Web Audio API
  • IndexedDB

It's mostly been developed/tested on Google Chrome, and an up-to-date version of Chrome is probably required to run it. Firefox might work also though there will probably be rot at any given time.

The goals of the project are to better understand the above APIs, to try ways of implementing various game features, be they copied or original, and to make something kind of cool. Minecraft is a great sandbox, but a Minecraft-like codebase is a sandbox sandbox. So each grain of sand is now a sandbox; you get me?

As it stands, the game is little more than a poor clone of Minecraft; nevertheless, it is a non-goal to duplicate Minecraft. I've implemented many features lifted from Minecraft for the sake of doing them myself.

It is an anti-goal to look at Minecraft's source code; rather I've based my implementations on behavior observed in-game, and general research on the web. See REFERENCES for links that have helped.

It isn't necessarily a goal to create something fun to play. This is more of a research and practice project than a game. If something fun (that isn't Minecraft) evolves from what I've done so far, so much the better.

Notes about some features

Web workers

Terrain generation (and perhaps, eventually, loading) are offloaded to a web worker to take advantage of multiple cores and reduce ugly pauses in the game. There are still pauses when a new chunk is generated, probably due to lighting updates.

Load/save

Forever poorly tested, load and save is implemented using the Indexed Database API. There's only one save slot as things stand.

Reticule

The targeting reticule is a color-inverted cross at the middle of the viewport. It is implemented by drawing WebGL lines over the scene with the blending function gl.blendFunc(gl.ONE_MINUS_DST_COLOR, gl.ZERO).

Planned features

Head bob

Based on field tests, it appears the MC head bob moves the camera sinusoidally left and right of center about 1/16 m, and up an down at around the same amplitude, or perhaps a bit less (but, as logic would dictate, at double the frequency). The POV camera moves smoothly back to the fixed position when motion stops, in perhaps 1/2 sec, and much quicker in the reverse direction.

The wavelength of the stride seems to be about 3m (per left + right step).

Recent activity

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.