Git Product home page Git Product logo

voxel-hello-world's Introduction

voxel-hello-world

Learn more at http://voxeljs.com

Using it as a module

npm install voxel-hello-world

var game = require('voxel-hello-world')

Get it running on your machine

The first time you set up, you should install the required npm packages:

cd voxel-hello-world
npm install

Then run the start script:

npm start

Then point your browser to http://localhost:8080 and have fun!

How does this work?

voxel.js modules use browserify for packaging modules together into game bundles. This means that every time you change code in your game you have to build a new bundle in order to test it out. Luckily this is very easy and is automated. When you run the npm start script, it runs a local server: when the browser requests index.js, it compiles it serverside and then serves up the compiled version.

The upshot is, as long as you're running the npm start script in the background, you can save your changes to index.js and reload the game to see the new code in action, without having to have a build step in between. (If you'd like to change the start script, it's contained in the package.json file in the root directory.)

license

BSD

voxel-hello-world's People

Contributors

chrisdickinson avatar katiejots avatar max-mapper avatar nakedible avatar theoxylo avatar yenthefirst avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

voxel-hello-world's Issues

Some packages are not installed correctly or missing

Step 1. Importing git repository

git clone https://github.com/maxogden/voxel-hello-world.git

Step 2. Do the first time setup

cd voxel-hello-world
npm install

Step 3. Run the start script

npm start

This gives the output:

> [email protected] start C:\Users\homw\Documents\voxel-hello-world
> beefy test.js:bundle.js 8080

listening on 8080
using .\node_modules\.bin\browserify

When you open http://localhost:8080 you get the following error in console and in npm-debug.log

console:

200   13ms    1.08KB /index.html
events.js:141
      throw er; // Unhandled 'error' event
      ^

Error: spawn C:\Users\homw\Documents\voxel-hello-world\node_modules\.bin\browser
ify ENOENT
  at exports._errnoException (util.js:870:11)
  at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
  at onErrorNT (internal/child_process.js:344:16)
  at nextTickCallbackWith2Args (node.js:442:9)
  at process._tickCallback (node.js:356:17)


npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Program Files (x8
6)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v4.4.0
npm ERR! npm  v2.14.20
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `beefy test.js:bundle.js 8080`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'beefy test.js:bundl
e.js 8080'.
npm ERR! This is most likely a problem with the voxel-hello-world package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     beefy test.js:bundle.js 8080
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs voxel-hello-world
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR!     npm owner ls voxel-hello-world
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\homw\Documents\voxel-hello-world\npm-debug.log

npm-debug.log

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files (x86)\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info prestart [email protected]
6 info start [email protected]
7 verbose unsafe-perm in lifecycle true
8 info [email protected] Failed to exec start script
9 verbose stack Error: [email protected] start: `beefy test.js:bundle.js 8080`
9 verbose stack Exit status 1
9 verbose stack     at EventEmitter.<anonymous> (C:\Program Files (x86)\nodejs\node_modules\npm\lib\utils\lifecycle.js:214:16)
9 verbose stack     at emitTwo (events.js:87:13)
9 verbose stack     at EventEmitter.emit (events.js:172:7)
9 verbose stack     at ChildProcess.<anonymous> (C:\Program Files (x86)\nodejs\node_modules\npm\lib\utils\spawn.js:24:14)
9 verbose stack     at emitTwo (events.js:87:13)
9 verbose stack     at ChildProcess.emit (events.js:172:7)
9 verbose stack     at maybeClose (internal/child_process.js:827:16)
9 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
10 verbose pkgid [email protected]
11 verbose cwd C:\Users\homw\Documents\voxel-hello-world
12 error Windows_NT 6.1.7601
13 error argv "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
14 error node v4.4.0
15 error npm  v2.14.20
16 error code ELIFECYCLE
17 error [email protected] start: `beefy test.js:bundle.js 8080`
17 error Exit status 1
18 error Failed at the [email protected] start script 'beefy test.js:bundle.js 8080'.
18 error This is most likely a problem with the voxel-hello-world package,
18 error not with npm itself.
18 error Tell the author that this fails on your system:
18 error     beefy test.js:bundle.js 8080
18 error You can get information on how to open an issue for this project with:
18 error     npm bugs voxel-hello-world
18 error Or if that isn't available, you can get their info via:
18 error
18 error     npm owner ls voxel-hello-world
18 error There is likely additional logging output above.
19 verbose exit [ 1, true ]

However, I was able to fix this error by simply typing:

npm install beefy
npm install browserify
npm start

Error while starting voxel-hello-world

