an exploration into modular core game systems : improving code quality

22
An Exploration into Modular Core Game Systems: Improving Code Quality by Stephen Phillips #0710108

Upload: mariko

Post on 22-Feb-2016

35 views

Category:

Documents


0 download

DESCRIPTION

An Exploration into Modular Core Game Systems : Improving Code Quality. by Stephen Phillips #0710108. The Aim. To improve quality of code by engineering low level communication between common game modules in an extensible manner. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: An Exploration into  Modular Core  Game Systems : Improving  Code Quality

An Exploration into ModularCore Game Systems:

Improving Code Quality

by Stephen Phillips#0710108

Page 2: An Exploration into  Modular Core  Game Systems : Improving  Code Quality

by Stephen Phillips#0710108

To improve quality of code by engineering low level communication between common game modules in an extensible manner.

To create a streamlined and uniform interface for accessing and using these game modules.

To enable the seamless exchange of different middleware engines with minimal impact upon code reusability.

The Aim

Page 3: An Exploration into  Modular Core  Game Systems : Improving  Code Quality

by Stephen Phillips#0710108

To produce a report on research pertaining to software metrics designed for complex object-oriented systems, and to software engineering patterns that are most applicable in the proposed solution of this project.

To support the efficacy and relevance of this research through a programming artefact which demonstrates the proposed architecture at a small scale.

The Objective

Page 4: An Exploration into  Modular Core  Game Systems : Improving  Code Quality

by Stephen Phillips#0710108

What problems do I seek to address

The Intent

Page 5: An Exploration into  Modular Core  Game Systems : Improving  Code Quality

by Stephen Phillips#0710108

The new game being developed

The Intent

Game

Page 6: An Exploration into  Modular Core  Game Systems : Improving  Code Quality

by Stephen Phillips#0710108

Introduction of external middleware

The Intent

Physics

Input

GameRendering

Audio

GUI

Page 7: An Exploration into  Modular Core  Game Systems : Improving  Code Quality

by Stephen Phillips#0710108

The IntentProblem #1: Incompatibility at the data level

Vector3

+ float x+ float y+ float z

btVector3

+ getX() : float+ getY() : float+ getZ() : float

- float[4] m_floats

vector3d<Type>

+ Type X+ Type Y+ Type Z

OGRE IRRLICHT

BULLET

btVector3 pos(5.0f, 10.0f, 15.0f);Ogre::Vector3 meshPos(pos.getX(), pos.getY(), pos.getZ());

Page 8: An Exploration into  Modular Core  Game Systems : Improving  Code Quality

by Stephen Phillips#0710108

The IntentA further example of incompatibility

vec3<Type>

+ Type X+ Type Y+ Type Z

vector3d<Type>

+ Type X+ Type Y+ Type Z

IRRLICHT

IRRKLANG

irr::core::vector3d<f32> pos(5.0f, 10.0f, 15.0f);irrklang::vec3d<f32> soundPos(pos.X, pos.Y, pos.Z);

Page 9: An Exploration into  Modular Core  Game Systems : Improving  Code Quality

by Stephen Phillips#0710108

Problem #2: Complexity for the developer

The Intent

Physics

Input

GameRendering

Audio

GUI

Page 10: An Exploration into  Modular Core  Game Systems : Improving  Code Quality

by Stephen Phillips#0710108

Problem #3: Wasting and rewriting code

The Intent

Physics

Input

Audio

Game

Rendering

Rendering

(with GUI)

GUI

Page 11: An Exploration into  Modular Core  Game Systems : Improving  Code Quality

by Stephen Phillips#0710108

There is no predefined method of transferring different data types between game modules, despite the similarities in their structure.

Using multiple external engines results in a complex set of interfaces for the developer.

Replacing a module with a similar one wastes any interface code written by the developer, despite the similarities in their functionality.

The Intent: Summary

Page 12: An Exploration into  Modular Core  Game Systems : Improving  Code Quality

