shadow warrior 2 and the evolution of the roadhog engine, gic15

39
„Shadow Warrior 2 and the evolution of the Roadhog Engine” Jarosław Pleskot Senior Engine Programmer Flying Wild Hog 2015

Upload: jaroslaw-pleskot

Post on 29-Jan-2018

2.364 views

Category:

Engineering


0 download

TRANSCRIPT

Page 1: Shadow Warrior 2 and the evolution of the Roadhog Engine, GIC15

„Shadow Warrior 2 and the evolution of the Roadhog Engine”

Jarosław Pleskot Senior Engine Programmer

Flying Wild Hog

2015

Page 2: Shadow Warrior 2 and the evolution of the Roadhog Engine, GIC15

Presentation overview

1. Introduction

2. The engine evolution

a) Level construction pipeline

b) Character destruction

3. Foliage system 2.0

a) Architecture

b) Storage

c) Rendering

Page 3: Shadow Warrior 2 and the evolution of the Roadhog Engine, GIC15

Shadow Warrior vs Shadow Warrior

* both games run on PS4 and XONE, SW was ported to Mac and Linux externally

Shadow Warrior Shadow Warrior 2

Production time 18 months total > 2 years

Team size 35 50

Engine programmers 2 7

PC Platform differences* PC DX9 32 bit, ported to DX11 32/64 bit

PC DX11, 64 bit only

Multiplayer - COOP

Renderer Light Pre-Pass, nonlinear Deffered, linear, PBR

Page 4: Shadow Warrior 2 and the evolution of the Roadhog Engine, GIC15

The engine evolution

Page 5: Shadow Warrior 2 and the evolution of the Roadhog Engine, GIC15

Steps of the evolution

Hard Reset (DX9, 32 bit)

Shadow Warrior (DX9, 32 bit)

Shadow Warrior (32/64 bit

DX11/PS4/XONE)

Shadow Warrior 2 (64 bit DX11, PS4,

XONE)

• First version of

Roadhog Engine

• Light pre-pass

renderer

• Main + render

threads + a few

worker threads

(Havok, sound,

etc)

• Foliage system

• Mirror

• Cutscenes

• Animation system

extended

• SSAO

• Skinned decals

• Job system

introduced

• Renderer ported

• New platforms

• Extensive use of

job system

• Physically based

rendering

• Multiplayer

• Procedural

character

destruction

• Big change in

level pipeline

2011 2013 2014 2016

Page 6: Shadow Warrior 2 and the evolution of the Roadhog Engine, GIC15

For all FWH games before Shadow Warrior 2 level

geometry was constructed mainly outside game

editor.

• Hard reset: one big mesh + smaller meshes

• Shadow Warrior: a few parts of a level (loaded

or not) + smaller meshes + foliage

• Game editor was simple, focused on gameplay

design

Level construction pipeline

Page 7: Shadow Warrior 2 and the evolution of the Roadhog Engine, GIC15

Level construction pipeline

• Shadow Warrior 2 has randomized maps

• Four levels of randomization:

• large scale randomization: level blocks

connected together with special parts

(connectors) + background blocks

• small scale randomization : ability to

change/hide/show parts of a block

• random interiors

• random weather

Page 8: Shadow Warrior 2 and the evolution of the Roadhog Engine, GIC15

Level construction pipeline

• Now level construction is done in the game

editor

• A lot of new features added including:

• Terrain system(meshes creation+painting)

• Geometry brush (simple meshes)

• Wire modifier (static meshes deformation)

• Scaling support

Page 9: Shadow Warrior 2 and the evolution of the Roadhog Engine, GIC15

Character destruction

Hard Reset:

• ragdoll breaking

• swapping chunks

• spawning character parts

as static meshes

• swapping textures

„Hard Reset – Case Study”, Tomasz Baran, 2012

Page 10: Shadow Warrior 2 and the evolution of the Roadhog Engine, GIC15

Character destruction

Hard Reset:

+ fast

+ low memory cost

- limited to

noncontinues meshes

(robots)

- predefined places

of destruction

Page 11: Shadow Warrior 2 and the evolution of the Roadhog Engine, GIC15

Character destruction

Shadow Warrior:

• ragdoll breaking with

skinned mesh cloning

• character is made of parts

(standard, gore, skeleton)

• spawning character parts

as static meshes

• skinned decals

Page 12: Shadow Warrior 2 and the evolution of the Roadhog Engine, GIC15

Character destruction

Shadow Warrior:

+ excellent quality of

meshes

+ low CPU time cost

- a lot of work for

character artists

- predefined places

of cuts

Page 14: Shadow Warrior 2 and the evolution of the Roadhog Engine, GIC15

Character destruction

Shadow Warrior 2:

+ unique cuts

+ less work for artists

- more memory,

splitting time

- some constraints for

artists

Still under development

look for future presentations for details

Page 15: Shadow Warrior 2 and the evolution of the Roadhog Engine, GIC15

Foliage system 2.0

Page 17: Shadow Warrior 2 and the evolution of the Roadhog Engine, GIC15

Foliage system 2.0 – requirements

• Denser foliage

• Levels created in game editor

• Random level generation (level blocks, predefined parts of a block changed)

Must reinvent the foliage system!

Use (spatially) bigger meshes and reduce an instance size to lower the gather time

Page 18: Shadow Warrior 2 and the evolution of the Roadhog Engine, GIC15

Foliage system 2.0 – architecture

• Main classes:

• Foliage Area

• Foliage Layer

• Foliage Palette

• Foliage Set

• Foliage Element

Page 19: Shadow Warrior 2 and the evolution of the Roadhog Engine, GIC15

Foliage system 2.0 – layers

• Foliage layer - contains instance transformations in local space

• One Foliage Layer per gameobject with foliage painted

• Objects can be moved, rotated, scaled in editor, foliage will be updated properly

Foliage Area

Foliage Layer „A” Foliage Layer „B” Foliage Layer „N” …

Page 20: Shadow Warrior 2 and the evolution of the Roadhog Engine, GIC15

Foliage system 2.0 – layers

• On level start we build foliage grid using foliage layers of all created objects (random levels)

Foliage Area

Foliage Layer „A” Foliage Layer „B” Foliage Layer „N” …

World

Placeable „A”

Placeable „B”

Placeable „N” …

Page 21: Shadow Warrior 2 and the evolution of the Roadhog Engine, GIC15

Foliage system 2.0 – layers

• A foliage layer stores full FP32 positions and

FP16 normals together with coloring values, set

ids and seeds for a random number generator

• Foliage can be blocked in some areas using

foliage blockers (eg. don’t want foliage under a

randomly placed fountain)

• 100-200 layers per level block used

• Artist can change brush parameters without

repainting the layer

Page 22: Shadow Warrior 2 and the evolution of the Roadhog Engine, GIC15

Foliage system 2.0 – palette

• Painting using Foliage Set (Brush)

• One set can contain many elements

• Each element can specify many meshes and painting properties for all meshes in the element

Foliage Palette

Foliage Set „A”

Foliage Element 1

Foliage Element N

Foliage Set „N”

Foliage Element 1

Foliage Element N

… …

Page 23: Shadow Warrior 2 and the evolution of the Roadhog Engine, GIC15

Foliage system 2.0 – palette editor

Page 24: Shadow Warrior 2 and the evolution of the Roadhog Engine, GIC15

Foliage system 2.0 – painting

• Density counted for

every set individually

• Can erase instances of

a single set or all of

them at once

• Painting on

translucents as an

option (e.g. over/under

water)

• Angle limit (eg.

painting the stairs)

Page 25: Shadow Warrior 2 and the evolution of the Roadhog Engine, GIC15

Foliage system 2.0 – coloring

• Constant or

background color mode

• Can randomize color

in HSL space

• Can blend out

coloring using object

space Z coord and

multiplier

Page 26: Shadow Warrior 2 and the evolution of the Roadhog Engine, GIC15

Foliage system 2.0 – grids

• Multi resolution grids (2 levels: 4x4 and 64x64

meters, one grid per batch) in Shadow Warrior

DX11

Page 27: Shadow Warrior 2 and the evolution of the Roadhog Engine, GIC15

Foliage system 2.0 – storage (grid)

• Now more batches used and visibility test used

for foliage (software Z buffer visibility)

