yohangglobal / webaverse

An open metaverse engine for everyone.

Home Page:https://webaverse-compiler.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

chat on Discord follow on Twitter

Webaverse

An open source web3 metaverse game engine that anyone can host. Easy to use, runs in the browser and utilizes open tools and standards like three.js and Node.

Everything you need to get started with building in the Webaverse is contained in this repository.

Key Features

  • 🎮 A full-featured game engine running in your browser
  • ♾️ Infinite procedurally generated world
  • 🧑‍🤝‍🧑 Multiplayer with voice and chat
  • 🤖 AI-powered non-player characters
  • 👓 Supports desktop and VR (mobile coming soon)
  • 😊 Expressive, vocal and emotive avatars
  • 🔮 Runtime support for user uploads and custom apps
  • 🖥️ Completely self-hostable

Documentation

Developer documentation is here
User documentation is here

Table of Contents

Minimum Requirements

(Back to top)

Webaverse Tools

(Back to top)

Download and install Git.

Download and install GitHub Desktop.

Download and install Visual Studio Code (VS Code).

  • This is optional but using an IDE/text editor will be beneficial when you start creating your own local scenes.

Download and install Node.js with version 18 (v.18).

  • You can manage your Node version by using NVM.
  • If you are installing Node.js for the first time, you can check the version by typing node -v into your terminal.

Programs Used

(Back to top)

Within this platform, the app will primarily be using these programs:

Installation

(Back to top)

Begin by opening the Webaverse repository on your device.

After installing the above tools, open VS Code and create a new folder where you want to clone the webaverse repository.

This can also be done from your Command Prompt, however, your VS Code terminal will allow for opening and running the program as easily as possible.

For example, name your folder “webaverse” and type cd webaverse in your terminal to navigate to this folder.

Now you can follow these commands within your terminal to download and install the program:

# Clone the Webaverse repository.
git clone https://github.com/webaverse-mmo/webaverse.git
# Go into the repository folder you created.
cd webaverse
# Install the required dependencies.
npm install
# Run the "dev" version of the program.
npm run dev
# Wait for this to load and navigate to the URL mentioned in the terminal.
ctrl+click https://local.webaverse.com

Loading the Server

(Back to top)

You will need to let the server load and for the browser process to begin before starting up. Once it is ready, you will see the following message:

event - compiled client and server successfully in _ (_ modules)

After navigating to the URL using “ctrl+click” you might see a warning to open an external website.

Click “Open” and your designated browser will begin to build your first testing scene.

Once the server has loaded, you will now be able to test out your avatars and create your own scenes!

This should be the first display that you see:

Installation for Windows

(Back to top)

The above steps will work just as described for Operating Systems (OS) like Linux, however, Windows will require Windows Subsystem for Linux (WSL) to be set up in advance for installation.

This video shows you how you can set up WSL and Ubuntu.

Alternatively, you can open up your terminal and type wsl --install. This should fully download and install all requirements needed to run WSL and load the Ubuntu distribution.

For more details, visit Microsoft’s guide here.

In case you are running an old version of WSL, make sure you have upgraded to WSL2. You can check this version using wsl -l -v.

Once you have fully installed WSL, type these commands:

# Go into the webaverse folder you created.
cd webaverse
# Enter WSL
wsl
# Clone this repository
git clone https://github.com/webaverse-mmo/webaverse.git
# Go into the repository
cd webaverse
# Install dependencies
npm install
# Run the app
npm run dev
# Navigate to the URL mentioned in the terminal
ctrl+click https://local.webaverse.com

Hosting Source Files

(Back to top)

You can host the source files on either your Windows file system or on the Ubuntu file system in WSL's virtual drive.

Windows File System: Run the Git commands to clone and pull source files from a Windows command prompt. You may find this best if you're using programs such as SourceTree as a Git GUI. You can also edit source using your usual IDE.

Ubuntu File System: Run the Git commands to clone and pull source files from a WSL command prompt. In this case consider using the Visual Studio Code WSL extension as your dev environment - for features such as hot reload.

Creating a New Scene

(Back to top)

Now that you have your environment set up and the initial view of your world, we can finish by showing how to create your own scene.

This will focus on adding a new environment to this repository, so we recommend becoming familiar with the code layout of each folder.