by Stephen Phillips#0710108

What does this project suggest as a solution

The Proposal

Page 13: An Exploration into  Modular Core  Game Systems : Improving  Code Quality

by Stephen Phillips#0710108

Modular abstraction of grouped middleware

The Proposal

Physics• Bullet• Havok• PhysX

Rendering

• Irrlicht• Ogre• Horde3D

Audio• FMOD• IrrKlang• PortAudio

Game CoreGame

Page 14: An Exploration into  Modular Core  Game Systems : Improving  Code Quality

by Stephen Phillips#0710108

Interactions made through Game Core module

The Proposal

Physics• Bullet• Havok• PhysX

Rendering

• Irrlicht• Ogre• Horde3D

Audio• FMOD• IrrKlang• PortAudio

Game CoreGame

Page 15: An Exploration into  Modular Core  Game Systems : Improving  Code Quality

by Stephen Phillips#0710108

The lowest level interactions

The Structure

Irrlicht HavokConvert

vector3d<float> hkVector4Vector3

CMatrix4<float> hkMatrix4Matrix4

quaternion hkQuaternionQuaternion

Page 16: An Exploration into  Modular Core  Game Systems : Improving  Code Quality

by Stephen Phillips#0710108

The lowest level interactions

The Structure

Irrlicht BulletConvert

vector3d<float> btVector3Vector3

CMatrix4<float> btMatrix4Matrix4

quaternion btQuaternionQuaternion

Page 17: An Exploration into  Modular Core  Game Systems : Improving  Code Quality

by Stephen Phillips#0710108

Swapping out different libraries

The Structure

//developer code#include <OgreModule.h>#include <HavokModule.h>#include <GameCore.h>

int main(int argc, char *argv[]){

//external codereturn 0;

}

//Ogre module example#ifndef _OGREMODULE_H#define _OGREMODULE_H

//Ogre-specific code...

#endif

//Havok module example#ifndef _HAVOKMODULE_H#define _HAVOKMODULE_H

//Havok-specific code...

#endif

Page 18: An Exploration into  Modular Core  Game Systems : Improving  Code Quality

by Stephen Phillips#0710108

Game Core Module header layout

The Structure

//Game Core module#ifdef _OGREMODULE_H#include “OgreInterface.h”#elif _IRRLICHT_H#include “IrrlichtInterface.h”#endif

#ifdef _HAVOKMODULE_H#include “HavokInterface.h”#elif _BULLET_H#include “BulletInterface.h”#endif

//Game Core code...

Page 19: An Exploration into  Modular Core  Game Systems : Improving  Code Quality

by Stephen Phillips#0710108

Is there research to support this project

Ali Mili, Sherif Yacoub, Edward Addy and Hafedh MiliToward an Engineering Discipline of Software

Reuse

Concern for practice is no excuse for poor theoryEmpirical methods are no excuse for dispensing with

analytical methodsScientific research ultimately affects and enhances

practice

The Theory

Page 20: An Exploration into  Modular Core  Game Systems : Improving  Code Quality

by Stephen Phillips#0710108

What feasibility issues restrict this project

Cannot predict additional requirements; must code in a way that can be iteratively improved

Scope must be defined; this project is not a self-contained engine like Unity

Middleware engines have similarities, but are all unique; developer must have some access

The Limitations

Page 21: An Exploration into  Modular Core  Game Systems : Improving  Code Quality

by Stephen Phillips#0710108

How can this project’s effectiveness be measured

Chandrashekar Rajaraman and Michael R. LyuReliability and Maintainability Related

Software Coupling Metrics in C++ Programs

(1) Class Inheritance-related Coupling (CIC)(2) Class Non-Inheritance-related Coupling (CNIC)(3) Class Coupling (CC)(4) Average Method Coupling (AMC)

The Test

Page 22: An Exploration into  Modular Core  Game Systems : Improving  Code Quality