0 info it worked if it ends with ok
1 verbose cli [ 'C:\Program Files\nodejs\node.exe',
1 verbose cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose node symlink C:\Program Files\nodejs\node.exe
5 verbose run-script [ 'prestart', 'start', 'poststart' ]
6 info prestart [email protected]
7 info start [email protected]
8 verbose unsafe-perm in lifecycle true
9 info [email protected] Failed to exec start script
10 error [email protected] start: beefy test.js:bundle.js 8080
10 error Exit status 8
11 error Failed at the [email protected] start script.
11 error This is most likely a problem with the voxel-hello-world package,
11 error not with npm itself.
11 error Tell the author that this fails on your system:
11 error beefy test.js:bundle.js 8080
11 error You can get their info via:
11 error npm owner ls voxel-hello-world
11 error There is likely additional logging output above.
12 error System Windows_NT 6.2.9200
13 error command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "start"
14 error cwd C:\cygwin64\home\SmrutiranjanS\node_modules\voxel-hello-world
15 error node -v v0.10.28
16 error npm -v 1.4.9
17 error code ELIFECYCLE
18 verbose exit [ 1, true ]

It doesn't do anything

I run npm start, I browse to Port 8080. I get the logo, I get the cross hair, I get nothing else. Chrome debugger shows bundle.js as an empty, blank file. If this is what is expected, what are the next steps?

Seems to be broken?

I'm using windows

C:\Users\Rafi Khan\Desktop\voxel-hello-world-master>beefy -o
module.js:338
    throw err;
          ^
Error: Cannot find module 'C:\Users\Rafi Khan\Desktop\voxel-hello-world-master\n
ode_modules\browserify/bin/args.js'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at setupBrowserify (C:\Users\Rafi Khan\AppData\Roaming\npm\node_modules\beef
y\lib\bundlers\browserify.js:6:19)
    at onlocalbrowserify (C:\Users\Rafi Khan\AppData\Roaming\npm\node_modules\be
efy\lib\setup-bundlers.js:30:5)
    at C:\Users\Rafi Khan\AppData\Roaming\npm\node_modules\beefy\node_modules\re
solve\lib\async.js:42:21
    at C:\Users\Rafi Khan\AppData\Roaming\npm\node_modules\beefy\node_modules\re
solve\lib\async.js:121:35
    at C:\Users\Rafi Khan\AppData\Roaming\npm\node_modules\beefy\node_modules\re
solve\lib\async.js:93:39
    at C:\Users\Rafi Khan\AppData\Roaming\npm\node_modules\beefy\node_modules\re
solve\lib\async.js:59:30

New npm start script fails

New npm start script (0ff500d) fails. npm-debug.log:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/0.10.0/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose read json /Users/mindaugasmozuras/long path to project/package.json
5 verbose run-script [ 'prestart', 'start', 'poststart' ]
6 info prestart [email protected]
7 info start [email protected]
8 verbose unsafe-perm in lifecycle true
9 silly exec sh "-c" "browservefy test.js:bundle.js 8080 -- -d"
10 silly sh,-c,browservefy test.js:bundle.js 8080 -- -d,/Users/mindaugasmozuras/long path to project spawning
11 info [email protected] Failed to exec start script
12 error [email protected] start: `browservefy test.js:bundle.js 8080 -- -d`
12 error `sh "-c" "browservefy test.js:bundle.js 8080 -- -d"` failed with 8
13 error Failed at the [email protected] start script.
13 error This is most likely a problem with the voxel-hello-world package,

Old one works fine.

Exception during initialization

Uncaught TypeError: Cannot read property 'physical' of undefined index.js:15
Fly index.js:15
module.exports index.js:6
defaultSetup index.js:43
module.exports index.js:36
voxel hello.coffee:22
s hello.js:1
e hello.js:1
(anonymous function)

Am I supposed to pass something else in when creating the game?

This is the contents of hello.coffee (browserify is turning it into index.js

voxel = require 'voxel'

generate = (x,y,z) ->
y < -20 ? 1 : 0

opts =
texturePath: './textures/',
generate: generate
materials: [['grass', 'dirt', 'grass_dirt'], 'brick', 'dirt']
materialFlatColor: false
chunkSize: 32
chunkDistance: 2
worldOrigin: [0, 0, 0]
controls: { discreteFire: false }
lightsDisabled: false
fogDisabled: false
generateChunks: true
mesher: voxel.meshers.greedy
playerHeight: 1.62

createGame = require 'voxel-hello-world'
game = createGame()
game.appendTo(document.body)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.