How we did 60FPS in our 3D RTS mobile game

Post on 11-Jul-2015

884 views 2 download

transcript

How We Did 60fps

In Our 3D RTS Mobile Game

Daniel Sim - Senior Developer

Nonstop Games - A King studio

Oct 2014

● Quick Intro

● 3D RTS on Mobile

● Q&A

● Hands-on + Lunch

Overview

About Me

● Started Game Programming in 1987

● Was a “3D Artist” in a previous life (7 years)

● Made game that hit #23 What’s Hot Role

Playing Games for iPad (U.S. App Store)

● MMO Gamer - WoW, EVE Online

● 2009 Singapore Champion - Radio

Controlled Helicopter Aerobatics

● Founded in 2011 - Teemu, Henrik, Juha,

Henrico 17 of us - Passionate about Making Games Gamers

Love

o Encourage Innovation, Individuality

About Nonstop Games

● Real-time Map Strategy War Game (2D)

● App Store Feature (> 100 countries)

Heroes of Honor

About the Kingdom

● Maker of Candy Crush, Farm Heroes, Pet

Rescue, and more!

● 6 Studios in Europe

● Nonstop Games is King’s 1st Studio in Asia!

● Bi-annual Infomarket

● Induction in Europe (Berlin)

● Brand New Office in the City

● Access to network of artist and developers

(Platforms to Share Knowledge)

● And more!

Kingdom Perks

Global Kingdom of Fun

● 345 Million Monthly UNIQUE Users

● 1.2 Billion Average Daily Game Plays

● Truly Free-to-play

Nonstop Games - A King Studio

● Independent Studio

● Fun, Innovative Games

● Beyond Traditional Casual Genre

● Bring Best of East to the Global Market

● Amazing Games in the pipeline

Introducing Our Tech Demo

● FLEET - Naval RTS Prototypeo Current Mobile RTS Examples

o What Might Happen in The Near Future

o Requirements for the Tech Demo

o Ocean Simulation

o Tech Details

o Rendering Techniques

Current Mobile RTS On Mobile

● Clash of Clans

● Boom Beach

In The Near Future...

● High Fidelity 3D Graphics

● Silky Smooth Framerates

● More Complex Battle Mechanics

● Lots of RTS games on mobile

● Many “entry-level” smartphones in use

Tech Demo Requirements

● Naval Combat Game (with Vikings!)

● Hundreds of Units (3D Character Animation)

● Particle Effects for Explosions and Water

● WOW! Ocean Simulation+Effects

● Real-time Physics+AI for Units

● < 100MB Memory Usage (Core Runtime)

Ocean Demo

Video time!

Ocean Simulation

● Try for “Never seen before”

● Works on “all” phones

● Complex Problem

● Techniques apply to any “ground”

Pieces of an Ocean

Detail Normal MapsReflection Map

Displacement+Normal Maps

Displace+Normal Animated Blend

Map A moves

Map B is faster

● RGB is Normal, Alpha is Displacement

● 8x Over-sample over U axis

● Same Technique for Detail Normal Maps

Detail Normal Maps

● Inexpensive “Close-up” Detail

● 4 Normal Map Layers in total

3D Normals into 2D Texture Coords

Reflection Map (Fresnel Mimic)

Challenges (of Oceanic proportions)

● Displacement and Normal Map Size

● Reflection Mapping

● Texture Look-up Bandwidth

● Artist deliver the “Punchline”

● Particle Projection Mappingo Pre-render Noise

o Generate Projected Mesh

o Minimize Overdraw

o A Whole Topic on its own

Epic Naval Battle

Another video!

Tech Details (Entities)

● Fleet Prototype @60fps (iPad 4)

o 4k Bone Animated Tris (4 skin weights per vertex)

o 23k Transform Animated Tris

o 42k Static Tris

o Above Tris are with normals and lit with 2 lights,

ambient + directional

o Box2D physics with 30 dynamic bodies and 28 static

bodies

Tech Details (Ocean + Effects)

● Full scene displacement animated Ocean

Mesh

o 32k tris

o 3.9k tris with particle billboard animation projected

on Ocean Mesh (Ship Wakes)

● Particle Effects

o 1.6k particle billboard animated sprite tris

o Smoke, Explosions and Spells

● Grand Total

o 107,000 Triangles Per Frame

Tech Details (AI, Sound)

● AI + Physics

o Nearest target fire and movement

o AI controls 30 ships

● 16 concurrent sound channels

o 3D spatial processing

32 Ships and a Base on an iPad 2

Brand X (3D Engine)

26 FPS

44 FPS

3D Rendering (1 of 3)

● SIMD capable Vector Matho GLM - Second fastest library, most portable

● Vertex Buffer Objects (VBO)o Pre-load vertex data to GPU

● Vertex Array Objects (VAO)o Pre-configure rendering programs on GPU

3D Rendering (2 of 3)

● Multi-thread Ready (WIP)o Entity Render States are Thread Safe

● Future Proofo Apple Metal Ready

o UBO and Geometry Instancing will be quick to

integrate (OpenGL ES 3.0)

● Vertex Cache Optimized Mesh Export

3D Rendering (3 of 3)

● Particle Animationo Export Baked Animation from Maya

o Animated Attributes Per Particle:

Sprite Frame

Opacity

Twist

Scale

Shaders

● Right Shader for the Right Jobo Optimize where it matters

o Easy to write, use and benchmark custom shader

● Shader Uniformso Aggressive use

o 400% faster than glBufferData (selected use case)

Animation

● Export from C++ Maya Plugin

o Skeleton Animation

o Quaternion Rotations

Record and Interpolation

● GPU based mesh deformation

File Formats

● Mesh, Animation, Collision, Particle and Font

● No-fluff Binaryo Depends on Artist/Content Tools to pull-it together.

● Memory dump of GPU buffer o As fast as it gets

o Not possible all the time

o Amazing with Apple Metal

Questions Please!

● Know Each Other Better

● Seen how we make a naval RTS game

● Went through rendering techniques

● Try the Tech Demo for yourself

o Lunch!

Recap

nonstop-games.com/jobs

linkedin.com/in/danniesim

Thank You!