Chapter 9: Game Databases and JDBC

image from book Download CD Content

by Will Bracken, Game Server Architect, Game Technologies Group, Sun Microsystems

Introduction

Games are rapidly evolving, growing in complexity and size. Naturally, the amount of game data and the overall persistence requirements are increasing over time. Fortunately, the amount of computing resources and hard disk space continues to grow as well. In fact, the gaming industry is really driving the evolution of computer technology in many ways, more so than many other areas of computing. These days, MMO (massively multiplayer online) games are on the rise, and for this type of system, the game data needs to be managed in an environment where access to the data is fast, efficient, and centralized. At the time of the writing of this book, a prototype engine was being tested to service a million online users in a single virtual environment. There are many challenges to building such a system, and databases play a key role. Actually, a case could be made that plenty of single-player games (such as complex RPGs) could benefit from using a database as well. Think about it. Databases are perfect for the job of managing higher volume and more complex data, as well as reducing development time and providing easier access to data. Databases are an incredibly useful tool, if not the next step in the evolutionary process of game development itself.

Of course, many games out there don’t need a database at all. Perhaps small- to medium-size games may never need one. However, some of the off-the-shelf games today can contain gigabytes of data. For a large game like that, the amount or complexity of data can become a bottleneck. When there’s that much data running around, it makes no sense to write custom code to store, fetch, and manage the game data—at least, not when robust, fast database technology is already available. One problem with the acceptance of the idea of using a generalized database tool is that most game developers are used to working on making the game lighter and faster, and databases can feel like an anvil. However, it’s important to understand the advantages, as well as the disadvantages, of using databases. For example, most of the time game developers instinctively react negatively at the thought of deploying a database with the game because they don’t want the runtime overhead that a database engine incurs. Yet it’s not always that black and white. Databases can be used for tool development or for speeding up the development process as well, not just at runtime. Furthermore, especially for MMO games or networked games, the database can be deployed onto another machine, separate from the machine that hosts the game. It’s important that everyone understands the different applications of the database and keeps an open mind.

This chapter focuses on the design and creation of databases, as well as accessing the database using Java, Java Database Connectivity (JDBC), and SQL. To accomplish this, many concepts will be covered, yet not all of them will be covered in great detail, because there’s not enough room in this book for the extensive treatment the topic deserves. The specific concepts and techniques discussed here were chosen based on their viability and general usefulness to the majority of projects and people in the industry. Concepts presented here are meant to be as generic as possible, yet specifics will be covered where performance is concerned. The aim is to provide general and practical knowledge applicable to the most common databases and platforms. Nevertheless, by the end of reading this chapter, you should be able to design, implement, and code against working databases.



Practical Java Game Programming
Practical Java Game Programming (Charles River Media Game Development)
ISBN: 1584503262
EAN: 2147483647
Year: 2003
Pages: 171

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net