npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@asalvatore/troisdchan

v0.1.0

Published

Troisdchan a javascript library to display and manage a 3Dchan's dungeon. The goal of 3Dchan is to provide a 3D abstraction layer for data's, especially images and users, in the web browser.

Downloads

48

Readme

3Dchan NPM library

It's a javascript library to display and manage a 3Dchan's dungeon. The goal of 3Dchan is to provide a 3D abstraction layer for data's, especially images and users, in the web browser. It's important to aknowledge than this version is an alpha and than the next even minor versions will probably introduce some method change.

Can send me some ETH here if you want me to maintain the lib: 0xDe83AE3bF150c7f23A0B4549fD8307592dbD4a79

3Dchan

Installation

npm i @asalvatore/troisdchan

Usage

Import the library

import TroisDchan, { BLOCK_SIZE } from '@asalvatore/troisdchan';

// Get a canvas view where put the 3Dview inside
const canvas = document.getElementById("renderCanvas");

// Instantiate the lib
const troisDchan = new TroisDchan(canvas,
    (dataReceive) => {
        console.log("dataReceive", dataReceive)
    },
    (dataToSendMethod) => {
       console.log("dataToSendMethod", dataToSendMethod)
})

// Set the canvas HTML to fullscreen, with automatic resize
troisDchan.setFullScreen()

// Set the player position (x, y , z) are tile coordonates
// and the 0 is the direction (0 == north, 1 == east, etc.)
troisDchan.setPlayerPosition({x:4,y:0,z:-4}, 0);

Add a Block

    // x, y , z are tile coordonate, they are automatically multiplied
    // by the block size inside of the library
    const x = 3;
    const z = 3;
    const y = 0;
    const block = troisDchan.addBlock(
        {x, y, z}, // position of the block
        1, // ID of the type of the block
        "" // name of the parent, if a name is provided we put it on top of it
        );
    // The method return the created block and you can get it name
    console.log(block.name)


    /*
    The list of the bloc types and IDs
    These value can be subject to changes
    BLOCK_CATALOG = [
        { id:1, name: "Concrete", type: BLOCK_TYPE_WALL, u: 0, v: 0 },
        { id:2, name: "Brick", type: BLOCK_TYPE_WALL, u: 2, v: 0 },
        { id:3, name: "Elevator", type: BLOCK_TYPE_ELEVATOR, u: 4, v: 0 }, // Elevator goes up and down
        { id:4, name: "Grass", type: BLOCK_TYPE_WALL, u: 0, v: 1 },
    ];
    */

Add art

    const fileMesh = troisDchan.addFile({
        fileData: "https://pbs.twimg.com/media/FKhh5iyVkAEQHd1?format=jpg&name=medium", // the URL or the base64
        fileType:"image/", // the type of the file
        fileName:"some file"
    });
    
    fileMesh.setToWall(
        block.position, 
        dir, // dir is optional (0 = north, 1 = east, 2 = south, 3 west)
        block); // the parent block

Add a characters at a position

    // X & y are tile coordonate, we mutiply them with the real size of a block
    // if position not provided Art or characters are added on the selected object or place on the ground
    const x = 1;
    const z = 1;
    troisDchan.addCharacter({ position: {x: x*BLOCK_SIZE , y:0 , z: z*BLOCK_SIZE}})

Import and export Map as a JSON object

troisDchan.parseMap(
    JSON.parse(mapSave)
)
console.log(troisDchan.objectifyMap());

You can see more example at the test.js file at the root of the project

Roadmap

  • Loading and saving the map as a JSON object
  • Signing levels with a wallet
  • deploy on 3Dchan.net and offering hosting to 3Dchanner
  • Work on texture, to manage characters avatar