

Chapter 1: Preface

Over the past few years where two dimensional and three dimensional graphic has been utilized consecutively for developing computer games and console games. Two dimensional graphic games have been very popular since the beginning of 1940's and that's where it all started at the first place. It started with 2D games at first which is developed for the use of arcade mainframes and console machines, followed by the development of computer games for mainframe computers. Through the innovation development of dimensional graphic games, 3 dimensional games were to emerge as the most popular game genre which started in the late 80's. But despise all the development of 3D games in the games software industries, 2D games are still being developed in the new market. This is because 2D games are still being preferred by many people in the world, and due to this point, games software vendors are still taking account of 2D games development.

In the past few years, starting from the year 2000, 2D games starts to become widely know and played by many users with the development of mobile games and internet web based games. There have been rapid development of 2D technology to create new application games for the growing internet network, more and more website incorporate web based 2D mini games, online games and puzzle games.

It's been proven that 2D games are getting more and more popular compared to the years before year 2000, and with more websites trying to incorporate 2D games towards their web as the 3rd party application. Such website is like the ever popular incorporating hundreds and even thousands of 2D games as the 3rd party game application to attract more and more people towards joining the social web network.

Few years back, Microsoft introduced the XNA Game Studio software distributed across the internet to enable software programmers to develop new games for windows platform and also the new XBOX 360. The XNA game studio is licensed software, but with the MSDN help, the author as a student get to have the chance to obtain a tryout of this Microsoft XNA game studio. According to Microsoft, XNA game studio will need to be incorporated with Microsoft Visual Studio to enable references to be added in the system coding.

If we were to look back few years before, developing a game even for a two dimensional game would took probably months and even years, a simple personal computer would not even be sufficient to run the system codes, execute the game, and debug the system. And even with the availability of the development tools, it would surely require serious experts to come out with a game system coding, due to the complicated level of programming language available during the urban times. In other words there are almost none development tools available to reach in the hands of the student, or internet users to develop their own games by themselves. And by looking at the games development now, and comparing them, it is a breakthrough for the games development.

As I foresees the development potential for two dimensional games, I am sure that two dimensional game will have plenty of development potential in the future, as its been proven development of two dimensional games did not stop although three dimensional games been around for quite a long time, it didn't manage to replace the two dimensional games market its technology. There are quite a few reasons why two dimensional games are still around developing, which mainly are because of its cheap development cost, simple development process, easy for users to understand and well played. It's one of the reasons why Microsoft, the top player in IT industry is still in for two dimensional games development and searching for the breakthrough for it by creating development tools to support the development of two dimensional games.

Chapter 2: Development Tools


This chapter was designed to elaborate the use of each development tools which is related towards developing the XNA BubbleBall Attack 2D game. In order to produce this game system a set of software development tools need to be installed on the developer's machine to enable full support to the game system.

All identified developing tools which is related in the development process includes DirectX SDK (DirectX Software Development Kit) a set of application programming interfaces designed to handle tasks. It is a development tool containing all DirectX software required to build and produce cutting-edge, rich media interactive applications.

Microsoft .NET Framework is required for its library reference of coding solutions to common problems and local machine to manage execution of code written programs specifically for the Microsoft framework.

Microsoft Visual Studio 2008 is the development tool used to write for the game system coding. This application is used to build up the game system code, code debugging process, system appearance design, execution of game system, it is mainly the key development tool used in this project.

Microsoft XNA Game Studio is utilized by me the system programmer to design the animation, sound, and the entire multimedia enhancement required for the game system. This tool is required to be included in this process to enable the coding languages to add references in its library files and to execute the library files in the Microsoft Visual Studio 2008. Without this tool, the coding language will never be executed because failure in retrieving the coding files from the library files.

Adobe Photoshop C3 is used by the developer to create image file as the two dimensional graphic to be presented in the system. All animation that present in the system is created by this tool and included in the system as the two dimensional graphic.

DirectX SDK

DirectX SDK is developed by Microsoft with the objective of allowing the creation of application for a certain software package, software framework, hardware plat form, computer system, video game console, operating system or any other similar platform which supports DirectX. DirectX SDK comes in a set of development tools which contains of all the DirectX software needed for a game developer to create DirectX based application using the Visual Basic.Net, C or C++, and C+ coding language which was developed by Microsoft.

The reason why DirectX SDK is so powerful was mainly because it was made up from many different system tools which some of the main components includes:

  • DirectX headers and libraries
  • DirectX system runtime components
  • DirectX Application Programming Interfaces Documentations
  • Additional application and source code developed using DirectX compliant
  • Various powerful tools and utilities integrated to the DirectX SDK

This development tool allows me to take a complete advantage of DirectX technologies for creating excellent games and graphic applications. DirectX SDK allows developers to utilize its latest technology in hardware innovation for developing powerful games. DirectX SDK will receive update in its version releases to keep up with the latest technology enhanced within the DirectX software this is necessary to boost the codes, tools, library files and the documentation for every Microsoft Platform SDK.

Microsoft DirectX SDK comes with an important feature which is the D3DX library acts like a toolkit which provides developers with high level functionality to help create DirectX applications. This feature helps to optimize low level routines so as to obtain the best performance out of Microsoft platform. Incorporated with basic features such as math calculation and texture loading routines, updated technology in art manipulating content including tangent frame generation, mesh optimization and Precomputed Radiance Transfer.

DirectX SDK come with many other features such as D3DX effects framework, High Level Shading Languages, Shader Debugger, PIX for Window Platform. These technologies will help developer in all way developing their game system accordingly. DirectX SDK will be able to integrate with Microsoft Visual Studio .Net to enable developers to code their system using it. Pipelining feature will be enabled with the integration of DirectX SDK towards Microsoft Visual Studio .Net, these enable developers to code for pipelining structure for their game application. Certain samples will be included within DirectX SDK to help developers to understand the technologies used in DirectX.

In other words DirectX SDK will help developers by providing technical solution, best suitable graphic rendering outcome, graphic localization, code implementation, library files, better and simple developing experience, and also how to render and produce most from interactive audio. Microsoft DirectX SDK comes with all the features and tools needed for the graphic rendering, audio rendering, and visualization for game developers to make use of in order to create powerful DirectX based applications either for a simple game or a complicated game development.

Microsoft .NET Framework

Microsoft .Net Framework is a platform or so what people called a development environment to seamlessly create applications that accessible through developer's computer from all across the world. It is an application adopted to comply with open standards such as eXtensible Markup Languages, Hypertext Transfer Protocol, and Simple Object Access Protocol in order to interact with applications that are available in other platform.

.Net Framework is platform independent and language independent system which allows the developer to use different programming languages such as VB.Net, C#, Jscript, VBscript, C and C++ to run applications on different platform such as Unix, Mac, Linux, and Window. .Net Framework enables developer to use various libraries to help in developing and application faster, easier and cheaper. As for now, .Net Framework is identified to be able to support over 20 different programming languages.

There is a reason for why .Net Framework is built to support multiple different types of programming languages is explained by the concept of Common Language Runtime engine. CLR engine compiles the code into Microsoft Intermediate Language. The MSIL is a set of instructions used to translate the codes into native codes making .Net Framework capable of language and platform independent. CLR is also responsible for run time services such as language integration, security enforcement, memory process and thread management. In addition, .Net Framework provides wide infrastructure to create web applications and non web applications. As for the time being, Microsoft has claimed .Net Framework comes in two different categories which is CLR and .Net Framework class library.

Common Language Runtime is responsible to provide common runtime services to all .Net based applications. As for more CLR reduces the developers time to code for an application by utilizing its feature like life cycle management, strong type naming, cross language exception handling, and dynamic binding designed to turn application development software into reusable components.

As for .Net Framework class library, it appears that this system consists of predefined sets of functionality that developer can freely utilize to enhance their application. The class library consists of three major components which are:

  • Windows Form

Well for this game application project, I will be using CLR and also .Net Framework class library as VB.NET and Window Form will be use for my game application as the two key component.

Microsoft Visual Studio 2008

Microsoft Visual Studio 2008 was released in 19 November 2007 replacing the older version of Visual Studio with the newer enhanced version of Visual Studio. Visual Studio 2008 is focused based on the development for Window Vista, Microsoft Office 2007 system and web applications. Visual Studio 2008 requires .NET Framework 3.5 to run properly and to process compiles assemblies. Visual Studio 2008 will possess the ability to chooses and utilize different .NET framework version depending to the developers choice.

Microsoft Visual Studio 2008 delivers on Microsoft's vision of smart client applications by enabling developers to rapidly create new applications without ignoring the quality of the application with accounted rich user experiences. Visual Studio 2008 comes with the ability for the developer to capture and analyze information to help make effective decisions. Packed with the ability for developer to rapidly create secured, manageable, and reliable applications is the strongest advantage of using Microsoft Visual Studio 2008.

