Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught Error: voxel-stitch requires game-shell #9

Closed
z3t0 opened this issue Apr 10, 2015 · 4 comments
Closed

Uncaught Error: voxel-stitch requires game-shell #9

z3t0 opened this issue Apr 10, 2015 · 4 comments

Comments

@z3t0
Copy link

z3t0 commented Apr 10, 2015

It seems to think that game-shell isnt there even though it is...

// Require

require('voxel-registry')   // TODO: learn
require('voxel-keys')
require('voxel-chunkborder')
require('voxel-mesher') // TODO: learn - > Needed by voxel-chunkborder
require('voxel-stitch') // TODO: learn - > Needed by voxel-mesher
require('game-shell')   // TODO: learn - > Needed by voxel-stitch

var createGame = require('voxel-engine')
var voxel = require('voxel')
var texturePath = require('programmerart-textures')('');
var game = createGame({
    generate: function(x, y, z) {
        return y === 1 ? 1 : 0
    },
    texturePath: texturePath,
    materials: [
        ['blocks/grass_top', 'blocks/dirt', 'blocks/grass_side'], 'blocks/stone', 'blocks/dirt'
    ],
    materialFlatColor: false,
    controls: {
        discreteFire: true
    },
    lightsDisabled: false,
    fogDisabled: false,
    playerHeight: 1.62,
    generateChunks: true,
    keybindings: {
        'W': 'forward',
        'A': 'left',
        'S': 'backward',
        'D': 'right',
        '<up>': 'forward',
        '<left>': 'left',
        '<down>': 'backward',
        '<right>': 'right',
        '<mouse 0>': 'firecheck', // Middle mouse button
        '<mouse 1>': 'fire',
        '<mouse 2>': 'mouse2',
        '<mouse 3>': 'alt', // left mouse button
        '<space>': 'jump',
        '<shift>': 'crouch',
        '<control>': 'cotnrol'
    }
})



// Terrain

// Plugins
// Need to use stackgl ndarray
// var registry = require('voxel-registry')
// var land = require('voxel-land')


// var createLand = require('voxel-land')
// var land = createLand(game, {})
// land.enable()

//

// generateTerrain()

function generateTerrain() {
    // TODO: better terrain generation
    var terrain = require('voxel-perlin-terrain')
    var chunkSize = 32

    var seed = 'foo'
    var floorHeight = 0
    var ceilingHeight = 5
    var scaleFactor = 20;

    // initialize your noise with a seed, floor height, ceiling height and scale factor
    var generateChunk = terrain(seed, floorHeight, ceilingHeight, scaleFactor)

    game.voxels.on('missingChunk', function(p) {
        console.log("Generating Chunks")
        var voxels = generateChunk(p, chunkSize)
        var chunk = {
            position: p,
            dims: [chunkSize, chunkSize, chunkSize],
            voxels: voxels
        }
        game.showChunk(chunk)
    })
}

// Highlighting
/*
    voxel-highlight @ https://github.com/maxogden/voxel-highlight
    Allows us to select blocks to destroy them and also to select adjacent
    blocks so that we can place new blocks
*/

var highlight = require('voxel-highlight')
var adjacentBlock;
var block;
var hlColor = '#00CC00' // Green

var highlight = require('voxel-highlight')
var hl = highlight(game, {
    color: hlColor
});

hl.on('highlight', function(voxelPos) {
    block = voxelPos
});
hl.on('remove', function(voxelPos) {
    block = null
});
hl.on('highlight-adjacent', function(voxelPos) {
    adjacentBlock = voxelPos
    game.setBlock(adjacentBlock, 1)
    console.log('Placed: ' + adjacentBlock)
});
hl.on('remove-adjacent', function(voxelPos) {
    adjacentBlock = null
});

// Append game to body
var container = document.body
game.appendTo(container)

// Player
var createPlayer = require('voxel-player')(game)
var playerTexture = 'textures/player.png' // Minecraft Skint
var player = createPlayer(playerTexture)

player.possess()
player.position.set(0, 100, 0); // Makes sure player doesnt spawn inside a block

// Allows player to fly

// var fly = require('voxel-fly')
// var makeFly = fly(game)
// makeFly(player)
// makeFly(game.controls.target())


// Controls

controls()

