Author Topic: Slayer game mode API feedback  (Read 1788 times)

I'm working on a new game mode API for Slayer and I wanted your input on it.

This is the extent of the current API:
Code: [Select]
Slayer.GameModes.addMode("Capture the Flag", "CTF", true, true);It's very limited and doesn't have any flexibility.

This is a mockup of the new one:
Code: [Select]
new ScriptGroup(Slayer_GameMode)
{
//Game mode settings
title = "Capture the Flag";
scriptName = "CTF";
useTeams = true;
useRounds = true;

//Default minigame settings - player can change these
//Anything not defined here will use the global defaults.
default_title = "test minigame";
default_weaponDamage = false;

//Locked minigame settings - player cannot change these
locked_playerDatablock = nameToID("PlayerStandardArmor");

//Teams
new ScriptObject()
{
//Prevent team from being deleted
disable_delete = true;
disable_edit = false;

//Default team settings
default_name = "Red";
default_botFillLimit = -1;

//Locked team settings
locked_color = 0;
};
};
This allows the game mode to specify its own default settings and to prevent players from editing settings. ("locking" them) The game mode can also create teams.

What do you think about the design and how can I improve it?

It'd be pretty neat for each mini-game to have an actual ScriptObject instance of the gamemode (set by the class field in the ScriptGroup definition of it), which would then be used for callbacks and could be used for per-gamemode state.

new ScriptGroup(Slayer_GameMode)
{
    class = "MyGameMode";
    ...
};

function MyGameMode::onRoundStart(%this, %miniGame, ...)
{
    %this.clockExplodedThisRound = %miniGame.numMembers > 3;

    if (%this.clockExplodedThisRound)
        explodeClock();
}

function MyGameMode::onRoundEnd(%this, %miniGame, ...)
{
    if (%this.clockExplodedThisRound)
        %miniGame.chatMessageAll("\c6You have passed the clockening.");
}


Which would just internally be managed by creating a ScriptObject with class set to the same thing as whatever was specified in the original gamemode declaration.
« Last Edit: September 30, 2014, 02:25:09 AM by portify »

Yes, that's actually the plan! It'll be much cleaner than the current method.


Will the players be able to see in the GUI that some of the options are locked?
I assume so, but just making sure.

Other then that, seems a lot better!
I have no other thoughts or ideas for improvement currently.
I am not entirely known with the scriptgroup and scriptobject deal, shows how much i have really deepened myself into Torquescript.. :S
I did came across it once and figured it could be useful.