The main repository for the Darkflame Universe Server Emulator project.
Go to file
wincent 5f689104af Initial work on LUA scripting.
This LUA scripting implementation uses the sol header only C++ wrapper for the native LUA libraries.

The API does not follow the original LU scripting. Each instance of a script is in its own LUA-State, and has 'self' as a global. There are hooks to all the implemented CppScript methods, as well as a subset of the entity functionallity. Has to be expanded upon.

This is local work which has been sitting for awhile; thought someone might like to take a look at it.
2022-04-13 19:51:14 +02:00
.github Update requested VS version 2022-01-05 14:29:24 +01:00
dAuthServer Fixes dlogger PR 2021-12-13 16:57:43 +01:00
dChatFilter Updated solution 2021-12-07 21:03:55 +01:00
dChatServer Added more missing newline characters 2021-12-28 19:27:46 +00:00
dCommon Added logic to Convert UScore to Coins for Level 45 Characters (#348) 2022-02-03 07:50:02 +01:00
dDatabase fixed __int64 in missions table 2022-03-29 19:47:27 -07:00
dGame Initial work on LUA scripting. 2022-04-13 19:51:14 +02:00
dLua Initial work on LUA scripting. 2022-04-13 19:51:14 +02:00
dMasterServer Merge pull request #416 from Marcono1234/MasterServer-closing-db 2022-04-03 11:31:53 +02:00
dNet World packets change 2022-03-31 18:17:23 -07:00
docker Rename build dir to cmake_build 2022-01-05 17:38:53 +01:00
dPhysics Public release of the DLU server code! 2021-12-05 18:54:36 +01:00
dScripts Initial work on LUA scripting. 2022-04-13 19:51:14 +02:00
dWorldServer moved initialization of entity 2022-03-31 18:17:43 -07:00
dZoneManager fixed ghosting issue 2022-02-05 17:56:19 -08:00
migrations Merge pull request #476 from EmosewaMC/bugReportFixing 2022-04-01 15:12:58 -07:00
resources Merge branch 'DarkflameUniverse:main' into main 2021-12-25 17:05:37 +01:00
tests Add windows CI 2022-01-05 14:12:28 +01:00
thirdparty Move AccountManager to submodules 2022-01-05 17:32:30 +01:00
vanity Update NPC.xml 2021-12-06 08:04:19 -06:00
.clang-format Public release of the DLU server code! 2021-12-05 18:54:36 +01:00
.clang-tidy Public release of the DLU server code! 2021-12-05 18:54:36 +01:00
.dockerignore WIP: connection issue 2021-12-08 02:40:27 +01:00
.env.example Add special character warning 2022-01-05 17:46:59 +01:00
.gitattributes Use LF for *.sh files 2021-12-31 14:07:40 +01:00
.gitignore Moved all the setup of client files into a single use Docker image 2021-12-08 00:50:15 -07:00
.gitmodules Move AccountManager to submodules 2022-01-05 17:32:30 +01:00
build.sh Marked build.sh as executable and updated README.md to note that build.sh exists and is useful 2021-12-05 17:28:27 -06:00
CMakeLists.txt Initial work on LUA scripting. 2022-04-13 19:51:14 +02:00
CMakePresets.json Update CMake minimum requirement (#380) 2022-01-17 12:46:33 +01:00
CMakeVariables.txt Bump patch version 2022-02-09 10:59:43 +01:00
CONTRIBUTING.md Update CONTRIBUTING.md to include commit guidelines 2021-12-08 18:11:12 +01:00
Docker_Windows.md Removed unnecessary note about slashes 2022-01-02 10:24:01 +01:00
docker-compose.yml Make some Docker Compose volumes read-only 2022-01-24 21:52:11 +01:00
Docker.md Merge branch 'main' into pr-comments 2021-12-14 20:03:58 +01:00
LICENSE Public release of the DLU server code! 2021-12-05 18:54:36 +01:00
logo.png Public release of the DLU server code! 2021-12-05 18:54:36 +01:00
README.md Update README.md 2022-01-31 04:34:22 -08:00
versions.txt Public release of the DLU server code! 2021-12-05 18:54:36 +01:00

Darkflame Universe

Introduction

Darkflame Universe (DLU) is a server emulator for LEGO® Universe. Development started in 2013 and has gone through multiple iterations and is now able to present a near perfect emulation of the game server.

LEGO® Universe

Developed by NetDevil and The LEGO Group, LEGO® Universe launched in October 2010 and ceased operation in January 2012.

License

Darkflame Universe is licensed under AGPLv3, please read LICENSE. Some important points:

  • We are not liable for anything you do with the code
  • The code comes without any warranty what so ever
  • You must disclose any changes you make to the code when you distribute it
  • Hosting a server for others counts as distribution

Disclaimers

Setup difficulty

Throughout the entire build and setup process a level of familiarity with the command line and preferably a Unix-like development environment is greatly advantageous.

Hosting a server

We do not recommend hosting public servers. DLU is intended for small scale deployment, for example within a group of friends. It has not been tested for large scale deployment which comes with additional security risks.

Supply of resource files

Darkflame Universe is a server emulator and does not distribute any LEGO® Universe files. A separate game client is required to setup this server emulator and play the game, which we cannot supply. Users are strongly suggested to refer to the safe checksums listed in the resources tab below when checking if a client will work.

Build

Development of the latest iteration of Darkflame Universe has been done primarily in a Unix-like environment and is where it has been tested and designed for deployment. It is therefore highly recommended that Darkflame Universe be built and deployed using a Unix-like environment for the most streamlined experience.

Prerequisites

Clone the repository

git clone --recursive https://github.com/DarkflameUniverse/DarkflameServer

Python

Some tools utilized to streamline the setup process require Python 3, make sure you have it installed.

Choosing the right version for your client

DLU clients identify themselves using a higher version number than the regular live clients out there. This was done make sure that older and incomplete clients wouldn't produce false positive bug reports for us, and because we made bug fixes and new content for the client.

If you're using a DLU client you'll have to go into the "CMakeVariables.txt" file and change the NET_VERSION variable to 171023 to match the modified client's version number.

Linux builds

Make sure packages like gcc, cmake, and zlib are installed. Depending on the distribution, these packages might already be installed. Note that on systems like Ubuntu, you will need the zlib1g-dev package so that the header files are available.

CMake must be version 3.14 or higher!

Build the repository

You can either run build.sh when in the root folder of the repository:

./build.sh

Or manually run the commands used in build.sh:

# Create the build directory, preserving it if it already exists
mkdir -p build
cd build

# Run CMake to generate make files
cmake ..

# Run make to build the project. To build utilizing multiple cores, append `-j` and the amount of cores to utilize, for example `make -j8`
make

MacOS builds

Download precompiled MySQL connector

# Install required tools
brew install boost mysql-connector-c++

# Symlinks for finding the required modules
sudo ln -s /usr/local/mysql-connector-c++/lib64/libmysqlcppconn.dylib /usr/local/mysql-connector-c++/lib64/libmysql.dylib 
sudo ln -s /usr/local/mysql-connector-c++/lib64/libcrypto.1.1.dylib /usr/local/mysql/lib/libcrypto.1.1.dylib

Then follow the Linux build steps (gcc is not required), but before running make, run the following to make sure all the libs are available in the build folder:

sudo ln -s /usr/local/mysql-connector-c++/lib64/libssl.1.1.dylib /path/to/build/folder/libssl.1.1.dylib
sudo ln -s /usr/local/mysql-connector-c++/lib64/libcrypto.1.1.dylib /path/to/build/folder/libcrypto.1.1.dylib

Windows builds (native)

Ensure that you have either the MSVC or the Clang (recommended) compiler installed. You will also need to install CMake. Currently on native Windows the server will only work in Release mode.

Build the repository

:: Create the build directory
mkdir build
cd build

:: Run CMake to generate make files
cmake ..

:: Run CMake with build flag to build
cmake --build .

Windows builds (WSL)

This section will go through how to install WSL and building in a Linux environment under Windows. WSL requires Windows 10 version 2004 and higher (Build 19041 and higher) or Windows 11.

Open the Command Prompt application with Administrator permissions and run the following:

# Installing Windows Subsystem for Linux
wsl --install

Open the Ubuntu application and run the following:

# Make sure the install is up to date
apt update && apt upgrade

# Make sure the gcc, cmake, and build-essentials are installed
sudo apt install gcc
sudo apt install cmake
sudo apt install build-essential

Follow the Linux instructions

Setting up the environment

Database

Darkflame Universe utilizes a MySQL/MariaDB database for account and character information.

Initial setup can vary drastically based on which operating system or distribution you are running; there are instructions out there for most setups, follow those and come back here when you have a database up and running.

  • Create a database for Darkflame Universe to use
  • Run each SQL file in the order at which they appear here on the database

Resources

LEGO® Universe 1.10.64

This repository does not distribute any LEGO® Universe files. A full install of LEGO® Universe version 1.10.64 (latest) is required to finish setting up Darkflame Universe.

Known good SHA256 checksums of the client:

  • 8f6c7e84eca3bab93232132a88c4ae6f8367227d7eafeaa0ef9c40e86c14edf5 (packed client, rar compressed)
  • c1531bf9401426042e8bab2de04ba1b723042dc01d9907c2635033d417de9e05 (packed client, includes extra locales, rar compressed)
  • 0d862f71eedcadc4494c4358261669721b40b2131101cbd6ef476c5a6ec6775b (unpacked client, includes extra locales, rar compressed)

Known good SHA1 checksum of the DLU client:

  • 91498e09b83ce69f46baf9e521d48f23fe502985 (packed client, zip compressed)

How to generate a SHA256 checksum:

# Replace <file> with the file path to the client

# If on Linux or MacOS
shasum -a 256 <file>

# If on Windows
certutil -hashfile <file> SHA256

Unpacking the client

  • Clone lcdr's utilities repository here
  • Use pkextractor.pyw to unpack the client files if they are not already unpacked

Setup resource directory

  • In the build directory create a res directory if it does not already exist.
  • Copy over or create symlinks from macros, BrickModels, chatplus_en_us.txt, names, and maps in your client res directory to the server build/res directory
  • Unzip the navmeshes here and place them in build/res/maps/navmeshes

Setup locale

  • In the build directory create a locale directory if it does not already exist
  • Copy over or create symlinks from locale.xml in your client locale directory to the build/locale directory

Client database

  • Use fdb_to_sqlite.py in lcdr's utilities on res/cdclient.fdb in the unpacked client to convert the client database to cdclient.sqlite
  • Move and rename cdclient.sqlite into build/res/CDServer.sqlite
  • Run each SQL file in the order at which they appear here on the SQLite database

Configuration

After the server has been built there should be four ini files in the build director: authconfig.ini, chatconfig.ini, masterconfig.ini, and worldconfig.ini. Go through them and fill in the database credentials and configure other settings if necessary.

Verify

Your build directory should now look like this:

  • AuthServer
  • ChatServer
  • MasterServer
  • WorldServer
  • authconfig.ini
  • chatconfig.ini
  • masterconfig.ini
  • worldconfig.ini
  • locale/
    • locale.xml
  • res/
    • CDServer.sqlite
    • chatplus_en_us.txt
    • macros/
      • ...
    • BrickModels/
      • ...
    • maps/
      • navmeshes/
        • ...
      • ...
  • ...

Running the server

If everything has been configured correctly you should now be able to run the MasterServer binary. Darkflame Universe utilizes port numbers under 1024, so under Linux you either have to give the binary network permissions or run it under sudo.

First admin user

Run MasterServer -a to get prompted to create an admin account. This method is only intended for the system administrator as a means to get started, do NOT use this method to create accounts for other users!

Account Manager

Follow the instructions here to setup the DLU account management Python web application. This is the intended way for users to create accounts.

Admin levels

The admin level, or game master level, is specified in the accounts.gm_level column in the MySQL database. Normal players should have this set to 0, which comes with no special privileges. The system administrator will have this set to 9, which comes will all privileges. Admin level 8 should be used to give a player a majority of privileges without the safety critical once.

While a character has a gmlevel of anything but 0, some gameplay behavior will change. When testing gameplay, you should always use a character with a gmlevel of 0.

User guide

A few modifications have to be made to the client.

Client configuration

To connect to a server follow these steps:

  • In the client directory, locate boot.cfg
  • Open it in a text editor and locate where it says AUTHSERVERIP=0:
  • Replace the contents after to : and the following , with what you configured as the server's public facing IP. For example AUTHSERVERIP=0:localhost for locally hosted servers
  • Launch legouniverse.exe, through wine if on a Unix-like operating system
  • Note that if you are on WSL2, you will need to configure the public IP in the server and client to be the IP of the WSL2 instance and not localhost, which can be found by running ifconfig in the terminal. Windows defaults to WSL1, so this will not apply to most users.

Survival

The client script for the survival minigame has a bug in it which can cause the minigame to not load. To fix this, follow these instructions:

  • Open res/scripts/ai/minigame/survival/l_zone_survival_client.lua
  • Navigate to line 617
  • Change PlayerReady(self) to onPlayerReady(self)
  • Save the file, overriding readonly mode if required

If you still experience the bug, try deleting/renaming res/pack/scripts.pk.

Brick-By-Brick building

Brick-By-Brick building requires PATCHSERVERIP=0: in the boot.cfg to point to a HTTP server which always returns HTTP 404 - Not Found for all requests. This can be achieved by pointing it to localhost while having sudo python -m http.server 80 running in the background.

In-game commands

Here is a summary of the commands available in-game. All commands are prefixed by / and typed in the in-game chat window. Some commands requires admin privileges. Operands within <> are required, operands within () are not. For the full list of in-game commands, please checkout the source file.

Command Usage Description Admin Level Requirement
info /info Displays server info to the user, including where to find the server's source code.
credits /credits Displays the names of the people behind Darkflame Universe.
instanceinfo /instanceinfo Displays in the chat the current zone, clone, and instance id.
gmlevel /gmlevel <level> Within the authorized range of levels for the current account, changes the character's game master level to the specified value. This is required to use certain commands.
testmap /testmap <zone> (clone-id) Transfers you to the given zone by id and clone id. 1
ban /ban <username> Bans a user from the server. 4
gmadditem /gmadditem <id> (count) Adds the given item to your inventory by id. 8
spawn /spawn <id> Spawns an object at your location by id. 8
metrics /metrics Prints some information about the server's performance. 8

Credits

Contributors to DLUv3

  • DarwinAnim8or
  • Wincent01
  • Mick
  • averysumner
  • Jon002
  • Jonny
  • Xiphoseer

Research and tools

  • lcdr

Community management

  • Neal

Former contributors

  • TheMachine
  • Matthew
  • Raine
  • Bricknave

Special thanks

  • humanoid24
  • pwjones1969
  • BlasterBuilder for the logo
  • ALL OF THE NETDEVIL AND LEGO TEAMS!