an open source voxel game building toolkit for modern web browsers
- About
- Examples
- Modules
- How
- Follow @voxeljs
- #voxel.js on freenode
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. If you find bugs it is most likely because we don't really know what we are doing when it comes to making games.
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. You can also donate to the project on gittip, a site that lets people support open source programmers through small recurring donations.
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:
voxel module and turns it into a three.js
3D Mesh that can be displayed in a game. voxel-engine also uses this.
The goal for all of these modules is that they are fun, simple and easy to hack.
@maxogden has been working on an in-browser game maker called Voxel Creator. You don't need to install anything to use it. To save your game you just need a free account from Github. You can try it out by visiting http://voxel-creator.jit.su.
If you encounter any issues with Voxel Creator, please open a bug report over here as the program is open source.
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-engine": "0.5.3",
"painterly-textures": "0.0.3"
}
}
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-engine')
var texturePath = require('painterly-textures')(__dirname)
var game = createGame({texturePath: texturePath})
var container = document.body
game.appendTo(container)
game.setupPointerLock(container)
Then to build your game you use browserify:
$ npm install browserify@1.17.3 -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>
For images (block textures, player skins, etc) to load correctly you need to serve voxel games from an http server (as opposed to opening the .html file in your browser directly). Here is how to do that using http-server from npm:
# install http-server and put it in your command line path
$ npm install http-server -g
# start a local server in the local directory
$ http-server
Now you should be able to play your game by opening up http://localhost:8080 in your browser. Look at one of the working examples to learn more.
There are also API docs in the voxel-engine readme
Check out this guide: Writing node modules with voxel.js
If you make a voxel.js module and want it featured on the site you can fork the source and add your module to the list.
If any of these look fun to you please help an existing module out by making it better or start a new module that provides a solution -- whichever is easier.
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!
by @jllord