Code Layout

(Back to top)

The main area you will work with in this example is the "scenes" folder, which is displayed as follows: packages → client → public → scenes folder

The "packages" folder contains the majority of files you will engage with, all from the "client" itself to the README images you see in "docs".

Packages Layout

Next, we will open client to visit the public folder.

Within the public folder, we can view each folder's use case, such as the avatars we will use and the overarching scenes that we can display within Webaverse.

Scenes Folder

This layout can be viewed in the other test folders such as test-e2e.

As you begin building your own world, the scenes folder and its files can be formed around any avatar, item, or environment you upload.

To show this in more detail, we will create a new Scene (labeled as .scn files) to portray an environment with our own avatar for in-game use.

Building your Test Model

(Back to top)

First, you will need to download an environment and avatar for this example.

For the environment, we can visit the glTF Sample Models Repo and click "Download" in the top right corner.

For an avatar, we have chosen this VRoid Hub Sample Character. Click "Use this Model" to download.

Sample Character

After these files have downloaded, open up your Webaverse directory.

We will start by clicking on the client folder and creating a new folder called test-models.

Drag your new models into this folder and rename them accordingly.

Test Models Folder

Editing the scenes Folder

(Back to top)

Next, we will go to the previously mentioned public folder and open scenes.

Here we will see an extensive list of scenes that can be loaded into Webaverse.

Scenes Folder

As the foundation for our new Scene, we will be using the block.scn file.

block.scn File

You can either save this file as a new .scn file and label it "test-environment" or create a new file and simply copy-paste the code over.

For this example, we have left the block.scn file as is and created a new test-environment.scn file.

Initial test-environment.scn

After this has been set up, go to the scenes.json file within this folder.

You will see a list of all the added scenes, which is how your local Webaverse will be able to switch between scenes.

Scroll down to the bottom and add "test-environment.scn" at the end.

Make sure to add a comma after the scene above this.

Test Environment Scene

Now you can go back and visit the local instance of Webaverse that you have running and select this file.

Click on the "Maps" icon on the top right and you should see your new test-environment.scn file appear here.

With this displayed, you can make changes to the underlying file and see your changes whenever you refresh the browser.

Adding to your Test Environment

(Back to top)

Up next is editing your new Scene!

Revisit the test-environment.scn file. Each Scene starts out with "objects" which references the different parts of the scene you will be creating.

This covers everything from the position of your avatar, the lighting within the scene, and the full environment that we have downloaded.

Our first step will be to remove the next section under the directional light object so that we can add a new position.

Removing an Object

Once removing these, we can add in new objects.

We will start by adjusting the render settings to add in fog and a depth of field.

Copy the following code block underneath the object, beginning with },:

    },
    {
      "type": "application/rendersettings",
      "content": {
        "fog": {
          "fogType": "exp",
          "args": [[255, 255, 255], 0.001]
        },
        "dof": {
          "focus": 1.5,
          "aperture": 0.0004,
          "maxblur": 0.002
        }
      }
    },

Then we will place the downloaded environment into the center of our scene and increase its scale by 10x.

Place this code block right underneath the one above:

    {
	"position": [
		0,
		0,
		0
	],
	"scale": [
        10,
        10,
        10
	],
	"start_url": "/test-models/environment.glb"
    },

Finally, we can add the avatar and place it two meters to the right of our view.

When you initially opened your local scene, you most likely noticed the first-person view. With this example, and others in the scenes folder, you can play around with different ways for your avatar to be displayed.

Copy this code block underneath the environment and close it out like this:

{
	"position": [
		2,
		0,
		0
	],
    	"start_url": "/test-models/avatar.vrm",
        "dynamic": true
    }
  ]
}

Now save your file, go back to your browser's local instance, and refresh! You should now be able to move around in a brand new city scene with an equippable avatar.

Additional Tips

(Back to top)

Exploring

(Back to top)

With your brand new scene up and running, we suggest getting familiar with even more as you learn.

You can start by testing out different parameters or looking at other files in the scenes folder to understand how everything works.

Eventually, your experimentation will lead you toward new ideas to build out and help you understand what is possible in Webaverse.

Helping Out

(Back to top)

