0% found this document useful (0 votes)
190 views

Computer Game Design and Development Using Java

This document discusses game design and development using Java. It covers key aspects of game design like defining the game idea, story, goals and interactions. It then provides examples of prototypes developed for simple games like Tic-Tac-Toe and Space Invaders. The document outlines concepts like sprites, animation, collision detection and provides technical details on implementing a Space Invaders game with descriptions of characters, levels, menus and gameplay.

Uploaded by

John Lacea
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
190 views

Computer Game Design and Development Using Java

This document discusses game design and development using Java. It covers key aspects of game design like defining the game idea, story, goals and interactions. It then provides examples of prototypes developed for simple games like Tic-Tac-Toe and Space Invaders. The document outlines concepts like sprites, animation, collision detection and provides technical details on implementing a Space Invaders game with descriptions of characters, levels, menus and gameplay.

Uploaded by

John Lacea
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Computer Game Design and Development using Java

By
Game Design
 It is the entire process of creating a game idea, from research to the graphical interface to
the unit’s capabilities.
 It is the process of creating and defining games.

Game Prototype of Tic-Tac-Toe

Game Prototype of Patentiro


Some of the jobs of a game designer when creating a game are:
 Define the game idea.
 Define all the screens and how they relate to each other and menus.
 Explain how and why the interaction with the game is done.
 Create a story that makes sense.
 Define game goals.
 Write dialogs and other specific game texts.
 Analyze the balance of the game and modify it accordingly.
 And much, much more . . .
1
A SAMPLE GAME DESIGN: SPACE INVADERS

Space Invaders Prototype

1. GENERAL OVERVIEW OF THE GAME


Space Invaders is a typical arcade shooter game. The objective of the game is to destroy
all the enemy ships in each level. The player controls a ship that can move horizontally in the
bottom of the screen while it tries to avoid the bullets from the alien ships.

2. TARGET SYSTEM AND REQUIREMENTS


Space Invaders is target to Windows 32-bit PC machines with DirectX 9.0c installed.
Being such a low-end game, the basic requirements are minimal, such as:

Intel Core 2 Duo processor or equivalent (for DirectX performance)


1 GB of memory (depending on system)
5 Megabytes of free disk space
SVGA DirectX compatible video card

3. GAME STORY
Around 2049 A.D., aliens arrived at our planet, and they were not peaceful. They have
destroyed two of the major cities in the world and are now threatening to destroy more. The United
Defense Force has decided to send their special agent, Juan Matapang to destroy the alien force
with the new experimental ship: ZS 3020 Airborne. You play the role of Juan. Your mission: To
destroy all the alien scum.

4. THEME: GRAPHICS AND SOUND


The whole game has a futuristic feeling to it. The main menus are heavily based on metallic
walls and wire. The game itself is played in space, and as such, most of the backgrounds are stars or
small planets. The ships have a very futuristic look to them. The game is ensconced in heavy trance
techno music with a very fast beat. Sounds are basically based on metal beating, explosions, and
firing bullets effects.

2
5. MENUS
When the game starts, the user is presented with the main menu—in this menu he has five
options.
1. Start New Game
This option starts a new game. The player is sent to the new game menu where he can
enter his name and chose the game difficulty.
2. Continue Previously Saved Game
This option starts a game that was previously saved. The player is sent to the load game
menu where he can choose a game from a list of previous saved games.
3. See Table of High Scores
This option shows the high scores table.
4. Options
This option shows the Options menu. The player is sent to the Options menu where he can
change the graphics, sound, and control settings.
5. Exit
This option exits the game.

6. PLAYING A GAME
When the game starts, a company splash screen is shown for three seconds. After the three
seconds the screen fades to black and a splash screen starts to fade in. After four seconds the
screen re-fades to black and the player is sent to the main menu. When the player starts a new
game, he is presented with a new menu screen where he can enter his name, and choose the game
difficulty. After this is done, the user is sent to the game itself.

