Skip to content

Setting Up The Development Environment

FeroxFoxxo edited this page Mar 4, 2023 · 52 revisions

Dependencies

Make sure you have the following dependencies downloaded:

  • Visual Studio 2022 Community found here

    • .NET Desktop Development checked in the Workloads tab.

    • ASP.Net and Web Development checked in the Workloads tab.

    • .NET 7.0 Runtime checked in the Individual Components tab.

  • Game & Launcher Executables

    • Any version greater than 2014 is currently supported.

    • If you do not have this, there is a version that has been preserved on the Web Archive.

  • Cached Asset Bundles

    • ORIGINALLY located in AppData\LocalLow\Unity\WebPlayer\Cache. You will want to move everything out of this folder if files already exist and alert people of it. This is what we rely on to recache files.

    • If you do not have this folder, as is likely the case, there is a version that has been preserved on the Web Archive.

NB: The Internet Archive is a 501(c)(3) non-profit, building a digital library of Internet sites and other cultural artifacts in digital form. Please see here for more information.

We are not associated with these Web Archive uploads, as are independent of this project.

Running The Server

Cloning the repository

To clone the MQReawakened repository, please click Clone a Repository inside Visual Studio in the Welcome screen, setting the repository to be a GitHub repository with the URL of https://github.com/FeroxFoxxo/MQReawakened. Click Open and it should clone the repository.

Importing the game source code into MQReawakened

To import the DLLs, containing the code for the original game, into MQReawakened, copy all the files from game/[GAME]_Data/Managed, a folder in the original game directory, into MQReawaken/Server.Reawakened/Dependencies, a folder in the cloned repository from Visual Studio. If this Dependencies directory does not exist, create it.

First time building

Check to see if you're in the solution by going to the bottom right and clicking "Solution Explorer". Then, look at the bottom of this for a purple icon labeled MQReawaken.sln. Double-click on this to open the project. Then, press the green "Init" button at the top of Visual Studio to build and run the server.

You may get a message saying if you want to install SSL certificates as part of the IIS. If you do, just press yes.

After this, the server will prompt you with the following, where all files shown are in the MQReawaken\Init\bin\Debug directory, as this is the default build output:

  • Whether you want to host a server, or play on one, in which case whether you want to be put into multi-player or single-player mode. Instructions for joining the multiplayer community server are below](https://github.com/FeroxFoxxo/MQReawakened/wiki/Setting-Up-The-Development-Environment#setting-up-multiplayer), as with how to set up your own. Else, just press 'y' for playing, and 'n' to use single-player mode in the first prompt.

  • User data for your default login, including a chosen username, password, gender and date of birth. This is saved locally in Saves/account.json and Saves\userinfo.json.

  • Whether you wish to enable protocols that are handled and would otherwise fill the console, including ss (sync), Pp (ping), ku (clock). Generally, press 'N' unless you are dealing directly with them. You can add/remove these manually using the IgnoreProtocolType array in Configs\InternalServerConfig.json.

  • The location of the game's settings.txt file. Generally located in its root directory, though < 2014 may be stored in the launcher directory.

image

  • The location of the cached asset bundles. There will be a root __info file at the head of your stored cache. If you are using multiple caches, you can combine them by creating a blank __info file with no file extension in a parent directory containing these. If you do not know how to turn off file extension hiding, please use this article from Adobe.

image

  • Whether the cache should flush on server start. You should press N here if you have not run the game before on this computer. If you have used the original game, you should save these caches down - these are what you should use as your stored cache beforementioned, dragged out of this temporary folder. If you have used MQReawakened before, you should not save these, as the purpose of this is to delete the files the server has created itself. This root __info file, if it exists, should be stored in C:\Users\USER\AppData\LocalLow\Unity\WebPlayer\Cache. This folder should NOT be your stored cache folder shown above.

image

  • If you choose this option, you should enable flushing on each start of the server, in the next prompt. It will be slower, but ensure that any bugs with asset bundle loading will be able to be fixed.

The server will then detect all the cached assets you have provided and compile a dictionary of them. This commonly takes ~20 minutes, so sit back and have a coffee!

Setting up multiplayer

  • To switch to using our server, rather than singleplayer, please run the command 'changeOperationalMode' in the console.

  • You want to press 'Y' for playing the game, 'Y' for connecting to a server, and then the address is mqreawaken.games.

  • To create an account, once your launcher opens, simply press the Create a new account button at the bottom!

Setting up to be a server

All you need to do is publish the project to an executable file by right-clicking the Init project and pressing Publish. I recommend the following settings for installing on a Linux server.

image

Move all the files in the publish directory shown in the target location above to your own server and install a web server like Nginx. If you do not know how to do this, there is a link here.

Use the following script to create a reverse proxy.

server {
    listen 80;
    listen [::]:80;

    server_name DOMAIN www.DOMAIN;

    location / {
        client_max_body_size 10m;
        proxy_set_header X-Forwarded-For $http_x_forwarded_for;
        proxy_pass http://localhost:8080;
    }
}

This file goes into /etc/nginx/sites-avaliable/DOMAIN. Remember to make a link with it to sudo ln -s /etc/nginx/sites-available/DOMAIN /etc/nginx/sites-enabled/, and sudo systemctl restart nginx.

DOMAIN is the domain name of your website. For example, mqreawaken.games.

If you are on Linux, you can run the game using ASPNETCORE_URLS=http://0.0.0.0:8080/ ./Init.

If you want to host it for extended periods of time, you can use a service like TMUX, which may be preinstalled. Simply use tmux to start a session, Control+B + D to exit it, and tmux attach -t 0 to reattach to that session.

Then, when configuring operational mode, put in the IP Address or domain that is directed at your server. If you choose not to put these in, the server will ping another to find its own external address, however; this may not be correct.

If you are unable to connect to the server externally, please ensure that NGINX is allowed through the firewall, as well as the default port of the server of 8080 (for the website) and 9339 (for the socket TCP server).

Note: the server does not update automatically, so you will have to manually rebuild it, deploy, shut down, and start it on each update. It also does not currently support HTTPS encryption.

Running the game

Once you have completed this stage, you can log in using the username and password you have prior specified. It is recommended to choose to remember your username and password in the launcher for easier use.

The current asset bundle loading system does not work, and so on running the game it will crash. Before this, you should see a bunch of messages in light blue, of the client attempting to download these assets. When you stop seeing these blue messages, and it all turns purple, close the game. Then, with the game closed, run the replaceCaches command.

  • If this is your first time running replaceCaches, you will need to locate the __info file for the caches the game, if not specified in the "Flush Caches" section above. This file is located in C:\Users\USER\AppData\LocalLow\Unity\WebPlayer\Cache. Please note: do NOT select the stored assets that you used to generate the asset dictionary.

On load of any new asset, you will run into the client requesting these from the server. Such, every time you start to see these messages related to loading in bundled files pop up, followed by a subsequent crash of the client, you must repeat the replaceCaches process described above.

Each time you are done with the server and wish to close it, please run the shutdown command, so your progress gets saved to the disk.

How to update the project in Visual Studio

  • Go into the "Git Changes" tab.
  • Press the "pull" button.

image

Fixing the original game (OPTIONAL)

Setting up advanced logging

If the game encounters a crash, it will fire a log to the original servers. As such, you'll have to manually edit these to send them to your server. The strings are in Configuration.WebsiteRootUrl, DebugToolsManager.LogError and DebugToolsManager.LogFatalError, as shown below, using a program like DNSpy. These are found in the game/[GAME]_Data/Managed/Assembly-CSharp.dll file.

image image image

Simply, Configuration.WebsiteRootUrl must be set to use localhost and the URLs for DebugToolsManager.LogError and DebugToolsManager.LogFatalError must not have a / before them.

You can then save the DLL file back to the same place it was originally.

Setting up Omniture tracking

Use DNSpy, as shown above, to replace the following fields shown in pink with "localhost".

image

MQReawakened Wiki

Development

Developer Tutorials

System Protocols:

External Protocols (TO DO):

Entities (TO DO):

  • Init Data
  • Sync Events

Miscellaneous (TO DO):

  • Console Commands
  • Timers
  • XMLs
  • Web
Clone this wiki locally