Matchmaking

Xbox Live和UWP的匹配(多人游戏)需要一些配置,通过在Xbox开发者门户网站上设置会话模板和匹配跳板。GameMaker通过使用UWP目标支持这一点,并允许你做以下事情。

To create a multiplayer session, you need to specify what Session Template is going to be used. These session templates are defined on the XDP, but an example is shown below:

Session Name: MatchSession
Contract Version: 107
Session Template (JSON text):
{
    "constants": {
        "system": {
            "version": 1,
            "maxMembersCount": 12,
            "capabilities": {
        },
            "memberInitialization": {
                "externalEvaluation": false,
                "membersNeededToStart": 1
            }
        },
        "custom": {}
    }
}

A description of the fields can be found in "Session Overview" in the XDK help file. Note that we currently don't support setting session parameters dynamically from GameMaker.

Along with the session template, a matchmaking hopper must also be set up to allow the session to be found (this is also done on the XDP). Hoppers are used to define rules which are used when matching players. As with session parameters, we don't currently support setting hopper parameters dynamically from GameMaker: Studio. See the "SmartMatch Matchmaking Configuration" section in the XDK help file for further details.

The following functions are available for Xbox Live matchmaking (note that you will also need to use the GameMaker Networking Functions for the connections etc...):

 

GameMaker provides an extra set of matchmaking functions for you to use to invite other players on the network to join a session, or for you to accept an invitation to join someone else's session. The functions available are:

 

When the player accepts an invitation from another player, one of two things happens:

Once you have called xboxlive_matchmaking_join_invite() the user will attempt to join the session and you will receive Asynchronous Social Events as if you had called xboxlive_matchmaking_find() on this session.