roberto mangiafico, cto badseed entertainment - sleep attach: a technical post-mortem (how to web...

33
Sleep Attack TD The Technical Post Mortem Roberto Mangiafico

Upload: howtoweb

Post on 14-Jul-2015

348 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Roberto Mangiafico, CTO BadSeed Entertainment - Sleep Attach: A Technical Post-Mortem (How to Web Conference 2014 - Game Development Track)

Sleep Attack TDThe Technical Post Mortem

Roberto Mangiafico

Page 2: Roberto Mangiafico, CTO BadSeed Entertainment - Sleep Attach: A Technical Post-Mortem (How to Web Conference 2014 - Game Development Track)

Gameplay Programmer in Ubisoft Milan since 2007

In 2012 left Ubisoft and created Bad Seed with other colleagues

About Me

Page 3: Roberto Mangiafico, CTO BadSeed Entertainment - Sleep Attach: A Technical Post-Mortem (How to Web Conference 2014 - Game Development Track)

Bad Seed

Page 4: Roberto Mangiafico, CTO BadSeed Entertainment - Sleep Attach: A Technical Post-Mortem (How to Web Conference 2014 - Game Development Track)

Sheep Up!

Page 5: Roberto Mangiafico, CTO BadSeed Entertainment - Sleep Attach: A Technical Post-Mortem (How to Web Conference 2014 - Game Development Track)

Sleep Attack

Page 6: Roberto Mangiafico, CTO BadSeed Entertainment - Sleep Attach: A Technical Post-Mortem (How to Web Conference 2014 - Game Development Track)

Sleep Attack: featuring and critics

Page 7: Roberto Mangiafico, CTO BadSeed Entertainment - Sleep Attach: A Technical Post-Mortem (How to Web Conference 2014 - Game Development Track)

Engine and Tools

Page 8: Roberto Mangiafico, CTO BadSeed Entertainment - Sleep Attach: A Technical Post-Mortem (How to Web Conference 2014 - Game Development Track)

3D Camera in 2D game: Why

1. Circles in perspective2. 3D movement feeling

Page 9: Roberto Mangiafico, CTO BadSeed Entertainment - Sleep Attach: A Technical Post-Mortem (How to Web Conference 2014 - Game Development Track)

3D Camera in 2D game

Gameplay camera

Page 10: Roberto Mangiafico, CTO BadSeed Entertainment - Sleep Attach: A Technical Post-Mortem (How to Web Conference 2014 - Game Development Track)

3D Camera in 2D game: Issue #1

Z fight problem

Not good looking perspective on objects

Page 11: Roberto Mangiafico, CTO BadSeed Entertainment - Sleep Attach: A Technical Post-Mortem (How to Web Conference 2014 - Game Development Track)

3D Camera in 2D game: Issue #1

Solution: Every object is counter rotated towards the gameplay camera

Page 12: Roberto Mangiafico, CTO BadSeed Entertainment - Sleep Attach: A Technical Post-Mortem (How to Web Conference 2014 - Game Development Track)

3D Camera in 2D game: Issue #1

Page 13: Roberto Mangiafico, CTO BadSeed Entertainment - Sleep Attach: A Technical Post-Mortem (How to Web Conference 2014 - Game Development Track)

3D Camera in 2D game: Issue #2

Border artifact

Page 14: Roberto Mangiafico, CTO BadSeed Entertainment - Sleep Attach: A Technical Post-Mortem (How to Web Conference 2014 - Game Development Track)

3D Camera in 2D game: Issue #2

Rendering order:

A

B

Draw B

Blend border transparence with background color Write on the Z buffer

Draw A

Find Z buffer with higher value Can’t blend with the B object border

Page 15: Roberto Mangiafico, CTO BadSeed Entertainment - Sleep Attach: A Technical Post-Mortem (How to Web Conference 2014 - Game Development Track)

Possible solution:

High value of cut off on the shader

Cons:

Very aliased borders

3D Camera in 2D game: Issue #2

Page 16: Roberto Mangiafico, CTO BadSeed Entertainment - Sleep Attach: A Technical Post-Mortem (How to Web Conference 2014 - Game Development Track)

Possible solutions:

Setup the camera to use Z distance only for rendering order

Cons:

1. Very hard to manage for 200+ object per scene

2. Prompt to error

3. Don’t work for moving objects

3D Camera in 2D game: Issue #2

Page 17: Roberto Mangiafico, CTO BadSeed Entertainment - Sleep Attach: A Technical Post-Mortem (How to Web Conference 2014 - Game Development Track)

Very high draw call number for mobile game

200+ object per level

Almost every object is animated

3D Camera in 2D game: Issue #3

Page 18: Roberto Mangiafico, CTO BadSeed Entertainment - Sleep Attach: A Technical Post-Mortem (How to Web Conference 2014 - Game Development Track)

Possible Solution:

Use Unity batching

Cons:

Objects must be static : No animation, No movement

3D Camera in 2D game: Issue #3

Page 19: Roberto Mangiafico, CTO BadSeed Entertainment - Sleep Attach: A Technical Post-Mortem (How to Web Conference 2014 - Game Development Track)

The Mesh Merger

Create a big mesh with all the meshes vertices

Apply the transforms animations of objects

Keep the meshes UV’s

Order the meshes from top to bottom of the screen

The solution we chose

Page 20: Roberto Mangiafico, CTO BadSeed Entertainment - Sleep Attach: A Technical Post-Mortem (How to Web Conference 2014 - Game Development Track)

Every mesh:

At scene loading register himself to its MeshMerger

Mesh Merger at mesh registration:

Store the vertices and the transform into a struct inside an array containing all the registered meshes info

Mesh Merger – How it works

Page 21: Roberto Mangiafico, CTO BadSeed Entertainment - Sleep Attach: A Technical Post-Mortem (How to Web Conference 2014 - Game Development Track)

Mesh Merger at mesh registration:

Disable the renderer of the registered mesh

Order the vertices from up to bottom

Mesh Merger – How it works

Page 22: Roberto Mangiafico, CTO BadSeed Entertainment - Sleep Attach: A Technical Post-Mortem (How to Web Conference 2014 - Game Development Track)

Every frame:

Apply the transformation to the vertices of the mesh

Order the vertices from up to bottom IF NEEDED

Mesh Merger – How it works

Page 23: Roberto Mangiafico, CTO BadSeed Entertainment - Sleep Attach: A Technical Post-Mortem (How to Web Conference 2014 - Game Development Track)

Pro:

1. Resolve draw call issue

2. Resolve rendering order issues

3. Work with transform animated objects

4. Work with uv animated object

Cons:

1. Script a bit heavy on the cpu

2. All the meshes registered into a mesh merger must have the same material

Mesh Merger

Page 24: Roberto Mangiafico, CTO BadSeed Entertainment - Sleep Attach: A Technical Post-Mortem (How to Web Conference 2014 - Game Development Track)

No dynamic List<>

Optimized for quad

Mesh Merger – Optimizations

Page 25: Roberto Mangiafico, CTO BadSeed Entertainment - Sleep Attach: A Technical Post-Mortem (How to Web Conference 2014 - Game Development Track)

Before:

Mesh Merger – Comparison

After:

Page 26: Roberto Mangiafico, CTO BadSeed Entertainment - Sleep Attach: A Technical Post-Mortem (How to Web Conference 2014 - Game Development Track)

Different screen ratio 16:9 – 4:3 – 1:1 – 3.2:19

Different resolutions and dpi

Problems:

• Adapt the HUD

• Adapt the 3D view

• Adapt the resolution for dpi

Different screen types

Page 27: Roberto Mangiafico, CTO BadSeed Entertainment - Sleep Attach: A Technical Post-Mortem (How to Web Conference 2014 - Game Development Track)

Adapt the HUD

Different screen types: Issue #1

New Unity GUI system not yet available

Created our own dynamic HUD system

Page 28: Roberto Mangiafico, CTO BadSeed Entertainment - Sleep Attach: A Technical Post-Mortem (How to Web Conference 2014 - Game Development Track)

Dynamic HUD system

• Dedicated camera• 3D panels• Position relative to screen

Page 29: Roberto Mangiafico, CTO BadSeed Entertainment - Sleep Attach: A Technical Post-Mortem (How to Web Conference 2014 - Game Development Track)

Adapt the 3D view

Different screen types: Issue #2

No need to change nothing for different ratioSimply we see more background elements

Page 30: Roberto Mangiafico, CTO BadSeed Entertainment - Sleep Attach: A Technical Post-Mortem (How to Web Conference 2014 - Game Development Track)

Adapt for different resolutions

For devices with high resolution we needed an hd version

For almost everything we have a double version – SD and HD

HD has twice the resolution of SD

At the level load we load HD version if needed

Different screen types: Issue #3

Page 31: Roberto Mangiafico, CTO BadSeed Entertainment - Sleep Attach: A Technical Post-Mortem (How to Web Conference 2014 - Game Development Track)

Big memory load due to high number of textures with low compression and sounds

Average 150MB for SD Level

Average 300MB for HD Level

1. Load only needed sounds and textures

2. Mid loading level

3. Load everything at startup, nothing during gameplay

4. Load only needed resolution HD/SD

Memory issues

Page 32: Roberto Mangiafico, CTO BadSeed Entertainment - Sleep Attach: A Technical Post-Mortem (How to Web Conference 2014 - Game Development Track)

Q/A

Page 33: Roberto Mangiafico, CTO BadSeed Entertainment - Sleep Attach: A Technical Post-Mortem (How to Web Conference 2014 - Game Development Track)

Thank you!