building game ui with webkit

73
Building Game UI with WebKit Christopher Stott ([email protected]) GDC Canada – May 6 th 2010

Upload: gafna

Post on 24-Feb-2016

81 views

Category:

Documents


2 download

DESCRIPTION

Building Game UI with WebKit. Christopher Stott ([email protected]) GDC Canada – May 6 th 2010. Building online frontend can be expensive. There’s a way that makes things a lot easier. Not without trade-offs. . Social FEATURES. skate’s always been a sharing game. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Building Game UI with WebKit

Building Game UI with WebKitChristopher Stott ([email protected])

GDC Canada – May 6th 2010

Page 2: Building Game UI with WebKit

Building online frontend can be expensive.

There’s a way that makes things a lot easier.

Not without trade-offs.

Page 3: Building Game UI with WebKit

SOCIAL FEATURES.

Page 4: Building Game UI with WebKit

skate’s always been a sharing game

Page 5: Building Game UI with WebKit

Over 3 million videos uploaded

Over 20 million videos watched

Players shared over 400k spots

Page 6: Building Game UI with WebKit

May 11th !

Page 7: Building Game UI with WebKit

skate.feed

Extensible system. We can add new messages even after we ship.

Gives us the chance to highlight DLC

Permeates through the entire game

You, your friends and the wider community

Page 8: Building Game UI with WebKit

Landing page. What’s been happening since you last played?

Page 9: Building Game UI with WebKit

View the videos, photos and parks your friends created as you launch into the game.

Page 10: Building Game UI with WebKit

‘Friend beat your challenge score’

‘You’ve been invited to a team’

‘Friend uploaded a skate.park’

‘Friend uploaded a video to skate.reel’

‘Content was featured’

‘Team Logo was changed’

‘Somebody joined your team’

‘Your friend unlocked a new trophy / achievement’

‘New DLC available for download’

What messages do we send?

Page 11: Building Game UI with WebKit

Teams can compete together and create together. Plenty of tools for customising the experience and communicating.

Page 12: Building Game UI with WebKit

skate.Park

Create a park. Share with friends & community. Play online together in it.

Page 13: Building Game UI with WebKit

INTRODUCTION TO WEBKIT

Page 14: Building Game UI with WebKit

What is WebKit?

At the heart of many modern web browsers : chrome / safari / iphone / other smart phones

Page 15: Building Game UI with WebKit

Web Layout Engine

Heart of a web browser

Job to render HTML

Responds to user input

Reads resources from network

Page 16: Building Game UI with WebKit

EA took WebKit & got it working on consoles

Page 17: Building Game UI with WebKit

How did Skate 3 use it?

• Used it for about 50% of our UI• Particularly online-connected features

– Team Management / Team Profiles– skate.Feed landing page– Leaderboards– Player Profiles

Page 18: Building Game UI with WebKit

It isn’t about letting users go to arbitrary websites within the game. Present them with a walled garden.

Page 19: Building Game UI with WebKit

T

Two key concepts of the talk

Using a web layout engine to build UI

Dynamically serving content from online

Separate ideas, but fit naturally together.

Page 20: Building Game UI with WebKit

Very new.

• First console game to integrate WebKit• Has huge potential, but plenty to prove• Not a silver bullet• Not right for all feature sets• Requires different skill sets from those

working with it

Page 21: Building Game UI with WebKit

WEB DEVELOPMENT IN 5 MINUTES

Page 22: Building Game UI with WebKit

HTMLContent,

Information

JavascriptBehaviour,

Interactivity,Animation

CSSLook,

Appearance,Style

Three key pieces

Page 23: Building Game UI with WebKit

CONTENTTHE HTML PART

Page 24: Building Game UI with WebKit

HTML

• Content of the page, separated from how it looks & how it behaves.

• Let’s us focus on what information should be on screen, separately to how it’s presented.

Page 25: Building Game UI with WebKit

What’s AJAX?

• Basically means ‘Background Update’• Initiated by client (user activity or timer)• Way to update the page without doing an

expensive & jarring full page load.

Page 26: Building Game UI with WebKit

Page

Full Page Load :Full page worth of HTML generated,

delivered and consumed

AJAX Updates : HTML Fragments

Javascript APIs

How content gets onto a page

Page 27: Building Game UI with WebKit

Where does HTML come from?

file:// Real Web Server In-Game Web Server

Really that’s entirely up to youOne of the most important points of the talk

Most powerful is a combination of all three.

Page 28: Building Game UI with WebKit

Bring your own backend.

Page 29: Building Game UI with WebKit

APPEARANCETHE CSS PART

Page 30: Building Game UI with WebKit

CSS

• Also us to globally set up style.• Separates the Artist’s work from the

Engineer’s

Page 31: Building Game UI with WebKit

CSS Zen Garden

• Quick highlight of the power & flexibility• Exact same HTML, but radically different

appearance

An artist could reskin an entire game without talking to an engineer

Page 32: Building Game UI with WebKit
Page 33: Building Game UI with WebKit
Page 34: Building Game UI with WebKit

BEHAVIOURjavascript & jquery

Page 35: Building Game UI with WebKit

jQuery

• Freely available javascript library• Makes things significantly simpler• Emphasises building shared components

Page 36: Building Game UI with WebKit

Shared Components

• Let’s us quickly build new screens• Leverage already developed components• Drops cost of development• eg. Tab Bars, Pagination, Dynamic Updating

pages

Page 37: Building Game UI with WebKit

