46
Brewing Your Brewing Your Own Game Own Game Engine Engine The Pros & Cons of Using Open Source Software to The Pros & Cons of Using Open Source Software to Rapidly Develop Cross-platform Indie Games and Tools Rapidly Develop Cross-platform Indie Games and Tools Ye Feng

Brewing Your Own Game Engie eng

Embed Size (px)

DESCRIPTION

The Pros & Cons of Using Open Source Software to Rapidly Develop Cross-platform Indie Games and Tools

Citation preview

Page 1: Brewing Your Own Game Engie eng

Brewing Your Brewing Your Own Game Own Game

EngineEngineThe Pros & Cons of Using Open Source Software to The Pros & Cons of Using Open Source Software to

Rapidly Develop Cross-platform Indie Games and ToolsRapidly Develop Cross-platform Indie Games and ToolsYe Feng

Page 2: Brewing Your Own Game Engie eng

What’s In The Talk

No rocket science

From practical experience

Arguable

Page 3: Brewing Your Own Game Engie eng

Who We Are

Page 4: Brewing Your Own Game Engie eng

Project OneTap

One One ButtonButton

2D Action2D Action

Simple Simple PuzzlePuzzle

CasualCasual

CustomizabCustomizable Levelsle Levels

Page 5: Brewing Your Own Game Engie eng

Challenge:Level Design

Page 6: Brewing Your Own Game Engie eng

Wise Man Builds His House On The

Rock

Option 1: Cheap Commercial Engine

Option 2: Open Source Engine

Page 7: Brewing Your Own Game Engie eng

Cheap Commercial Engine

Pros

IDE

Cross platform(when officially supported)

Moderate license fee

Cons

Offline IDE

Portability(when not officially supported)

No source code

Pure script driven

Page 8: Brewing Your Own Game Engie eng

Open Source Engine

Pros

Source code

Cross platform

Free

Cons

No IDE

Pure native code driven

Open Source License

Page 9: Brewing Your Own Game Engie eng

Choice

Option 1: Cheap Commercial Engine

Option 2: Open Source Engine

Option 3: Open Source Engine + Game Support Layer

Allegro

http://alleg.sourceforge.net/

Page 10: Brewing Your Own Game Engie eng

Demo

Page 11: Brewing Your Own Game Engie eng

What’s In ItGame Object System

Script Integration

Physics Integration

Content pipeline tools

Others

Simple Scene Management

Action System

Script Key-Value Dictionary

etc...

Page 12: Brewing Your Own Game Engie eng

Game Object System

Page 13: Brewing Your Own Game Engie eng

Inheritance & Gameplay

Development

Gameplay dev nature: iteration

Iteration causes changes

Inheritance: not change-friendly

Page 14: Brewing Your Own Game Engie eng

Good

Page 15: Brewing Your Own Game Engie eng

Bad

Page 16: Brewing Your Own Game Engie eng
Page 17: Brewing Your Own Game Engie eng
Page 18: Brewing Your Own Game Engie eng
Page 19: Brewing Your Own Game Engie eng
Page 20: Brewing Your Own Game Engie eng
Page 21: Brewing Your Own Game Engie eng

Design Pattern

Favor object composition over class inheritance

Page 22: Brewing Your Own Game Engie eng

Game Object & Game Component

Composition instead of inheritance

A object of gameplay logic

Is composed by multiple functional components

Game Game ObjectObject

Component Component #1#1

Component #2Component #2

Component #3Component #3

Page 23: Brewing Your Own Game Engie eng

Game Object & Game Component

Add/remove component in runtime

Key to build an IDE

Page 24: Brewing Your Own Game Engie eng

Composition To The Rescue

Page 25: Brewing Your Own Game Engie eng

Basic ComponentsPositioning info: Transform

2D rendering: Sprite

Bitmap info: Bitmap Source

Input processing: Event Receiver

Rigid body entity: Body

Collider entity: Fixture

Particle effect: Particle Emitter

etc...

Page 26: Brewing Your Own Game Engie eng

User Components

Arbitrary stuff that gameplay needs

Rotation forever

A goal in level

The behavior of characters

A spike need to be avoided

Line drawer needed by editor

etc...

Page 27: Brewing Your Own Game Engie eng

Demo

Page 28: Brewing Your Own Game Engie eng

Script Integration

Page 29: Brewing Your Own Game Engie eng

Dilemma of Native

Compilation time

Runtime modification

Advanced language feature

“Glue” code

Page 30: Brewing Your Own Game Engie eng

2-tiers System To The Rescue

Core: native code

Editor and gameplay: script

Lua

Page 31: Brewing Your Own Game Engie eng

Related Works

Communication between native and script

Export tools/libraries

Script API

Page 32: Brewing Your Own Game Engie eng

Communication - Native & Script

Simple interfaces/engine API

tolua

http://www.tecgraf.puc-rio.br/~celes/tolua/

Simple, no compilation cost

Complex interfaces

Lua C API

Page 33: Brewing Your Own Game Engie eng

Related Works cont.

Serialization

Load/save, editor

Support for advanced features

Reference

Function object, closure

etc...

Page 34: Brewing Your Own Game Engie eng

Serialization

Pluto

https://github.com/hoelzro/pluto

Write serialization code for every component

1000 lines of Lua code

Page 35: Brewing Your Own Game Engie eng

Prefabricated Object

Take snapshot of object

Parameters

References

Hierarchy

Assisted object design

Level editor ➔ object editor

Page 36: Brewing Your Own Game Engie eng

Patching

Patching binary ➔ patching data

Page 37: Brewing Your Own Game Engie eng

Demo

Page 38: Brewing Your Own Game Engie eng

Content Pipeline Tools

Page 39: Brewing Your Own Game Engie eng

DCC Tools

Flash?

Page 40: Brewing Your Own Game Engie eng

StaticStatic

AnimationAnimation

Pipeline

FlashFlash

PhotoshoPhotoshopp

ExporExportt ManuallManuall

y y Created Created

AtlasAtlas

IDEIDE

GameGame

Page 41: Brewing Your Own Game Engie eng

Solution

swfdec

Open source Flash player

LGPL

swfdec-dumper

Surface ➔ disk

https://github.com/fengye/swfdec-dumper

Page 42: Brewing Your Own Game Engie eng

Pipeline 2.0

StaticStatic

AnimationAnimation

FlashFlash

PhotoshoPhotoshopp

IDEIDE

GameGame

swfdec swfdec dumpedumpe

rr ManuallManually y

Created Created AtlasAtlas

☹☺

Page 43: Brewing Your Own Game Engie eng

Atlas Tool

Stitch bitmap into Atlas

Automation

Transparent process

Page 44: Brewing Your Own Game Engie eng

Texture Atlas Gen

nVidia Texture Atlas Tools

File format support☺

Mipmap☺

Free☺

Only for sprite sheets☹

Pack algorithm

Page 45: Brewing Your Own Game Engie eng

Pipeline 3.0

StaticStatic

AnimationAnimation

FlashFlash

PhotoshoPhotoshopp

IDEIDE

GameGame

swfdec swfdec dumpedumpe

rr Texture Texture Atlas Atlas GenGen

☺☺

Page 46: Brewing Your Own Game Engie eng

Questions?