![]() |
|
||||
|
JAVATM TECHNOLOGY IN THE MULTIPLAYER INTERNET GAME ARENA by Dana Nourie March 29, 2002 -- Market researcher IDC predicts a total U.S. revenue from online gaming will increase almost 50% annually over the next few years, from $210 million in 2001 to $1.8 billion in 2005. How those numbers pan out in reality has yet to be seen, but one thing is certain: The JavaTM platform has what it takes to produce online games in the hands of creative developers as demonstrated in this year's JavaOneSM conference session, "Building High Performance Multiplayer Internet Games With Java Technology." Why use the Java platform for online gaming?"'Write Once, Run AnywhereTM' is essential for online gaming," says John G. Miller Jr., president of Digital Gamers. "In console gaming, massive revenue is lost every time a new console comes out. We don't suffer this revenue loss with online gaming, and the Java platform has the API we need for both the client side and the back end." What You NeedThe following Java technologies can be used specifically for online gaming:
Small games can run from browser-based applets while larger games can be packaged on CDs, both of which can connect to a network so that players can enter a multiplayer environment. This environment is not without problems, however. Special Gaming ChallengesNetwork and server-side pose challenges:
To minimize these problems, send as little data as possible over the network and store as much of the virtual world as possible on the client's machine. Send substates of objects rather than entire objects. Thereafter, you only need to send messages of changes that have occurred for any particular object. Create your own sequenced protocol on top of UDP. UDP packets are delivered just like IP packets: connection-less datagrams that may be discarded before reaching their targets. UDP is useful when TCP would be too complex, too slow, or just unnecessary. A sequence number is tracked by the client to detect earlier messages. Sequence numbers may be used to detect and ignore superseded messages as well. Create separate command and delta network channels:
User Interface-Responsive ChallengesEqually important is working with user interface issues (UI) and challenges. The main aspect here is responsiveness in the UI. Users must see avatars or characters move about in real time or at least in what appears to be very close to real time. Warping is one of the most common UI problems. For instance, a character may be walking along, and the message for him to stop gets lost. The character continues to move, walking into a wall. So the user sends the message to back up to the right. Suddenly, the previous message for the character to stop at the previously specified point comes through; the image suddenly appears back where it should have stopped; then the message arrives that the user had backed the character to the right, warping the character yet again. You must prevent this kind of UI problem for an enjoyable gaming experience. Possible UI blockers are:
Take advantage of the Java thread model. Multithreading works well in a
multiplayer environment. Place these blockers on separate threads from
the UI. Perform animation with javax.swing.ActionListener.Use wait() and notify() in audio threads for MIDI or
sound samples to be placed in a queue.
Use the new I/O in J2SE 1.4 for file network reads. New I/O,
A socket channel is created by invoking one of the open methods of this
class. A newly created socket channel is open but not yet connected. An
attempt to invoke an I/O operation upon an unconnected channel causes a
Socket channels support nonblocking connection: A socket channel may
be created, and the process of establishing the link to the remote socket may be
initiated by way of the connect method for later completion by the
For fast graphics rendering, use
The
Because of the potential for hardware acceleration, a
Finally, set up full-screen mode and use page flipping. Once an
application is in full-screen exclusive mode, it may be able to take
advantage of actively setting the display mode. A display mode
-- When a page flip occurs, the pointer to the old back buffer now points to the primary surface, and the pointer to the old primary surface now points to the back buffer memory. This sets you up automatically for the next draw operation. Java technology, especially with the big release of J2SE 1.4, provides the API necessary to build solid virtual worlds where gamers can play against each other in a multiplayer environment.
See Also
Digital Gamers
JavaGaming.Org
Creating a Threaded Slide Show Applet
Java 3DTM API Tutorial
3-D User Interfaces with Java 3DTM
Java 3DTM API
Frequently Asked Questions About Java 2DTM Full-Screen Exclusive Mode (http://java.sun.com/docs/books/tutorial/extra/fullscreen/exclusivemode.html) Double Buffering and Page Flipping (http://java.sun.com/docs/books/tutorial/extra/fullscreen/doublebuf.html) Download J2SETM (http://java.sun.com/j2se/) |
|
|
|
||
|
Products & APIs -
Developer Connection -
Docs & Training -
Support Community Discussion - Industry News - Solutions Marketplace - Case Studies |
||
|
|
||
|
Glossary -
Help Pages
|
||
|