• One grid per batch changed to one grid for all

batches to reduce grid total traverse time and

to evade redundant visibility tests

Page 28: Shadow Warrior 2 and the evolution of the Roadhog Engine, GIC15

Foliage system 2.0 – storage

Instance size reduced from 32 to 16 bytes

struct SObject { Half4 m_plane0; // 8 Half4 m_plane1; // 16 Half4 m_plane2; // 24 Vec3Packed64 m_position;// 32 };

struct SObject { Half4 m_euler; // 8 Int16 m_worldZ; // 10 UInt8 m_localX; // 11 UInt8 m_localY; // 12 UInt32 m_coloring; // 16 };

Page 29: Shadow Warrior 2 and the evolution of the Roadhog Engine, GIC15

Foliage system 2.0 – storage

• Rotation stored as FP16 euler angles

• XY position relative to node corner

• Z in worldspace

• Position resolution ~1,6 cm, min/max Z = ±512 m

• Size generated at runtime

• Batch and LoD index in m_euler.W

struct SObject { Half4 m_euler; // 8 Int16 m_worldZ; // 10 UInt8 m_localX; // 11 UInt8 m_localY; // 12 UInt32 m_coloring; // 16 };

Page 30: Shadow Warrior 2 and the evolution of the Roadhog Engine, GIC15

Foliage system 2.0 – imposters

Imposter system was created for static meshes

• Diffuse + normal maps

• Many angles

Adopted for the foliage system:

• Yaw only rotation

• Sharpening

• Background color

Page 31: Shadow Warrior 2 and the evolution of the Roadhog Engine, GIC15

Foliage system 2.0 – imposters

• Enabled by default

• From 1 to 16 angles, default 4

• 3 texture sizes, default 128 (size == bigger dimension

of single image, power of 2)

• Range ratio, default 0.5 (?)

• Generation background color

• Sharpening option

Page 32: Shadow Warrior 2 and the evolution of the Roadhog Engine, GIC15

Foliage system 2.0 – imposters

meshes 100 %

imposters, 100 %

imposters, 20 % Level of detail:

• 3 stages for high

and ultra setting,

• 2 stages for low

setting (20% of

instances)

• Dissolve between

stages

Page 33: Shadow Warrior 2 and the evolution of the Roadhog Engine, GIC15

Foliage system 2.0 – imposters

OFF

Page 34: Shadow Warrior 2 and the evolution of the Roadhog Engine, GIC15

Foliage system 2.0 – imposters

ON

Page 35: Shadow Warrior 2 and the evolution of the Roadhog Engine, GIC15

Foliage system 2.0 – terrain

• Foliage is usually placed on the terrain

• Editing the terrain must update the foliage

• When painting we get positions and normals

from g-buffer

• When updating

terrain they are

recaluclated

from heightmap

Page 36: Shadow Warrior 2 and the evolution of the Roadhog Engine, GIC15

Foliage system 2.0 – backend

OFF • Traversing grid and gathering data for a

renderer using one separate job, many arrays of vertices copied to a single dynamic VB / passed to imposter system

• Rendering:

- main G-Buffer pass

- directional shadowmap pass

- ids for picking, editor only

Page 37: Shadow Warrior 2 and the evolution of the Roadhog Engine, GIC15

Foliage system 2.0 – to do list

• Coloring on imposters

• Dedicated instancing vertex format

• Reaction to the passing characters ?

Movies 1. https://youtu.be/hFz5OAVFSC8

2. https://youtu.be/SkEJ7ox2c8w

Page 38: Shadow Warrior 2 and the evolution of the Roadhog Engine, GIC15

Acknowledgment

Łukasz Zdunowski – Lead Artist

Zbigniew Siatecki – Senior Environment Artist

Marcin Sapiejewski – Senior Environment Artist

Przemysław Witkowski – 3D/Engine Programmer

Artur Maksara - Producer

+ our entire team and GIC staff.

Page 39: Shadow Warrior 2 and the evolution of the Roadhog Engine, GIC15

Thank you for your attention

Questions?

Contact: Email: jarek.pleskot AT flyingwildhog.com Twitter: @JaroslawPleskot Facebook: Jarosław Pleskot