How to set up a Lego Universe Server using Darkflame

Leonard Haddad
4 min readDec 25, 2021

--

Characters within LEGO Universe | NetDevil/The LEGO Group (2010) | Source: https://medium.com/subpixelfilms-com/the-story-of-lego-universe-c6377a8ca01b

History

Lego Universe was a Massive Multiplayer Online Game (MMO) that launched October 26th, 2010 and was closed on January 30th, 2012.

Ever since it’s closure fans have been trying to set up their own server projects to play the game again, the most notable of which are LuniServer, lcdr Universe, Uchu, and Darkflame Universe.

Darkflame Universe is a Lego Universe server emulator written in C++ which gained a whole lot of popularity thanks to its advances in development compared to other server emulators. It was closed source up until the 5th of December, 2021, which is when the Darkflame team open-sourced the Server and made it available to the world.

Disclaimer

Lego, the name and logo are copyrighted trademarks of The Lego Group Ltd. I am not associated, nor have any affiliation with them. Neither do I have any associations with the Darkflame team whatsoever. This article is meant purely as an easy to follow setup guide for a Darkflame Server emulator.

Foreword

This guide showcases how to setup a Darkflame Universe server on a Linux machine running an x86 architecture. Trying to set up a server on a different architecture, operating system or virtual machine might need slight modifications in the setup process.

For those looking for an automated setup tool, check out my gist on Github: https://gist.github.com/leolion3/ccf654ab60c8e110c65ef948da6af461#semi-automatic-installation

It includes both a Dockerfile for easy deployment, as well as an automated build tool which we will be using below.

For server admins looking to automate repetitive processes, such as server updated and data-backups, check out my other article: https://leolion.medium.com/how-to-automate-your-lego-universe-server-backups-and-updates-c2c4022241c2

Prerequisites

Before we run the build tool, navigate into a directory and then copy over the locale and res directories into this directory. The directory structure should look as follows:

server_directory/
├── locale/
| └── locale.xml
└── res/
├── cdclient.fdb
├── chatplus_en_us.txt
├── macros/
| └── ...
├── BrickModels/
| └── ...
├── maps/
| └── ...
└── names/
└── ...

Now that you’ve got that out of the way, download the setup tool using

curl -O https://gist.githubusercontent.com/leolion3/ccf654ab60c8e110c65ef948da6af461/raw/06c87e202a89c6de1704b4d8a9591c107ef01784/buildserver

This will download the buildserver.sh tool to the current directory. Then, just make it executable and run it:

chmod +x ./buildserver.sh
./buildserver.sh

After 10 seconds, the setup process starts. It will automatically download and update any libraries required for the server build. Should it fail on the cmake update or during the CMake file generation, stop it using ctrl+c and update to the latest CMake version using

sudo apt remove --purge --auto-remove cmake -y
sudo apt purge --auto-remove cmake
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata
sudo apt install -y software-properties-common lsb-release
sudo wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 42D5A192B819C5DA
sudo apt-add-repository "deb https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main"
sudo apt update
sudo apt install kitware-archive-keyring
sudo rm /etc/apt/trusted.gpg.d/kitware.gpg
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6AF7F09730B3F0A4
sudo apt update
sudo apt install cmake -y

and then restart the server build.

During the server build, it will prompt you for the location of the res directory. In a second commandline console, navigate into your server_directory directory and then into the res folder and execute pwd . Copy the full path excluding the trailing /. Do not use the tilde ~ in the path, as the bash script cannot resolve it.

Next hit enter, and watch as the script starts building the server (might want to grab a coffee while this goes on, it will take a while). When its done, it will prompt you for the IP Address on which you wish to host the server. Based on how the server will be hosted, there are three options:

  1. The server is hosted for the local machine only, the IP should be localhost
  2. The server is hosted on the local network, the IP should be your IPv4 address (ip route get 1.2 ). If doing this, make sure to set up a static IPv4 address for your machine.
  3. The server is hosted publicly. This is only allowed between friends according to the terms under which Darkflame was allowed to go public. Figuring out what IP Address to use here is quite tricky if you’re unfamiliar with networking, and keeping the (physical and virtual) server secure is quite the daunting task, so perhaps do your research before attempting this.

After entering the IP Address, the server will start and allow you to set up an admin account, after which the setup will terminate and the server is ready to roll.

Running the server

Finally, we can run the server using

~/DarkflameServer/build$ sudo ./MasterServer

Note: sudo is required as the authentication server runs on port 1001 which requires escalated privileges. This can be avoided using the command

su -m root -c "setcap CAP_NET_BIND_SERVICE=+eip ./AuthServer" && sudo -k && ./MasterServer

This will temporarily disable the need for sudo while using a protected port (port 1001 in this case) and then run the server without superuser privileges.

Closing words

In this article we learned how to set-up a Darkflame Universe Lego Universe server emulator. For additional features, client bug fixes and automation check out my gist on Github: https://gist.github.com/leolion3/ccf654ab60c8e110c65ef948da6af461

Additional tools are provided under the gist for managing user accounts, setting up Discord notifications for server startups/updates/shutdowns, automated server updates and more. If you’d like additional help setting up these automations, gladly leave a comment under this article or the public gist.

Thank you very much for your time, and have fun playing your favorite childhood game once more!

--

--

Leonard Haddad
0 Followers

Visual and Medical Computing M.Sc. / Software Engineer