The huge popularity of video games, which rank second only to movies as a source of entertainment in industrialized countries, has created vast opportunities for developers. But the technical and economic challenges involved in creating and deploying online games that scale to thousands of users and dozens of platforms have -- until now -- been enormous, requiring not only expertise in multithreaded programming, distributed computing, and transactional processes but deep pockets to sustain back-end processing resources. With the open-source release of Sun Labs' Project Darkstar -- which offers Java technology-based infrastructure software designed for latency-critical, massively scaled online applications such as online games -- not only will development costs go down, but the technical challenges of scaling, load balancing, data consistency, and failure recovery currently faced by developers of multiplayer games will be radically reduced or even eliminated. Project Darkstar, which is not to be confused with a game engine or a communications framework, is already being put to good use by leading companies in the games industry. For an update on Project Darkstar, we met with Sun Labs' Jeff Kesselman, whose official title is "chief instigator" for Project Darkstar. Kesselman has a deep and abiding connection to video games. As an undergraduate at the University of Wisconsin, he crafted a major in computer science, art, and film production, which led to 15 years in the game and multimedia industry after he graduated in 1987. During his time in the industry, he wrote the U.S. launch demo for the Philips CD-I player, contributed to such commercial games as The Horde, Titan, and Blazing Dragons, and was senior game integration engineer at the Total Entertainment Network, where he wrote Internet networking code for games such as DukeNukem3D, CivNet, Total Annihilation, and Dark Sun Online. In addition, he was co-designer, architect, and lead engineer for Dark Sun Online II: The Age of Heroes. Kesselman joined Sun in 2001 to work on the JDK performance tuning team, where he concentrated on tuning JDK 1.3. Since 2004, he has focused on the application of Sun technologies in the game industry. He is the coauthor of Java Platform Performance: Strategies and Tactics.
We've open sourced it to lower the entry barriers to encourage developers to work with it. We want to grow the online game space by reducing the risk and the work required to create games. Open sourcing Project Darkstar is a good way to drive developer adoption. It allows people to play with it without making a big up-front commitment, and it allows them to see better how the system works. They can grab the technology, see what it does, and, we hope, come on board.
The client side is different since the client API is a set of libraries that you embed into your own code. Using a modified BSD license here allows developers to use the Project Darkstar client SDK code as part of their game clients, and to relicense and redistribute that combined code however they want.
Sun sees this as a potential growth market for our servers and for services. The industry estimates that it currently costs about $30 million to create the basics for massively multiplayer online games such as World of Warcraft or EverQuest. By releasing software that reduces development costs, we hope to enable more developers to participate in the rapidly expanding online game market and to create growth opportunities for Sun hardware and service businesses there.
Project Darkstar solves the problem of building your own game server infrastructure and handles the scaling, load balancing, persistence, and other challenges. This makes it easier and faster to write robust, scalable, and highly performant online games. Project Darkstar also provides a unified platform that games can be run on so that a single provider can run different games for different people in the same environment, just as you would on an app server. This improves resource utilization at deployment time, which lowers costs on that end too. The Project Darkstar Server and Client
The client download provides them with client APIs, Javadocs for the client APIs, and another tutorial that explains all the client-side coding with examples. Developers can sign up at the Project Darkstar community site, where we have an entire portal with downloads and forums. Working through both the server and client tutorials is a good way to start to understand the system. A very active community forum exists to answer questions.
No More Dupe Bugs
From the point of view of a database programmer, that's a break in referential integrity. We know exactly what causes it: It's because the systems aren't transactional on the back end, so they can temporarily end up in states in which the referential integrity is not preserved. Darkstar is built on a transactional event-processing system that prevents this from happening.
You might code it in a way similar to this:
What happens if the machine does step one and then it crashes? It never finished. So it added a dollar to you but didn't take a dollar from me. We've just duplicated a dollar. You might think you could reverse the order, but that doesn't help. If we do it this way:
If we crash between steps one and two, a dollar vanishes to the twilight zone! That's not any better. Such a trade is what computer scientists call an atomic action. We can't do just half of it and preserve a sensible situation -- that's what we mean when we talk about referential integrity, that the data is in a sensible state. Transactional processing allows you to group multiple actions together and call them atomic, so that either they all happen or none of them do. A sudden crash such as I described earlier is rare, but I used it as a simple illustration. Multithreaded code sometimes has what are called race conditions, which are bugs that result from doing two incompatible things at once. I can demonstrate a race condition by breaking the action down and adding a thief in the crowd while I'm giving you a dollar. The action looks something like this:
Let's say I only have one dollar in my wallet. The thief's pickpocket algorithm looks like this:
Each of these actions works well alone, but if they occur simultaneously, problems can arise. Let me walk through what happens to X,Y, TX, and TY when the two routines race.
Imagine I have one dollar in my wallet, everyone else has zero, and the following things happen:
At the end, I have zero dollars, but you and the thief each have one dollar, so there are now two dollars in the world. We just duplicated a dollar! Transactions enforce isolation. They have rules to make sure races such as these can't happen. Race conditions are the number-one cause of dupe bugs. Rollbacks
Project Darkstar allows the entire virtual world to asynchronously persist back to a central server. It's possible to lose up to a second or two of game play, due to the asynchronous nature of the data that is saved. That's a small price to pay for performance. You shouldn't ever lose 20 minutes or two hours worth of work.
It's important to understand the state of the industry today. Load balancing is performed in a primitive fashion in which worlds are broken into what are called zones, areas of space in the virtual world. So the town of Foo or the forest of Bar might be zones on different physical servers. In the town of Foo, you connect to the server of the town of Foo. When in the forest of Bar, you connect to that particular server. This would be a perfect load-balancing scheme if people spread themselves evenly across the virtual world -- but they don't. People are social and tend to clump together, and the spaces become overloaded and laggy, while other spaces are sitting idling and unused. And if everyone's in the town of Foo, and the town of Foo crashes, you're out of the game. In the worst case, you're stuck until the town of Foo's server comes up. Some games, after a certain period of time, will move you somewhere else in the game after a crash, so you can get back in the game, but you still can't return to what you were doing. With Project Darkstar, all the data in the virtual world is held in what we call the data store, which you can think of as a persistent cloud of objects that exists above the servers. Players are assigned a seat on a server. As they pick up an object or fight a creature, the data comes down to their server from the data manager and data store. The idea is that if that server fails, we can reconnect them to another server, because the servers have no state. The state is all in the cloud. The cloud is probably the most whiz-bang "researchy" thing in the Project Darkstar system and the focus of much of our ongoing R&D. Essentially, what we're building is a transactional database tuned for massive scalability at a 50 percent read-50 percent write data load. And of course, like any back-end database, the Project Darkstar data store will also be made highly available. Many databases can scale up, and some are even quite fast, but most of them scale through replication, which is duplication of the data across multiple servers. This scheme assumes that data is mostly read and seldom written. That's not our case, so we've had to research our own solutions to the problem. The data store is a transactional database, but it's not a relational database. We do no querying, so we don't need SQL or any other query support. All our access is based off of primary keys. It's simply a very fast place to read and write data in a transactional manner.
Disaster refers to the entire machine room going down. Project Darkstar has a real database back end that saves a historically accurate record of the game up to a couple of seconds before it went down. So even if we lose the machine room, once the machine room is restored, we can still bring the game back up, without losing anything except a second or two.
Shardless Architecture
Developers build clusters of zone servers, each of which serves one or more zones, and call that a shard, which game developers and players both think of and refer to as servers. So when you start a game, you choose a server -- a shard -- to start your character on. So when I play in City of Heroes, I choose the Virtue server to start my character on, but I have friends who play on other shards, so we can't play together, which severely limits the number of players who can interact. Shards split up the user base, which really hurts the networking effect. Each shard has a limit on the number of players it can support simultaneously. This puts a hard limit on the number of players who can play together. Each shard is its own dedicated cluster and cannot use resources from other shards to extend its own capacity, even if they are sitting idle, which wastes server resources. What's further challenging is that each shard has to be overbuilt by an order of magnitude because the vast majority of the time you have 5 percent to 10 percent of your total shard's user population online at once. But if you only built out for this small number, you would invite trouble because during critical times in a game's life, generally referred to in the industry as events, which are promotional events like Halloween or Christmas parties, 90 percent of your users could be online at once. If you can't handle that, your customers become unhappy. Games have failed in the market because they were underbuilt. Project Darkstar changes the economics. Games no longer need to be split up. We will run shardless in one instance of the game world, so everyone with an account can play together. Furthermore, we can share resources on the back end across multiple games. Promotional events are driven by deliberate developer actions and are thus highly predictable. A Darkstar machine room can have a single pool of event servers that any game in that room can use.
Making Better Games
Persistence in Project Darkstar is under the hood and automatic, so everything that the developer writes is persistent. Every monster, every door, everything is automatically persisted by the system. Without this kind of persistence, certain kinds of game play are simply not possible. But with Project Darkstar, now I can, for instance, build a castle and know that the castle will be present even if the server or whole back end goes down. One problem with games today is that players feel more like spectators than participants. Structures and entities remain static because they can't create games that grow and develop. We're going to change all of that. Imagine a game in which you are an explorer or trader. By moving goods, you affect the state of the world. For example, farms appear near a town because you're bringing in more farm implements. Now let's say you get tired of trading and want to start a town of your own. You clear the land of monsters, and over time it becomes a safe area. You cut down the trees, create farm land, and build structures. Eventually you get someone to haul rocks to your land with which to build a castle. You raise an army and become a warlord. Meanwhile, the monsters you ran out of your area have been forced into overpopulation nearby. Because there isn't enough game for them all, they go through behavioral evolution and selective breeding, and after many generations become much tougher and smarter. They return to see if they can take back the land. None of this is rocket science. We know how to mathematically model economies and populations today. We know how to build genetic artificial intelligence that evolves. But all of this depends on the game having a memory. Imagine you went through all the changes described earlier, became a fierce warlord, and then the server crashed, and when it came back up, all the doors were closed. All the changes you made to the world were gone! I don't think you'd play that game much after that. We play to be entertained, not to become frustrated. The Project Darkstar Playground: A Hosted Game Server
Environment
The Playground provides these developers with an environment that they can use to test the scalability of their online games. It gives us the opportunity to work closely with these developers too, so that we can use real games to help us with our own benchmarking and performance analysis work. The Playground offers a taste of what we envision for the industry, which is hosting providers that take the load in building and running the game room off of the shoulders of the developer. Not Just for Java Programmers
We are agnostic on the client side. As a group, we have a Java SE API and a C API we've just finished, and we're doing a Java ME API as well. We hope to see the community build more APIs for the system. One community group has already built a Flash API to share with others. We ultimately want to support as many kinds of clients as people want to write games for. The Future of Project Darkstar
We think the result is going to be a renaissance in the online games market. Right now, all massively multiplayer online games pretty much play the same. That's because they are all chasing the same well-known, existing large markets. Today, it just costs too much to risk building games for unknown markets. Darkstar will enable game developers to build massively multiplayer online games on smaller budgets that will be more risk-taking, more experimental, and ultimately will expand the market into entirely new areas. All of which will be great for Sun!
_______ Project Darkstar
|
| |||||||||||||||||||||||||||||||
Oracle is reviewing the Sun product roadmap and will provide guidance to customers in accordance with Oracle's standard product communication policies. Any resulting features and timing of release of such features as determined by Oracle's review of roadmaps, are at the sole discretion of Oracle. All product roadmap information, whether communicated by Sun Microsystems or by Oracle, does not represent a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. It is intended for information purposes only, and may not be incorporated into any contract.
|
| ||||||||||||