pptx - NaimadGames.com

hedgebornabaloneΛογισμικό & κατασκευή λογ/κού

2 Δεκ 2013 (πριν από 3 χρόνια και 9 μήνες)

88 εμφανίσεις

Damián Isla, Moonshot Games

HEY INDIES,

IT’S
A
GREAT
TIME
TO
BUILD
AN
ENGINE

Disclaimers


1.
Goes against history and common sense


2.
Not for everyone



You Know You Want To



Build your own game engine!

“Reinventing the wheel”

“I get total control”

“I know exactly how

everything works”

“I am more emotionally invested

when it’s my own tech.”

“We can get on to more platforms faster.”

Write games, not engines

Observations


1.
You can reinvent as much of the wheel as you
want.


2.
The Engine IS the Game



ENGINES ARE CONTENT MACHINES

Part 1:

What Makes a Great Engine?

NOT


rendering


physics


AI


The ability of content creators to shovel content
into the game as fast as possible


... and to iterate on it.

The Content Problem

“Shovel content into the game as fast possible.”


Bitmaps


Audio


Models


Environments


Animations


Objects


Behavior


...


???

Model

Geometry

Textures

LOD 1

LOD 2

LOD 3

...

Color

Bump

Detail

Specular

...

Skeleton

LOD 1

LOD 2

LOD 3

...

Vertex weights

AI

Behavior

Perception

Script support

...

Animations

Action logic

Ragdoll

Audio

FX

Dialogue

...

Game
params

(~10
bajillion
)

CryEngine 2

Sandbox
TM

/ Roads and Rivers Tool

CryEngine

2

Editor

full
-
featured terrain

editor


Storage

Parametric surface


Runtime

Dynamically tessellated polygon
-
based terrain



Flexibility vs. Usability

Flexibility

Usability

Universal Principles of Design


Lidwell
, Holden & Butler , 2003

Generality vs. Usefulness

Generality

Usefulness

Behavior

Your Engine

Universal Principles of Design


Lidwell
, Holden & Butler , 2003

Bitmaps

Licensed Engine

The Content Meta
-
Problem

“Shovel content into the game as fast possible.”


Bitmaps


Audio


Models


Environments


Animations


Objects


Behavior


...


Find
the Game as fast possible.


(i.e. define all of the above)


MIDDLEWARE

Part 2:

The Hard Bits

Reinvent as much of the wheel as necessary.



Physics


Animation


Scripting


Pathfinding


For the rest, there’s middleware.


The Ideal

The best way to build an engine is to assemble it.

Choose your Price

Box2d, Bullet



Havok

Physics,
PhysX

Cal3d



Granny,
Havok

Behavior,
Morpheme

GameSWF



Scaleform
,
Iggy

Lua



... Lua?

Recast,
OpenSteer



AI.implant
,
Kynapse
,
Navpower

SPUTNIK

Part 3:

Sputnik



Dev Time: ~ 1 year



Team size: 2



Cost: $0 (excluding labor)

Clear

Maintainable

Iterable

Philosophy

Performant,
Game
-
agnostic

Exquisitely
Engineered

C++

Loose

Game
-
specific

Sputnik

App
-
Layer Features





AI / A*


2d physics


Embedded Flash


Layer
-
based rendering


skeletal 2d animation

Sputnik

Core Features



data
-
reflection


component

object
-
model


data versioning


pervasive scripting


C# Editor Bindings


memory management


performance tools


XML / binary file formats


in
-
engine Performance tools


“High
-
leverage

technologies”

Sputnik

Core Features



data
-
reflection


component

object
-
model


data versioning


pervasive scripting


C# Editor Bindings


memory management


performance tools


XML / binary file formats


In
-
engine Performance tools


Data Reflection

Run
-
time information about the structure of data types


Do you have a field named “
foo
”?


What is the offset of that field from the start of the instance?


Is it read
-
only?


Note:


Built into Java/C#


Implicit in C/C++


The Big Advantage: allow type
-
agnostic code

Data Reflection

C++ Class

(
file.h
)

Run
-
time

Schema

C# Glue

Parse

(Python)

Data

Serialization

Versioning

Lua

C# Editors

s_plane2d::x_s_plane2d_schema_handle=
schema_new
("s_plane2d", "");

if (s_plane2d::x_s_plane2d_schema_handle.valid())

{


s_schema

*schema= s_plane2d::x_s_plane2d_schema_handle.get();


schema
-
>
set_initialize
(s_plane2d_initialize);


schema
-
>
set_erase
(s_plane2d_erase);


schema
-
>
add_struct_field
("normal", "s_vector2d", _
read_write
, 1);


schema
-
>
add_struct_field
("point", "s_vector2d", _
read_write
, 1);



schema
-
>
set_expected_size
(
sizeof
(s_plane2d));

}


Note: We DON’T support


multiple
inheritence


virtual functions

Pervasive Scripting

The Goals



Everything you can do in C++, you can do in Script



To Create a Continuity between Prototyping and
Production

Pervasive Scripting

We use
Lua


Runtime recompilation


Dynamic typing



Two parts


Component scripts


System scripts

Hurray!

2x Productivity

Kill me now

Component Scripts

A*

Perception/
Ray
-
casting

Target
selection

Behavior

Physics

Animation
playback

Animation
control

Squad
behavior

Random

Script

Component Scripts

A*

Perception/
Ray
-
casting

Target
selection

Behavior

Physics

Animation
playback

Animation
control

Squad
behavior

Random

Script

System Scripts

I/O

Boids

Subtitles

Console

Effects

Rendering

Achievements

Missions

Random

Script

System Scripts

Missions

A Note on Script Data

Script data will need to


Serialize


Version


Interoperate with tools


All of this suggests


All script data is schematized


The engine manages all script data


Lua’s

memory pool is transient


Ancillary benefit: One
lua

state per source file, not one per
instance.

The Result

Systems that don’t exist in Fallen Frontier:


Health / death / damage


Weapons / items / equipment / powers


AI


Behavior


HUD / UI / Menus


Missions / Levels / Objectives


C# Editor Bindings

Why C#?


The best language for the job


Easy, familiar, elegant


Reasonably performant


Massive availability of dev tools


syntax coloring,
intellisense


winforms


Organization


Build Sputnik Core as DLL


Reflection Layer in C#


Reflected classes call transparently into DLL

A Word on Editors

The two most important workflow /

productivity technologies ever invented:



Copy / paste

Undo / Redo


(Hard to start with, very VERY hard to retro
-
fit.)



DEMO

Ideas


The Engine is the Game


Game Concepts are Supported at Every Level


Flexibility vs. Usability


Meta
-
Content: Finding the Game


Tight Core vs. Loose App Layer


High
-
Leverage Technology


Data Reflection


Pervasive scripting


Tools

Necessities


Time


Experienced engineering


Data


Serialization


Versioning


Tools


Don’t be afraid to go custom


Optimize the critical pipelines


Undo/redo


Copy/paste

“Write Games Not Engines”



Yes.


Don’t build in isolation

You won’t get your representations right

The Engine IS the game

Thanks!