Oliverde8's blue Website

logo.png

eXpansion the story of a server controller for Maniaplanet

This last few years I have spent most of my weekends working on eXpansion. I have literally spent month on this wonderful project. Expansion is a server controller for Maniaplanet, but let start from the begining. 

What is eXpansion?

I suppose they are very few who wouldn't now about Trackmania? Trackmania is a multiplayer car racing game. The purpose of Trackmania is doing the best possible chronometer possible on a track. Depending on the game mode some rules might change but the basics of Trackmania has always been speed & speed with simplicity. You have only 4 buttons to play the game, no nitro nothing, and everyone has the same car.

From the beginning Nadeo, Trackmania's editor allowed players to create servers using the Dedicated Server. This way we could start servers without starting the game and run them on nearly any machine, Linux or Windows. 

But they didn't give the players just the means to open the server, they also put in the Dedicated Server means for other applications to communicate with it. Those applications can then interact with the players playing on the server. We call those applications controllers

Back to the story, Maniaplanet is the evolved version of Trackmania, and as developers we can create controllers that can interact with players in new ways never possible in the game before. 

Existing controllers from Trackmania Forever, were modified to work for Manialive but they didn't use the dedicated servers API to it's full potential. 

A friend of mine that realized this started working on eXpansion. From the beginning eXpansion was built as a package of plugins for the fantastic controller Manialive. But with time eXpansion evolved quite beyond it.

We use the bases of Manialive to communicate with the dedicated server & to handle events & loading of plugins but we had to expend Manialive quite a lot. Manialive was abandoned by it's developers so it didn't support everything we needed. And so eXpansion grew to start doing things that Manialive was never meant to do. For example

  • eXpansion is capable of loading & unloading plugins on the live without needing to restart the controller
     
  • All settings in Manialive are handled throught ini files. eXpansion uses this for default settings, but all settings can be overridden inside the game with dedicated interfaces. 
     
  • eXpansion has changed the install process & uses composer. It can use composer to auto update itself. 
     
  • When manialive was created we couldn't send custom scripts to the display of the game (like javascript but for the game)
    so we build in eXpansion it's own script inclusion engine; according to the blocks used on a certain window (like a html page but for the game) it will include the necessary scripts for the blocks to display. 
    • Example : if we display on a certain page a button with a tooltip, the tooltip scripts will be added
    • This goes further as eXpansion can actually build intelligent scripts.
       
  • Support for new game mode using json data instead of the traditional XML were added
     
  • Maniaplanet was also built to support custom game modes & custom games. (games in games).
    We created a unique dependency system, capable of detecting through the game (title) & game mode which plugins should run & should not run. 
    The system can load/unload plugins live as the gamemode changes. 
     
  • The ingame HTML doesen't support scrollbars, we designed & built scroller using the ingame scripting language (maniascript).
    It's integrated in eXpansion in such a way that creating new windows using this is very simple

We have done so many other cool features. 

  • You can change all the settings of you server in game with you mouse. No need for fancy commands
  • multi language support
  • The interface of eXpansion is unique, simple left click displays a menu. The players hud is completely customizable. Each player can move hide elements as he wishes. The settings are then saved and shared on all servers the player is playing. 
  • and check it all here http://ml-expansion.com/

eXpansion has certainly not the cleanest code out there; but for me it is the best controller for Trackmania on Maniaplanet.

Performance

While other controllers (with widget plugins active) can barely work with 200 players, eXpansion will not only work perfectly but it will on top of that display more accurate information on your Hud.  

How do we do that ?

There is 2 reasons why eXpansion is faster even through it's coded in object and should be slower. 

The Gui Handler

eXpansion uses Manialive's GUI handler which is completely different then the other controllers.With other controllers when a plugin needs to send a GUI element it will call the dedicated server and do it at that very moment. So if 20 plugins needs to display 20 windows, there are going to be 20 calls to the dedicated server. 

Manialive Gui handler uses a queue, so when a plugin asks for a window to be displayed it won't do it at that instance. It will only send it when the main loop is completed. When time comes to send it, it will group those windows in order to do a single grouped call to the dedicated (multicall).

Later in our developpments we realized that this engenders a major issue. The conceptors of Manialive had not taken into account 2 scenarios : 

  • A player has disconnected since the plugin has sent the send order to the controller. 
    So when the controller sends the window to let's say 3 user, and the first isn't connected anymore the dedicated servers throws an error, and all 3 users see nothing. 
  • When to much windows are grouped in a single call, we have a silent error, and the windows disappear.

So we had to do a lot of work to fix those issues, and they are still work in progress. The first issue is totally fixed, but we are still having issues with the second point.

But still on majority of the cases the GuiHandler works fine, and widgets are displayed to the player in the second it is needed. while the other controllers are still looping.  

In game scripts

Each time a player finishes the map, or passes thought a Checkpoint we need to update the display of nearly all the players in game, to keep them informed of where that guy is compared to him. Imagine now 200 players on map. Every few seconds we need to send 200 windows to 200 players. 

The other controller will start cheating when the number of players are above a certain level. For example they will stop displaying player specic data. Basically if you are 20th and the Panel shows only the first 10, you won't know where you are. 

But even with this solution, they need to send nearly a window per second when there is 200 players on a server. So they will only send windows every 20 seconds or so. In the end we have an issue. We don't always see the data we wish to see & even when we do we are not sure if it's up to date or not. 

This is where eXpansion, changes the game. We don't update our windows mid race. They are created at the beginning of the race, and updated with the in game scripting language Maniascript (the idea is the same as JS)
This makes the process much more complicated to handle, but offers a unique interface that can keep up with even the busiest servers. 

The only downfall, is fps loss. Well it like Javascript it runs on the client, so it can cause a slight FPS drop. But you can choose to disable them with a simple mouse click. 

Conclusion

eXpansion has become much more then a pack of plugins for Manialive, it is today the best controller for Maniaplanet. It lacks still a lot of features for Shootmania ( The FPS for Maniaplanet) but for Trackmania it is a complete solution. 

It still require work, alot of work, the game is constantly evolving and we need to have eXpansion keep up with it. There are also still bugs that needs fixing. 

But I am very happy to see the number of people using it, it's the second most used controller in Trackmania 2 according to Dedimania. And even through there is a couple of years of work in it, compared to the other controllers that are now over 10 years old, it's very young