Visual Studio 2008 promised to be able to deliver key advances for developers in three primary pillars which are:

  • Rapid Application Development
  • Effective team collaboration
  • Breakthrough user experiences

Visual Studio 2008 has received a many users feedback and most of them are identified to be positive. Based on the three pillars, user's feedbacks are mostly related to those of the three with different technology area. They are categorized into seven technology areas

  • Focused on Smart Client Application Development
  • Microsoft Office Applications Integrated
  • Window Platform Applications Integrated
  • Enhanced Productivity in Data Handling
  • Enabling New Web Experiences
  • Improved Overall Developer Experience
  • Enhanced Application Lifecycle Management

It is the most effective smart client development to begin with good application design. Able to integrate UI designers into development process by supporting most of the popular languages such as VB.NET, C++, C#, Jscript, and many of others.

The first reason that I find to use Microsoft Visual Studio 2008 in my system development are mainly because it has a very good system development tools which is capable of rapid application development and the easy to understand .NET code languages, which is the language I preferred the most among all other programming language.

Microsoft XNA Game Studio

Microsoft XNA Game Studio is a set of game development tools designed based on supported versions of Microsoft Visual Studio tools that allows developers to build up games supported by Window platform, Microsoft XBOX 360 game console, and Microsoft Zune. XNA Game Studio will require both Microsoft DirectX SDK and Microsoft .Net Framework to run correctly when integrated into Microsoft Visual Studio 2008. This tool comes including the XNA Framework which acts as same as Microsoft .Net Framework. The XNA Framework will integrate XNA library files onto Visual Studio 2008 to enable XNA graphic and audio coding to get executed.

XNA Game Studio is seamlessly integrated with supported version of Microsoft Visual Studio tools, this integration will enable developers to use new coding structure to develop two and three dimensional games easily due to new library files added to the Visual Studio base library, developers will have a new experience in learning new codes which only works with the XNA Game Studio integration.

XNA Game Studio provides three main features which are:

  • Game component models
  • New framework library designed to support Microsoft Windows, XBOX 360, and Zune game development
  • Integration with XNA Framework Content Pipeline.

Microsoft XNA Game Studio has become popular since it has been launched years ago, the reason why more and more people are utilizing it is because if new technology in game development breakthrough, the rapid application development, and the game quality produced.

Adobe Photoshop C3

Adobe Photoshop is simply an advanced graphic editing program designed and published by Adobe Systems. Adobe Photoshop managed to rise up as the graphic development software after years of competing in the market. Now, Adobe Photoshop is considered to be the top in its market leader for commercial bitmap and image manipulation software. Furthermore, Adobe Photoshop is known to be the flagship product in its company and the main development focus of the company.

Adobe Photoshop is developed to be a software targeting the graphic professional industry, its name has been around the graphic development tool industry for years. For so it gained the fame and popularity through time. Adobe Photoshop is consider to be the best, rated as a killer application for both MAC and Window OS.

Adobe Photoshop were born out from its first generation program named ImagePro in 1987. Developed by the Knoll Brothers, Thomas Knoll and John Knoll. The first published Photoshop program managed to sold at 200 copies which is considered a good outcome. And soon, in the following year, after the Adobe is established, the Knoll brothers purchases Adobe Photoshop distribution license to begin distributing Adobe Photoshop worldwide.

The reason Adobe Photoshop is used in the project development were mainly to develop image files which serves the purpose as two dimensional graphic rendered to the system. Image files are designed and edited in the Photoshop so that it could be added later to the system as the active two dimensional graphic.

Chapter 3: Research on the technology related to 2D games and game system's programming

Two Dimensional Graphic

Two Dimensional games know as 2D computer graphic games are a computer based graphic images. These images are made up from 2D digital images, 2D texts, and 2D geometric models. Images can vary from image compositions, pixel arts, digital arts, photographs, and texts. 2D graphics are frequently used most in the graphic industry because of its conveniences and simple rendering. Nowadays almost all of the websites incorporates 2D graphic content into its webpage, those graphic content may vary from a tiny graphic image file to a fully functional 2D games. Therefore 2D graphic plays an important part in the information technology field.

Two dimensional graphic have certain advantages which makes it to be superior when compared with three dimensional graphic. The three main differences which makes 2D graphic to be superior are:

  • Able to render faster than 3D graphic
  • This point makes developers to choose 2D graphic for low bandwidth consumption. And also why means rendering it also means that 2D graphic is produced faster when compared with 3D development. Thus 2D graphic can be developed with rapid application development tools.

  • Creating simple games such as puzzle, card, and board games where high degree of realism is not required.
  • 2D games are categorized as a simple graphic structure which can be easily developed, thus it does not require the graphics to be truly realistic. Games that is developed using 2D technology will be simple looking, not too complex, and depends a lot on the graphic coloring.

  • Supported by all of the operating system
  • 2D graphic technology is used heavily on the appearance of an operating system to increase system load efficiency. Thus OS such as Window, Mac and Linux implements lots of 2D graphic objects which increases the loading speed and reduces CPU workload in rendering OS graphical interface.

    Two dimensional graphic started back during 1950's using vector graphic devices. Soon enough raster based graphic technology was introduced and manage to take over the usage of vector graphic.

Vector Graphics

Vector graphics uses mathematical relationships between points and the paths connecting them to shape the image. Vector graphic emphasizes much more on the quality of the image compared with the raster graphic. Thus raster graphic are usually used to represent photographic images because of the quality it possess. Vector graphic are made from smooth quality images which do not suffers from loss of image quality even after resized. This is the main key point why people prefers vector over raster graphics.

The Figure above shows the differences of the vector and raster graphic when the image is displayed in magnified condition. The left side of the picture is represented with vector graphic, the magnified image is displayed which total quality of the source image, produced with full quality of smoothness. Where else raster graphic, is represented at the right side with a bitmap image, which suffers great loss of picture quality due to the source image is produced with arrays of pixels.

In other word when judging an image quality, vector based graphic image wins fair. Vector graphics possess four main key advantages that makes it superior graphic which is:

  • Complete Scalability
  • A vector graphic image allows picture resizing without suffering any quality loss. This applies to any size of picture whether it is at a size of a poster or business card. This is the key advantage of vector graphic.

  • Compatibility for both web and print
  • Due to the image quality is always high, for this reason vector images are always compatible with printing specification and also web images. Unlike raster bitmaps which has a limited graphic resolution minimum of 300 dpi to be able to display the image in the paper and also in webpage.

  • Completely editable using imaging tools
  • Vector graphics is completely editable using both vector and raster graphic editing tools such as Adobe Photoshop and Adobe Illustrator. Images can be resized, skewed, rotated, reshaped, combines with other vector model, and other functions that is supported by both vector graphic and the imaging tools.

  • Supporting Background Transparency
  • Vector graphics will support all types of background, with any color or pattern, either it is with another raster graphic or vector.

    Vector graphics when displayed in computer display will produce results of grids of small rectangular cells called pixels, vector graphics are composed of tiny pixel dots far smaller than raster graphics.

Raster Graphics

Raster Graphics is a type of graphic in which the image of it is separated into matrix of picture elements which is known as pixels. An image with the present of pixels in the image file is made up by rows and columns of pixels lines up forming an image in the picture. Each of the pixels will be assigned with different or same color which serves the purpose of creating color depth of an image, this is often referred as number of bits needed to encode all the colors. Raster graphics are usually coded in typical bits depth with are used nowadays in:

  • Black and white ( Two Colors ) : 1 Bit
  • Color shades of gray ( Four Colors ) : 2 Bit
  • 16 Colors : 4 Bit
  • 256 Colors : 8 Bit
  • 65, 536 Colors ( 65K High Colors ) : 16 Bit
  • True Color : 24 Bit
  • True Color ( Improved ) : 32 Bit

In a raster graphic image, the numbers of row and column determines the image resolution, in other words the more pixels presented in an image the higher the resolution. Image resolutions are calculated using total pixels present in the first row multiplied by total pixel present in the first column. If the image is presented in certain physical size, then the size will combine with the number of pixels resulting with number of Dot Per Inch (DPI) in the image. DPI is a measurement of an image's resolution. A high resolution image will present in higher DPI with smaller dot, this makes it harder to be spotted as individual spot in the image.

Raster Graphic is much more convenient when compared to vector graphic. They are resolution independent, thus it happens that raster graphic can be used to represent a photo realistic images in a short amount of time. But because of certain limitation in raster graphic, it makes the quality of the image to be vary from different source of quality. Pixels tend to get arranged in a regular pattern, resulting weird shaping pattern displayed in the screen of a computer monitor. Rather if the pixels are assigned with wrong color, the whole image might get displayed weirdly with all the color mixed. If a resolution is too low and the contrast is too high, certain pixels will stand out leaving the image with jaggies.

