Skip to Content
Darkstar: The Java Game Server
book

Darkstar: The Java Game Server

by Brendan Burns
August 2007
Intermediate to advanced
77 pages
1h 59m
English
O'Reilly Media, Inc.
Content preview from Darkstar: The Java Game Server

Efficient Client-Client Communication Through Channels

In some cases you want to send information from one client to another client. For example, you might provide chat communications between clients on the same team, or all players in the same room in a MMORPG. Using the communication methods previously discussed, all of these communications would have to first be sent into the server and then broadcast back out to the appropriate other clients. This approach makes the server a single bottleneck in communication. In general, your game server has much better things to do with its CPU resources than relay communications from one client to another. A more efficient approach is to have clients communicate directly with each other. In Darkstar, this direct communication is provided by channels. Channels provide a publish/subscribe paradigm for communication. Clients are subscribed to one or more named channels. A client can then send arbitrary messages to the channel. Any message sent by a client to a particular channel is received by all of the other subscribers to the channel. The sender does not receive a copy of his own message. A comparison between Darkstar's two different communication methods are shown in Figure 5.

Comparing Client 2 sending a message to Clients 1 and 3 using direction communication through the server or channel communication

Figure 5. Comparing Client 2 sending a message to Clients 1 and 3 using direction communication through the server or channel communication

In Darkstar, channels are created ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Beginning Java 8 Games Development

Beginning Java 8 Games Development

Wallace Jackson

Publisher Resources

ISBN: 9780596514846Errata