⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 315-318.html

📁 java game programming e-book
💻 HTML
字号:
<HTML>
<HEAD>
<META name=vsisbn content="1571690433"><META name=vstitle content="Black Art of Java Game Programming"><META name=vsauthor content="Joel Fan"><META name=vsimprint content="Sams"><META name=vspublisher content="Macmillan Computer Publishing"><META name=vspubdate content="11/01/96"><META name=vscategory content="Web and Software Development: Programming, Scripting, and Markup Languages: Java"><TITLE>Black Art of Java Game Programming:Advanced Networking and Multiplayer Gaming Concepts</TITLE>
<!-- HEADER --><STYLE type="text/css">  <!-- A:hover  { 	color : Red; } --></STYLE><META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW"><script><!--function displayWindow(url, width, height) {         var Win = window.open(url,"displayWindow",'width=' + width +',height=' + height + ',resizable=1,scrollbars=yes');	if (Win) {		Win.focus();	}}//--></script><SCRIPT><!--function popUp(url) {        var Win = window.open(url,"displayWindow",'width=400,height=300,resizable=1,scrollbars=yes');	if (Win) {		Win.focus();	}}//--></SCRIPT><script language="JavaScript1.2"><!--function checkForQuery(fm) {  /* get the query value */  var i = escape(fm.query.value);  if (i == "") {      alert('Please enter a search word or phrase');      return false;  }                  /* query is blank, dont run the .jsp file */  else return true;  /* execute the .jsp file */}//--></script></HEAD><BODY> 
<TABLE border=0 cellspacing=0 cellpadding=0>
<tr>
<td width=75 valign=top>
<img src="../1571690433.gif" width=60 height=73 alt="Black Art of Java Game Programming" border="1">
</td>
<td align="left">
    <font face="arial, helvetica" size="-1" color="#336633"><b>Black Art of Java Game Programming</b></font>
    <br>
    <font face="arial, helvetica" size="-1"><i>by Joel Fan</i>
    <br>
    Sams,&nbsp;Macmillan Computer Publishing
    <br>
    <b>ISBN:</b>&nbsp;1571690433<b>&nbsp;&nbsp;&nbsp;Pub Date:</b>&nbsp;11/01/96</font>&nbsp;&nbsp;
</td>
</tr>
</table>
<P>

<!--ISBN=1571690433//-->
<!--TITLE=Black Art of Java Game Programming//-->
<!--AUTHOR=Joel Fan//-->
<!--AUTHOR=Eric Ries//-->
<!--AUTHOR=Calin Tenitchi//-->
<!--PUBLISHER=Macmillan Computer Publishing//-->
<!--IMPRINT=Sams//-->
<!--CHAPTER=9//-->
<!--PAGES=315-318//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->

<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="../ch08/311-314.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="318-322.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<H2><A NAME="Heading1"></A><FONT COLOR="#000077">Chapter 9<BR>Advanced Networking and Multiplayer Gaming Concepts
</FONT></H2>
<P><I>Eric Ries</I></P>
<P><FONT SIZE="+1"><B>Goals:</B></FONT></P>
<P>Create a Java Chat Room by using advanced networking concepts
</P>
<P>Implement AWT components with the Java API specifications</P>
<P>Learn to use Events to control the flow of an applet</P>
<P>In this chapter, we will build upon the simple networking concepts discussed in Chapter 8, Implementing a High Score Server on a Network, and create a chat room program. If you are familiar with the Internet Relay Chat (IRC) or any of the chat forums on services like America Online or Prodigy, you already know what a chat room is. We are going to build an applet that allows an unlimited number of users to have a conversation in a virtual &#147;room.&#148; The user will be able to &#147;say&#148; things to the entire room or &#147;whisper&#148; them to one specific person.</P>
<H3><A NAME="Heading2"></A><FONT COLOR="#000077">Why Create a Chat Room?</FONT></H3>
<P>Chat rooms and similar services have been available on the Internet for years. Writing this applet in Java, however, allows anyone with a Java-enabled browser to use our service, so additional software is not needed. Our program will be easy to use and easy to add to a Web page, so you will be able to customize and use this applet to drum up enthusiasm for your own pages. Many users really enjoy getting to meet other people interested in your Web page.
</P>
<P>In addition to its practical uses, writing an applet like this is an excellent prelude to writing multiplayer online games. The client-server relationship that you will have to understand in order to write this applet is the same one used by almost every game of this type. In fact, although this chapter deals with the concepts required to create multiplayer games, we will discuss them all in the context of the chat room applet.</P>
<P>First, let&#146;s discuss what some of these concepts are.</P>
<H3><A NAME="Heading3"></A><FONT COLOR="#000077">Fundamentals of Multiplayer Gaming</FONT></H3>
<P>Almost every game is, in a sense, a multiplayer game. Most computer games pit the user against a variety of computer-generated opponents. This can range from a simulated human opponent, in board games, to a whole alien universe in some space games.
</P>
<P>There are many ways that a computer opponent can be made more challenging, and there are many incentives that can be used to lure users into these games (one such device is a high score list, which should sound familiar). Nevertheless, there is nothing that can compare to playing with a real, flesh-and-blood human opponent, because computer opponents have inherent limitations. Sometimes they are too perfect, other times too predictable. But human opponents vary in skill and attitude, and thus are far more exciting. This is true in real-life games as well as computer games. Ever notice that bridge or hearts is much more exciting than solitaire? Or that bowling is more fun in a group? Humans are social by nature, and many successful computer games recognize and appeal to this part of the human psyche.</P>
<H4 ALIGN="LEFT"><A NAME="Heading4"></A><FONT COLOR="#000077">Types of Multiplayer Games: The User&#146;s Perspective</FONT></H4>
<P>Most likely, you have played a multiplayer game some time in your life. Different games have different ways of allowing multiple players to interact, but from the user&#146;s point of view, generally they fall into one of two categories: cooperative and competitive.
</P>
<H4 ALIGN="CENTER"><A NAME="Heading5"></A><FONT COLOR="#000077">Cooperative Gaming</FONT></H4>
<P>In a cooperative game, players work together toward some common goal. The old arcade game, Gauntlet, is a perfect example of this kind of game play. Up to four players can play on the same screen at the same time. The players must work together to ward off hordes of nasty monsters while collecting treasure and other goodies. If the players refuse to work together, it is nearly impossible to defeat all of the monsters; a good team of players can succeed nicely.
</P>
<H4 ALIGN="CENTER"><A NAME="Heading6"></A><FONT COLOR="#000077">Competitive Gaming</FONT></H4>
<P>The other style of play is far more common. In a competitive game, players work against each other, and sometimes against the computer, too. Most board and card games are of this type, and victory always comes at your partner&#146;s expense. Some games allow players the option of playing cooperatively or competitively. A good example of this kind of game is the now-classic DOOM. DOOM is a pretty typical game in which players roam around different levels and blow the heck out of a whole variety of demons and monsters. One of the things that has propelled DOOM to its current mega-hit status is the fact that multiple players can play simultaneously. Sometimes, players work together to rid a level of all of its monsters, but the game also has an option to let the players hunt each other down. Apparently, getting to &#147;kill&#148; your friends (or even your enemies) without actually damaging them has a huge popular appeal. Despite its apparent popularity, a good game programmer will always keep in mind that there are many people who do <I>not</I> enjoy violent competition, and so the very best games often include a variety of modes of play.</P><P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="../ch08/311-314.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="318-322.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>


</BODY>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -