ROBLOX Enables HTTP Requests from Game Servers
In order to surf the web, you need a web browser. The browser functions as a bridge–whenever you type in www.roblox.com (or any URL for that matter), or click on any link or picture, your browser is making something called an HTTP Request, then displaying the results of that request on your screen. As you can no doubt imagine, there are billions of these requests made daily, as a huge volume of people browse the web, download music, play ROBLOX, and read emails from all sorts of devices. It is the single most widely used communication protocol of the modern web.
Starting today, we’re allowing developers to make these very same requests from their ROBLOX game servers. We host all ROBLOX game servers in order to allow our developers and players to focus on what matters: creating and playing high-quality games. Your game’s code lives in a cloud, and can now talk with any website on the internet. In writing this sounds like a small feature. The implications of it, however, are quite large. Developers can now use services like Google Analytics to track what’s happening in their games–the number of players, the number of active servers, the percentage of returning users–all in an effort to better understand player behaviors.
Though this feature has just been turned on across ROBLOX, we’ve been beta testing it with some experienced developers to see how they use it. User Nexx created his very own website, www.rbxstats.com, which allows you to register an account and, by inserting a Lua script into your game, view a dashboard of game statistics. Another developer is toying with the idea of cross-server chatting where players in different game instances can communicate in a single, unified chat stream.
ROBLOX is an open platform, and all this is in an effort to open it even wider. We’ve been putting a real emphasis on identifying and providing all the tools developers need to continue to create the best and most polished gaming experiences possible, and we think this new HTTP Request will be an incredibly useful tool in the ever-expanding toolbelt of the ROBLOX developer. Though this feature is only in its infancy, there is an ocean of possibilities that could come pouring out of it. Put simply, developers can now link their game to the vastness of the internet–whether that’s an existing website, or one created specifically for their game.
To get started, you’re going to want to enable this feature in ROBLOX Studio. Doing so is simple–open Studio and follow this path:
Insert > Service > double click HTTPService.
This will bring the HTTP Service icon into your Explorer. Double click the icon to open it in the Properties window, where you’ll see a new check box that says “HttpEnabled”. Tick that checkbox and you’re good to go.
Below, you will find a quick example of a script that is utilizing this service:
This particular script reports an event to a theoretical external analytics service every time a player joins a game. This is a simple example, but you can see how this service could be extended for other types of gameplay events. We’ll be updating the ROBLOX Wiki soon with more detailed information about this service, so keep an eye out.