0% found this document useful (0 votes)
78 views12 pages

Gamedevelopmentusing C

This document discusses game development using C++. It provides an overview of the history of computer games, from early text-based games to modern graphical games. It also covers some of the key requirements for game development using C++, including the need for a graphical user interface (GUI), and the historical use of compilers like Turbo C++ for C++ development. The document serves as a literature survey on this topic.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
78 views12 pages

Gamedevelopmentusing C

This document discusses game development using C++. It provides an overview of the history of computer games, from early text-based games to modern graphical games. It also covers some of the key requirements for game development using C++, including the need for a graphical user interface (GUI), and the historical use of compilers like Turbo C++ for C++ development. The document serves as a literature survey on this topic.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/354354000

Game Development using C++

Article · October 2014

CITATIONS READS
0 1,632

1 author:

Divya Sheril Nanadath


Forefront Events
11 PUBLICATIONS   4 CITATIONS   

SEE PROFILE

Some of the authors of this publication are also working on these related projects:

RESCUE ROBOT”- Alive Human Body Detection System Using an Autonomous Mobile Robot View project

All content following this page was uploaded by Divya Sheril Nanadath on 04 September 2021.

The user has requested enhancement of the downloaded file.


International Journal of Emerging Technology and Advanced Engineering
Website: www.ijetae.com (ISSN 2250-2459, ISO 9001:2008 Certified Journal, Volume 4, Issue 10, October 2014)

Game Development using C++


