Game to Web Server Communication
As we started building services that talked to each other, we realized we needed to have some way of keeping track of what servers were up and available. For example, when a game is started, there needs to be one specific game server it is started on. What if there are several game servers running? How do we know what game servers are running to choose between them?
That was the original mandate of MISSIVE, our inter-service communication system. We needed a way to have services talk to each other, be aware that these services were out there, and send simple messages to each other synchronously.
A predecessor to MISSIVE was set up to use HTTP requests just like all of our other APIs, but we quickly realized that this didn't work very well -- HTTP requests only support a poll model, where information can only be learned if you choose to ask for it.
When servers are started or stopped, we needed to distribute this information throughout the existing servers, ideally immediately. Thus, MISSIVE uses a simple TCP/IP connection and a simple message format to pass messages. The primary implementation of this is done in Python, allowing our Python web services to communicate with each other.
After we built this system, we realized that something similar could be extremely useful within games. If a game can send a message whenever something important happens, this message could be received by another server and data could be recorded in a database.
Once data is in a database, it is instantly accessible to whatever web site wants to display the information. To this end, we've implemented a MISSIVE client for our game engine, so that data can be sent from within the game to whatever external server wants this data, and messages can be sent into the game from externally.
Choice of Game Engine/Modularity
We tried to make as few assumptions about the game engine being used as possible. We started with a C++ interface that must be implemented by a game engine to be plugged into Sandstone.
Whenever Sandstone starts up a game, whether it is starting a game server or running a local game in the browser, it calls through this interface to start up the game. In fact, the implementations of this interface are themselves content packages.
So the entire game engine that is used is not pre-installed, it is downloaded and updated just like any other content. This allows us to easily push bug fixes to our engine, as well as have several games that run on different major versions of the engine all work at the same time.
The question, though, is why did we choose to build our own LOCUST game engine? Why not use one of the many existing 3D game engines there to build our games and then use our new technology to run them differently? The truth is that no engine really matched the requirements we had for a game engine. These requirements are:
- The game client can be run inside of another process without issue
- The game client can render as a child of a parent window that is passed in
- The game content can be broken up into small, reusable chunks
- The game server can easily be instrumented to communicate back to the web services
It's surprising that most game engines don't work for the first two points. Most game engines assume that the working directory of the process is the location of the .exe file of the game and look up content from there. This simply does not work if the process is the browser process, and it could have done any number of things to the working directory. And this becomes a basic assumption of the entire game engine, meaning that #1 is not feasible.
The second point is often not the case either. Many game engines assume that the game is running as a top level window. Asking it to render under a parent window is not supported at all. Despite these issues, we have hacked a couple game engines to actually render in the browser using Sandstone. It was not elegant, we would never want to ship such a game, but it worked enough to show what was possible.
However, even if a game engine could render within a window, most game engines aren't built for #3 or #4. Most game content is built on a scenario or level basis, where an entire level is built as one optimized set of stuff. This does not make for any reusable chunks, and every level ends up needing to be downloaded separately. Finally, it becomes very useful to communicate data out of the game into the web services, and we needed a game engine that could do this easily.
In addition, we wanted to improve our game-building and modding capabilities, both to support Making History's lively modding community, and to provide greater development speed and power in our serious games work. We built on architecture we developed for the first Making History game, The Calm and the Storm, which allows game data to be set up from XML.
We have expanded this engine to make it possible to build complete levels entirely from XML, using embedded JavaScript for scripting. We are seeing improvements in productivity and flexibility in our work on Making History II and our other projects.
Our path to web-integrated, browser-based games has been challenging, and we are excited about the results: the upcoming release of Making History II, and the possibilities the platform provides to create and deploy new kinds of engaging, web-integrated 3D games.
|
(that is - as far as I know, Unity meets most of your requirements and is widely used, though maybe in practice it did not?)
"Most 3D-in-the-browser solutions currently solve this issue by writing a browser plug-in. However, there are two drawbacks to this. First, many people distrust custom browser plug-ins (Flash and Java plug-ins being the exception.) Second, each browser plug-in is very browser specific. Even the Mozilla plug-in architecture, that many browsers support, still often needs to be slightly tweaked for each individual browser. This eventually becomes a maintenance nightmare."
Also, though I think Unity is interesting, I don't see how you could possibly refer to it as "standard" - most especially not as "more standard" compared to Java! The Java plugin's penetration is (depending upon version and who's numbers you trust) between 85% & 90%. Unity is in the single digits.
Java penetration is as sub-par as Silverlight is. Unity and other custom plugins = puke. Do you want your game to be played by 95% of people visiting web page or by 10%?
C++, Java, JavaScript, Python, XML
Is it just me, or is that too complex?
Aren't people figuring out that if their core speciality is content-oriented, why waste time creating new technology?
Game sounds cool though ;}
Additionally, you're opening up a potential security hole within someone's java plugin. Execution of native, non-sandboxed code from within a browser where the plugin is a means not an end for the developer. How is this better, or more trustworthy?
I can see that it made sense for you to wrap an existing codebase to enable you to get to market sooner within the "browser-based gaming" sphere, and it doesn't sound the worst way of doing it, but I just don't buy the reasons set out in your article.
But best of luck with the game, and thanks for sharing your experiences :)
There are terrific plays out there by Unity, and to a much lesser extent, Torque. So far, nothing in Flash compares or even comes close to the immersive experience of a real game engine. Users want 3D, but they also like the ease of Flash, having already installed it. I think we are at a tipping point, a moment of great opportunity. It astounds me that Flash hasn't been able to capitalize on this yet since they are poised for the greatest potential success. But even if they win, how's Flash for debugging? How is it for collaboration and version control? Getting better, yes, but still inferior.
Ever notice how the only way to play Farmville is in low quality mode? If you haven't, you probably haven't tried the kind of hardware most people have access to. If Farmville is pushing the boundries of Flash, well, I just tremble...
Believe it or not, I am not anti-Flash, quite to the contrary. I've done the bulk of my work with the tech since the very first version, completely sold by the fact that it came from the "Dark Castle" guys. But it bothers me to see blind fanboidom applied to it: it's not the best solution to every problem.
As for the argument that "everyone uses Flash, anything else is an instant fail!"... I guess I would reply that it would have been insane for a search engine to compete with Infoseek, Yahoo, and AOL at one time. Good thing the Google guys weren't paying attention. By that standard, Apple should stop making computers today, instantly! Less than 10% of the market? Pshaw.
I was arguing that the percieved user acceptance of this method was a fallacy. A solution provided my a middleware company is more trustworthy, basically because their aim is to get maximum plugin penetration, so security is disproportionately high on their agenda. Muzzy Lane's aim is to produce a game that people want to play, so plugin security will be comparatively lower on their agenda.
Mike was saying (excuse me for paraphrasing you here) that even with their goal of simplifying the development / deployment process of a unique browser-based game, the added complexity introduced through the java layer outweighed the benefits of not tweaking the plugin for each browser.
@Kirill Vainer - We have looked at the Java based solutions. Primarily, we had a rich C++ codebase to start from, and were not looking to rewrite the world. We instead wanted a thin wrapper on top of our existing C++ code. Honestly, those Java engines were the inspiration for creating a Java plugin.
The other problem with the Java engines is that they are all OpenGL, and we've learned the hard way that OpenGL on Windows, at least, is a nightmare. It's not too much to ask the end user of a commercial PC game to update to the latest graphics drivers, but it's a lot to ask of someone who only plays your game through a website. In our experience, a large percentage of initially released OpenGL drivers do not have much more than OpenGL 1.1 support, even though the cards themselves support all the latest OpenGL features. I've seen way too many debug logs from end users that say "OpenGL 1.4 not supported" despite the presence of a less-than-one-year-old graphics card. This exact issue drove us to switch to a Direct3D renderer.
@Matt Hackett, @Mike Wuetherick - Yes, it's a complex solution, but as Eric Hardman was pointing out, it's a complex problem. There are all the end user headaches of 3D games (hardware incompatibilities, driver issues, graphics bugs) coupled with the end user headaches of browser compatibility coupled with the deployment headaches of a web service stack. We've tried to use the best tool to solve each problem we've faced: C++ for the game engine, Python for back end web services, XML + JavaScript for in game scripting, etc. We've been able to do this through a large amount of modularity. Our game programmers and content people almost never run the game in the browser, because we have a clean interface to launch games. They develop the game then run and test locally. Eventually official builds get put into our web ecosystem. These get tested through the browser and game services. We've rarely had bugs running in the browser that were game bugs or crashes due to game code. More often than not, it's a bug in the interface code, and the number of these has been going down steadily.
As for the choice of Java, it's definitely not the only answer. However, I've been very pleased that I can start up random browsers (Chrome and Opera in particular) and it seriously has just worked. No extra work to try the plugin there. That's definitely worth something.
@Tim Carter - Muzzy Lane is a technology company. It's rare for a technology company in the game industry to succeed without producing real games on its own technology, so here we are building Making History II.
@Dave Mariner - If the Java Extension mechanism worked as well as it claims to in the documentation, it would be a much cleaner system. The end user would get something that basically looks like "Java wants to add a feature, do you want it to?". Obviously, there is an entire side argument here about whether or not that's a security hole in the Java Plugin or not. Anyway, the reality of the Java Extension mechanism is that it is not user friendly at all. It generally just disappears into a black hole, showing a sometimes animating Java logo while your extension is downloaded and/or installed. By the time we figured that out, we decided it was better to stick with the Java shim than to write plugins from scratch. This has worked out pretty well for getting it to "just work" in new browsers.
As for installing a plugin for a *single* game *in-browser*, Sandstone is a technology that enables any number of games to be played. We have our first commercial release upcoming on it, but we've developed several more serious games with partners, and plan future releases using the same technology. And if all works out, others will eventually be using it for their own games as well. As has been pointed out, penetration is always the issue, but we have to start somewhere.
"Unity does the 3D in the browser part, but we had other requirements, mostly involving distribution and communication with web sites that aren't even touched by something like Unity."
What distribution/communication issues did you find that pushed you away (in full or in part) from Unity? And for reference I'm the Product Evangelist for Unity, I just want my "angle" to be clear and transparent and I'd like to better understand what kept you away from our tool and player.
FWIW, I applaud the effort, we're all in the games industry trying to find ways to bring better, more engaging 3D experiences to end users so kudos for that, despite not using our tool in particular! :)
- Enormous marketing efforts. If I'd be your publisher, I'd say "make it downloadable, it doesn't make sense to be inside the browser with a custom plugin or Java".
- A web-based version with a custom plugin has less chances to be played than a downloadable game, unless it has existing prominent branding or free (or careless) marketing or unless you are in Korea (where IE ActiveX plugins are a de-facto launch kick-start standard for casual MMO games).
- In reality, those plugins are a huge disaster to support. New browser versions, compatibility hassle, weeks of debugging for developers instead of focusing on the game, endless complaints from players who've updated their computer or try to migrate.
There are very very few cases besides Quake Live and FreeRealms where plugin-based product have reached great heights. Name another Unity or other custom-based plugin product please that have achieved some success.
And I'm still waiting (as a strategy/civ genre fan) for Call of The Kings: http://www.callofthekings.com/screenshots.php which is Java as well!
Certainly indie developers producing hardcore sim or strategy titles have one major problem, gamers don't like 200 page pdf manuals. They wanted printed manuals that they can have open while their learning the game.
Digital Distribution is generally going to dumb down gaming unless indie publishers have a system where they can send a printed manual to their customers.
I personally do not want to be able to play a game within minutes and have to wait for snail mail to arrive with my manual, if at all. I think most "hardcore" games have solved this issue by providing online help; in game tutorials / encyclopedias / very good in game help / built in play and learn content.
The whole point of having browser-based games moving to the next level is the problem of distribution / community. Get more copies out there, get their friends playing = £££ $$$. It makes it easier for the consumer to lift their card out of their wallet.
One could put it into this rough timeline
1. Going to your local game shop (hours / other factors, lose the cd/dvd/media and your up the creek, install and hope it works and you can get access to online features)
2.Steam / Direct2Drive (Still time dependant downloads are big! always available incase you lose it, multi computer, semi-cloud settings, good but limited community / web integration)
3.Browser (Time varies, but it will always be available and compatible with a lot of PCs, a lot more stuff stored in the cloud, native integration with communities / web services).
Hell i played QuakeLive for 5 minutes, within 20 minutes i had about 10 friends playing with me! If they charged $5 per user or per month they would be raking it in!
Or we could live in your world... and go have a long bath until the manual arrives.. maybe write a scroll to our friends to play as well and have penpals to share our experiences.
My own strategy, as a solo developer, is a defensive "follow-the-market" one:
1. Flash is what's there right now, and I don't have the resources to push anything else to users; I want the assistance of the portals to promote my game! Therefore I use Flash.
2. Develop Flash games in haXe. haXe is a VM-portable compiler, and has a strong likelihood of compiling to whatever becomes the standard after Flash. (My money is on JS/WebGL/media extensions.)
3. When the time comes, port to the new standard and be automatically ahead of the game because, presumably, less code will have to be rewritten.
Despite "only" doing a 2D game, I've still found a lot of areas that can use better tech, mostly in tools and gameplay logic. My goal is to make Flash as convenient for 2D prototypes as a tool like Game Maker. I still have a ways to go, but give me another year... :)
edit: webGL, not Canvas3D(canvas3D was a prototype)
Basic HTML/AJAX. 100% penetration, basic visualization. Harder to bring casual players in. Think Mafias, MUD.
Flash. 95% penetration, awesome 2D visuals, basic 3D.
Java, Silverlight, Unity3D, Shockwave, better custom plugins, various endless "web players". 1%-50% penetration. Endless compatibility problems.
Everything else. javascript canvas webgl svg and other stuff that will never catch up. Non-existent.
Game genres:
Casual games = Flash only.
Social = Flash, AJAX.
Core = It's easier to get stable game when it's downloadable, than inside the browser.
Hardcore = custom plugins (InstantAction, Quake Live, FreeRealms launcher).
Note: you could make any tech or plugin acceptable by putting a lot of expensive marketing into it.
Something that probably didn't come across in the article is that this technology was not developed specifically for Making History II. We additionally have about a half dozen serious games currently in production using this same technology, including a DARPA funded project to create games for middle school science. We were originally founded on the idea that 3D multiplayer games could teach people something. To that end, we found integrating our games with the web almost a necessity, allowing for much more intuitive multiplayer lobbies and much easier install paths. Plus you end up with integration into existing web infrastructures, like social networks and learning management systems.
Also, it's important to note that rendering 3D in the browser is only a small part of creating a game that integrates with the web. Additionally, a user-friendly way of distributing the content is necessary, since 3D game content is HUGE compared to anything else, and is very difficult to stream. Plus, there needs to be some way for the game to report information about the game play experience back into the website. Finally, for a multiplayer game, having a way to manage game server instances from the web makes things like multiplayer lobbies much easier to deal with, and much more cleanly integrated into the website.
That all being said, MHII is not a browser-only game. It will be sold on CD, downloadable as a separate installer, available through other game download services, etc. etc. The Java plugin will not be required to play, only to take advantage of the integration of the game with the social website surrounding MHII.
@Matt Seegmiller: Any chance of hearing how Unity didn't measure up as per my Qs above? Either here or via email would be great if you have time, thanks! (tom -at- unity3d.com) Otherwise rock on good man.
Thanks for taking the time to explain and as noted above, kudos on the effort regardless. I'm always pleased to see others pushing for better web delivery of 3D experiences so keep at it and I wish you all the best! Rock on brother.
HTML5 is still in draft but maybe in the near future we can have in browser games with out the need for plug-ins?
with C++ can do anything.
The hurdle of 3D web gaming with hardware acceleration is the security issues of browsers and applications. This is more of the social psychology then gaming technology. After all if the players don't trust the stuff they are running they will not buy and play the games and all these wonderful technologies will sit and waste over time. Win the trust and games will be sold fast. Call me a socialist or of a worse kind, I do think that the internet should be deeply regulated like real world in order for online businesses to win consumers' trust. At its current state, the internet is far from it.
From javascript to Java to C++ DLL to gameplay and AI, no wonder the development cost is so high. Gaming in web browsers are certainly good. I do like, however, a off-line browser gaming option when the player wants to play alone.