Top Banner
2.2. ARCHITECTURAL DESIGN I Introductory exploration of game architectural design
18

2 . 2. Architectural Design I

Feb 20, 2016

Download

Documents

coyne

2 . 2. Architectural Design I. Introductory exploration of game architectural design. Game Architecture (In the Abstract). Identifying game architectural structures and key modelling techniques. Input Events. Abstracting Game Architecture . Game objects have: Defined type (+ inherited) - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 2 . 2. Architectural Design I

2.2. ARCHITECTURAL DESIGN IIntroductory exploration of game architectural design

Page 2: 2 . 2. Architectural Design I

GAME ARCHITECTURE (IN THE ABSTRACT)Identifying game architectural structures and key modelling techniques

Page 3: 2 . 2. Architectural Design I

Abstracting Game Architecture

Object

The collective

property set of all game

objects defines the game state

at an instance in

time

Object

Object

Object

Game objects can be grouped

together

Game objects have:• Defined type (+ inherited)• Properties• Functionality

Game objects can interact with one

another

Assets

Input Device

s

Graphics

Devices

Sound Device

s

Game Layer

Game Objec

ts

Game Engine

Asset Manager

Input Events

Page 4: 2 . 2. Architectural Design I

Software Design TheoryYou will need to define the type, properties and functionality of your game objects and also how game objects are grouped and interact. This is a process of software design.

Software design is a large and important aspect of programming and can include theoretical approaches such as object-oriented design, HCI, design patterns, component-based modelling, etc. and modelling tools such as UML, etc.

Most of the above will be considered within your degree. In this module we can restrict our design modelling as follows:

Page 5: 2 . 2. Architectural Design I

Object-oriented designEncapsulation:For each game object you will need to identify the• properties that define

the game object• functionality offered

by the game object

Inheritance:You will also need to think about if/how game objects are related to each other via inheritance

2D-GTA clone: AI carProperties =

current/max velocity / acceleration, turning speed, damage, etc.

Functionality =update( route planning, obstacle avoidance, movement update), draw

Asteroid clone:Inheritance =

MovingObject class{Ship, Missile, Asteroid} : MovingObject

Page 6: 2 . 2. Architectural Design I

Data-Structures: CollectionsDifferent sized groupingsObjects within a game layer might be grouped together into smaller sub-groupings.

Game Layer

objectobjectobjectobject

objectobject

objectobjectobjectobject

Both C# and Java offer a number of incredibly useful generic collection classes that can be used to group game objects (see resources)

Aside: You will learn more about the ‘internal’ workings of the collection classes in the Data Structures and Algorithms module.

Array / Dynamically Sized Array

Hash Map

Linked List

Page 7: 2 . 2. Architectural Design I

Devolved vs. Centralised ControlCentralised ControlOne central process (e.g. defined within a layer) updates a number of game objects

Decentralised ControlEach game object updates itself

Update Process

Object

Object

ObjectUpdate

Process

Easy to coordinate behaviour between multiple objects

× Can be cumbersome to manage if objects differ in their update behaviour

Easy to isolate object specific updating

× Can be difficult to manage inter-object interaction

Or both! – The above options are not mutually exclusive and can be combined, e.g. Common centralised update, combined with secondary devolved update

ObjectUpdate

Process

Page 8: 2 . 2. Architectural Design I

Doing things in the right orderOrdered DrawingFor 2D games it is often necessary to draw game objects in the right order (and for performance reasons)

Castle wall drawn in front of background scenery

Hud drawn on top of everything

Player drawn in front of background and castle wall, but behind rope bridge.Ordered Updating

It is normally useful to update game objects in a certain order (e.g. check for collisions, resolve collisions, update score, etc.)

Page 9: 2 . 2. Architectural Design I

EXAMPLE GAME DESIGNObject-oriented version of Space Invaders

Page 10: 2 . 2. Architectural Design I

Space Invaders…Let us consider one possible design of a classic computer game – Space Invaders.

Warning: This is better classified as a final-pass reverse engineered design – i.e. we have a clear understanding of the target game and the final ‘solution’ is presented. The normal design process is often highly iterative and exploratory.

Page 11: 2 . 2. Architectural Design I

Design Considerations110CSC207 Games Programming

Background decoration

Overlay information / messages

Game Objects

Decorative Effects

Not forgetting sounds… but we will...

Page 12: 2 . 2. Architectural Design I

Example design (Identifying objects)

Missile AlienShip PlayerShip MotherShip Base

Explosion Lifes

ScoreSplashMessage

GameObject

Background

● All extend GameObject

● No deep hierarchies, but identified groupings○

Ships○ Missiles○ Bases

○ Lifes○ Score

○ Explosions○ Messages

● Core objects

● Temporal Objects

● Overlay Objects

○ Background

● Decorative Objects

Page 13: 2 . 2. Architectural Design I

Explosion SplashMessage

TemporalEvent

Lifes Score

OverlayObject

AlienMissile PlayerMissile

Missile AlienShip PlayerShipMotherShip

Sprite

AIControlledSprite

(Exploiting object reuse)Extracting functionality

that is common between related game objects into superclasses.

Missile AlienShip PlayerShip MotherShip Base

Explosion Lifes

ScoreSplashMessage

GameObject

Background

Page 14: 2 . 2. Architectural Design I

(Grouping objects)Decomposing the game into layers and smaller groupings

TitleLayer

InvadersLayer

Bases

AlienShips

AlienMissiles

Dynamic

Array of:

MotherShip

PlayerShip

PlayerMissile

0 or 1 of:

SplashMessage0 to N of:

Lifes

Score

1 of:

Background

Page 15: 2 . 2. Architectural Design I

(Updating/drawing objects)Deciding upon the order of update and render processes – using centralised control

InvadersLayer

● Update background● Update player ship● Update player missile● Update mothership● Update alien ships● Update alien missiles● Update score

Update

● Draw background● Draw bases, ships and missiles● Draw explosions● Draw score, lifes and messages

RenderPlayer ship destroyed

● Remove life● Trigger respawn/ game over

All aliens destroyed● Trigger next level

Aliens hit player● Trigger game over

• scroll background

• get input, update position, check fire

• update position• remove if needed• check/resolve collision

• move/appear check

•move across/down, fire check

• update position• check/resolve collision• remove if needed

Page 16: 2 . 2. Architectural Design I

DEVELOPING YOUR GAME DESIGNHaving a stab at producing your own game design

Page 17: 2 . 2. Architectural Design I

Making a start (and meeting uncertainty)

• What are the key game objects• How do the key objects behave• How are the key objects

grouped• How are the key objects

updated

Based on your current game idea, have a go at developing an architectural design, in particular in this exercise:

Do not try to aim for some mythical ‘correct’ design – this is a first stab and lecture time is very limited. Try to identify the current areas of uncertainty and ask away.

To do:Complete Design

Start10 mins9 mins8 mins7 mins6 mins5 mins4 mins3 mins2 mins 1 min 30 secFinished

Page 18: 2 . 2. Architectural Design I

Summary

To do:Complete Question Clinic

Finalise initial game idea, team/no-team, development language and complete Project Development Report

Do another iteration of your game design

Today we explored:

Software design techniques

Space Invaders example design

Initial own game design