Add the Ability to Communicate with Other Games

Addressing the Issue

As a Roblox developer, it is too hard to communicate with other games without having to set something up in Discord with Discord bots that synchronize 2 different game places (doesn’t have to be Discord).

Elaborating the Issue

To elaborate, let’s say you wanted to partner up with a game that’s not owned by you, what will you do? Your best option would be creating a Discord bot that syncs both games and fetch and sending HTTP requests using the Discord API. This has many cons as you would have to learn the language (which is not Lua), is one-sided (I believe a bot can only be owned by 1 person), and you would have to learn the API.

Possible Solution

A solution for this issue can be adding a service called CollaborationService (not the best name in my opinion), or an extension to MessagingService as this service basically what messaging service does but across 2 or more games and not the same game.

How Will it Work?

This service is more or less creating your own API for your game, that whitelisted games can access and run:

print(game.GameId) -- 100
local CollaborationService = game:GetService("CollaborationService")

CollaborationService:WhitelistGames(200, 300, 400, 500) -- Whitelists these game Ids

CollaborationService:CreateAPI{
    AddStats = function(gameId: number, playerId: number, stat: string, incrementAmount: number | string?) 
        --[[
            gameId: gameId of the game that called the function
            arguments: tuple
        --]]
        if gameId == 200 then
            -- Increase the "stat" according to the "playerId" by "incrementAmount"
        elseif gameId == 300 then
            -- Increase the "stat" according to the "playerId" by "incrementAmount * 2"
        else
            -- Increase the "stat" according to the "playerId" by "incrementAmount * 3"
        end
    end,
    DecreaseStats = function(gameId: number, playerId: number, stat: string, decreaseAmount: number) 
        if gameId == 1234567890 then
            -- Decrease the "stat" according to the "playerId" by "decreaseAmount"
        elseif gameId == 0987654321 then
            -- Decrease the "stat" according to the "playerId" by "decreaseAmount * 2"
        else
            -- Decrease the "stat" according to the "playerId" by "decreaseAmount * 3"
        end
    end
} -- Sets this as the games api
--// In a separate game
print(game.GameId) -- 200
local CollaborationService = game:GetService("CollaborationService")

CollaborationService:Call(
    100, -- gameId
    "AddStats", -- API name
    135123, -- playerId
    "Coins", -- stat
    100 -- incrementAmount
) -- If the game is not allowed to call that game it will error

Why this Service?

Roblox is an amazing platform, it has so many features, but I feel like it’s missing one very important feature: communicating across different games. This can open so many possibilities such as being able to advertise and work with others! This will make games more immersive because users will feel like they’re travelling across the Roblox universe to get things.

This will also help in Roblox events such as the Egg Hunt. Instead of having the hassle to code things themselves, why not have it precoded for the developers? The developers will only need to worry about when to fire a specific API from the main place of the egg hunt!


Thank you for reading!

24 Likes

This isn’t valid code, did you mean to put curly brackets for a table?

CollaborationService:CreateAPI{
	AddStats = --[[....]],
}

You have also named 2 things AddStats, did you mean to give unique names?

3 Likes

Thanks for the catch! I have edited accordingly, wasn’t paying too much attention on detail but on the general concept.

2 Likes

Roblox is prototyping a feature called “Cloud Scripts”, these would act as compute cloud servers that would allow you to deploy code without needing to run a game.

This, in turn, would allow you to send data between two games

https://devforum.roblox.com/t/help-us-understand-what-you-would-do-with-cloudscripts/1041321?u=metatablecatgirl

8 Likes

I was under the impression this was to be per-game, since datastores are specific to a game (if access to datastores is allowed via cloud scripts), and if so, this would accompany cloud scripts nicely. If not, great!

4 Likes

If the use case is there, I believe they can make it cross-site instead of per universe which would be neat to have for this feature request.

3 Likes