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

📄 ch4.htm

📁 对于程序员来说可以利用JAVA来开发网络游戏!
💻 HTM
📖 第 1 页 / 共 3 页
字号:
<HTML>

<HEAD>
   <TITLE>Chapter 4 -- The Basics of Graphics</TITLE>
   <META>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000EE" VLINK="#551A8B" ALINK="#CE2910">
<H1><FONT COLOR=#FF0000>Chapter 4</FONT></H1>
<H1><B><FONT SIZE=5 COLOR=#FF0000>The Basics of Graphics</FONT></B>
</H1>
<P>
<HR WIDTH="100%"></P>
<P>
<H3 ALIGN=CENTER><FONT COLOR="#000000"><FONT SIZE=+2>CONTENTS<A NAME="CONTENTS"></A>
</FONT></FONT></H3>

<UL>
<LI><A HREF="#GraphicsinGames" >Graphics in Games</A>
<UL>
<LI><A HREF="#GameWindowSize" >Game Window Size</A>
<LI><A HREF="#TargetAudience" >Target Audience</A>
<LI><A HREF="#SettingandMood" >Setting and Mood</A>
<LI><A HREF="#GraphicsStyle" >Graphics Style</A>
</UL>
<LI><A HREF="#TheGIFImageFormat" >The GIF Image Format</A>
<LI><A HREF="#CreatingandEditingGraphics" >Creating and Editing Graphics</A>
<UL>
<LI><A HREF="#GraphicsUtilities" >Graphics Utilities</A>
<LI><A HREF="#LineArtGraphics" >Line-Art Graphics</A>
<LI><A HREF="#DRenderedGraphics" >3-D Rendered Graphics</A>
<LI><A HREF="#ScannedPhotographyandVideoCapturedG" >Scanned Photography and Video-Captured Graphics</A>
<LI><A HREF="#BackgroundGraphicsandTextures" >Background Graphics and Textures</A>
<LI><A HREF="#AnimatedGraphics" >Animated Graphics</A>
</UL>
<LI><A HREF="#FindingGraphics" >Finding Graphics</A>
<LI><A HREF="#Summary" >Summary</A>
<LI><A HREF="#QA" >Q&amp;A</A>
<LI><A HREF="#Workshop" >Workshop</A>
<UL>
<LI><A HREF="#Quiz" >Quiz</A>
<LI><A HREF="#Exercises" >Exercises</A>
</UL>
</UL>
<HR>
<P>
The graphical appearance of a game is the first impression a user
has of the game. And even though game play is the ultimate measure
of how engaging a game is, weak graphics can often kill a potentially
cool game. For this reason, it's important for you to take the
time to carefully create graphics and animation for your games
that are sure to catch someone's attention. You'll learn more
about the technical details of using graphics in Java tomorrow.
Today, the focus is on how to create game graphics and animation.
<P>
If you aren't fortunate enough to have a staff of artists at your
disposal, then you are like the rest of us and have to work graphical
magic with the limited resources at hand. Even if you decide to
get help from an artist on your game graphics, you still need
to have a solid understanding of the role of the graphics in your
game. Either way, any insight that a game developer has into the
process of creating game graphics can only serve to ease the development
and improve the visual appeal of the game. Today's lesson gives
you a good dose of this insight.
<P>
The following topics are covered in today's lesson:
<UL>
<LI>Graphics in games
<LI>The GIF image format
<LI>Graphics utilities
<LI>Creating and editing graphics
<LI>Finding graphics
</UL>
<H2><A NAME="GraphicsinGames"><B><FONT SIZE=5 COLOR=#FF0000>Graphics
in Games</FONT></B></A></H2>
<P>
Before you begin any actual graphics creation, it's important
to decide exactly what you need in terms of game graphics. You
already should have the game pretty well defined before progressing
to this stage. The next step is to take what you know about the
game and assess the graphical content required to make it a reality.
This consists of making decisions regarding the game's graphical
elements and itemizing the graphics needed.
<H3><A NAME="GameWindowSize"><B>Game Window Size</B></A></H3>
<P>
The first major decision to make regarding a game's graphics is
the size of the game window.
<P>
The <I>game window </I>is the rectangular surface on the screen
where the game applet is displayed.
<P>
Because Java games typically run within the confines of a Web
page, you have pretty wide control over the size of the game window.
The only potential limitation on the game window is performance.
<P>
You might wonder how performance could be related to the size
of the game window. In games with animation, the game window is
usually constantly redrawn with animation frames. The amount of
time it takes to redraw the game window is based on the window's
size; the larger the game window, the longer it takes to redraw,
because there is more to draw. Therefore, in games that use extensive
animation, you need to weigh the game window size against the
performance of the game. I've found that a game window size in
the range of 200 to 300 pixels in both width and height yields
decent performance results on a wide variety of systems.
<P>
Keep in mind that games that don't use animation aren't necessarily
restricted to the game-window size limitation. However, it is
still generally a good idea to keep the game window size within
reason, because the game will be embedded inside a Web page.
<H3><A NAME="TargetAudience"><B>Target Audience</B></A></H3>
<P>
The target audience for your game can impact the graphics requirements
a great deal. Games for children typically use graphics with bright
colors to help keep their interest. Games aimed at very young
children often use highly contrasting bright colors and larger
graphic images. Very young children have much more difficulty
with mouse precision and timing, so you need to address these
issues in your game design. Most children are drawn toward animals
and cartoon-type characters. These types of graphics make a good
addition to almost any children's game.
<P>
If you're developing a game aimed at teenagers or an older crowd,
the graphics pretty much depend on the game itself. Many teens
and young adults are attracted to games with realistic violence
and a lot of gory graphics. Both inside and outside the commercial
game community, there has been much debate about violence in video
games, and the decision to include bloody graphics in your game
is ultimately your own to make. I personally don't see gory graphics
as being any different than special effects in movies; they have
their place in some games and certainly can add to the excitement.
<P>
Movies are a good example of how the target audience dictates
the graphic detail. Children gravitate toward cartoons; the characters
are easily recognizable and contrast well with the background.
Within cartoons, there are varying levels of graphic detail typically
associated with the target age group for the cartoon. Older kids
usually are more interested in cartoons that more closely approach
realism. Similarly, most adults prefer movies with human actors
instead of cartoons.
<P>
<CENTER><TABLE BORDERCOLOR=#000000 BORDER=1 WIDTH=80%>
<TR><TD><B>Note</B></TD></TR>
<TR><TD>
<BLOCKQUOTE>
It is sometimes possible to aim primarily for a particular target audience while also including elements that appeal to other audiences. This approach is sometimes referred to as shotgun marketing because the appeal of a game spreads across a wide group of 
people. Shotgun marketing is regularly employed in movies with great success. As examples consider the immensely popular Disney animated movies which clearly target children but always include plenty of humor that adults can appreciate.</BLOCKQUOTE>