Divya. S. N
Department of Computer Science and Engineering, Shirdi Sai Engineering College, Bangalore, India
Abstract— This paper is a literature survey on Game In 1962 Stephen Russell constructed a computer game
development using C++, which requires keyboard for input that was revolutionary for its time. Spacewar was the first
and all programming languages are mostly text oriented. The game intended for computer use. Many developments in
use of C++ in game development is being evaluated in this the history of the computer game are not technological but
paper. Games’ quick evolution, demands great flexibility,
purely conceptual. Spacewar and Pong are games for more
code reusability and low maintenance costs. Games usually
differentiate between versions, in respect of changes of the than one player. The time from approximately 1977 to
same type (additional animation, terrains etc). 1993 is completely dominated by games for single players.
Digital games are one of the most profitable industries in
Keywords— C++, Computer games, Object, OOP, Game the world. According to the ESA (Entertainment Software
development Association) [17, 18], digital games (both computer and
console games, along with the hardware required to play
I. INTRODUCTION them) were responsible in 2004 for more than ten billion
Computer games have been a preference to most of dollars in sales.
computer users. Nowadays, it does not only focus on The earliest computer games were limited
computer that we normally use in our office or house, but by memory constraints. This forced content, such as maps,
handheld devices such as hand-phone and Personal Digital to be generated algorithmically on the fly: there simply
Assistant (PDA) have also been a target platform for users wasn't enough space to store a large amount of pre-made
to play computer games. Computer games come in various levels and artwork. In the mid-1980‘s, interactive fiction
types to suit different user‘s requirement such as role began to become gradually more graphical. In the early
playing game, educational game, sport game and hybrid The Hobbit (Melbourne‘s house 1984), all
entertainment game. Researches reveal that the focal group interaction still is done by typing, and all game elements
in computer games is adolescents (Griffiths & Hunt, 1995; are described textually, but some locations are also
Subrahmanyam et al., 2001) [1]. The first generation of represented graphically:
computer games were text adventures or interactive fiction,
in which the player communicated with the computer by
entering commands through a keyboard. By the late 1970s
to early 1980s, games were developed and distributed
through hobbyist groups and gaming magazines, such as
Creative Computing and later Computer Gaming World.
These publications provide game code that could be typed
into a computer and played [24].
Games are the first advanced graphics techniques to
demonstrate the quality of graphics they produce [12, 13]. It
has been acknowledged [14] that game industry draws on
research from academia, corporate R&D labs and in-house
work by game developers. In 1952, A.S. Douglas wrote his
PhD degree at the University of Cambridge on Human
Computer interaction. Douglas created the first graphical
computer game - a version of Tic Tac Toe. The game was
programmed on a EDSAC vacuum-tube computer, which
had a cathode ray tube display [11]. William Higinbotham
created the first video game in 1958. His game, called
The Hobbit: Textual and graphical representation
"Tennis for Two", was created and played in Brookhaven
National Laboratory. Spacewar is one of the first computer
games.
433
International Journal of Emerging Technology and Advanced Engineering
Website: www.ijetae.com (ISSN 2250-2459, ISO 9001:2008 Certified Journal, Volume 4, Issue 10, October 2014)
Among early players of text-based interactive fiction, a The faster graphics accelerators and
certain amount of nostalgia is directed to the old games and improving CPU technology resulted in increasing levels of
newer, graphical games are viewed with skepticism. The realism in computer games. PC gaming currently tends
last purely text-based interactive fictions were published in strongly toward improvements in 3D graphics.[30]
the late 1980‘s, and with the arrival of the mouse, textual Gold commented that computer games development is
interaction was replaced by graphical interfaces. Games are different from other types of software development because
our legacy for the future, and we must take pride in our computer games include far more artistic content than other
history. The past shows us how far we had to go to get to types of software systems [36, 35]. A modern computer game
where we are today, and it puts into perspective how far we may include hundreds of thousands, or even millions of
still have to go: the past is the prologue to the future [13, 22]. lines of code [37]. Developing a modern computer game
Aligned with the creation of language-based tools, an may involve a team of over 50 professionals ranging from
emerging tendency is to make models first-class citizens computer programmers, designers and testers, to animators,
for game development, in the same sense that source code artists and musicians [38].
already is an essential part of game development. Models
can be described by visual Domain-Specific Languages III. LITERATURE SURVEY
(DSLs) [20], providing a richer medium for describing
relationships between abstractions and giving them greater Requirements For Game Development Using C++:
efficiency and power than source code. 1. GUI-gives the visual appearance of the virtual file
system to the end user. GUI color schemes, layout, working
II. OVERVIEW and behavior are quite similar to Windows Explorer.
Graphics consist of any images that are displayed and any
By 1987 the IBM PC market was growing so rapidly that
effects that are performed on them. This includes 3D
the computer had become the largest and most important
objects, textures, 2D tiles, 2D full screen shots, Full Motion
platform for computer game companies. More than one Video (FMV), statistics informational overlays and
third of games sold were for the PC, twice as much as those anything else that the player will see.
for the Apple II and even outselling those for the
Commodore 64. With the EGA video card, an 2. Turbo C++- was a C++ compiler and integrated
inexpensive PC clone was better for games than the development environment and computer language
Commodore 64 or Apple II.[25,26] originally from Borland. C++ development has come a
By 1989 Computer Gaming World reported that "the long way since Borland first introduced Turbo C++ in
industry is moving toward heavy use 1990. Over the years, Turbo C++ evolved into Borland
of VGA graphics"[27] which gave the PC graphics. The use C++ and then C++ Builder with new language and
of computer mouse was driven partially by the success development environment innovations like visual
of adventure games and high resolution bitmap displays development to greatly increase developer productivity [8].
allowed the industry to include increasingly high- 3. A level editor-(also known as a map, campaign or
quality graphical interfaces in new releases. Further scenario editor) is a software tool used to design levels,
improvements were made possible with the introduction maps, campaigns, etc. and virtual worlds for a video game.
of FM synthesis sound. The rise of the Creative An individual involved with the creation of game levels is a
Labs Sound Blaster card, released in 1989, which featured level designer or mapper. Level editors are used to create
much higher sound quality due to the inclusion of environments and other tools may be used to view assets
a PCM channel and digital signal processor, led AdLib to before they are incorporated in the game. Images of the
file for bankruptcy by 1992. Also in 1989, the FM player's character were also hard-coded, being drawn,
Towns computer included built-in PCM sound, in addition frame by frame, by source code commands. As soon as the
to a CD-ROM drive and24-bit colour graphics.[28] more technologically advanced use of sprites became
By 1990 MS-DOS comprised 65% of the computer- common.
game market, with the Amiga at 10%; all other computers, 4. Sound -consists of any music or sound effects that are
including the Apple Macintosh, were below 10% and played during the game. This includes starting music, CD
declining.[29] In the same time frame, games such music, MIDI, MOD tracks, Foley effects (Environmental
as Myst took advantage of the new CD-ROM delivery sound), and sound effects.
format to include many more assets (sound, images, and
video) for a richer game experience.
434
International Journal of Emerging Technology and Advanced Engineering
Website: www.ijetae.com (ISSN 2250-2459, ISO 9001:2008 Certified Journal, Volume 4, Issue 10, October 2014)
5. Interface-is anything that the player has to use or have 6. Flixel-supports Animations, Collisions, Movement, Tile-
direct contact with in order to play the game. The interface maps, Particle effects, Visual effects such as flickering,
is not as straight forward as the above definitions and it screen-shaking, blend-modes, alpha adjustments, etc.,
goes beyond simply the mouse/ keyboard/ joystick, which Simple physics (Box2D can also be used with Flixel),
is only the first contact the game has with the player. The Keyboard and mouse access, Audio controls for volume
interface includes graphics that the player must click on, and muting, Pausing gameplay, Site-locking, Pre-loading.
menu systems that the player must navigate through and 7. Gameplay-is a fuzzy term. It tells how fun the game is
game control systems such as how to steer or control the and the length of playability.
pieces in the game. Half of a game‘s Artificial Intelligence
8. Story- The game‘s story includes any background before
is also related to interface.
the game starts, all information the player gains during the
Table 1: game or when they win and any information they learn
Features and description of certain tools used: about characters in the game [16].
Feature Description