When each level starts, there is a three-second countdown for the game to start. The player
can move his ship to the left or right and shoot using the controls defined in the Options menu. When
all the enemies are destroyed, the player advances a level. When the player is shot by an alien, he
loses a life. If the player loses all the lives, the game ends. If the aliens reach the bottom of the
screen, the game is also over.

If the player presses the Escape key while playing, the game is paused and a dialog appears
asking what the user wants to do, and he can choose from the options:

Save game — Saves the game


Options — Shows the Options menu
Quit game — Returns to the main menu

7. CHARACTERS AND NON PLAYER CONTROLLED(NPC)


In this version of Space Invaders there are two versions of alien ships. The first, the normal
ones that are constantly on the screen trying to destroy the player, and the second randomly appear
and if shot gives bonus points to the player.

Normal Ships
Normal ships are the typical enemies of the player. They can have various images but their
functionality is the same. They move left and right and randomly shoot bullets to the player vertically.
When the ships reach a vertical margin, they move down a bit. These ships are destroyed with a
single shot and each ship destroyed gives one hundred points to the player. As the levels progress,
the faster the ships move.

3
Bonus Ships
Bonus ships show randomly on the top of the screen. They move horizontally and very quickly.
These ships exist only to give bonus points to the player and don’t affect the gameplay since they
don’t shoot at the player and are not required to be destroyed. When a bonus ship is destroyed, the
game awards 500 points to the player.

8. ARTIFICIAL INTELLIGENCE OVERVIEW


This game is very simple and requires almost no artificial intelligence. The ships move horizontally
only until they reach one of the vertical margins where they move down. They also randomly shoot
a bullet down, in a vertical-only direction.

Space Invaders arcade game(Toshihiro Nishikado, 1978)

CONCEPTUAL FRAMEWORK
4
ELEMENTS OF COMPUTER GAME
1. Graphics
 2D
 3D
 Resolution measured in pixels of width and height.
2. Animation
 Sprite Animation
3. Sound Effects
4. Background Music
5. Collision Detection

GAME BUILDING STRATEGIES


SCENERY
Scenery is the background of a scene in a game. You build scenery by building a bitmapped
graphics file. There are three strategies: You can scan in a scene from an existing picture or sketch
drawings, manually design or paint the scenery by using a paint program, or render the scenery by
ray-tracing a 3-D model of the scene.

Background of Space Invaders

SPRITE
Sprites are the characters in your game. A moving object in the display. A sprite has solid
pixels that show the shape the object and transparent pixels that are hidden so that it will not
block the background.

Sprite bitmapped Sprite draws on screen and hides Transparent Pixels

5
ANIMATION
Animation is where the action is. To add action to a game, you make a sprite move around
the screen and do interesting things. Animation is the product of showing a sequence of frames,
with each frame representing the next increment of motion in the sequence. The motion is an
illusion. Nothing really moves. Every picture that we see is a still frame. But when the frames are
shown in rapid succession, our brains are tricked into thinking that we are seeing motion.

Four (4) Frames Animation of an Alien Ship

Sixteen (16) Frames Animation of an Explosion

DOUBLE BUFFERING TECHNIQUE OF ANIMATION

Background Sprite

Fast
transfers

Graphics Buffer(Video Memory) Screen

6
AREA INTERSECTION-RECTANGLE PIXEL-BASED COLLISION DETECTION ALGORITHM
Invented by John B. Lacea

Two Sprites Collide

Sprite #1

Sprite #2

Two Sprites’ Rectangles Overlap or Intersect

Pixel-Based Collision Test for the Two Area Intersection-Rectangles


(StartX2, StartY2)

Sprite #2

Sprite #1 
(StartX2 + Width, StartY2 + Height)

Sprite #2 Area Intersection-Rectangle


(StartX, StartY)

 (StartX + Width, StartY + Height)


Sprite #1 Area Intersection-Rectangle

