460 likes | 579 Views
Hey Indies, It’s a Great time to Build An Engine. Damián Isla, Moonshot Games. Unannounced. Disclaimers. Goes against history and common sense Not for everyone. You Know You Want To. Build your own game engine!. “I am more emotionally invested when it’s my own tech.”.
E N D
Hey Indies,It’s a Great time to Build An Engine Damián Isla, Moonshot Games
Disclaimers • Goes against history and common sense • Not for everyone
You Know You Want To Build your own game engine!
“I am more emotionally invested when it’s my own tech.” “I get total control” Write games, not engines “Reinventing the wheel” “I know exactly how everything works” “We can get on to more platforms faster.”
Observations • You can reinvent as much of the wheel as you want. • The Engine IS the Game
Part 1: Engines are Content machines
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 • ... ???
Audio Skeleton FX Dialogue ... Model LOD 1 LOD 2 LOD 3 ... Vertex weights Geometry LOD 1 LOD 2 LOD 3 ... Animations Textures Action logic Color Bump Detail Specular ... Game params (~10 bajillion) AI Behavior Perception Script support ... Ragdoll
CryEngine 2 Sandbox TM / Roads and Rivers Tool
CryEngine 2 Editorfull-featured terrain editor StorageParametric surface RuntimeDynamically tessellated polygon-based terrain
Flexibility vs. Usability Usability Flexibility Universal Principles of Design – Lidwell, Holden & Butler , 2003
Generality vs. Usefulness Your Engine Licensed Engine Bitmaps Usefulness Behavior Generality Universal Principles of Design – Lidwell, Holden & Butler , 2003
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)
Part 2: Middleware
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.
Part 3: Sputnik
Sputnik • Dev Time: ~ 1 year • Team size: 2 • Cost: $0 (excluding labor)
Philosophy Script Clear Loose Maintainable Performant, Game-agnostic Exquisitely Engineered C++ Game-specific Iterable
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
Versioning Data Reflection Lua Data Serialization 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)); } Run-time Schema C++ Class (file.h) Parse (Python) C# Glue • Note: We DON’T support • multiple inheritence • virtual functions C# Editors
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 Perception/Ray-casting Behavior A* Target selection Squad behavior Animation control Random Script Animation playback Physics
Component Scripts Perception/Ray-casting Behavior A* Target selection Squad behavior Animation control Random Script Animation playback Physics
System Scripts Boids Console I/O Subtitles Missions Achievements Random Script Rendering Effects
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.)
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