Skip to content
/ lemuria Public

Yet another project about creating a 3D virtual world and stuff

License

Notifications You must be signed in to change notification settings

7185/lemuria

Repository files navigation

Lemuria

build license last-commit CodeFactor
nestjs angular three

Yet another project about creating a 3D virtual world and stuff.

Lemuria

Powered with Nest (or Quart), Angular and Three.js.

Installation

First we need to fetch all dependencies:

$ npm ci

Then we build the frontend:

# You can also use build:prod to build a production-ready bundle
$ npm run build -w frontend

First DB and server setup

Here you will find a few steps to follow in order to create and populate a working database for Lemuria.

Install various dependencies for the server

There are two different implementations for the backend server: Node and Python.

Node backend

$ npx -w backend prisma generate --generator client

Python backend

$ python -m venv venv
$ source venv/bin/activate
$ pip install -r backend-py/requirements.txt
$ prisma generate --schema backend/prisma/schema.prisma --generator client-py

Create an empty database and import the dump files

Node backend

$ npx -w backend prisma db push --skip-generate

There is no node script to import worlds yet, so you can use the python one instead.

Python backend

# See above for the venv setup
$ prisma db push --schema backend/prisma/schema.prisma
$ cd backend-py
$ python tools/import_lemuria.py

This will create and init the database backend/app.db using the data in dumps/atlemuria.txt and dumps/proplemuria.txt.

Serve the world files

Once again, you can choose between node or python to serve the world resource files. To avoid CORS issues when accessing static files from a web browser, do the following:

Node file server

$ npx -y http-server -p 8181 -c-1 --cors

Python file server

$ cd backend-py
$ python tools/serve_path.py

This will run a script to serve files in the current directory on port 8181. You will also need the village2 resource path to be served, to do so you can create a symlink by running the following (but set the path correctly first):

$ ln -s /my/path/to/resource/directory/for/village2 village2

Run the server

The API backend is listening on port 8080.

Node backend

$ npm -w backend run start

Python backend

$ prisma generate --schema backend/prisma/schema.prisma --generator client-py # only needed if the prisma version or the schema changed
$ cd backend-py
$ python app.py

Docker

You can also generate a docker image to build the project and run the server in a container:

# Build with the node backend
$ docker build --target node -t lemuria .
# OR with the python backend
$ docker build --target python -t lemuria .

$ docker run -it -p 8080:8080 -v $PWD/backend-py/app.db:/backend/app.db -v $PWD/dumps:/backend/dumps lemuria

Bot

You can use node or python bots on Lemuria. See the bot and bot-py directories.

// typescript
import {Bot} from './bot'
# python
from bot import Bot

An example bot bonobot.ts/bonobot.py is available in this repository.

Try it out!

Once npm run start (or app.py) and http-server (or serve_path.py) are running: open your favorite web browser and go to http://localhost:8080, you should be prompted with a login screen, put whatever nickname you want, the password you provide doesn't matter as there's no proper authentication for the moment.