Figure is a raster graphic image which shows clearly the pixel resolutions of the image. As the image shows the rectangular array of dots which is large enough to be identified using the eye of a human, these rectangular are call pixels. The image is displayed by drawing the pixels sequentially in a fixed order either from the left to right or top to bottom. The image of a fish is made up using plain white and blue color which is assigned to each of the pixel dots. Usually a raster image is made up from high resolution in which pixel dots are not visible from human's eye sight. But the above image is a low resolution raster image, thus pixels are visible.

Raster graphic are presented in digital file format usually in JPEG images, Bitmap images, GIF images, TIFF images and PNG images. The usage of raster graphic has been popular since the rise of World Wide Web in the internet. This is because raster graphic presents huge advantages when it is utilized within the web network. Advantages of raster graphic are:

  • Widely used in personal computer in displaying images.
  • Most of computer operating system nowadays supports raster image display as the basic image file distribution. Digital images are used widely in operating system as the main graphic image display. This is the strongest advantage of raster graphic.

  • Web standard for image uploading, display, image file distribution and file download due to the small file size. It's one of the main reason raster image is widely distributed across web.
  • Resolution image independent, able to display all resolution types of image file.
  • Can be edited using image developing tools.

Throughout all the advantages may be excellent in a point of view, but raster graphic image easily suffers from quality loss due to its pixel dot independent resolution. Most of the image file used to display raster graphic image have a limited color support which disadvantages in image color displayed in the monitor. Raster graphic images that are distributed across the network may be compressed to reduce its file size, this is a drawback as compressing the image file usually will reduce its image quality.

Benefits from Two Dimensional Games Programming Over Three Dimensional Games

  • Development Cost
  • This point is obviously correct and without doubt, 2D games development is really cheaper when it is compared to 3D games development due to the difference of content creation. The move towards hi-definition graphic content has brought 3D games a breakthrough in the games technology, but at the same time the cost of development has also double up because of using new developed engines which is expensive. Most 3D games development faces high development cost and they are still in researching of new game engines to cut down the development costs. Unlike 2D games engines, they are sold cheaper than most of the 3D game engines in the market. This point is based on the logical assumption that 3D is a newer technology which need more resources for development and 2D is a traditional game technology which is developed even before existence of 3D, thus making it to be considered not as complex as 3D games development

  • Graphical Processing Performance
  • 2D games development uses lower processing speed and power compared with 3D development. In the old days where personal computers are still not as advance as nowadays, it is impossible to commence development in either 3D or 2D games development. But considering the advance of technologies nowadays which makes most of those not too complex games development of 2D and 3D graphic possible. In the old days personal computer lacks of the processing speed and memory capacity to run the system process. The reason why 2D games requires less graphical processing performance is because 2D games uses less graphical animation which would requires heavy framerate processing with fast processing speed.

  • Shaders capabilities in 2D graphics
  • All thanks to the shaders technology used in the 3D technology, 2D graphics can now implement of shaders. 2D graphics can be enriched with a soft look to the entire scene, bloom effect, glowing effects and graphic effects. Shaders enable 2D graphic animation to improve its quality and technology. Although shaders brings lots of new effects to the 2D graphic, but it's still in experimental stage where its relatively unexplored concept that has a lot of potential.

  • Real time audio synthesis
  • 2D games once uses midi and redbook audio for its audio sound effects, it's the only available audio technology that is supported by the 2D graphic games. But that was during the old days. With the help of VST instruments, real time synthesis of audio can be implemented towards 2D game development. Music in games can expand beyond playback into performing dynamic arrangements and dynamic synthesis. The game can be implemented with audio music that is suitable with the nature of the game type accordingly. With the advanced processing power, a complete real time audio track can be implemented using VST effects in the form of compressors, equalizers and mixing tables. With this technology, 2D game nowadays could experience rich enhancement to bring new breakthrough.

  • 2D Multiplayer Online Games
  • Despite 2D multiplayer games are being made in application program, there are publishers that release 2D online games which has gained quite the fame among online users. Despite the simple concept of 2D programming, new technologies enable the developers to actually implement 2D online games into website. Incorporating both the 2D engine and game program directly into web browsers nowadays. This is a very convenient and brilliant way into marketing 2D games online as no setups and download are required. This new technology has helps 2D games to be once again gain popularity in the world.

Programming Language

Programming language is the all time famous programming instructions which are created by developers since late 40's until today which is to serve the purpose to create applications. The so call programming language is actually a set of languages which composed of words, symbols, and numbers which is made up to be algorithms that each type of language differs. In other words Programming Language is actually a set of instructions that constructs the logic of the system, instructs every action of the system and performs of functions. As human language are too difficult for a computer to understand, thus commands of programming language are used to replace human language so computers will understand the way it was designed for the same purpose.

In game development, programming process is inevitable, the functional process in the system is fully dependent to the programming code which is written in its way. The way game system reacts will turn out running according to the programming code structure in which the programmer designed it to be.

So far in the game development coding technology, only certain programming languages are capable in developing 2D and 3D game system. And most of the popular ones are Java, C#, C++, C, and VB.Net. Java coded game are usually popular in mobile gaming system where java games are supported by mobile phones. Where else C#, C++, C and VB.NET is usually used to code computer and console based games.

In my system programming, I'll be using VB.NET language as the programming code because of my experiences and I'll feel more comfortable dealing with VB.NET codes.

Visual Basic .NET (VB.NET)

Visual Basic.Net usually written as VB.NET is the newly introduced objected oriented computer programming language which is the successor to the precious Microsoft Visual Basic which is much more traditional programming approach. All .NET languages creates code known as intermediate language as long as the code is written at the state of Common Language Specification the intermediate language can be used by any other .NET language.

.Net uses type definition in which it enables another assembly to be able for others to use. .Net executes this feature by exporting classes and metadata from the library base to another assembly. By importing the library file, one could include different code inheritance to the assembly.

Object oriented programming method has helped to bring VB.NET to high level programming language. All types of codes are derived ultimately from the object base class in the library. The .Net supports different type of classes such as properties, fields, methods, constructor classes, and finalizers. This object oriented programming allows the ability to use multiple interface inheritance in a single assembly, in which one class may include multiple interfaces onto it.

With improved security measures, .NET seems to be more stable compared to other releases. .NET allows the system to control how memory is allocated and accessed to run the system, this feature is supported by Garbage Collector system within the .NET. Objects defined in .NET can be allocated on the stacks or as a class member which are defined as the value types known as boxing and unboxing.

.NET strongest feature is the support of Framework library file which contains rich classes used to containing objects. The Framework library contains lots of library file which is used by developers to import new types of classes and method in the coding process. Without the framework support, coding classes and methods will be limited in numbers and library file will not be updated to the newest. Framework library powers up the latest .NET application with Window Form Classes and drag and drop features directly into the Window Form with the help of window form events, controls, tools, graphic libraries, and GDI+ used in forms drawing.

Metadata in .NET features the type safe technology which enables the programmers to use metadata in the codings, this metadata is also customizable using the preferred attributes. Besides metadata, .NET incorporates the mechanism to serialize objects which is proven to be useful when dealing with applications programming where in the state where the developers wants to save the current state of an application, a vital framework features to include in .NET remoting. Object serialization will consist four mechanisms which is streams, encoders, readers, and writers.


After the research and study on the general knowledge of 2D programming sequences, process, and basic structure, we knows that the understanding of image file is used to represent the graphical animation of the 2D game system. And it is clearly stated that in the game structure fully depends on the system programming code to execute its functional features.

We now know that 2D graphical games are a major player in the game development industry which is as important as the 3D graphical technology. A good 2D design of image will ensure the quality of the 2D animation. And the programming techniques will help in executing nearly perfect of the system functionalities as well as in debugging.

Chapter 4: XNA BubbleBall Attack 2D Game Structure


This system development project is a game system application development. The game system incorporates 2D graphic technology using the XNA development tools. This game is named as BubbleBall Attack 2D, created as the puzzle game genre. The motive of this game is meant for single player emphasizing on puzzle solving. In order to solve the puzzle game and advance through different stages, a player must use problem solving skills including logic thinking, strategy planning, pattern recognition, and sequence solving and also memorization skills.

Existing Game System in Same Genre

This game is built resembling the game structure and game play of the once famous Puzzle Bobble game known as Bust-a-Move released by Taito Corp. in 1994 first in Neo-Geo Systems. Later on the game was developed with compatibility to run in mobile devices, Nokia N-gage, Sony Playstation consoles, XBOX consoles, Nintendo Systems, mobile phones, and the all new iPhone.

Puzzle Bobble was firstly introduced in the arcade system machine, in which looks like the picture below. This game was a classic game it was actually the advance version of its ancestor, the Bubble Bobble. The main aim of this game was to break all the bubbles in each stage. This game was first introduced in arcade game machine which enable two player and one player mode.

Gameplay System

The system uses images as the base 2D graphic animation, codes are executes to enable the images perform different functionalities. This game uses direction calculation and also positioning to enable the movement of 2D objects in the game play area. The direction of the object movement are specified in the axis of X and axis of Y. So it is expected that this game uses a lot direction and movement calculation algorithm.

Arrays are also used to ensure the ball positioning and re-spawning new balls in the game screen. The array uses and infinite value to assign the ball so that there will be no limited maximum amount of number the ball can be created using the game system.

Bubble balls will be fired using the Arrow pointer in the game which defines the direction to launch the ball to. The Arrow pointer is defined with the maximum angle of 180 degree within the play area. The Bubble balls have 2 different direction of movement, defined as in straight line direction, bottom to top and also bouncing movement, left to right or either way.

There will be no login system implemented as this game is designed for single player in the first place. All users will be able to start the game using the game system menu. The game system allows the player to control the arrow pointer only in the game, other objects are mostly non-controllable objects which operates according to the system programming. Player will need to launch the balls into the play area in which is the rectangle area. There will be a row of bubble ball array which indicated the queue of the colored bubble ball available after one ball is launched.

The gameplay basic knowledge is quite simple. A player will need to eliminate all the balls in the play area by launching the color matching the same colored ball in the play area. If there are groups of three or more balls which same color touching each other, those balls will be expelled from the play area. The player may need accurate pointing skills to be able to tackle angle points to expel some random same colored balls because this game requires a player to bounce the ball to left or right in order to touch other balls.

The game proceeds with different level and stages which is harder, but in this game system development system, I decide to not include multiple stages, its either two or three different stages will be included to test for the system functionalities, as this is not the finalized fully functional system. The system presented will be a prototype of the system development, with a functional system structure.

In the system stages, codings will be implemented to enable the top ceiling in the game system play area to drop down systematically using the timer sequence. In other words this is meant to add an excitement and difficulty level to the game.

The main objective is to eliminate all other ball from the play area before the game ends. Ending the game will proceed the player to the next game stage.

Gameplay System Summary

The game play system is very important in order to bring out the game system's main purpose of the game. It is important that every possible gameplay feature to be implemented successfully to make the gameplay more entertaining. A game system with a perfect gameplay functions will enable players to enjoy fully with satisfaction in the middle of the game.

Chapter 5: Requirement Analysis, Problem Statement and Solution

Introduction to Requirement Analysis

This chapter will focus on the requirement of the software system because it is concern with problems to be addresses by the software causes. A system requirement analysis is a property which must be exhibited by the system developer which is the author of this project. The problem may be to automate part of a task of someone who will use the software, to support the business processes of the organization that has commissioned the software, to correct shortcomings of existing software, to control a device, and many more. The functioning of users, business processes, and devices is typically complex. By extension, therefore, the requirements on particular software are typically a complex combination of requirements from different people at different levels of an organization and from the environment in which the software will operate.

Requirements Analysis Concern

The Requirement Analysis will be able to:

  • Detect and resolve problems and conflicts between requirements
  • Discover the bounds of the software and how it must interact with its environment
  • Explain and elaborate the system requirements to derive software requirement

The requirement analysis will focus on the three different parties which is the user's requirement. By the term users, all finders will be pointed towards the peoples that will interact with the system. Users can be of any particular groups such as client managers, end system users, client engineers, contractor managers, and system architects.

The second party is systems requirement, in this party, there will be a certain special groups of users consideration will only be taken into account of. This is due to the system development interaction or those who have direct access to the development process of the system.

The third will be software design specification. This requirement type is needed to gain design comments, design idea, design architectures, and also the software design of functionalities. Those who are supposed to be involved are system designers, system architects, software engineers, and software testers.

The picture below shows the requirement classification of each type of requirement.

The requirement types will be differ in some other system development depending the what types of software are to be developed.

Types of requirement analysis

When speaking of requirement analysis, there is a lots of requirement types which can be used in the system analysis. It is not an essential for a system developer to use all the requirement analysis on just a system because too much of analysis conducted on a system will result in wastage of time, money and resources.

The system developer will decide which types of requirement analysis to conduct on the system based on the most suitable and compatible match with the developing system.

The requirement analysis consists of two different types which are functional and non-functional requirement.

Functional and Non-Functional Requirement

Functional requirements explain about the functions that the system will execute itself for example, formatting some text or modulating a signal. sometimes known as capabilities or statements of services the system should provide, how the system should react to particular inputs and how the system should behave in particular situations.

Nonfunctional requirements are the ones that act to constrain the solution. Nonfunctional requirements are sometimes known as constraints or quality requirements.

Non-functional requirement usually requires heavy investment of time, money and resources to execute the process.

Fact Finding Techniques

Fact finding, the most efficient way to gain information and knowledge into something. With the largely available data can be access using the World Wide Web, research books and texts, and social interview can be conducted to obtain rich information data. This is good technique despite with its disadvantages of confused with the level of accuracy of the information gained, and also facts that may be scientifically unproven.

Selected fact-finding technique

In this 2D game system development, the author will use most of the time in literature studies in order to obtain information related to the 2D game programming, system design, audio implementation, and other functions.

It is important in a game system implementation for the author to do in depth understanding about the system structure of game system development. This is because a game system development has certain area that it needs to focus on unlike normal application system.

A game system will need to focus on the graphical interface design, graphical animation programming, and the system functionalities execution as well. All related materials rated from document information up till real experience of 2D gameplay will be needed in a game system programming.

Functional Requirement of the Proposed System

  • Graphical design
  • The author found out that most of the users will get attracted towards an attractive, cute looking, cool looking, and beautifully enhanced graphic game system. This in order for a game to gain its popularity as the first step, the game system graphical design must be prioritized.

  • Enjoyable game
  • This is the second priority for the game to gain higher rating after it successfully attracted more and more people into experiencing the game. Users that play a game will normally expect an enjoyable game, not too hard and not too dull. Enough to please or satisfied the users experience of the game.

  • Game functionalities
  • A game system implemented with stable and functional game features will be able to run perfectly without any game defects. Users will less complain about the game and more will praise of the game system.

  • Functional game control
  • In order to provide users with control over the game, the author must ensure the game system is functional with the input and output device. System must be able to interface with the users using devices such as keyboard, mouse, gamepad, and audio devices, as those are the only material which enables interaction between the user and the game system

Non-Functional Requirement of the Proposed System

  • Game response
  • The game system will and must be ensured frequently through regularly tests. This method is to ensure the game system is responding well. All the game programming codes are executed well. The game system should not eat up much memory, cpu speed, and the game process will not suffer from system delays.

  • Ease of use
  • The system is used by many users, thus this game system is developed to be user friendly. It does not need the users to be an expert in gaming systems, users will slowly get used to the game if they are willing to spend at least a minute of game play.

  • Documentation
  • The game system documentation is a non-functional requirement in which, the author prepared the documentation to help explain the development process to users which is interested in the proposed game system process. The documentation will provide from basic information up to detailed explanations of the proposed game system.

  • Accessibility
  • This game system is developed simply meant for freeware distribution. In which the term freeware will ensure the users to be able to obtain a copy of the system without paying even one cent. The proposed game system client may be distributed using the World Wide Web for an example.

System Requirement

The proposed game system will require the user's system device to be at a certain standard. The minimum system required to run the proposed game system will be needed in order to execute the system perfectly. Below are the details of the system requirements.

Hardware requirements

  • Intel Pentium IV processor or equivalent (1.5GHz, FSB 400MHz, 1MB L2 Cache)
  • Graphic Processing Unit with 128MB DDR2 supporting DirextX 9.0c and content pipelining
  • At least 10GB of hard disk drive

Software Requirements

  • Microsoft .Net Framework 2.0 or higher
  • Microsoft Window Platform 32-bit
  • Microsoft DirectX 9.0c or later

Problem Statement

In this chapter, the author will show, discuss, and explain what are the problems the author has experienced along in the development of the proposed game system.

Programming code problems

In the process of system coding, the author has encountered numerous times of coding problems. Most problems can be fixed through research of code solution or using the correct coding.

But there are still some problems unsolved in the proposed game system which is identified to be bugs. The problems encountered will be listed here in the form of a table.

Example of one of the problems mentioned earlier is the failure to implement the background music.

