Web Services
We have often stated that Metaplace “speaks web fluently.” In today’s blog post, we will elaborate a bit more on what we mean by this.
To begin, every Metaplace world process is also a web server. It can issue both outgoing web requests of arbitrary type, and handle incoming web requests as well.
This means that any Metaplace world is capable of creating a web request from script, and then issuing that request to an arbitrary outside web service. The game server provides useful API methods to easily parse the responses from these web service, including REST-like XML parsing and RSS. You can also pull entire web pages and regex parse (string match) the response manually for more granular control if you wish. Examples of this include issuing queries to outside SQL databases from an object in-game, pulling external real-time stock quotes into your world, getting the latest RSS news from CNN and feeding it to a town crier NPC chat bot, slurping real-time sports scores into your in-game sports bar, pulling YouTube videos into a wall in your apartment, etc. This also means that objects and scripts in your world can transmit outgoing data such as badges, in-game events, or game scores to an external database or web service. This allows for a nearly limitless extension of game functionality out across the internet.
Additionally, because every Metaplace world is also an embedded web server, external services can make requests of the game process through a simple CGI-like interface. This means that an external webpage could call into the server process and access real-time data on individual objects currently in the world. It is also possible to issue events through the game simulation using this interface, meaning that you could spawn a monster in-game when someone clicks on a webpage link, for example.
Because this functionality is customizable and defined by the world owner through script, world builders are free to define this behavior themselves in any arbitrary format to suit their particular needs. This also allows a world builder to externally expose only the data and functionality that they explicitly choose to. World builders are free to use all or none of this functionality on a case-by-case basis, depending on their world’s desired functionality, and user skill level.
Furthermore, because script functionality is inherently modular, complex web service implementations can be packaged into module format and published across the service. This would allow even beginner world builders to import such functionality into their worlds with just a few clicks of the mouse. A town-crier NPC that pulls its chat dialogue from an external news RSS feed, for example, can be packaged as one simple module that any world builder could use in their world, without any knowledge of web programming required.
Dorian Ouer
Server/Client Engineer
As a reminder, we are having our Developer Chat this week. You probably want to update your Flash player to the latest version. Please check back here on Thursday, January 31 at 5:00pm Pacific Standard Time to participate! We look forward to chatting with everyone.


