JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 48
  • Score
    100M100P100Q66266F
  • License MIT

Load voxel.js chunks asynchronously from a server

Package Exports

  • voxel-async-simulation

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (voxel-async-simulation) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

VoxelSimulation

Things got much better... it may even be useful now. There are two things this package provides:

  • A simple server based loading abstraction
  • chunk referencing when generating (which will soon manifest in a biome abstraction)

This means you provide a generator function factory on the server:

function(chunkX, chunkY, chunkZ){
    //chunk specific work here
    return function(x, y, z){
        //voxel specific work here
    }
}

Usage

There is a reimagining of voxel-hello-world, that loads materials based on what it finds in the texture pack and has a different terrain loader (that runs on the server). Check out the source of the example-client. Make sure to either change the client or to name your texturePack 'PhotoRealistic' so you can use the client with the textures you are about to download.

Speaking of... go Download a Minecraft texture pack then unpack it and put your textures in a folder at the root called texture-packs. If you want you can also drop a player.png minecraft skin in the root directory so your avatar is textured.

Now let's build the app(with browserify):

browserify example-client.js -o app.js

then run the example server:

node example-server.js

and access the html root

Biomes[TBD]

Experimental! Untested! Likely to be externalized!

This will produce material 1 in common areas, material 2 in uncommon areas and material 3 in rare areas, and because we pick a prime distribution, uncommon and rare biomes are more infrequent and continuous common areas increase in size as you move outward from the origin. rare biomes are alternated in the order they are provided. In addition to hints from the distribution algorithm, context contains a deterministic random() function for use in generating this submesh, but still being reproducible.

app.addBiome({
    name : 'material-1',
    generator : function(subX, subY, subZ, context){
        return function(x, y, z){
            if (y===0) return 1;
        }
    }
});
app.addBiome({
    name : 'material-2',
    generator : function(subX, subY, subZ, context){
        return function(x, y, z){
            if (y===0) return 2;
        }
    }
});
app.addBiome({
    name : 'material-3',
    generator : function(subX, subY, subZ, context){
        return function(x, y, z){
            if (y===0) return 3;
        }
    }
});
app.setBiomeDistribution(Server.Segmenters.prime)

Testing

Eventually it'll be:

mocha

Enjoy,

-Abbey Hawk Sparrow