function controls() {

    //Mouse Input
    document.body.addEventListener('mousedown', mousePressed)

    function mousePressed(event) {
        switch (event.button) {
            case 0: // Left mouse button
                var position = block
                if (game.getBlock(position) != 0) {
                    game.setBlock(position, 0)
                    console.log('Break: ' + position)
                } else {
                    console.log('No Block')
                }

                break;

            case 1: // Middle mouse button
                var position = block
                var type = game.getBlock(position)
                console.log('BlockType: ' + type + ' : ' + position)
                break;


        }
    }

}

// Audio

play = require('play-audio')

play('audio/background.ogg').autoplay().controls().loop()
play('audio/block.ogg').preload()

game.on('setBlock', function(pos, val, old) {
    play('audio/block.ogg').volume(1.0).play().on('ended', function() {})
})

// Plugins 

var createPlugins = require('voxel-plugins');
var plugins = createPlugins(game, {
    require: require
});
plugins.add('voxel-registry', {})
plugins.add('game-shell', {})
plugins.add('voxel-stitch', {})
plugins.add('voxel-mesher', {})
plugins.add('voxel-chunkborder', {}) // F9 to toggle, default solid blue
plugins.loadAll()

var registry = game.plugins.get('voxel-registry');

// Keybindings
var keys = game.plugins.get('voxel-keys');

// Example for adding a keybinding, opts.keybindings is used
// keys.down.on('left', function() {
//     console.log('the key corresponding to the left keybinding was pressed');
// });
@deathcap
Copy link
Member

Yeah this is not a very good error message either. https://github.com/mikolalysenko/game-shell is the underlying base of voxel-engine#ndarray (aka voxel-engine-stackgl to be), which is really what this plugin means to say it requires. voxel-stitch works alongside voxel-mesher and voxel-shader to provide the voxel rendering. With the three.js-based voxel-engine (the version released on NPM), none of these are needed because voxel-engine itself handles it, or delegates to other modules among them voxel-view and three-js, I believe (it's been a while).

Also voxel-highlight is only for three.js voxel-engine, for voxel-engine#ndarray/gl-modules/stackgl there is https://github.com/deathcap/voxel-outline

@z3t0
Copy link
Author

z3t0 commented Apr 10, 2015

hmm. I'm starting to wonder if i should work on the three.js or stackgl version, from what i can see stackgl is growing to become the new standard? I want to help with voxel engine development so which one would you recommend, at the moment I'm using the npm three.js one, I'm trying to figure out how to switch them out. Also, thanks for replying to all those other issues I'll get back to you on those asap, I'm on my phone now so typing is a bit of a pain.

Thanks!

Thanks,
Rafi Khan

----- Reply message -----
From: "deathcap" [email protected]
To: "deathcap/voxel-stitch" [email protected]
Cc: "Rafi Khan" [email protected]
Subject: [voxel-stitch] Uncaught Error: voxel-stitch requires game-shell (#9)
Date: Thu, Apr 9, 2015 20:32

Yeah this is not a very good error message either. https://github.com/mikolalysenko/game-shell is the underlying base of voxel-engine#ndarray (aka voxel-engine-stackgl to be), which is really what this plugin means to say it requires. voxel-stitch works alongside voxel-mesher and voxel-shader to provide the voxel rendering. With the three.js-based voxel-engine (the version released on NPM), none of these are needed because voxel-engine itself handles it, or delegates to other modules among them voxel-view and three-js, I believe (it's been a while).

Also voxel-highlight is only for three.js voxel-engine, for voxel-engine#ndarray/gl-modules/stackgl there is https://github.com/deathcap/voxel-outline


Reply to this email directly or view it on GitHub:
#9 (comment)

@deathcap
Copy link
Member

deathcap commented Jan 1, 2016

Well I'm in favor of stackgl, and what is now https://github.com/voxel/voxel-engine-stackgl — I'm no longer doing anything with the three.js-based voxel-engine (https://github.com/maxogden/voxel-engine), although as it is open source anyone could continue to work on it, and to be fair it does have some more functionality than the current version of voxel-engine-stackgl. Anyways, I've updated the error message to clarify this missing dependency condition.

@z3t0
Copy link
Author

z3t0 commented Jan 1, 2016

ok thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants