Strategy Games

One genre still predominately handled on the PC is that of strategy. Strategy games may involve the player commanding a group of characters of units into some sort of conflict or in guiding a whole civilization through its history. Strategy games have been with computers since the first version of Chess was coded. Since then the games have become much more complex and require the player to develop deep strategies. Games such as Warcraft 3 and Command and Conquer top the charts in the strategy realm and introduce a new level of competition in the form of the real-time strategy (RTS) games. The RTS requires the player to think and plan quickly, then execute and manage the units to a victory condition. These games have been particularly popular over the last few years. Currently a few commercial Java-based strategy games are on the market. One of the more creative and popular is the incredible Kingdoms of War by Abandoned Castle Studios (Figure 1.4). Kingdoms of War is a combination of online strategy game and RTS, in which players compete for three months in a persistent environment, pitting different medieval kingdoms against each other. This game illustrates some of the strengths of Java for games in this genre.

Strategy Games and Java

Strategy games developed with Java have similar concerns as the other genres that have already been discussed, but Java is perfectly suited to tackle one aspect of this genre. Most RTS games require a large number of specialized units that may be subclasses of a Unit class or some derivation thereof. Java’s limitation on multiple inheritance attempts to enforce a good solid object hierarchy. In addition, when debugging a game using a wide range of similar classes, it is nice to have an easy way to find out about the information contained within a given class. This technique is called reflection. Reflection, which has been with Java since the 1.1 release, allows programmers to retrieve a myriad of information about specific classes, including the classic toString() method. Also, using reflection developers can find out what constructors and methods are declared for a given class and use them as they are identified. This feature is built into the language and is contained in any object created on the platform. Bugs happen all the time. The key is working with a tool that allows the programmer to best protect the code from the inevitable mistakes that creep in. Java supports dynamic class loading, which allows other developers to create new classes and load them into the game without touching the underlying engine. This ability is a powerful advantage and gives control back to the designers instead of requiring a programmer to implement even the most minor of changes.

In summary, Table 1.5 lists the major benefits and drawbacks to using Java for strategy titles.

Table 1.5 :  PROS AND CONS OF JAVA IN STRATEGY GAMES

Pros

Cons

Offers reflection, which makes for easy debugging and flexibility when using objects

Lacks a precision performance timer

Allows for easy expansion without engine modification using Dynamic Class loading

Commercially unproven for high-quality strategy games



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