User Interface Information display screens


containing textual and/or
graphical elements are
supported.

Game flow Each game should have at


least a main character, an
introduction screen and a IV. C++ IN GAME LOGIC
game over screen. During the 1990s C++ grew to become one of the most
popular computer programming languages. Today C++
remains high on the Tiobe rankings. C++ is the most
Sound Background music can be popular high-performance, object-oriented programming
associated with games or language in use today. The article, "Why C++?" by Kyle
information display screen. Wilson discusses why C++ is the best language for game
programming. The feature of C++ that makes it so suitable
for games is "platform availability" (selected by almost
Input handling Keyboard only. everyone, 86.8%), followed by the ability of directly
manipulating raw memory via pointers, encapsulation in
classes and the compile-time knowledge of type size
Artificial Intelligence Enemies can be set to chase (67%).
the player within a room. Although until now there is not much work found on
More elaborated behaviors C++ use in games, we believe that such a use can be
can be created visually by proven very useful in this domain. This fact can be
combining predefined event examined by investigating the source code of games for the
triggers and event reactions. existence of design patterns [2]. As a first approach, we
will provide examples of how object-oriented design
patterns [8, 3] could be used in simple games. In addition to
Target Platform PCs running Microsoft that, we will present real games that could use these object-
oriented design patterns and improve their design.
Windows 98 or higher We know that C++ is an OOP (Object Oriented
Programming) Language. Programming styles, such as
OOP, help to organize code in such a way that it becomes
easier to maintain and modify.

435
International Journal of Emerging Technology and Advanced Engineering
Website: www.ijetae.com (ISSN 2250-2459, ISO 9001:2008 Certified Journal, Volume 4, Issue 10, October 2014)
OOP helps organize code by organizing it into what are
known as objects. Objects hold information about state and
behavior: States are the characteristics of the object, or the
words you would use to describe it, and usually take the
form of is or has descriptors. A computer is either on or off,
a chair has four legs, and you have a name. Behaviors are
the things the object can do, or the actions the object can
perform, and are usually verbs that end in ―ing‖. You are
sitting, using a computer, and reading this article.
The simplest method of achieving polymorphism is
through the use of Interfaces. An Interface is like a job
license: it lets the outside world know that you are capable
of performing certain tasks. By using Object Oriented
Programming, the internal working of an object is hidden Other languages like C# (C sharp), Java, Flash etc. have
from the rest of the program (Encapsulation) i.e. the details their place. Games written in these languages run slower
are hidden, it reduces the ability of other objects to directly than C++ games but the advantage (in theory) is rapid
modify an object's state and behavior. development. The problem with C# is that only the Xbox
community games area supports C#. Java and Flash can be
V. SIGNIFICANCE OF C++ IN GAME DEVELOPMENT: used for online games. All major game consoles use C++
only. Other devices like phones are becoming gaming
The efficiency and power of C++ make it the best
platforms. The iPhone development is done using
language choice for core game engine technology, where
Objective C and for Android phones it is Android.
runtime efficiency is important and iteration time is not. Microsoft has released XNA which is a set of tools that
For gameplay code, however, those requirements are allow to quickly program games for Windows and the
reversed. The ability to iterate quickly on gameplay and get Xbox 360 console. Programming is done in C#. Inorder to
immediate feedback on design changes is paramount. But
start a career in games C++ is required.
gameplay logic executes infrequently compared to physics
or graphics routines, so highly-optimized native-code inner
VI. GAME ARCHITECTURE
loops are less important. For rapid iteration, a simple
language that compiles quickly or doesn't need to be Design pattern usage in game development is an open
compiled at all is used. Inorder to make changes and see research field. In literature, it is not easy to find catalogues
their effect immediately in-game, restarting or reloading of with patterns that could be used as ‗‗common solutions for
the game is not required. C++ as nowadays it is the most common problems‘‘ in games. Such catalogues would
common language that games are written in. There are still make the communication between developers easier and
games being written solely in C and a smattering of the documentation of this kind of programs more
assembler is used but the trend is very much to C++. This understandable. Designing patterns for games, can be
is mainly because games have got bigger and more approached from two different perspectives; firstly, as
complex. With C++ you can more easily manage and patterns used for describing the game mechanics (game
maintain huge amounts of code than with C. play and game rules) and secondly, as the use of object-
oriented design patterns in programming games [2, 7].

