Previous topic

File storage

Next topic

GameSessions

This Page

Game finder

The Game finder plugin regroups all game finding related functionalities. It works as a pipe that accepts Parties as input, and produce game sessions as output.

parties —> Game finder —> game sessions

The simpliest game finder creates a game session per party in input. It’s used to create premade games.

A more complex implementation uses an internal in memory queue to match parties together.

Server Setup

The AddGameFinder extension method adds a GameFinder service to the scene it is called on. The metod takes a GameFinderConfig as argument, which declares:

  • The configuration key used for the gamefinder

  • The IGameFinderResolver, IGameFinder and IGameFinderDataExtractor implementations to use in the gamefinder service in place of default implementations registered either in the host or in the scene dependency scopes.

Game finder scene template declaration:

host.AddSceneTemplate(GAMEFINDER_TEMPLATE, (ISceneHost scene)=>
{
    scene.AddGameFinder(new Stormancer.Server.GameFinder.GameFinderConfig("default",builder=> {
        builder.Register<SampleGameFindingResolver>().As<IGameFinderResolver>();
        builder.Register<SampleGameFinder>().As<IGameFinder>();
        builder.Register<SampleGameFinderDataExtractor>().As<IGameFinderDataExtractor>();
    }));
});

Configuration

The game finder configuration system is designed to support a flexible configuration system with overriding of default configuration values:

The default configurations are keyed by “kind” defined when using AddGameFinderConfig. These configuration objects are available by default

"gamefinder":{
    "configs":{
        //Configs by "gamefinder kind"
        "matchmaker-solo":{
            "parameter":32
        }
    },
    "rules":{
        "filters":[
            {
                //Optional filters
                "scene":"matchmaker-solo",
                "region":"us-west",
                //Target config
                "config":"solo-us-west"
            }
        ],
        "configs":{
            "solo-us-west":{
               "parameter":12
            }
        }
    }

}