External Game Backend integration

Subscribe to match events with your additional game backend service

What is the purpose of External Game Backend?

If you want to add to your game leaderboards, player progression or any play to earn functionalities and smart contract integrations, your game has to know about matches running on Elympics. To provide that information we have implemented a feature to add additional callbacks to your API called by our services.

How to enable it?

You just have to define endpoint for external game backend in web panel or via Elympics CLI. Changes should be applied within 5 minutes. Use keys provided in the web panel or in the CLI to verify request integrity and authenticity.

Available events

OnMatchCreate

Called after the match is created in our database, but before bootstrapping real game on one of ours game servers. It could be used to:

  • Insert information about the match in your database e.g. for statistical / progression purposes
  • Verify player-provided data for match initiation
  • Add and/or replace players initial data using one stored in your database
  • Block some players, game versions etc.
{
    "MatchId": "zxcv",
    "GameId": "asdf",
    "GameVersion": "123",
    "UserDatas": [
        {
            "UserId": "u1",
            "IsBot": false,
            "BotDifficulty": 0,
            "GameEngineData": "",
            "MatchmakerData": [1.0]
        },
        {
            "UserId": "u2",
            "IsBot": false,
            "BotDifficulty": 0,
            "GameEngineData": "",
            "MatchmakerData": [0.0]
        }
    ]
}
  
{
    "Allow": true,
    "RejectionCause: "",
    "UserDatas": [
        {
            "UserId": "u1",
            "IsBot": false,
            "BotDifficulty": 0,
            "GameEngineData": "",
            "MatchmakerData": [
                1
            ]
        },
        {
            "UserId": "u2",
            "IsBot": false,
            "BotDifficulty": 0,
            "GameEngineData": "",
            "MatchmakerData": [
                0
            ]
        }
    ]
}
  
curl --location --request POST 'https://{YOUR_BACKEND_URL}/elympics/match/create' \
--header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE2NTIzNjU0MjYsImV4cCI6MTk2NzcyNTQyNiwiaWF0IjoxNjUyMzY1NDI2fQ.EZ09qotly3uNzIntRzHYmo8G6dCNcCd5-LBCrlCzhye8WrmKWHkokFD2tXi54r0h1buLaMG7Q1O_fHLr0CxhJi1C5_pXrVjgpVrsJeYa-sIdlJnGnqS0QgmVeqvnIeacf8Y-hthQwysxtmy3pAzAdDk27AI5SfoIjJXVpIJZ6WRjdVfPMWjMUMqqtr9PNHUOklsg3umgPlmHe5Nc0RpPTX5tCpvyZQVlvXD7BZ1drrquhhXiN5wmnvVP8Ma8snjug0Btchw-kx2wGwR0U_1b5VMO1hMneybwNP8nwZSbZb9j3yurcrb2Q8MhHZDGyNBFXMQR3nCH76duvGtmr-byPg' \
--header 'Content-Type: application/json' \
--data-raw '{
    "MatchId": "zxcv",
    "GameId": "asdf",
    "GameVersion": "123",
    "UserDatas": [
        {
            "UserId": "u1",
            "IsBot": false,
            "BotDifficulty": 0,
            "GameEngineData": "",
            "MatchmakerData": [1.0]
        },
        {
            "UserId": "u2",
            "IsBot": false,
            "BotDifficulty": 0,
            "GameEngineData": "",
            "MatchmakerData": [0.0]
        }
    ]
}'
  
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA8Pjlz0DIJKyhOmw5t4Ih
D8wXOP3lN93+petucmvn7sC6TTtaGUAIyzMCaHh080LE2aCnLaF5aSWDown5u80X
tvL8NXLt9NsTriHxKpwgx5UQthpzsgd1AdkzFLmHQ84aFKndZly39nX/XiWBu3N4
VuPeWI4U9l23fGM3X14bEv1f7uz2GOipFkdfvl6TuFZmpRC9nJG57lfdKvifesei
jD2AbsyZi3WMU5Zz2znquxa/zzFGCxkjSmx6zKkNFMJYUM7As25Cp87mMEoIn8Pm
gEqFJX4DUtJibbw/dDUy+VIglAoCf9kHohM+aNH9WPgZ1DbXJKKHns4K/vQbgGus
5QIDAQAB
-----END PUBLIC KEY-----
  

OnMatchFinish

Called after the match is finished. It contains the information about match results.

{
    "MatchId": "zxcv",
    "GameId": "asdf",
    "GameVersion": "123",
    "UserDatas": [
        {
            "UserId": "u1",
            "IsBot": false,
            "BotDifficulty": 0,
            "GameEngineData": "",
            "MatchmakerData": [0.0, 3.0, -2.0]
        },
        {
            "UserId": "u2",
            "IsBot": false,
            "BotDifficulty": 0,
            "GameEngineData": "",
            "MatchmakerData": [1.0, -1.0, 4.0]
        }
    ]
}
  
{}
  
