Tag Archives: update

Migrating to ManiaPlanet 3

Hey there folks,

After a long time I’m back with new Defusing posts. ;)
The first step we have to take before going on with developing actual features is the migration to ManiaPlanet 3 (MP3).

Nadeo introduced quite some new stuff but also discarded some old things.
Especially if you look at maniascript classes!


The well known BlockSpawns and BlockPoles are gone.
Now you have to access the Spawns and Goals via the new landmarks arrays
“MapLandmarks_PlayerSpawn” and “MapLandmarks_Gauge”.
For that and more new properties I recommend taking a look at the class documentation.

A “landmark” is a generic block on the map that can have various properties and features.
The spawn block for example is a landmark that has a filled PlayerSpawn property to use for spawning players.
The goal blocks are now called “Gauge” which basically tells you that it can be captured. Since they added the gates, the name “Goal” didn’t fit anymore, as the gates can be captured just like the goals and checkpoints.
The CSmMode class has some array properties to conveniently access these different types of blocks.

Implementing this change is basically the only thing we have to do for Defusing because it doesn’t have many features.
In order to do that I heavily recommend using the ingame script editor and its “Compile” function. It will tell you if you use deprecated properties or functions so that you can replace them accordingly.
Most of the time the needed change is a simple replacing of the name as the new classes have pretty much the same interfaces as their old versions.

“BlockSpawns” becomes “MapLandmarks_PlayerSpawn”
“BlockPoles” becomes “MapLandmarks_Gauge”
“Bases” becomes “MapBases”


Though there are a few stumbling blocks that I would like to mention here:

1. The property “CSmModeEvent::BlockPole” hasn’t been marked as deprecated yet even though it’s supposed to be replaced by “CSmModeEvent::Landmark”! You will need to watch out for that yourself as you don’t get a warning for it. I simply search for the string “block” via Ctrl+F to check if there are obsolete occurrences.

2. Using spawn objects to spawn players has a facet that you should keep in mind. Before MP3 one often accessed an object from the BlockSpawns array and passed it to the spawn function. Now you have to pass the .PlayerSpawn object of a spawn landmark. The thing is that many game modes save ids of spawns in variables. For that you should now use the landmark id because there is no array of playerspawn objects.
It’s kind of obvious but I just wanted to mention it because I saw someone doing something like:

declare Spawn <=> MapLandmarks_PlayerSpawn[0].PlayerSpawn;

This way he doesn’t have access to the landmark and its properties like the Position which is quite important imo.

3. If you use Manialinks with scripts you will have to check them by yourself as they aren’t validated by the Compile function, simply because they are placed in a string so that their code can’t be recognised.
I noticed that the log will print the warning if an error occurs. So if you want to quickly check if your Manialink script needs some update work you can cause an error on porpose.
For example like that:

log(BlockPoles.count); // Deprecated property access
Null.Error = True; // Error source

This will lead to the result you can see here:
Deprecated warning in Manialink script
(The script needs to have a valid syntax because the warning wouldn’t show up if there is a compile error.)


Now you’re good to go for updating your game mode script for ManiaPlanet 3.
And we will be able to add some nice stuff in the future because Defusing is now again fully supported by MP3.

You can find the updated script on GitHub: Defusing v0.08

Cheers,
Steff

New Posts after Upcoming Update!

Hey there,

You probably have noticed that there haven’t been any posts in 2014. This is mainly caused by the fact that I don’t have much time these months.
Now I would have the time to continue the work on Defusing while blogging about it, but with the big update around the corner I would rather like to wait for it to be released.

The first post will then be about migrating an existing mode to MP3.
After that the actual development of Defusing will continue.

So stay tuned and have fun!

Cheers,
Steff