Spacetime-Meta / spacetime-sdk

The spacetime-sdk is a turnkey virtual environment package for building in the Spacetime Metaverse
https://www.spacetimemeta.io/metaverse/spawn-planet
MIT License
11 stars 2 forks source link
javascript metaverse opensource peerjs threejs web3

👋 Spacetime SDK 🛰️

The Spacetime standard kit provide developers with turnkey virtual environments. This package will provide multiple metaverse features like multiplayer, custom avatars, vehicle and blockchain connection.

We are making this codebase open source and free to use by our community members and partners in order to facilitate the standardization of the metaverse.

Discord Twitter Follow

GitHub GitHub top language
GitHub issues GitHub closed issues


Main Focus

This standard kit project was initially started to populate this universe with uniquely generated worlds. It has now extended to much more. As multiple other projects use our open source kit to create their own virtual environments and connect them to the spacetime metaverse.

Partners and contributors should keep in mind that; even as the project gets more traction, our main focus will always be on populating the space chunks with complete worlds and valuable experiences. Also, every feature will be reviewed and developed in orientation to the spacetime meta roadmap.

How to run locally

Goal: Run a simple environment with avatar, ui, multiplayer and cardano wallet connection:
If you are just looking to develop an environment, the base template is probably what you are looking for. The spacetime-sdk is meant for developpers who wants to add new features into the metaverse.

First, clone the repo and install the dependencies a the root.

git clone https://github.com/Spacetime-Meta/spacetime-sdk.git
cd spacetime-sdk
npm install

Second, configure the cardano connection. For this you need to create a config file in src/cradano/config.js. This config file must contains your blockfrost api keys in the following format:

const blockfrostApiKey = {
    0: "testnet...", // testnet
    1: "mainnet..." // mainnet
}
export default blockfrostApiKey;

Third, install the dependencies of the cardano folder.

cd src/cardano
npm install
cd ../..

Finaly, once all the steps are completed, you will be able to run the sdk using npm run start. This will start a server on your local machine and the examples will be available at http://localhost:8080/

How to use the sdk

To use the sdk in your webpage, you first need to get it from a source.

<script src="http://localhost:8080/bundle.min.js"></script>

Then you have access to the VirtualEnvironment class in the window. To instantiate a new VirtualEnvironment, you need to pass it a config.

// simply call the virtual env with your config 
const virtualEnvironment = new VirtualEnvironment("./configs/devPlanet.json");

// then start the animation
animate();
function animate() {
    virtualEnvironment.update();
    requestAnimationFrame(animate);
}

If everything works properly, you should see something like this world

Contributors

contrib

Thanks to our contributors 💎🚀