curl --location --request POST 'https://{YOUR_BACKEND_URL}/elympics/match/finish' \
--header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE2NTIzNjU0MjYsImV4cCI6MTk2NzcyNTQyNiwiaWF0IjoxNjUyMzY1NDI2fQ.EZ09qotly3uNzIntRzHYmo8G6dCNcCd5-LBCrlCzhye8WrmKWHkokFD2tXi54r0h1buLaMG7Q1O_fHLr0CxhJi1C5_pXrVjgpVrsJeYa-sIdlJnGnqS0QgmVeqvnIeacf8Y-hthQwysxtmy3pAzAdDk27AI5SfoIjJXVpIJZ6WRjdVfPMWjMUMqqtr9PNHUOklsg3umgPlmHe5Nc0RpPTX5tCpvyZQVlvXD7BZ1drrquhhXiN5wmnvVP8Ma8snjug0Btchw-kx2wGwR0U_1b5VMO1hMneybwNP8nwZSbZb9j3yurcrb2Q8MhHZDGyNBFXMQR3nCH76duvGtmr-byPg' \
--header 'Content-Type: application/json' \
--data-raw '{
    "MatchId": "zxcv",
    "GameId": "asdf",
    "GameVersion": "123",
    "UserDatas": [
        {
            "UserId": "u1",
            "IsBot": false,
            "BotDifficulty": 0,
            "GameEngineData": "",
            "MatchmakerData": [1.0]
        },
        {
            "UserId": "u2",
            "IsBot": false,
            "BotDifficulty": 0,
            "GameEngineData": "",
            "MatchmakerData": [0.0]
        }
    ]
}'
  
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA8Pjlz0DIJKyhOmw5t4Ih
D8wXOP3lN93+petucmvn7sC6TTtaGUAIyzMCaHh080LE2aCnLaF5aSWDown5u80X
tvL8NXLt9NsTriHxKpwgx5UQthpzsgd1AdkzFLmHQ84aFKndZly39nX/XiWBu3N4
VuPeWI4U9l23fGM3X14bEv1f7uz2GOipFkdfvl6TuFZmpRC9nJG57lfdKvifesei
jD2AbsyZi3WMU5Zz2znquxa/zzFGCxkjSmx6zKkNFMJYUM7As25Cp87mMEoIn8Pm
gEqFJX4DUtJibbw/dDUy+VIglAoCf9kHohM+aNH9WPgZ1DbXJKKHns4K/vQbgGus
5QIDAQAB
-----END PUBLIC KEY-----
  

User authentication

When user authenticates with ElympicsLobbyClient, he receives a JwtToken used to authenticate to external services:

{
    "IsSuccess": true,
    "UserId": "23dc10e9-fc00-4622-9ab1-92d9bc19fc89",
    "JwtToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1laWQiOiIyM2RjMTBlOS1mYzAwLTQ2MjItOWFiMS05MmQ5YmMxOWZjODkiLCJuYmYiOjE2NTc1MzUzNDIsImV4cCI6MTk3Mjg5NTM0MiwiaWF0IjoxNjU3NTM1MzQyfQ.BPq0JwtzMZlyWUxUexY3wi6eAxLoPD6QiWAOUce2NmDE5IOWYVAHiDwCXZW-9xUP-3tQrUQBYLgOfwyMhVyE89P3RQw2QatTpITIMJd-dlmUCAFmA1sQ_wKFS2_AoCu0SUo4qMremIAfwQCz4y8sIh40xG5oGTE-P725M_YFfWiLi0Am4kdL1ZCb2bnTr4elGop6o_PTX4WyTdVPXY6pJEPs6x2jEteH4hE2aXLUHYcO5TBzpW8rwRcdyi-w5WLXk-B1xrHPWQGVnfX6FQKk8R5ojTHsshfcuTeBTBewAY6Wo8Iftu7TyErdvsrNA5GpD3Faasl52YV-iPHHyq-tMg"
}
  
curl --location --request POST 'https://{YOUR_BACKEND_URL}/auth' \
--header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1laWQiOiIyM2RjMTBlOS1mYzAwLTQ2MjItOWFiMS05MmQ5YmMxOWZjODkiLCJuYmYiOjE2NTc1MzUzNDIsImV4cCI6MTk3Mjg5NTM0MiwiaWF0IjoxNjU3NTM1MzQyfQ.BPq0JwtzMZlyWUxUexY3wi6eAxLoPD6QiWAOUce2NmDE5IOWYVAHiDwCXZW-9xUP-3tQrUQBYLgOfwyMhVyE89P3RQw2QatTpITIMJd-dlmUCAFmA1sQ_wKFS2_AoCu0SUo4qMremIAfwQCz4y8sIh40xG5oGTE-P725M_YFfWiLi0Am4kdL1ZCb2bnTr4elGop6o_PTX4WyTdVPXY6pJEPs6x2jEteH4hE2aXLUHYcO5TBzpW8rwRcdyi-w5WLXk-B1xrHPWQGVnfX6FQKk8R5ojTHsshfcuTeBTBewAY6Wo8Iftu7TyErdvsrNA5GpD3Faasl52YV-iPHHyq-tMg'
  
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApdv45sXwa3rrOgU1iamm
ndC3jqR3xTgKpL9RfJWyf7Wv9XbAf+jxnZop49S2x+A5tcfr67clVyGGSUldQyF1
JbEeXWdfvwlTf6BJka2qPhvkiNUDTnHJnCeGnTDR6g+YWF0jHpVv28CTU7eKvaiZ
dA9EaEjPKHcT6GcRONumH0pXmxkRgfVjk3PXPmuR7OSoj63EHfd8e1GORW/FI87X
1KI1D/ajK8FYBOgqmzaSHsTNz+nRztYYbkb7PM6d5bv5O0hu8PFi7TAzwP9Smw/I
UNf8jCLUlojYlwT1cSxkgCzE44PZaCP59fxMdcORH5Px+H3thctXwBBFajMuHMHy
+wIDAQAB
-----END PUBLIC KEY-----