Imports Microsoft.DirectX
Imports Microsoft.DirectX.AudioVideoPlayback
Public DirectXAudio As New Microsoft.DirectX.AudioVideoPlayback.Audio("..\..\Audio\mario.mid")
Public Sub SelectMusic()
DirectXAudio.Volume = -3000
DirectXAudio.Open("..\..\Audio\mario.mid", True)
End Sub

Although the library reference of Microsoft.DirectX.AudioPlayback has been added to the project reference. This problem still occurs preventing the debug program from executing the system. The Warning Log has one of these messages appearing in it.

The only solution that is recommended for this problem which I found in the online reference is to wait for the .Net Framework to release a bug fixed version. Thus I left this function behind for the moment.

Problem Solution

Right now at the moment, there is no absolute solution for the mentioned problems that occurred in the game system. Some of the problems has already been solved after research for coding implementation and multiple times of coding implementation try out. Some of them are decided by the author to be ignored for the moment.

Chapter 6: Interface Design Specifications


This chapter will cover the game system interface design report, explained and elaborated, the important features and 2D image design will be shown and explained. In a system development process, interface design play an important role in the first impression the user looks at it. A good system interface will be able to let a user knows what the system is about and what does it do.

Importance of User Interface Design

Designing user's interactions requires deep knowledge and skills. It is not an easy job to be able to produce a fully functional user interface design which is satisfied by everyone in the world. Interface design professionals are hired by lots of companies just to create a quality standard UID and implement to a system which is meant got market distribution.

Designs will be required to carry out an artistic notion usually done by web designers, multimedia professionals and graphic designers. User interface design requires an artistic appearance such as shiny buttons, colorful logo's and fancy background which is the first step in attracting peoples, users to be interested onto it.

Interface designation is a game regardless of a 2D game or a 3D game is very important as in full time, users utilizing the system will be looking at only the game design, graphics and user interface. The interface plays a big part when users are interacting which a game system. This is because in a game system, the user interface deigns takes almost all of the physical appearance of a game screen space.

Interface Design of the Proposed System

In this chapter section, the author will elaborate the proposed system interface design. The proposed system is a 2D game system, thus the author uses lots of image, bitmap files to incorporate toward the game system. There will be few different layout interface in the system, which are the beginning of game system, the game layout in play, and the ending of the game termination.

Main Interface Design

The Figure showed below is the first layout of the system screen, when the BubbleBall Attack 2D game starts, it will wait for the users instruction to proceed to the next stage. The screen will start with a basic main layout with black background screen frame rendering text graphics on top in the middle of the screen.

In Game Interface Design

This proceeds after the user interacts with the game system. The user will be given two options only in this system stage. The options provided are "Esc" button and "Spacebar" button on the keyboard.

If the user presses the "Esc" button, system will automatically terminates itself by exiting the game system completely. And of course the "Esc" button can be press at anytime within the running time of the system.

If the user chooses to proceed with the game play, the "Spacebar" button should be pressed. Upon press the "Spacebar" the system proceeds to the in game play graphic layout which is shown in the figure below.

Game Countdown Timer

As seen in Figure, new area is visible now, with multiple bubble balls in black, blue, yellow, green, and red, spawned in a sorted order.

As soon as the system finished the game loading, it will start with a three second countdown timer, to ensure the users are ready to begin playing. This in an indication for the users to get ready as the game system will begin shortly as soon as the countdown finished.

The system countdown will commence as the figure shown below.

Game Play Commenced

After the three second countdown timer the game will commence. Users will now be able to utilize five different key buttons which performs different functionalities. Those button keys are Spacebar, Esc, Arrow key left, Arrow key right, and the Pause Break button on the keyboard. Explanations of different key button functionalities will be provided below.

  • Spacebar
  • Launches the bubble balls from the arrow holder into the blue play area

  • Esc
  • Terminates the game system, exiting the game immediately

  • Arrow key left
  • Changes the direction of the aim arrow pointer to the left direction

  • Arrow key right
  • Changes the direction of the aim arrow pointer to the right direction

  • Pause Break
  • Pauses the game system in the middle of the game play

The bubbles will break and explode if there are three or more same colored balls touching each other. Each time the ball launches lands a sound will be generated indicating the ball has landed and stopped. The game state will commence the top ceiling in orange color of the game to drop from time to time in order to indicate game time countdown and also increasing game difficulty

The figure in the nest page will show the system functionalities in the middle of the game play.

Game Over

When the user failed to complete the game or lost in a stage of the game, this means the system will proceed with the game over sign. The figure below shows the game over sign.

As seen above the figure, when the system game over's, all the remaining ball will exploded automatically in to small round particles. The system will automatically proceed to the waiting for user's instructions state as shown in the Figure The user may continue play a second round of game.

Game Stage Completion

When the user successfully eliminates all the bubble balls in the game, the user have already completed a game stage and will be showed with a "Congratulations" graphical text. The graphical design is much similar with Figure Game over animation, but the graphical text is written as "Congratulations" which indicates the success of that particular game stage. The picture below shows the game stage completion result.

Graphical function and features

The game is implemented with some different functional features to help make the game structure more fun to play with. As seen in the figures above starting from the top part of the picture, there's the window mode of the game, the game window is titled with the game name of "BubbleBall Attack 2010" and to the right of it is the framerate indicator.

The game framerate is set to not more than 60 frames per second which limits the maximum framerate it can achieve. The framerate is set to be flexible, thus it can operates at any value under 60 framerate. The indicator will constantly update itself with the newest framerate running in game every second.

In the game screen, at upper left, there is the game title, and to the lower left it's the ball limit sign which states the limit of how low the ball can stack up until the game over state is achieved.

At the right side, the implementation of the scoring system is introduced. 2 scoring type is defined which is the Highest Score of the game session, and the player's current achieved score. Each time of a group of balls is exploded will add up 1000 points to the score board.

To the right bottom is the game controls basic introduction, and keyboard button indication of each buttons function along with the gaming main purpose. And lastly the author's declaration at the bottom screen.

Chapter 7: System Functional Design


In this chapter, the author will explain abound the analysis tasks such as diagrams and models. These diagrams and models are used to represent the system processes and also the activity commenced by the system responds. This process helps the author to understand each steps of the system process with interaction from the users towards the system.

Use Case Model

"A use case is a sequence of actions that provide a measurable value to an actor. Another way to look at it is a use case describes a way in which a real-world actor interacts with the system. In a system use case you include high-level implementation decisions."(Scott W. Ambler, 2003-2009)

The above definition from the author defines that a use case can be used best to represent the interaction process between the actors, which is the user and the system much like a real world interaction.

The author will now list the Use Case in the table format consisting of Actor, Use Case and Use Case descriptions.

Use Case Diagram

Captures the information on how the system interacts with the user. This use case represents real time system and users response. The Use Case Diagram is developed in System Architect 2001 by POPKIN SOFTWARE.


The provided diagrams has help enhance understanding towards the system funtional processes. This method enables the author to know better about the system that is developed. A total of nine diagrams and one table have been developed in this chapter to elaborate the overall system process. Although the diagrams maybe not be one hundred percent accurate, but it will still resembles most of the system process acurrately.

Chapter 8 : System Development and Programming Code


As mentioned earlier, this system will be developed using VB.NET. this system is a stand alone application, of using only the client side development, and not server side development is required. System development will focus on the system coding to implement real time funtional system.

In this system development, the author learned to use different types of coding, classes, modules, subs, and reference library. The process of system programming has helped the author to improve in system coding development and software engineering process.

System Coding

In this section, the author will show, elaborate, and explain about some of the important funtional coding.

Initializing Graphics and Graphic Rendering in the MainForm class

Starting with the mainform of the BubbleBall Attack 2D codings. This code is used by the author to initialize the graphics codings to render in the system. This is a private calling function which will server other class and subs that uses the variable defined in it.

Private Function InitializeGraphics() 'Defining Graphics Initialization function
Dim presentParams As New PresentationParameters
presentParams.SwapEffect = SwapEffect.Discard
Dim XNAGraphicsAdapter As Microsoft.Xna.Framework.Graphics.GraphicsAdapter = Graphics.GraphicsAdapter.Adapters.Item(0)
Device = New Graphics.GraphicsDevice(XNAGraphicsAdapter, DeviceType.Hardware, Me.Handle, presentParams)
AddHandler Device.DeviceReset, AddressOf OnResetDevice
Return True
Catch ex As Exception
Return False
End Try
End Function

This sub will call the function of initializegraphics() and other functional coding so that all the related graphics, audio, fonts, graphic font subs that need to implement in the main form.

