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!