Need people on the team with these skills to succeed

Page 38: Building Game UI with WebKit

LOWER DEVELOPMENT COSTS

Page 39: Building Game UI with WebKit

why?because we can act faster

Page 40: Building Game UI with WebKit

Decouples things

• Decouples artists from engineers• Decouples the data source from the

presentation• Decouples the logic from the game code

Page 41: Building Game UI with WebKit

Fast Iteration

• Break the usual compile-link-run-test cycle• Can see things in game earlier• Test most changes inside a browser• Fewer people can do more

We estimate we were at least 4x more productive

Page 42: Building Game UI with WebKit

Fix bugs faster

• Bugs are often just less complex / easier to fix• Iteration time helps• Can get changes into QA’s hands faster

skate3’s Community Scrum had half the projected number of bugs & we could fix them far faster.

Page 43: Building Game UI with WebKit

BUILDING SCREENS

Page 44: Building Game UI with WebKit

Different from building regular web page?

• No mouse / keyboard / cursor• Needs to fit with the rest of the game• TRCs to comply with on consoles

Page 45: Building Game UI with WebKit

Should feel like game frontend & not a web page

Page 46: Building Game UI with WebKit

Dealing with change

• When new information comes in, need to update.

• No ‘push’. Have to poll for updates (AJAX)• Handle the cursor when page layout changes.

Page 47: Building Game UI with WebKit

NAVIGATION

Page 48: Building Game UI with WebKit

How to navigate page properly with only a controller?

Page 49: Building Game UI with WebKit

Needs to deal with pages that change dynamically, where new arbitrary content is added or removed.

Don’t want to hardcode, maintainance would be a nightmare.

Can hardcode. As a fallback.

Page 50: Building Game UI with WebKit

Very simple system for attaching controller buttons to actions.

<a href=“http://www.google.com” class=“l2_button”>Left Trigger

</a>

Controller Buttons

Page 51: Building Game UI with WebKit

Banish cursor. No where else in the game uses it.

Page 52: Building Game UI with WebKit

Highlight the ‘current’ element

Using CSS & jQuery, came up with a simple system for to highlight the element the cursor is hovering over, without needing to render the cursor.

Page 53: Building Game UI with WebKit

INTEGRATION WITH REST OF GAME.

Page 54: Building Game UI with WebKit

WebKitInput

Transport Handlers

Texture

Game Actions

Page 55: Building Game UI with WebKit

Pick the appropriate art style

Page 56: Building Game UI with WebKit

Don’t be scared to mix Flash & WebKitRoom for a hybrid UI-model

Page 57: Building Game UI with WebKit

Custom URL handlers

Like http points to a web resource

browser://

skatepark://

dlc://

skatereel://

Page 58: Building Game UI with WebKit

Javascript Bindings

Page 59: Building Game UI with WebKit

ART STYLE.

Page 60: Building Game UI with WebKit

Presenting WebKit

• WebKit renders to a texture. That’s all.• Up to you how to present that texture

– Fade in / Animate in– Overlay over the rest of the game with alpha– Transform and present in 3d

• On skate we’re always full screen and playing a Flash intro & ambient animation on top.

Page 61: Building Game UI with WebKit

Animation

• Global: Animating the entire webkit texture• Local : Animate within the page (CSS + JS)• jQuery provides easy way to implement

simple animations• No where near as powerful as Flash tools

Page 62: Building Game UI with WebKit

TECHNICAL ASPECTS.

Page 63: Building Game UI with WebKit

Debugging

• Much easier in Chrome• Great developer tools an artist can use• Harder in game, but possible. Mostly printf’s.

Page 64: Building Game UI with WebKit

Memory can be a challenge

• Code’s in a DLL – about 6 megs• Pages typically require 6-8 megs to display

• Tighter on memory you are, the more you have to worry about the page.

Page 65: Building Game UI with WebKit

WRAP UP.

Page 66: Building Game UI with WebKit

Overall

• Makes building online connected UI much easier

• Overall 4x productivity win & easier to final• Needs people willing to learn the right skills• There are lessons for everyone to learn.• Some sacrifices necessary on visual quality• Memory could be an issue

Page 67: Building Game UI with WebKit

Potential Uses

Prototyping

Launch page

Sign up / Sign in Flows

In Game Media / UGC Galleries

Video Libraries

Tutorials

Team Management

Messaging

Page 68: Building Game UI with WebKit

Skate played it safe

• Couldn’t dedicate significant resources to this• For a long time this was just a ‘science project’• Went for a ‘safe’ implementation that we

could guarantee we could ship.• Meant we never had to cut anything.• Plenty of lessons learned to take it to the next

level for the next project

Page 69: Building Game UI with WebKit

Benefits aren’t exclusive to WebKit, anyone can…

• Focus on being data-driven• Build shared components• Deliver content & layout from a server• Find a way to get iteration times down

Page 70: Building Game UI with WebKit

Current

• WebKit naturally aligns with a lot of trends happening in the industry right now.– Lower development costs– Pushing Direct-to-Consumer– Social & Always Connected Gaming

Page 71: Building Game UI with WebKit

Questions?

Page 72: Building Game UI with WebKit

Thanks!

• GDC for inviting me• Jeff Howell & Brian Lindley• Joe VanZeipel & Hideki Bessho• Arpit Baleva, Chris Sidhall, Paul Pedriana• Skate3 Team & Blackbox for their support

Page 73: Building Game UI with WebKit

Feedback?

[email protected]