7
GAME PROGRAMMER NEEDS TO BE AWARE THAT
1. Drawing bitmaps and sprites consume a large amount of memory RAM.
2. Sound effects and music consume a large amount of memory RAM.
3. Higher graphics resolution slows down the CPU’s processing.
4. More bitmaps and sprites to draw on screen slow down the CPU’ processing.
5. More collision tests slow down the CPU’s processing.

EVENT-DRIVEN and MESSAGE-BASED PROGRAMMING


Events are things that happen outside of and asynchronous to the game program. Clock
ticks, keystrokes, mouse movements, mouse clicks, joystick or gamepad motion, joystick or
gamepad button presses, and receptions of network packets are all events.
Messages are function or method calls that the system makes to registered functions of the
game program. Messages report events to the game program. The game program gets only those
messages for which it has registered.
Game loop is where it intercepts events and processes messages. It repeats continuously
until the user exits the game.

8
Pricing:
 Free for personal use, beginners and students (cannot be used by developers whose
revenue or money raised (ie: from Kickstarter) is over $100k)
 Unity Plus: $35/month (cannot be used by developers whose revenue or money raised is
over $200k)
 Unity Pro: $125/month
Features:
 Editor that supports both 2D and 3D, AI pathfinding tools, UI creator, physics engine and
can be customized with plugins and assets from Unity’s asset store
 Art and design tools including a timeline tool for cutscenes, camera control, post processing
effects like color grading, animation tools, level design and lighting tools
 Graphics rendering
 The ability to develop across platforms, including the Nintendo Switch, Sony PlayStation 4,
Xbox One and Oculus Rift
 Unity asset store with environments, characters and other models
 Multiplayer capabilities
 Team collaboration tools
 Built-in live-ops analytics
 Monetization features

Pricing:
 Free to use, but you will have to pay a 5 percent royalty after the first $3,000 in revenue
you make per product, per quarter
Features:
 Real-time rendering
 C++ source code
 Blueprints to code without using code
 Multiplayer
 VFX and particle systems
 Post-process effects
 Material editor
 Animation tools
 Cinematic tools for cutscenes
 VR, AR, and XR development tools
 Terrain and foliage tools for open worlds
 AI engine
 Audio engine
 Asset marketplace
 Modular plugins

9
Pricing:
 Pay what you want, royalty-free, but you can allocate money to the Indie Development
Fund to help support indie developers creating games with CryEngine
Features:
 Physically based rendering
 Real-time dynamic water caustics
 Tessellation
 Efficient Anti-Aliasing
 Real-time local reflections
 Lighting tools
 Particle system and volumetric fog shadows
 Material editor
 Level design
 Trackview cinematic editor
 Flowgraph
 Designer tool
 Animation tools
 Character creation and customization
 Advanced AI system
 Multi-platform support
 Audio editors
 Physics engine

Pricing:
 Creator version: $39
 Developer version: $99 with ability to publish to PCs, $149 with ability to publish to Amazon
Fire or HTML5, $399 with ability to publish to mobile and Microsoft devices such as Xbox
One
 Creators Portal
 Console version: $399 with ability to publish to Xbox One Creators Portal, $799 12-month
license to publish to PlayStation 4 or Xbox One, $1500 12-month license to publish to all
platforms
Features:
 Laptop mode
 Customizable game development environment skins
 Drag-and-drop workflow
 Code library of events and actions
 Code preview
 GameMaker Language for coding
 Object layers
 Tile brushes
 Brush-based editing
 Animation support
 Debugger
 Monetization
 Sound mixing
10
 Push notifications
 Extensions
 Marketplace

Pricing:
 Free
Features:
 Multi-platform 2D and 3D open source game engine.

Pricing:
 Free
Features:
 Open-source implementation of the Microsoft XNA 4 Framework.

Pricing:
 Free
Features:
 High performance realtime 3D rendering using Direct3D and OpenGL,
 Platform independent. Runs on Windows, Linux, OSX, Solaris, and others.
 Huge built-in and extensible material library with vertex, pixel, and geometry shader
support.
 Seamless indoor and outdoor mixing through highly customizeable scene management.