InitializeGraphics() 'Starting the 3D device
'SelectMusic() 'Render the music to play
DefineObjectDetails() 'Spawn the gmae objects and varaiables
Me.SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.Opaque, True) 'This method is meant to force the windows to only use the Onpaint method to draw the window
ShowText("Loading", "Mirror", 25, FontStyle.Bold, Brushes.Black, 320, 300, Loadfor_Texture, Loadfor_Vector)
End Sub

The next coding will explain how the graphic rendering sub is performed, along with system conditions state. Use case is used in this system code to enable the different conditional selection depending to the game state. Graphic drawings, text graphics, text properties, spritebatch definition, image file rendering, and most of if else conditional checks to initiate different function are included as this sub is the most important sub in the graphic rendering funtion. Despite this sub is very large, thus only some important parts of the sub will be included in this documentation.

Use case used to perform different functions when the conditional is met. The coding below is the condition of first running the game system and awaiting for the user to input, thus the system will render the graphical text "Press space to start the game".

The if statement below is used to show the and overwrite the scoring system, graphical text and its properties are defined as well.

Select Case Gamestate
Case Is = "Awating Game to Start" ' game state functional
MainSB.Draw(BackgroundTex, BackgroundRect, Color.White) 'codes are executes of the case above meets the condition
MainSB.Draw(PlayAreaTex, PlayAreaRect, Color.White)
If Player_Score > Temporary_Score Or WriteText_FirstLoop = 0 Then
WriteText_FirstLoop += 1
ShowText("Player High Score" & vbCrLf & High_Score, "Mirror", 12, FontStyle.Bold, Brushes.SlateBlue, 630, PlayAreaRect.Y - 8, ScoreSheet_Texture, ScoreSheet_Vector)
End If
MainSB.Draw(ScoreSheet_Texture, ScoreSheet_Vector, Color.White)

This use case is used to perform the functions when the game is loading for the game top start. As showed below this coding is much longer when compared to the previous one due to the massive graphical texture rendering and functions open starting the game. The code below is only a part of the game load use case.

Case Is = "Loading, please wait" ' game state functional
If LoadLevel_FirstLoop = 0 Then 'codes are executes of the case above meets the conditin
PlayAreaRect.Y = 60
CeilingR.Y = PlayAreaRect.Y - 380
Player_Level += 1
LoadLevel_FirstLoop += 1
End If
If UBound(BallLogicArray) > 0 Then 'conditional checks
For Each SingleBall As BallLogic In BallLogicArray
If SingleBall.DeletedBall = False Then
MainSB.Draw(SingleBall.BallLogicTex, SingleBall.BallLogicRect, Color.White)
End If
End If
MainSB.Draw(BackgroundTex, BackgroundRect, Color.White) 'spritebatch graphic rendering
MainSB.Draw(PlayAreaTex, PlayAreaRect, Color.White)
MainSB.Draw(ArrowHolderTex, ArrowHolderRect, Color.White)
MainSB.Draw(AimArrowTex, New Vector2(405, 485), Nothing, Color.White, AimArrowSBRotate, New Vector2((AimArrowTex.Width / 2), (AimArrowTex.Height / 2)), 1.0F, SpriteEffects.None, 0.0F)

The conditional use case when game state is in the middle of the game.

Case Is = "InGame" 'game state functional
If UBound(BallLogicArray) > 0 Then 'Renders the Ball Graphic
For Each SingleBall As BallLogic In BallLogicArray 'Condition to check every ball in the array
If SingleBall.DeletedBall = False Then
MainSB.Draw(SingleBall.BallLogicTex, SingleBall.BallLogicRect, Color.White) 'Statement to draw each ball in the game
End If
If SingleBall.MovingBall = True Then 'Condition when the ball is premitted or directed to move
SingleBall.MoveBallLogic() 'Allow the ball to move or launched
End If
If ArrowHolderRect7IsEmpty = True Then 'Condition if a ball is launched
SingleBall.MoveArrowHolderBall() 'Directs the movements of the balls in the ArrowHolder
End If
If SingleBall.MarkedBallDeletionDrop = True Then 'Condition permits the ball to be dropped
SingleBall.BallLogicRect.Y += SingleBall.BallLogicXVel 'Ball speed defined
SingleBall.BallLogicXVel += 0.5 'increased speed implementation
If SingleBall.Awardpoints = False Then
Player_Score += 200
SingleBall.Awardpoints = True
End If
SingleBall.DroppedBall = True 'Condition when to drop the ball
If SingleBall.BallLogicRect.Y > PlayAreaRect.Bottom Then 'Ball exceeding the Playing Area
SingleBall.DeletedBall = True 'condition permits the ball to be deleted
BallRemoved = True

Use case to perform its function when game over condition is met.

Case Is = "Game Lost"
CeilingDrop = 4000
If UBound(BallLogicArray) > 0 Then 'draws each balls
For Each SingleBall As BallLogic In BallLogicArray ' Check every ball in array
If SingleBall.DeletedBall = False Then
If SingleBall.DroppedBall = False Then
MainSB.Draw(SingleBall.BallLogicTex, SingleBall.BallLogicRect, Color.White) 'Draw Each Ball
End If
End If
End If
If UBound(BallLogicArray) > 0 Then 'set ball to explode
If SingleBall.LauncherBall = False Then
If SingleBall.MarkedBallDeletionExplode = False Then
SingleBall.MarkedBallDeletionExplode = True
End If
End If
BallRemoved = True
End If
If UBound(ParticlesLogicArray) > 0 Then 'Particle animation
For Each TemporaryParticle As ParticleSystem In ParticlesLogicArray
MainSB.Draw(TemporaryParticle.ParticleTex, TemporaryParticle.ParticleRect, Color.White) 'Draw Each Particle
ParticleMovementSystem(TemporaryParticle) 'Move each particle
End If
If RedimParticleLogicArray = True AndAlso UBound(ParticlesLogicArray) > 10 Then 'removes the particle deleted
End If
If BallRemoved = True Then
RemoveBall() ' Find balls that is set to MarkedBallDeletionExplode = False, then set DeletedBall = True
ReDim_BallLogicArray() ' Remove balls that have DeletedBall = True from the BallLogicArray
End If
MainSB.Draw(CeilingT, CeilingR, Color.White) 'draws object texture in the play area
MainSB.Draw(BackgroundTex, BackgroundRect, Color.White)
MainSB.Draw(PlayAreaTex, PlayAreaRect, Color.White)
MainSB.Draw(ArrowHolderTex, ArrowHolderRect, Color.White)
MainSB.Draw(GameOverT, GameOverR, Color.White)

The game code below is a protected sub which overrides the functions of the game, non-changeable. It's a fixed type of code.

Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
OnResetDevice(Device, Nothing) 'Resets the system if device is lost or missing
Me.Text = String.Format("BubbleBall Attack 2010 Framerate is now : {0}", GraphicFramerate.CalculateGraphicFramerate())
Render() 'Renders the Graphic initialized to screen
Me.Invalidate() 'Forces the window to redraw the window
GameAudio.UpdateSoundEngine() 'GameAudio engine enhancement
End Sub

Next sub below will elaborate on the key binding of functions to which assigns the keyboard button to perform different functionalities when it's pressed.

"Esc" key binding

Private Sub Form1_Keydown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
Select Case e.KeyCode
Case Is = Windows.Forms.Keys.Escape 'assigns system with esc key in keyboard
Application.Exit() 'Closes the application window when escape key is pressed
Exit Sub

"Right Arrow" key binding

Case Is = Windows.Forms.Keys.Right 'assigns system with right arrow key in keyboard
If Gamestate = "InGame" Then 'in the game
If AimArrowSBRotate >= MathHelper.ToRadians(85) Then
AimArrowSBRotate = MathHelper.ToRadians(85)
Exit Sub
End If
AimArrowSBRotate = AimArrowSBRotate + MathHelper.ToRadians(2)
End If

"Left Arrow" key binding

Case Is = Windows.Forms.Keys.Left 'assigns system with left arrow key in keyboard
If Gamestate = "InGame" Then 'in the game
If AimArrowSBRotate <= MathHelper.ToRadians(-85) Then
AimArrowSBRotate = MathHelper.ToRadians(-85)
Exit Sub
End If
AimArrowSBRotate = AimArrowSBRotate - MathHelper.ToRadians(2)
End If

"Spacebar" key binding

