Browser and Game Engines Ali Rantakari T -106.5840 Seminar on - - PowerPoint PPT Presentation

browser and game engines
SMART_READER_LITE
LIVE PREVIEW

Browser and Game Engines Ali Rantakari T -106.5840 Seminar on - - PowerPoint PPT Presentation

Browser and Game Engines Ali Rantakari T -106.5840 Seminar on Software Systems Presentation on 24 November 2010 Aalto University School of Science and Technology Department of Computer Science and Engineering Contents Introduction


slide-1
SLIDE 1

Browser and Game Engines

Ali Rantakari T

  • 106.5840 Seminar on Software Systems

Presentation on 24 November 2010

Aalto University School of Science and Technology Department of Computer Science and Engineering

slide-2
SLIDE 2

Contents

  • Introduction
  • Game Engines
  • Web Browser Engines
  • Conclusion
  • Definition
  • Reference architecture
  • Provided features
  • Interface design
slide-3
SLIDE 3

Introduction

Engine Application

Focus in this presentation is

  • n the usage of engines in

applications; the relevant things in connecting the two.

We perceive the engine as a black box

  • f which we may know the provided

features and perhaps a general structure but we are not concerned with internal implementation details.

? The topic is wide and deep. Let’s not get lost, or drown.

slide-4
SLIDE 4

Questions

  • What is the engine?
  • What does the engine provide?
  • How is the engine used in an application?
  • As a library?
  • As a framework (inversion of control)? To what extent?
  • What is the interface like?
  • Where is the boundary between engine and application?
slide-5
SLIDE 5

Inversion of Control (IoC)

  • Term used in this presentation not in the

design pattern sense but in the architectural principle sense

  • Who is responsible for the control flow?
  • Martin Fowler: “defining characteristic of a

framework”

slide-6
SLIDE 6

Inversion of Control: Library

Library App code Direct calls to library Program flow

slide-7
SLIDE 7

Inversion of Control: Framework

Framework App code Callbacks on registered handlers Program flow

slide-8
SLIDE 8

Game Engines

slide-9
SLIDE 9

Game Engine: Definitions

  • Sherrod: “a framework comprised of a collection of different

tools, utilities, and interfaces that hide the low-level details of the various tasks that make up a video game”

  • Lewis and Jacobson: “collection of modules of simulation code

that do not directly specify the game’s behaviour (game logic) or game’s environment (level data)”

  • J.Gregory: “We should probably reserve the term ‘game engine’

for software that is extensible and can be used as the foundation for many different games without major modification”

  • “The part that’s not specific to any one game”
slide-10
SLIDE 10

Game Engine: Definitions

  • Generally: a bit vague
  • Consensus: Not just a rendering engine (e.g. OGRE)
  • Is the toolset part of the engine?
  • In this presentation we use the concept of the

runtime game engine which excludes the toolset from the definition

slide-11
SLIDE 11

Game Engine: Definitions

  • J.Gregory: “Clearly this is not a black-and-white

distinction. We can think of a gamut of reusability onto which every engine falls” (see figure)

  • In this presentation we focus on (somewhat)

generic (3D) game engines

Picture credit: J.Gregory; Game Engine Architecture.

slide-12
SLIDE 12

Folmer: A Reference Architecture for Games

Picture credit: E.Folmer; Component based game development - a solution to escalating costs and expanding deadlines?

slide-13
SLIDE 13

Game (Engine) Components

Picture credit: J.Gregory; Game Engine Architecture.

Summary: Lots of stuff

slide-14
SLIDE 14

Game (Engine) Components 1/3

Continues

slide-15
SLIDE 15

Game (Engine) Components 2/3

Continues

slide-16
SLIDE 16

Game (Engine) Components 3/3 “Runloop” or “Main loop”

slide-17
SLIDE 17

Domain Boundary

  • J.Gregory in Game Engine Architecture:
  • “If a line can reasonably be drawn between the game

engine and the game itself, [the engine’s gameplay foundation systems] lie just beneath this line”

  • “[in practice] the line between the engine and the

game can probably be best visualized as one big blur – a gradient that arcs across these components as it links the engine to the game”

slide-18
SLIDE 18

Panda3D

Implementing game- specific functionality

  • Application base class has a runloop

implementation (although it can easily be substituted with something else)

  • Lacks a predefined entity system so it

has to be manually built

  • Custom tasks can be attached to

runloop via a TaskManager

  • Custom Event handlers can be

registered for arbitrary global events

slide-19
SLIDE 19

Unreal Engine

Implementing game- specific functionality

  • Scripting system divided into

UnrealScript (textual scripting) and Kismet (visual scripting)

  • Inheritance-based entity system
  • Custom game entities (Actor, Info,

Controller...) can be created with custom behavior and properties

  • Actors (entities) may define handlers

for events and trigger them in other Actors globally

slide-20
SLIDE 20

Crystal Space ( ) + CEL ( )

Implementing game- specific functionality

  • Crystal Space is primarily a rendering

engine; CEL provides entity management and other features for games

  • Composition-based entity system
  • Custom entities and behaviors

composed declaratively (XML) or imperatively (Python)

  • Behaviors and property sets

attached to Entities via Property Classes

  • Property classes may message each
  • ther through Entity channels
slide-21
SLIDE 21

Commonalities

  • Main connection points are in the

gameplay foundations modules

  • Implementation / lower level

design of the interface varies

  • Entity system may be

composition- or inheritance- based, or it might not exist

  • Messaging/event channels

may be e.g. per-entity or global

  • Connection based on IoC

(delegates / callback interfaces for game model objects, event handlers)

Somewhat homogeneous:

“entity system”

slide-22
SLIDE 22

Web Browser Engines

slide-23
SLIDE 23

Browser Engine: Definitions

  • webkit.org: “WebKit is an open source web browser engine”,