Baker, Albert L., Bieman, James M., Fenton, Norman, Gustafson, David A., Melton, Austin and Whitty, Robin (1990) 'A Philosophy for Software Measurement' Iowa State University, Colorado State University, The City University (London), Kansas State University and Polytechnic of the South Bank (London) http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.73.4431&rep=rep1&type=pdf [16 February 2011]

Bridger, Paul (2011) 'C++ Multithreading Tutorial' http://www.paulbridger.com/ [18 February 2011]

Bruegge, Bernd and Dutoit, Allen H. (2003) Object-Oriented Software Engineering Using UML, Patterns and Java. USA: Prentice Hall http://books.google.co.uk/books?id=VYdf2ONuRZIC [7 November 2010]

Grudin, Jonathan (1989) 'The Computer Reaches Out: The Historical Continuity of Interface Design' Department of Computer Science, Aarhus University http://www.ist-palcom.org/publications/PB/299/PB-299.pdf [2 November 2010]

Hoffman, Douglas (2000) 'The Darker Side of Metrics' Software Quality Methods, LLC http://www.softwarequalitymethods.com/Papers/DarkMets%20Paper.pdf [8 November 2010]

Huston, Vince (2010) 'Design Patterns' http://www.vincehuston.org/dp/ [7 November 2010]

Kaner, Cem and Bond, Walter P. (2004) 'Software Engineering Metrics: What Do They Measure and How Do We Know?' IEEE. http://www.kaner.com/pdfs/metrics2004.pdf [8th November 2010]

Liskov, Barbara and Zilles, Stephen (2000) 'Programming with Abstract Data Types‘ Massachusetts Institute of Technology and IBM Systems Development Division http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.136.3043&rep=rep1&type=pdf [5 November 2010]

Martin, Robert C. (2002) Agile Software Development: Principles, Patterns, and Practices. USA: Prentice Hall [9 November 2010]

Mili, Ali, Yacoub, Sherif, Addy, Edward and Mili, Hafedh (1999) 'Toward an Engineering Discipline of Software Reuse' Institute for Software Research, NASA Software Independent Verification and Validation Facility and University of Quebec http://www.raminsoftworx.com/elec443/lectures/reuse-3.pdf [16 February 2011]

Nesnas, Issa A.D., Wright, Anne, Bajracharya, Max, Simmons, Reid, Estlin, Tara and Won Soo Kim (2004) 'CLARAty: An Architecture for Reusable Robotic Software‘ http://trs-new.jpl.nasa.gov/dspace/bitstream/2014/7235/1/03-0921.pdf [4 November 2010]

Rajaraman, Chandrashekar and Lyu, Michael R. (2007) 'Reliability and Maintainability Related Software Coupling Metrics in C++ Programs' CS Department, The University of Iowa and Information Sciences and Technologies Research Lab, Bellcore http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.46.3055&rep=rep1&type=pdf [14 December 2010]

Sallis, Philip, Tate, Graham and MacDonell, Stephen (1995) Software Engineering. England: Addison-Wesley [9 November 2010]

Sametinger, Johannes (1997) 'Software Engineering with Reusable Components‘ Johannes Kepler University of Linz http://www.swe.uni-linz.ac.at/publications/pdf/TR-SE-97.04.pdf [7 November 2010]

Shalloway, Alan and Trott, James (2005) Design Patterns Explained, Second Edition. USA: Pearson Education [16 February 2011]

Shalloway, Alan (2010) 'The Net Objectives Design Patterns Repository' http://www.netobjectives.com/ [17 February 2011]

Shaw, Mary, DeLine, Robert, Klein, Daniel V., Ross, Theodore L., Young, David M. and Zelesnik, Gregory (1995) 'Abstractions for software architecture and tools to support them‘ Computer Science Department, Carnegie Mellon University and affiliations http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.92.9998&rep=rep1&type=pdf [5 November 2010]

Sommerville, Ian (2007) Software Engineering 8. England: Addison-Wesley [9 November 2010]

by Stephen Phillips #0710108