We always encourage everyone to contribute where they can! To make changes as simple as possible, we suggest forking the repository to your own Github account.

Then, go through the Installation steps as described.

Whenever you are ready to have your changes reviewed, refer to Let's Build Together! on best practices and our current processes.

Contributors

(Back to top)

Thanks goes to these wonderful people (emoji key):

empec-webastudios
empec-webastudios

🚇
Avaer Kazmer
Avaer Kazmer

💻
Vis
Vis

💻
codingbycl
codingbycl

💻
jin
jin

🖋 💻 📖 🤔
M̵̞̗̝̼̅̏̎͝Ȯ̴̝̻̊̃̋̀Õ̷̼͋N̸̩̿͜ ̶̜̠̹̼̩͒
M̵̞̗̝̼̅̏̎͝Ȯ̴̝̻̊̃̋̀Õ̷̼͋N̸̩̿͜ ̶̜̠̹̼̩͒

💻
Shubham Jain
Shubham Jain

💻
TheoTheDev
TheoTheDev

💻
tcm390
tcm390

💻
GuiltyRegicide
GuiltyRegicide

🎨
Muhammad Abeer
Muhammad Abeer

💻
arya
arya

💻
Loryhoof
Loryhoof

💻
plankatron
plankatron

🎨
torchesburn
torchesburn

💻
a Goblin King
a Goblin King

💻
Jack Z.
Jack Z.

💻
Ali Saad
Ali Saad

💻
Adam Clarke
Adam Clarke

💻
2AM
2AM

🔊
Matthew Willox
Matthew Willox

💻
memelotsqui
memelotsqui

💻
cjft
cjft

💻
UltraBot
UltraBot

💻
intelliverse777
intelliverse777

💻
Ron
Ron

💻
ꈤꍟꎭꍟꌗꀤꌗ
ꈤꍟꎭꍟꌗꀤꌗ

💻
Patrick Bozic
Patrick Bozic

💻
Grant Roberts
Grant Roberts

🎨
alextitonis
alextitonis

💻
ahadshams
ahadshams

💼
Emotionull
Emotionull

📖 🤔 🖋
Andrea Ruzzenenti
Andrea Ruzzenenti

💻
soulofmischief
soulofmischief

💻
belopot
belopot

💻
David Rowe
David Rowe

💻
potoelite
potoelite

💻
NotFuji
NotFuji

🎨
zenkale
zenkale

⚠️
Dmytro Fomenko
Dmytro Fomenko

🎨
kiibarina
kiibarina

🎨
Jonas Kraasch
Jonas Kraasch

💻
Jimmy
Jimmy

💻
kishdr
kishdr

🎨

This project follows the all-contributors specification. Contributions of any kind are welcome!

Support

(Back to top)

Let's Build Together!

(Back to top)

We would love for you to come build with us. Before getting started, please review the documentation in it's entirety before contributing.

We have provided both the User Documentation and the Developer Documentation for you to begin with.

For additional questions and to meet our contributors, join our Discord and introduce yourself!

New Issues and Features

(Back to top)

For developers adding to this repository, please search Github issues before reporting a new issue or starting a new feature.

If you are starting a new feature or bug fix, we ask that you summarize and reference the issue, then indicate that you are working on it.

Pull Requests

(Back to top)

Please make sure your PRs change as little existing code as is necessary to prevent upstream merge conflicts.

When posting a pull request, document what the PR does and how it can be reviewed for Quality Assurance (QA).

PRs will be reviewed and accepted if they conform to our linting and code conventions. These include PRs that do not cause any bugs and will not decrease performance of the app.

We Hope to See You Soon!

(Back to top)

About

An open metaverse engine for everyone.

https://webaverse-compiler.vercel.app


Languages

Language:C++ 80.0%Language:JavaScript 13.3%Language:CMake 2.4%Language:C 2.2%Language:HTML 1.3%Language:CSS 0.4%Language:Shell 0.1%Language:Python 0.1%Language:Batchfile 0.1%Language:Lua 0.0%Language:GLSL 0.0%Language:Scala 0.0%Language:SuperCollider 0.0%Language:Dockerfile 0.0%Language:TypeScript 0.0%Language:PowerShell 0.0%Language:Makefile 0.0%