- JS
voxel.js is a collection of projects that make it easier than ever to create 3D voxel games like Minecraft all in the browser.
It was written by @maxogden and @substack, two non-game developers that want to make voxel games easy, fun and modular, but is now collectively maintained by nearly 100 contributors.
Here is a presentation from May 2013 that covers all the exciting stuff that happened in voxel.js land up to that point.
Also definitely read this great blog post about Voxel.js in 2014 by @deathcap
All of the code is open source! If you find bugs or have ideas for improvements please open issues for them on the related github project, or better yet send code or write new modules.
voxel.js games require a computer that can run WebGL, the HTML5 3D graphics engine. Visit get.webgl.org to see if your current browser supports it. Chrome version 23 or above or Firefox version 17 or above are recommended.
Click on the screenshots below to run the demos in your browser:
Instead of making a giant game framework we instead decided to split voxel.js up into a bunch of small building blocks (modules). Modules can be installed with npm, the package manager from node.js. Here are some modules that we have already started working on:
There are around 200 addons for voxel.js published on NPM, here are live search results for all the modules on NPM with word 'voxel' in the title/description:
Here is a handy video screencast from @shamakry that will teach you how to get started in under 10 minutes:
If you don't wanna watch a video you can follow these instructions instead:
To use the voxel.js modules you will need to install node.js (which will also install npm) and be able to use your computer's command line.
Once node.js is installed, you can install the basic voxel.js npm package in your project directory, and then install a basic texture pack. Make a file called package.json
in your project directory and give it these contents:
{
"name": "mygamename",
"version": "0.0.1",
"dependencies": {
"voxel-hello-world": "0.6.0"
}
}
Now you can tell node to install your dependencies:
$ npm install
Next, create mygame.js and put the following code in it:
var createGame = require('voxel-hello-world')
var game = createGame()
Then to build your game you use browserify:
$ npm install browserify -g
$ browserify mygame.js -o builtgame.js
Load builtgame.js into a web page:
<!doctype html>
<html>
<body>
<script src="builtgame.js"></script>
</body>
</html>
Now you should be able to play your game by opening up index.html in your browser.
There are API docs in the voxel-engine readme
Here are some ways to learn and/or get involved with voxel.js:
The 0fps blog posts on voxel meshing by @mikolalysenko are the reason voxel.js exists. Highly recommended reading! Definitely check out the meshing toolbox.
mr. doob and three.js are what voxel.js is built on top of.
webgl-meincraft is a great tech demo that showed a lot of this can be done in a browser
Jonas Wagner made a killer demo and gave a great talk about Voxel Worlds on the web that helped to inspire this project.
Here are some of the wonderful things users have made with their voxel worlds. Tweet @voxeljs or email max@maxogden.com your photo to submit your art!