Case Is = Windows.Forms.Keys.Space 'assigns system with spacebar key in keyboard
If Gamestate = "Awating Game to Start" Then 'in the game
Player_Score = 0
Player_Level += 1.0F
PlayAreaRect.Y = 62
PlayAreaRect.Height = 456
PlayAreaRect.Width = 380
PlayAreaTex = Texture2D.FromFile(Device, "../../images/PlayArea.png", NonBallTexCreationParams)
Gamestate = "Loading, please wait"
ElseIf Gamestate = "InGame" Then
If BallLaunched = False Then 'If a Ball stopped
If BallInCorrectPosition = False Then 'Ball in not correct position
For Each SingleBall As BallLogic In BallLogicArray 'Statement to check every single ball in the array
If SingleBall.DeletedBall = False Then
If SingleBall.BallLogicRect = BallLogicLauncherRect7 Then 'If the ball in this posistion
If SingleBall.MovingBall = False Then
GetBallLogicVectorFromAimArrow() 'Retrives the direction fo the arrow pointing
End If
ArrowHolderRect7IsEmpty = True
NeedNewBall = True
SingleBall.MovingBall = True
SingleBall.LauncherBall = False
BallLaunched = True
Exit For 'end the loop
End If
End If
End If
End If
End If

"Pause Break" key binding

Case Is = Keys.Pause
If Gamestate = "InGame" Then
Gamestate = "Paused"
'If DirectXAudio.Playing = True Then
'End If
ElseIf Gamestate = "Paused" Then
Gamestate = "Playing"
'If DirectXAudio.Playing = True Then
'End If
End If
'Case Is = Keys.Enter
'If DirectXAudio.Playing = True Then
'ElseIf DirectXAudio.Paused = True Then
'End If

As shown above the DirectXAudio function have been excluded and put aside from the system coding due to the problems stated in the Chapter 5.7.1. The author decides to not delete the code for the moment to investigate got the possible solution to the problem.

Graphic Rendering and Functions Defined in the GraphicModule class

In this section, is the class where all 90% of the variable declaration is coded. This is the main functional class in which enables the game system functionalities, system checks, conditional checks, codes for game and level stage of the game, system particles, bubble ball image call, image file call, ball movement calculations and more.

The code shown below is part of the variable declaration.

Public BallLogicLauncherRect1 As Rectangle = New Rectangle(192, 495, 38, 38) 'Defining the Ball respawing at the declared location in the launcher bar

Public BallLogicLauncherRect2 As Rectangle = New Rectangle(230, 495, 38, 38)

Public BallLogicLauncherRect3 As Rectangle = New Rectangle(265, 495, 38, 38)

Public BallLogicLauncherRect4 As Rectangle = New Rectangle(295, 495, 38, 38)

Public BallLogicLauncherRect5 As Rectangle = New Rectangle(325, 495, 38, 38)

Public BallLogicLauncherRect6 As Rectangle = New Rectangle(355, 495, 38, 38)

Public BallLogicLauncherRect7 As Rectangle = New Rectangle(387, 468, 38, 38)

The game level stage advance through game completion, spawning the bubble balls in the sorted location in the game. Part of the code used are shown below.

Public Sub DefineStageLevel(ByVal LevelNo As Integer) 'ball positioning in the Playarea, spawing ball in the correct possition sorted order

Dim A1_PlayArea As Rectangle = New Rectangle(PlayAreaRect.X, PlayAreaRect.Y, 38, 38) 'column A

Dim A2_PlayArea As Rectangle = New Rectangle(PlayAreaRect.X, A1_PlayArea.Y + 38, 38, 38)

Dim A3__PlayArea As Rectangle = New Rectangle(PlayAreaRect.X, A2_PlayArea.Y + 38, 38, 38)

Dim A4_PlayArea As Rectangle = New Rectangle(PlayAreaRect.X, A3__PlayArea.Y + 38, 38, 38)

Dim A5_PlayArea As Rectangle = New Rectangle(PlayAreaRect.X, A4_PlayArea.Y + 38, 38, 38)

Dim A6_PlayArea As Rectangle = New Rectangle(PlayAreaRect.X, A5_PlayArea.Y + 38, 38, 38)

Dim A7_PlayArea As Rectangle = New Rectangle(PlayAreaRect.X, A6_PlayArea.Y + 38, 38, 38)

Dim A8_PlayArea As Rectangle = New Rectangle(PlayAreaRect.X, A7_PlayArea.Y + 38, 38, 38)

Dim A9_PlayArea As Rectangle = New Rectangle(PlayAreaRect.X, A8_PlayArea.Y + 38, 38, 38)

Dim A10_PlayArea As Rectangle = New Rectangle(PlayAreaRect.X, A9_PlayArea.Y + 38, 38, 38)

Dim A11_PlayArea As Rectangle = New Rectangle(PlayAreaRect.X, A10_PlayArea.Y + 38, 38, 38)

Dim A12_PlayArea As Rectangle = New Rectangle(PlayAreaRect.X, A11_PlayArea.Y + 38, 38, 38)

Dim B1_PlayArea As Rectangle = New Rectangle(PlayAreaRect.X + 38, PlayAreaRect.Y, 38, 38) 'column B

Dim B2_PlayArea As Rectangle = New Rectangle(PlayAreaRect.X + 38, A1_PlayArea.Y + 38, 38, 38)

Dim B3_PlayArea As Rectangle = New Rectangle(PlayAreaRect.X + 38, A2_PlayArea.Y + 38, 38, 38)

Dim B4_PlayArea As Rectangle = New Rectangle(PlayAreaRect.X + 38, A3__PlayArea.Y + 38, 38, 38)

Dim B5_PlayArea As Rectangle = New Rectangle(PlayAreaRect.X + 38, A4_PlayArea.Y + 38, 38, 38)

Dim B6_PlayArea As Rectangle = New Rectangle(PlayAreaRect.X + 38, A5_PlayArea.Y + 38, 38, 38)

Dim B7_PlayArea As Rectangle = New Rectangle(PlayAreaRect.X + 38, A6_PlayArea.Y + 38, 38, 38)

Dim B8_PlayArea As Rectangle = New Rectangle(PlayAreaRect.X + 38, A7_PlayArea.Y + 38, 38, 38)

Dim B9_PlayArea As Rectangle = New Rectangle(PlayAreaRect.X + 38, A8_PlayArea.Y + 38, 38, 38)

Dim B10_PlayArea As Rectangle = New Rectangle(PlayAreaRect.X + 38, A9_PlayArea.Y + 38, 38, 38)

Dim B11_PlayArea As Rectangle = New Rectangle(PlayAreaRect.X + 38, A10_PlayArea.Y + 38, 38, 38)

Dim B12_PlayArea As Rectangle = New Rectangle(PlayAreaRect.X + 38, A11_PlayArea.Y + 38, 38, 38)

Game stage code, spawning the balls as soon the game start.

Case Is = 1 'Stage Level 1

CreateBallColor(GetRandomBallColor(), A1_PlayArea.X, A1_PlayArea.Y, False)

CreateBallColor(GetRandomBallColor(), B1_PlayArea.X, B1_PlayArea.Y, False)

CreateBallColor(GetRandomBallColor(), C1_PlayArea.X, C1_PlayArea.Y, False)

CreateBallColor(GetRandomBallColor(), D1_PlayArea.X, D1_PlayArea.Y, False)

CreateBallColor(GetRandomBallColor(), E1_PlayArea.X, E1_PlayArea.Y, False)

CreateBallColor(GetRandomBallColor(), F1_PlayArea.X, F1_PlayArea.Y, False)

CreateBallColor(GetRandomBallColor(), G1_PlayArea.X, G1_PlayArea.Y, False)

CreateBallColor(GetRandomBallColor(), H1_PlayArea.X, H1_PlayArea.Y, False)

CreateBallColor(GetRandomBallColor(), I1_PlayArea.X, I1_PlayArea.Y, False)

CreateBallColor(GetRandomBallColor(), J1_PlayArea.X, J1_PlayArea.Y, False)

CreateBallColor("Red", A2_PlayArea.X, A2_PlayArea.Y, False)

CreateBallColor("Red", B2_PlayArea.X, B2_PlayArea.Y, False)

CreateBallColor("Red", C2_PlayArea.X, C2_PlayArea.Y, False)

CreateBallColor("Red", E2_PlayArea.X, E2_PlayArea.Y, False)

CreateBallColor("Red", F2_PlayArea.X, F2_PlayArea.Y, False)

CreateBallColor("Red", H2_PlayArea.X, H2_PlayArea.Y, False)

CreateBallColor("Red", I2_PlayArea.X, I2_PlayArea.Y, False)

CreateBallColor("Red", J2_PlayArea.X, J2_PlayArea.Y, False)

Ball collision detection enables the bubble ball to explode as soon three or more bubble balls are detected to be touching each other. Part of the code as as shown below.

For Each TemporaryBall As BallLogic In BallLogicArray 'Test the ball in the BallArray for the intersections