Character animation system with skeletal and morph target animation.
 Particle effects, billboards, light maps, environment mapping, stencil buffer shadows, and
lots of other special effects.
 Several language bindings which make the engine available to other languages such as
C#, VisualBasic, Delphi, Java …
 Two platform and driver independent fast software renderers included. They have different
properties (speed vs. quality) and feature everything needed: perspective correct texture
mapping, bilinear filtering, sub pixel correctness, z-buffer, gouraud shading, alpha-blending
and transparency, fast 2D drawing, and more.
 Powerful, customizeable, and easy to use 2D GUI System with Buttons, Lists, Edit boxes,
2D drawing functions like alpha blending, color key based blitting, font drawing, and mixing
3D with 2D graphics.
 Clean, easy to understand, and well documented API with lots of examples and tutorials.
 Written in pure C++ and totally object oriented.
 Direct import of common mesh file formats: Maya (.obj), 3DStudio (.3ds), COLLADA (.dae),
Blitz3D (.b3d), Milkshape (.ms3d), Quake 3 levels (.bsp), Quake2 models (.md2), Microsoft
DirectX (.X)…
 Direct import of Textures: Windows Bitmap (.bmp), Portable Network Graphics (.png),
Adobe Photoshop (.psd), JPEG File Interchange Format (.jpg), Truevision Targa (.tga),
ZSoft Painbrush (.pcx)…
 Fast and easy collision detection and response.
 Optimized fast 3D math and container template libraries.
 Directly reading from (compressed) archives. (.zip, .pak, .pk3, .npk)
 Integrated fast XML parser.
 Unicode support for easy localisation.
11
 Works with Microsoft VisualStudio, Metrowerks Codewarrior, Bloodshed Dev-C++,
Code::Blocks, XCode, and gcc 3.x-4.x.
 The engine is open source and totally free. You can debug it, fix bugs and even change
things you do not like. And you do not have to publish your changes: The engine is licensed
under the zlib licence, not the GPL or the LGPL.

1. Image
 This class is used to load images.
2. Media
 This class is used to represent a media resource.
3. MediaPlayer
 This class provides the controls for playing media.
4. Pane
 This class provides layout of text, image, GUI, etc. as layers.
5. start( ) method
 The main entry point for all JavaFX applications. The start method is called after the init
method has returned, and after the system is ready for the application to begin running.
6. GameLoop( ) method
 This method is called in the start( ) method and makes the CPU executes the codes
repeatedly until the user closes the application.

LABORATORY HANDS-ON ACTIVITY


Compile, Run and Play
1. Run the NetBeans IDE.
2. On the Menu bar, click the File menu and then select Open Project or press the keyboard short-cut Ctrl +
Shift + O.

3. On the Open Project Dialog Window, browse the location path and folder c:\IT Week 2019\Computer
Game Design and Development\Space Invaders and select the folder name with a coffee picture
beside and then click Open Project.
4. Press F6 to Run the executable JAR file
5. Close the game when you are done and please run and test my 3D C/C++ Game with Irrlicht
Engine. It is located at the path and folder c:\IT Week 2019\Computer Game Design and
Development using Java\C++ 3D and run the filename Lacea 3D Avatar.exe

12
“Try to learn something about everything and everything
about something.”
Thomas Henry Huxley
“I do not know anything, but I do know that everything is
interesting if you go into it deeply enough.”
Richard Feynman
“Example is the school of mankind, and they will learn at
no other.”
Edmund Burke
“Share your knowledge. It’s a way to achieve immortality.”
Dalai Lama
“It does not make much difference what a person studies.
All knowledge is related, and the man who studies
anything, if he keeps at it, will become learned.”
Hypatia
“Mathematics possesses not only the truth, but some
supreme beauty – a beauty cold and austere, like that of
a sculpture.”
Bertrand Russell
“Imagination is much more important than knowledge
because knowledge describes what we know. Imagination
describes everything that we can potentially know in the
future.”
Albert Einstein

13

You might also like