</TD></TR>
</TABLE></CENTER>
<P>
<H3><A NAME="SettingandMood"><B>Setting and Mood</B></A></H3>
<P>
Perhaps even more important than the target audience of your game
is the setting and mood of the game. Where is your game taking
place, both in time and in location? If it's a futuristic space
game, your graphics might include metallic colors contrasting
with dark space back-grounds. A gothic vampire game probably would
have dark, gloomy graphics based mostly at night. By using dark
colors, you can more effectively portray the gloomy mood of the
game, with creatures emerging from the moonlit shadows.
<P>
<CENTER><TABLE BORDERCOLOR=#000000 BORDER=1 WIDTH=80%>
<TR><TD><B>Note</B></TD></TR>
<TR><TD>
<BLOCKQUOTE>
Keep in mind that the setting of the game can also be enhanced with graphics in the surrounding Web page containing the embedded game applet.</BLOCKQUOTE>

</TD></TR>
</TABLE></CENTER>
<P>
<P>
In these two game examples, I've alluded a great deal to the colors
used for the graphics. This is important because colors can really
dictate the mood of a game more effectively than specific graphical
images. The best way to understand the impact of the colors on
the mood of a game is to think about the dimmer switch on a light.
Have you ever dimmed the lights in a room and noticed the immediate
change in mood reflected by the dimming? Whether the mood is interpreted
as gloomy or romantic, it is altered nevertheless. This lighting
technique is used frequently in movies and certainly can be used
in games as well.
<P>
You can easily apply the dimmer idea to your game graphics by
altering the brightness of the graphics in a graphics editor.
Most graphics editors provide image filtering features that enable
you to specifically alter the brightness of an image. You learn
some popular shareware graphics editors a little later today in
the &quot;Graphics Utilities&quot; section.
<H3><A NAME="GraphicsStyle"><B>Graphics Style</B></A></H3>
<P>
The style you choose for your game graphics is the final requirement
you need to address before moving on to creating them. You more
than likely already have an idea of the style, so this decision
probably won't take too much time. <I>Graphics style</I> basically
means the look of the images, such as cartoon style, lifelike,
rendered, and so on. Lifelike graphics, such as scanned photographs
or digitized video, usually contain a very broad range of colors.
On the other hand, cartoon-type graphics usually consist of black
edges with solid color fills.
<P>
After you select a graphics style, you should try to keep all
the graphics consistent throughout the game. It probably wouldn't
be a good idea to have a scanned background with cartoon characters
moving around in front of it. On the other hand, maybe your game
has some Roger Rabbit-type theme to back up this mix of graphics.
It's totally up to you; just remember that a more consistent style
used for graphics results in a more absorbing and realistic game.
<P>
The graphics style of the game is related closely to how the graphics
are created. It will be hard to commit to a cartoon style for
the graphics if you don't have access to an artist and have no
artistic abilities yourself, for example. So, while you're thinking
about the style you want for the game, weigh into your decision
the resources you have for carrying out the graphics development.
<H2><A NAME="TheGIFImageFormat"><B><FONT SIZE=5 COLOR=#FF0000>The
GIF Image Format</FONT></B></A></H2>
<P>
Graphic images in Java are usually represented using the GIF image
format. The GIF (Graphics Interchange Format) image format is
a platform-independent format created by CompuServe in 1987 to
help facilitate image compatibility across a wide range of computer
systems. At the time of the GIF format creation, most other image
formats were designed around a specific computer platform, and
therefore were difficult to transport to other platforms. This
isn't much of a problem today, but the GIF format has lived on
and thrived nevertheless.
<P>
The most current version of the GIF image format is version 89a,
which provides a lot of neat features beyond the primary purpose
of encapsulating a bitmapped image. The GIf89a format supports
up to 256 colors with a transparency color, data compression,
and interlacing.
<P>
<I>Transparency colors</I> are colors in an image that are unused,
meaning that they aren't drawn when the rest of the colors in
the image are drawn. The significance of trans-parency colors
is that they allow the background behind an image to show through.
<P>
<I>Data compression</I> is a technique involving the conversion
of data into a smaller, more efficient format so that it takes
up less space in memory or on a hard drive or takes less time

⌨️ 快捷键说明

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