If TemporaryBall.MarkedBallDeletionDrop = False Then
If TemporaryBall.DeletedBall = False Then 'Ignore the ball
If TemporaryBall.LauncherBall = False Then 'Ignore the ball
TemporaryBS_OtherBall = New BoundingSphere(New Vector3(TemporaryBall.BallLogicRect.X, TemporaryBall.BallLogicRect.Y, 0), 22) 'Set all Ball to be BoundingSphere
If TemporaryBS_OtherBall <> TemporaryBS_CollisionBall Then 'goto next ball
If TemporaryBS_CollisionBall.Intersects(TemporaryBS_OtherBall) = True Then 'overlapping
If TemporaryBall.BallColor = TemporaryBallColor Then 'if 2 ball is same in color
NextBallBS = TemporaryBS_OtherBall 'Hold the ball
NumberTouchingBall += 1
End If
End If
If NumberTouchingBall > 2 Then 'If 3 ball with same color colided
FunctionResult = True 'return the functionresult
GoTo EndOfFunction 'skip to the end
FunctionResult = False

The bubble balls that are spawned in the Aim Arrow holder will be in a random form calculation. The full code is shown below.

Public Function GetRandomBallColor() 'Randomize the color of the spawned balls
Dim RDMNum As Integer = RDM.Next(0, 5)
Dim RDMColor As String = ""
Select Case RDMNum
Case Is = 0
RDMColor = "Blue"
Case Is = 1
RDMColor = "Green"
Case Is = 2
RDMColor = "Red"
Case Is = 3
RDMColor = "Yellow"
Case Is = 4
RDMColor = "Black"
End Select
Return RDMColor
RDMNum = Nothing
RDMColor = Nothing
End Function

And lastly the 2D image file rendering which the system will use the image file to display in the system as the 2D graphicla interface. The codes below assignes the images file to different variables declared earlier, position calculation and defination, and the parameters.

Public Sub DefineObjectDetails() 'Funtion to define the NonBall Details
MainSB = New SpriteBatch(Device)
'Defining Background Details
BackgroundRect.Height = My.Forms.XNAForm.Bounds.Height
BackgroundRect.Width = My.Forms.XNAForm.Bounds.Width
BackgroundTex = Texture2D.FromFile(Device, "../../images/Background.png", NonBallTexCreationParams)
'Defining PlayArea Details
PlayAreaRect.Height = 480
PlayAreaRect.Width = 379
PlayAreaRect.X = 212
PlayAreaRect.Y = 60
PlayAreaTex = Texture2D.FromFile(Device, "../../images/PlayArea2.png", NonBallTexCreationParams)
'Defining ArrowHolder Details
ArrowHolderRect.Height = 107
ArrowHolderRect.Width = 380
ArrowHolderRect.X = 212
ArrowHolderRect.Y = 433
ArrowHolderTex = Texture2D.FromFile(Device, "../../images/ArrowHolder.png", NonBallTexCreationParams)
AimArrowTex = Texture2D.FromFile(Device, "../../images/AimArrow.png", NonBallTexCreationParams)
'Defining Arrow Details
Texture_no1 = Texture2D.FromFile(Device, "../../images/No1.png", NonBallTexCreationParams)
Texture_no2 = Texture2D.FromFile(Device, "../../images/No2.png", NonBallTexCreationParams)
Texture_no3 = Texture2D.FromFile(Device, "../../images/No3.png", NonBallTexCreationParams)
Lets_StartT = Texture2D.FromFile(Device, "../../images/LetsStart.png", NonBallTexCreationParams)
CongratulationT = Texture2D.FromFile(Device, "../../images/Congratulation.png", NonBallTexCreationParams)
Lets_StartR = New Rectangle(220, 225, 360, 150)
CountdownR = New Rectangle(350, 225, 100, 150)
CongratulationR = New Rectangle(220, 275, 360, 50)
CeilingR = New Rectangle(PlayAreaRect.X, PlayAreaRect.Y - 380, 480, 380)
CeilingT = Texture2D.FromFile(Device, "../../images/CeilingTexture.png", NonBallTexCreationParams)
GameOverT = Texture2D.FromFile(Device, "../../images/GameOver.png", NonBallTexCreationParams)
GameOverR = New Rectangle(275, 250, 250, 100)
PausedT = Texture2D.FromFile(Device, "../../images/Paused.png", NonBallTexCreationParams)
PausedR = New Rectangle(325, 275, 150, 50)
End Sub

Graphic Framerate class

This class is developed and coded to enable the movement speed which the system process. This class is important to enable movement of the graphical objects such as the aim arrow and the bubble ball movements. The full codes in this sub are shown below.

Public Class GraphicFramerate Private Shared lastTick As Integer Private Shared lastGraphicFramerate As Integer Private Shared GraphicFramerate As Integer Public Shared Function CalculateGraphicFramerate() As Integer 'This Funtion is the Framerate calculation If System.Environment.TickCount - lastTick >= 1000 Then lastGraphicFramerate = GraphicFramerate GraphicFramerate = 0 lastTick = System.Environment.TickCount End If GraphicFramerate += 1 Return lastGraphicFramerate End Function End Class

Game Audio class

The author creates this class to enable sound system implementation. Parts of the shown codes are vital in this class to enable the system to perform the sound audio.

Public Shared Sub InitializeSoundEngine()
AudioEngine = New AudioEngine("..\..\Audio\BubbleAttack.xgs") 'Render background audio
WaveBank = New WaveBank(AudioEngine, "..\..\Audio\Wave Bank.xwb") 'Soundtrack
SoundBank = New SoundBank(AudioEngine, "..\..\Audio\Sound Bank.xsb") 'soundtrack
MusicTrack.SoundCueName = "mario" 'Render background audio
MusicThread = New Thread(New ParameterizedThreadStart(AddressOf MusicTrack.PlayAudio))
End Sub

The codes shown above are the XNA Audio extension. In order to implement the system sound the author must use the XNA Microsoft Cross-Platform Audio Creation tool to create the sound bank file and wave bank file. The XNA system only supports implementation of .aif and .mid file.

The next code is in the GraphicModule class which implements the sound effects using GameAudio class.

Dim SoundTrack1 As New GameAudio
SoundTrack1.SoundCueName = "Power Up"
Dim SoundThread1 As New Thread(New ParameterizedThreadStart(AddressOf SoundTrack1.PlayAudio))


The author received a hard experience and too much of difficult times in the coding process but it was fun and enjoyable to be able to learn new programming techniques. The author found that system debugging is very annoying and troublesome, and in this system development there is not much time can be allocated, as the author understands debugging process can go on for years, thus the author can only minimize the bug occurrence and ignoring some bugs until the solution to it is obtained.

Chapter 9: System Testing


In this chapter, the author will perform various tests on the XNA BubbleBall Attack 2D game system to ensure that the system is functional. The purpose of this test is conducted are to ensure that the system will not produce serious errors and defects before the game prototype system is released.

Testing Method

In order to test the system, unit testing and EHT (Error Handing Testing) are used to identify and produce test results.

Unit Testing

The goals of unit testing lies on the in the signle funtionalities of each and every functions in the system. Each unit will be broken up to test its funtions results. This method is proven with its value that a large perfentage of detects are identified during in use.

Test results are differentiate in three different categories which are:

  • Functioning
  • Functioning but not as expected
  • Not Functioning at all

Remarks are rated in three different categories also, which are:

  • Good
  • Average
  • Bad

Testing Report Summary

The test report summary is used to summarize all the results obtained from the testing results. This report is meant to present the system testing report in a compact mode. Due to the massive imformation obtained through the system testing process, the author finds it hard to evaluate the overall result. Thus, by creating summary report would be appropriate solution method.

Unit Testing Report

From the unit testing process, the produced results are quite good. Among twenty unit testing conducted, it turns up that there are none "Non Functioning" test result. Only two of the unit testing resulted in "Functioning but not as expected" test result category with "Average" category in remarks. This means that the system is currently functioning with maximum of 90% full capability. And this means that there are about 10% system defects.

Integration Testing Report

The author conducted the system's integration on the same module as above and having the same test results due to the game system structure and functionalities are operating and dependent mode. The outcomes of the test result are completely same with the unit testing results which the author considers as a good result rated in overall performance. The same system errors and defects are detected just ask in the unit testing too.


From the testing results, the author has concluded the system is functioning normally with some common bug which is not in a serious situation. In which every system will turn out to having unsolved bugs.

Chapter 10: System Evaluation


In this chapter, the author will evaluate and rate the game system by acquiring help from potential users, which is familiar with game systems. This method will ensure the system interaction with the potential users will generate a proven result with is reliable in term of real life system and user interaction.

Evaluation Method

The system evaluation will be conducted using results obtained from the questionnaire. Potential users will be provided with questionnaire in a written paper. The questionnaire will include ten questions which are related to the proposed system, user will be required to answer all questions in an appropriate way provided. There will be no absolute answer to the questions, all the provided answer to the questions are acceptable.