“All of the rendering logic, SVG support, transforms, network support, etc. is [in WebCore]” “WebKit: the front-end layer used by applications”

  • MDN: Gecko: “Gecko is the name of the layout engine developed

by the Mozilla Project.”

  • MDN: Introduction to Gecko and Embedding: “Gecko is the

browser engine, networking, parsers, content models, chrome and the other technologies that Mozilla and other applications are built from. In other words, all the stuff which is not application specific.”

slide-24
SLIDE 24

Browser Engine: Definitions

  • Generally: quite clear
  • Confusion: rendering engine and browser engine
  • Grosskurth and Godfrey: “an embeddable component that

provides a high-level interface to the Rendering Engine. It loads a given URI and supports primitive browsing actions such as forward, back, and reload. It provides hooks for viewing various aspects of the browsing session such as current page load progress and JavaScript alerts. It also allows the querying and manipulation of Rendering Engine settings.”

slide-25
SLIDE 25

A Reference Architecture for Web Browsers Engine Application

slide-26
SLIDE 26

WebKit, as provided in in OS X

KJS Networking PCRE JavaScript Interpreter XML Display Backend Expat

Foundation Core

User Interface Cocoa / Carbon Parser User Interface Browser Engine Rendering Engine Adapter (KWQ) KHTML Brower Engine (WebKit) Data Persistence

Secure (Keychain) Engine User Persistence Persistence Persistence

Safari Architecture WebKit Main API connection points

WebView

Connect app to browser engine by hosting a WebView instance and providing delegate protocol implementations Connect app to scripting environment via a WebView’s windowScriptObject and by attaching your own WebScripting protocol implementation(s) there

WebScripting, WebScriptObject Picture credit: A. Grosskurth and M.

  • W. Godfrey; Architecture and evolution
  • f the modern web browser
slide-27
SLIDE 27

Mozilla’s Gecko

Mozilla Architecture

Necko Security

(NSS/PSM)

Spider− Monkey Expat GTK+ Adapter JavaScript Interpreter XML Parser Networking Display Backend Rendering Engine Browser Engine UI Toolkit (XPFE) User Interface User Interface GTK+ / X11 Libraries Gecko Data Persistence

Persistence & Engine User, Secure,

Mozilla’s Main API connection points

nsWebBrowser

Connect app to browser engine by hosting an nsWebBrowser instance and providing delegate interface implementations Connect app to scripting environment via a nsIDOMWindow’s wrappedJSObject and by attaching your own XPConnect wrappers there

XPConnect Picture credit: A. Grosskurth and M.

  • W. Godfrey; Architecture and evolution
  • f the modern web browser
slide-28
SLIDE 28

The Internet Explorer engine, as provided in Windows

IE Main API connection points

Connect app to browser engine by hosting a WebBrowser instance (or to rendering engine by hosting an MSHTML instance) and providing delegate interface implementations

WebBrowser MSHTML

Connect app to scripting environment by providing IDispatch interface implementations for WebBrowser or MSHTML through the IDocHostUIHandler interface implementation

IDispatch

slide-29
SLIDE 29

Commonalities

  • Main connection point for embedding
  • r hosting: a class representing the

browser engine

  • Possibly also a class

representing the “raw” rendering engine (e.g. MSHTML in IE)

  • Connection based on IoC

(delegates / callback interfaces)

  • Interface between JavaScript

environment and host via mechanisms in the type system that connects the engine to the JS environment

Very homogeneous:

slide-30
SLIDE 30

Summary

Game Engines Browser Engines Definition

Vague Clear

Features

Variant Static

Interface

Somewhat homogeneous Homogeneous

Relevant Interface modules

Gameplay system, Entity management system, Event/Messaging system Browser engine component, (Rendering engine component), JavaScript environment’s window object

Interface Design

Framework (IoC) Framework (IoC)

slide-31
SLIDE 31

Questions; Discussion.

slide-32
SLIDE 32

References 1/2

  • J. Gregory, Game Engine Architecture. Wellesley, Massachusetts: A K Peters,

2009.

  • A. Grosskurth and M. W. Godfrey, “Architecture and evolution of the modern

web browser,” 2006, submitted for publication.

  • E. Folmer, “Component based game development – a solution to escalating

costs and expanding deadlines?” in CBSE, ser. Lecture Notes in Computer Science, H. W. Schmidt, I. Crnkovic, G. T. Heineman, and J. A. Stafford, Eds.,

  • vol. 4608. Springer, 2007, pp. 66–73.
  • M. Lewis and J. Jacobson, “Introduction,” Commun. ACM, vol. 45, no. 1, pp.

27–31, 2002.

  • A. Sherrod, Ultimate 3D Game Engine Design & Architecture. Charles River

Media, 2007.

slide-33
SLIDE 33

References 2/2

  • Panda3D Manual. http://www.panda3d.org/manual/
  • Crystal Space 3D: CEL Design Document. http://www.crystalspace3d.org/

main/CEL_Design

  • Crystal Entity Layer Manual. http://www.crystalspace3d.org/cel/docs/online/

manual-1.4/

  • Unreal Developer Network: Unreal Engine 3. http://udn.epicgames.com/

Three/

  • WebKit Objective-C Programming Guide. http://developer.apple.com/library/

mac/#documentation/Cocoa/Conceptual/DisplayWebContent/ DisplayWebContent.html

  • Mozilla Embedding APIs. http://www.mozilla.org/projects/embedding/

PublicAPIs.html

  • Mozilla Developer Network: XPConnect. https://developer.mozilla.org/en/

XPConnect

  • Microsoft Developer Network: Internet Explorer Development: Hosting and
  • Reuse. http://msdn.microsoft.com/en-us/library/aa752038(v=VS.85).aspx