436
International Journal of Emerging Technology and Advanced Engineering
Website: www.ijetae.com (ISSN 2250-2459, ISO 9001:2008 Certified Journal, Volume 4, Issue 10, October 2014)
Concerning game mechanics, Bjork et al. (2002) Examples of static display screens are Game selection
introduced a set of design patterns which essentially are screen (which describes the menu options), Game start
descriptions (employing a unified vocabulary) of screen (screen at the beginning of the game, start-up
reoccurring interaction schemes relevant to game‘s story parameters, characters, intro music), and so on..
and game play. As such, these patterns are not related to the Examples of Dynamic display screens are Message
software architecture [42] or code. The proposed patterns are screens (in response to the actions of the player i.e., if the
collected from interviewing professional game player commits an illegal move/action, a message is
programmers, from analyzing existing games and from displayed), End of Game Screen (which include messages
[19]
transforming game mechanics. As mentioned, ‗‗The way to and responses to questions like what happens when
recognize patterns is playing games, thinking games, player loses/ wins the game? Where does the player go
dreaming games, designing games and reading about when the game is over?) and so on.
games‘‘. An example of such a pattern is the Paper – Rock
iii) Develop Logic for Game play
– Scissors pattern that is well known in game design
community (also as triangularity).This pattern is used when This step involves developing a proper logic for game
there are three discrete states (or options for a player) and play. The programmer must specify or program everything
option A defeats option B, option B defeats option C and that includes response to the player‘s action, response to
option C defeats option A. system events, rules of the game and if it is a two player
Concerning game programming examples of object- game (if the computer is a player), then the computer‘s
oriented design patterns in two game modules will be moves and actions. Sometimes in some games, some
presented in the succeeding paragraphs. random situations/ processes/ numbers, etc are to be
picked. To achieve this randomize( ) and rand( ) functions,
Designing The Game: stdlib.h header file is used. The randomize( ) function
Game design is primarily an artistic process [10, 39], but it initializes the random number generator with a random
is also a technical process. There are certain technical steps value and rand( ) is used to generate random numbers e.g.,
that should be followed. They are: i) Determine initial to generate a random integer between the range 0-9, we
Requirements, ii) Develop interface, iii) Develop Logic for may give:
Game play and iv) Develop Logic for Scoring points. (int) (rand( ) % 10)
i) Determine Initial Requirements:
iv) Develop Logic for keeping scores:
While writing a game program, after selecting the goal
We need to decide about maximum number of chances
of game, we need to determine the initial requirements. It
allowed, the scoring mechanism, whether it is tied to timing
can be easily determined if we have already described the
or not, etc. Once in a while, the player needs to be
game. The general description is the most important part of
rewarded or penalized for reaching that point in the game.
the Game Design specification. When the coding is
prepared for the game, general description is constantly The following is a simple Game Design of a Game called
inorder to know what still needs to be done. Jumbled Word:
ii) Develop interface: i. Ask the player to guess the correct word.
The interface is the mode of communication between the ii. If player does not enter the correct word then it
player and the computer. It composes input and output. shows that the word is incorrect.
While developing the interface, the programmer should iii. Initialize the maximum guess as five.
develop the static and dynamic screens. The static display iv. If player needs hint , player should type hint &it
is the screen which remains unaffected by the player‘s will show the hint about the word.
actions i.e., the input by the player. The dynamic display is
the screen which is governed by the player‘s actions. The v. After the guess, the score will be display.
dynamic screens show what has changed since the earlier vi. If the user want to continue press the letter y
screen [41]. Otherwise any letter.
vii. Asking the user name to store the score in files.

437
International Journal of Emerging Technology and Advanced Engineering
Website: www.ijetae.com (ISSN 2250-2459, ISO 9001:2008 Certified Journal, Volume 4, Issue 10, October 2014)
An example of flowchart logic is below:- Sound cards are also available to provide improved
audio in computer games. These cards provide improved
3D audio and provide audio enhancement that is generally
not available with integrated alternatives, at the cost of
marginally lower overall performance. [33]
All personal computers use a keyboard and mouse for
user input. Other common gaming peripherals are a headset
for faster communication in online games, joysticks for
flight simulators, steering wheels for driving games and
gamepads for console-style games.
Software:
Computer games also rely on softwares such as an
operating system (OS), device drivers, libraries and more to
run. Today, the vast majority of computer games are
designed to run on the Microsoft Windows family of
operating systems. Whereas earlier games written for MS-
DOS would include code to communicate directly with
hardware, today Application programming interfaces
(APIs) provide an interface between the game and the OS,
simplifying game design. Microsoft's DirectX is an API
that is widely used by today's computer games to
communicate with sound and graphics hardware. OpenGL
is a cross-platform API for graphics rendering that is also
used. The version of the graphics card's driver installed can
often affect game performance and game play. In late 2013,
AMD announced Mantle, a low-level API for certain
models of AMD graphics cards, allowing for greater
performance compared to software-level.
PC gaming technology Multiplayer:
Hardware: Local area network gaming:
Modern computer games have great demand on the Multiplayer gaming was limited to local area networks
computer's hardware, often requiring a fast central (LANs) due to their higher bandwidth and lower latency.
processing unit (CPU) to function properly. These LAN gaming requires two or more personal computers, a
processors allow the computer to simultaneously process router and sufficient networking cables to connect every
multiple tasks allowing the use of more complex graphics, computer on the network. Additionally, each computer
artificial intelligence and in-game physics. [30][31] must have a network card in order to communicate with
Similarly, 3D games make use of powerful graphics other computers on the network, and its own copy of the
processing unit (GPU), which accelerates the process of game in order to play.
drawing complex scenes. GPUs may [32] come packaged
Online games:
with a discrete graphics card with a supply of dedicated
Video RAM, connected to the motherboard through either Online multiplayer games have achieved popularity
an AGP or PCI-Express port. It is also possible to use largely as a result of increasing broadband adoption among
multiple GPUs in a single computer, using technologies consumers. Affordable high-bandwidth Internet
such as NVidia's Scalable Link Interface and ATI's Cross connections allow large numbers of players to play
Fire. together, and thus have found particular use in massively
multiplayer online role-playing games. Today there are
over 510,000 game servers hosted in North America alone.
[34, 40]

438
International Journal of Emerging Technology and Advanced Engineering
Website: www.ijetae.com (ISSN 2250-2459, ISO 9001:2008 Certified Journal, Volume 4, Issue 10, October 2014)
Types Of Online Games Played Most Often:
The below graph shows the various online games played
by the gamers.

Asteroids
Now that we have identified our objects, let's define the
state and behavior for one of them: the player's ship. Think
about what attributes describe the ship; these are its states.
Then think about what the ship can do; these are its
Evaluation behaviors. A ship has states of: rotation, momentum and
Evaluation 1: thrust and behaviors of turning, moving and firing.
The next game we'll use as an example is Pac-Man. The
To evaluate the benefits of object-oriented programming
player controls Pac-Man through a maze, eating Pac-dots or
in game development, we have studied three existing
pellets. Four enemies [ghosts] roam the maze, trying to
games (Asteroids, Egg Catch and Pac-Man) [6, 2]. These
catch Pac-Man. Near the corners of the maze are four
games have been selected because their code is publicly
larger, flashing dots known as power pellets that provide
available and multiple versions of them are released. The
Pac-Man with the temporary ability to eat the enemies. The
program evaluated has been developed using C++. The
enemies turn deep blue, reverse direction and usually move
design patterns in the C++ program have been detected by
more slowly. Pac Man is highly popular arcade computer
manual inspection and employing reverse engineering
game in which the player controls Pac Man via a maze,
tools.
eating pellets.
First, let's imagine that we wanted to make the classic
When all pellets are eaten, Pac Man is moved to the
game Asteroids. To identify what the objects are in
next stage. Four enemies named Blinky, Pinky, Inky and
Asteroids, try describing it. The objective of Asteroids is to
Clyde wander the maze, trying to grab Pac Man. If an
score as many points as possible by destroying asteroids
enemy touches Pac Man, a life is lost. When all lives have
and flying saucers. The player controls a triangular-shaped
been lost, the game ends.
ship that can rotate left and right, fire shots straight
forward, and thrust forward. As the ship moves, momentum
is not conserved – the ship eventually comes to a stop again
when not thrusting. Think about what in this description
could stand alone or the things that are described that could
have state and behavior. These become our objects.
The objects for Asteroids are: a ship, an asteroid, a
flying saucer, and a bullet.The cool thing about objects is
that we normally describe things in terms of objects in
everyday talk, so they usually reveal themselves through a
description.

439
International Journal of Emerging Technology and Advanced Engineering
Website: www.ijetae.com (ISSN 2250-2459, ISO 9001:2008 Certified Journal, Volume 4, Issue 10, October 2014)
The original Pac-Man arcade game Individual Ghost Personalities: ―This is the heart of the
For Pac-Man, there are three objects: Pac-Man, a ghost, game. I wanted each ghostly enemy to have a specific
and a Pac-dot. A power pellet isn't really its own object character and its own particular movements, so they
because it's a special Pac-dot (we'll talk about what to do weren‘t all just chasing after Pac Man in single file, which
about this in a later paragraph. we‘ll describe the ghost would have been tiresome and flat.‖
object because it's more interesting. The ghost has states of
colour, name (+1 if you can name all the ghosts off the top
of your head), state (eatable or not), direction and speed,
and behaviors of moving and changing state. You are to
implement the 4 ghosts in a way that replicates the
behavior of the original game. All ghosts are controlled by
a single controller object that inherits from Controller. To
get started creating the Pac-man program, seven sprites are
built. Start by creating a sprite named Pac-Man with only a In order to develop simple animation of characters in the
single costume. Then create a sprite called Horizontal to be game, flixels are used. Animation code (blocks) will be
a horizontal bar and vertical which will be a vertical bar. kept separate from functionality code (blocks) so that
The sprites will be used to build the maze for Pac-Man and sprites can be reused with simple changes to the costumes
should both be the same colour. Next we will create a sprite and minor changes to some variables. This is how
called Point Pill that Pac-Man will eat as he goes through computer languages and scripts that are fully object
the maze. We will then create a sprite called Ghost 1 with a oriented work.
single costume. This ghost will be Pac-Man's enemy and The procedure is repeated for Egg Catch Game, which is
will be copied to make further ghosts later in the game. a small game that is developed in C++ language. The egg
Lastly, we will create a sprite called Power Up in any randomly falls down and we have to catch it in basket, we
colour that is different from the Point Pill sprite. When Pac- have performed 2D scaling, rotation and transformation to
Man eats a Power Up, he will have the ability to eat the make game more attractive.
ghosts for about 10 seconds and score 100 points for every
ghost he eats. Our last sprite will be called Game Over and
will display a game over message on screen once three Pac-
Man characters have been eaten by the ghosts and the game
is finished.
There is a need to use polymorphism to control all the
objects throughout the game. If the code is reused to build
more games, one would probably end up with more
polymorphism, due to the re-using of interfaces. But at this
point, if it's the case that there are more methods in the
implementations than in the interfaces, then the interfaces
are serving a purpose--they're hiding implementation
details from the clients, who are thereby forced to conform
to the interface, enabling the polymorphism. We can use
C++ inheritance to share functionality and interface.
Much of Pac-Man‘s design and mechanics revolve The Logic Behind
around the idea of the board being split into tiles. ―Tile‖ in
A random function is used to generate the egg and at any
this context refers to an 8 x 8 pixel square on the screen.
given time. All the eggs move downward on the board
Pac-Man‘s screen resolution is 224 x 288, so this gives us a
matrix that is defined in the beginning of the program and
total board size of 28 x 36 tiles, though most of these are
if it is at the end, the catcher the score is incremented by
not accessible to Pac-Man or the ghosts. As an example of
one or you lose the chance.
the impact of tiles, a ghost is considered to have caught
Pac-Man when it occupies the same tile as him.

440
International Journal of Emerging Technology and Advanced Engineering
Website: www.ijetae.com (ISSN 2250-2459, ISO 9001:2008 Certified Journal, Volume 4, Issue 10, October 2014)
Logic behind moving of eggs--every time thrower want If the number is less than 0 or greater than 100, an error
to drop egg he put egg value in top of matrix, since every message will be displayed. If the user‘s number is less than
100 msec the matrix is reviewed and screen is redrawn the or greater than the computer‘s number, then the computer
egg can be shown on the screen, now for moving action prints a message saying that ―the number is too low‖ or
each time top row is copied in its lower row and soon that ―the number is too high‖ respectively and asks for another
and last row is discarded. This is the logic of moving guess. If the user‘s number is equal to the computer‘s
multiple egg in screen. number then the computer prints a message congratulating
the user and the game will end. Note that the player will be
given a maximum number of chances for guessing the
number.
Now let us analyze different elements of the game
design
i) Initial requirements:
In this game, a number is generated randomly. Thus we
need to have a variable to hold the number to be generated.
For this, we should declare a variable called number by
using the statement:
int number;
Also, a number is to be guessed by the player. So we
need one more variable to hold the guessed number. For
this, another variable called guess is declared:
int guess;
Now to calculate total number of chances taken by the
player, we require another variable chance:
int chances=0;
And to store the score, a variable called score is used:
int score=0;
Another variable called chanscore holds the score for
one successful chance:
int chanscore=0;
The maximum number of chances allowed for a user is
declared through the statement:
const int totchan =7;
Evaluation 2 ii) Developing Interface:
This part of the paper shows how to go about game In order to interact with the user, many messages have
development for a simple game program known as ―High/ been displayed, of course using cout statements. Examples
Low number guessing game‖. of these messages are:
General description of High/Low number game: Welcome to the High/Low game
The computer picks a random integer from 0 to 100. We
I will pick a random number from 0 to 100
shall use the random( ) method to generate a random
number. The computer asks the user for a guess. The user You must try to guess the number
types a number. The computer checks that the number is
What is your guess?
from 0 to 100.
441
International Journal of Emerging Technology and Advanced Engineering
Website: www.ijetae.com (ISSN 2250-2459, ISO 9001:2008 Certified Journal, Volume 4, Issue 10, October 2014)
To tell the player whether the number is high, low or This virtual environment is the future of education as it
equal, messages are displayed and also to display the offers an interactive way for students to learn and succeed
messages indicating the number of chances left for in this competitive world. Include PC games during
guessing. computer hours in schools, which help in increasing the
concentration skills, logical thinking, visual learning and
iii) Developing the Logic for Game play:
artistic skills. Also behavioral changes such as aggression,
The logic of this program generates a random number ADHD, and stress can also be reduced. Finally, a complete
using randomize () and rand ( ) functions and lets the user game engine, or a game, that uses all conclusions from the
enter his/her guessed number. Then the guessed number is above research, is planned to be implemented.
compared with the computer‘s number. If the guessed As every coin has its two sides, even it has got
number is not equal to the generated number, then the user advantages and its drawbacks. It also affects children
is intimated about it. If the guessed number is equal to the behavior because they take those illusions to be real and
generated number then the player is congratulated. All this become more aggressive while facing real situations [4]. So
is done using a do while loop (inner loop) that terminates if even parents get worried and pay great attention towards
the user has guessed a correct number or total number of each and every activity of their children. Doctors even
chances taken become equal to number of allowed chances. found it that it is harmful for the gamers because they get
Further, an outer do while loop gives the user a chance to addicted to gaming and lead to eye strain, wrist, back pain
replay the game. etc. Obesity is also a big negative cause which occurs due
iv) Developing logic for keeping score: to constant addiction to games. Last but not the least
demerits are that it affects their education and separates
Score is being calculated as per following specifications:
them from their surroundings and they tend to live an
chanscore= 100/totchan; isolated life which affect their brain as well. It is important
Here chanscore variable stores the score for 1 successful as well because it helps the users to face their phobias in a
chance. The total score is calculated as: controlled environment which helps them to recover their
score= chanscore*( totchan- chances); fear. It is also useful for those students who are having
More the number of chances left more will be the score. language and learning disability as it‘s a unique and
The total score is calculated as: interesting way of overcoming the same. An unique way of
number_of_chances_left*score_for_one_succesful_chance. socializing while playing on computer and also online
games .This is a great help for those who work in a 24*7
VII. FUTURE RESEARCH working environment for them it gets hard to revive their
excitement for life but by diverting their interest to
Computer games acts as a tool or methodology in computer games can make their life go smooth as it
psychological research especially for behavioral change. releases their stress out.
Playing video games helps in the development of To decrease the negative effects of gaming on children,
perceptual and cognitive abilities and motor skills. While when buying games for kids, parents should check the age
playing video games, children acquire problem-solving limit mentioned on the cover by the Entertainment
skills, learn teamwork, and become more alert. It also helps Software Rating Board (ESRB). They should also avoid
improve their short-term memory. Playing video games buying games that have too much violence in them.
requires them to make faster, accurate decisions, thus To draw safe conclusions about the use of patterns in
developing their decision-making skills [9]. game development, the applicability of other object-
Interactive video games compel a child to practice more oriented design patterns should be examined. What could
and more in order to be the best. Playing, devising gaming be done to make this game better and more fun to play? Try
strategies, and winning gives children a sense of adding more features to the game: Add a difficulty setting,
achievement and boosts their confidence. A study Add a start button after the Title Screen so that you do not
conducted by the University of Rochester states that, have to wait 10 seconds, Add a try again button on the
"Gamers perform better in tests that involve focus, speed, game over screen, Keep track of the player‘s high score,
multi-tasking, vision, and accuracy than others or non- add some more sounds or more live graphics.
gamers." So playing video games can teach your children
[22]
to concentrate, plan, and come up with different
strategies to reach the goal [5], perform multiple tasks at the
same time and learn how to handle complex situations.
442
International Journal of Emerging Technology and Advanced Engineering
Website: www.ijetae.com (ISSN 2250-2459, ISO 9001:2008 Certified Journal, Volume 4, Issue 10, October 2014)
An article by Dr Neil Gordon in 'Perspectives', the Consequently, due to the evolving nature of games we
newsletter of the Independent Games Developers believe that the appropriate employment of design patterns
Association, highlights some of the ways the games can be should be encouraged in game programming.
applied as part of teaching Computer Science. The article
describes about developing a serious game aimed at school REFERENCES
children to promote the subject of computer. It also The heading of the References section must not be
describes the use of beginning programming languages to numbered. All reference items must be in 8 pt font. Please
school pupils [23]. Educational video games, handheld use Regular and Italic styles to distinguish different fields
devices, and media production tools can allow young as shown in the References section. Number the reference
students to see how complex language and other symbol items consecutively in square brackets (e.g. [1]).
systems attach to the world. [1] Bowman, M., Debray, S. K., and Peterson, L. L. 1993. Reasoning
about naming systems. .
VIII. CONCLUSION [2] Ding, W. and Marchionini, G. 1997 A Study on Video Browsing
Strategies. Technical Report. University of Maryland at College
Currently, computer game development is one of the Park.
fastest growing industries in the worldwide economy. The [3] Fröhlich, B. and Plate, J. 2000. The cubic mouse: a new device for
continuous development in the strategies and techniques of three-dimensional input. In Proceedings of the SIGCHI Conference
developing games in the current industry is because of on Human Factors in Computing Systems
making it more and more appealing for the users. Object- [4] Tavel, P. 2007 Modeling and Simulation Design. AK Peters Ltd.
oriented programming is one way to organize code in a [5] Sannella, M. J. 1994 Constraint Satisfaction and Debugging for
game.OOP focuses on objects that are defined by their state Interactive User Interfaces. Doctoral Thesis. UMI Order Number:
and their behavior. This paper aimed at evaluating the use UMI Order No. GAX95-09398., University of Washington.
of C++ concepts in game development. In order to achieve [6] Forman, G. 2003. An extensive empirical study of feature selection
metrics for text classification. J. Mach. Learn. Res. 3 (Mar. 2003),
this goal we examined two open-source games. The results 1289-1305.
extracted by the two games were almost identical and
[7] Brown, L. D., Hua, H., and Gao, C. 2003. A widget framework for
indicate that patterns can be beneficial with respect to augmented interaction in SCAPE.
maintainability. The game version that includes the pattern [8] Y.T. Yu, M.F. Lau, "A comparison of MC/DC, MUMCUT and
under study has reduced complexity and coupling several other coverage criteria for logical decisions", Journal of
compared to a prior version without the pattern. Systems and Software, 2005, in press.
Additionally, the application of patterns tends to increase [9] Spector, A. Z. 1989. Achieving application requirements. In
the cohesion of the software. In contrast to that, the size of Distributed Systems, S. Mullende
the projects has increased in the pattern version.

443

View publication stats

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy