Page 1 of 1

NEWS 18-12-2017 - Dataproviders for flexibility & Code name : Two Rivers

Posted: 18 Dec 2017, 22:23
by oliverde8
Image
NEWS 18-12-2017 - Dataproviders for flexibility & Code name : Two Rivers

Previous news : Here is a second issue of our eXpansion news, in this issue we will have a look into a new concept built for eXpansion. To our knowledge it is unique.

First of all a few little news :

I am happy to say that developments for Alpha-1 are nearly done(it was done until discovered something not to our liking); and we have done so much more work that I anticipated that we will actually make a package so that anyone can try it out and not just developpers

eXpansion 2.0.0.0 has also an official code name, Two Rivers. A great adventure starts in the Two Rivers during the third age of the wheel, 3 thousand years after the death of Lews Therin Telamon. It hasn’t been 3000 years since we dropped support for eXpansion1 but well it feels as it has been. "There are neither beginnings or endings to the turning of the Wheel of Time. But it us a new beginning" quoting wheel of time.

Christmas is at our doorstep, and even through the devs are ended we need to finish the docs and prepare packages for the alpha of eXpansion : 2.0.0 Two Rivers. So it will probably happen by the end of January.

Back to the main topic of this news Data Providers.

Data Providers

eXpansion has 2 experimental features that no other server to my knowledge had before. Dependency Injection which we talked about during the previous news, and Data Providers.

Dependency Injection is a know concept and we used Symfony for that. It was experimental because again to my knowledge no one used it on a script that runs as deamon.

Data providers on the other hand is a concept designed for eXpansion, for the Maniaplanet context. The main issue we had we eXpansion 1 is that we supported both legacy and script modes. This meant that we ended up with alot if script and if legacy. We also supported alot of game modes which added more if's to the code. It made the code more complex to maintain. With MP#4 and legacy callbacks disappearing it meant all our plugins needed a lot of love to make them work properly without having to force useLegacyCallbacks option of the dedicated.

This made us think, this is not the first time such changes happens. Usually the changes are not that big, it’s just that it affects lots of plugins. So can’t we make a system that will actually allow us to make a complete abstraction of how the callback is called, how the data of the callback is structured?

This made us came with our unique solution DataProviders.

Image

This image illustrate what is happening, for each game mode and each “event” a data provider is created. This DataProviders normalize the data before sending them to the players. A data provider can be configured to work on a single gamemode/script or be configured as being generic. The system will always choose the most specific data provider for the task.

Let’s look into this with examples.

One of the DataProviders in eXpansion is the RaceDataProvider, this provider has a single instance that works on all Trackmania modes (not all titles). But won’t work on any Shootmania gamemodes. It will send normalized onCheckPoint, onFinish, and onFinishLap events. The LocalRecords plugin depends upon this provider.

When the server connects in Shootmania Obstacle it will disable the LocalRecords Plugin because there is no RaceDataProvider compatible with Shootmania Obstacle. But a developer can code just the RaceDataProvider for Shootmania Obstacles, when he does this he automatically enables LocalRecords on Shootmania Obstacle.

this goes slightly further, we have the LocalRecordsWiget that depends upon LocalRecords, it wasn’t enabled before because LocalRecords wasn’t. Now that LocalRecords is enabled thanks to the new DataProvider LocalRecordsWidgets will also enable and work.

So bascailly when you wish to make an existing plugin compatible with a new gamemode you just need to add new data provider(s).

Let’s look into a second example. RaceDataProvider is generic for all TM Based titles. What happens if you wish to run it on a specific script sends non normalized events? You can create a new RaceDataProvider and specify that it’s compatible with only the particular script. As the second RaceDataProvider has a more precise definition that one will be chosed when playing on that specific script.

More flexibility then before

eXpansion one’s plugins were capable of knowing which game mode they were compatible with and switch on and off. But to make a existing plugin compatible with a new mode was complicated. eXpansion2 keeps the same feature with plugins enabling disabling as the script used is changed, but make it extremely easy to support new mode, as the logic to handle a particular script is centralized in Data Providers and not duplicated across multiple plugins.

I hope you enjoyed the news, hopefully next one will be the release of alpha-1.

Re: NEWS 18-12-2017 - Dataproviders for flexibility & Code name : Two Rivers

Posted: 24 Dec 2017, 07:54
by endbase
Keep up the good work ! looks promising :thumbsup: