Hello! Switcheroo. • (session based on new project) + (bureaucracy) = trouble.

Download Report

Transcript Hello! Switcheroo. • (session based on new project) + (bureaucracy) = trouble.

Hello!
Switcheroo.
• (session based on new project) + (bureaucracy) = trouble
building multiplayer games
with Grant Skinner
building games in silverlight
with Grant Skinner
about this talk
•
•
•
•
•
•
microsoft platform
market opportunities
skills required
technology
challenges
Q&A / discussion
Market Opportunities
35%
MALE
65%
FEMALE
Online Casual Games
20% AGR & accelerating
Downloadable Casual Games (PC)
$600M
2007
$2.1B
2008
Social Games
$490M
2008
$835M
2009
FarmVille by Zynga
FarmVille
• Primarily played
through Facebook
• 5 weeks to develop
• 1M users in first 4 days
• 82M users in 9 months
• Est. $200M+ revenues
from micropayments,
ads, & offers in just 2
years
Monetization
Revenue Breakdown 2010*
• Direct sales to consumer
• Sale / licensing to
distributor
• Advertising (in-game &
banner)
• Premium subscriptions
• Micro transactions
(fastest growing
segment)
• Indirect: marketing,
services, component
sales
Who builds these games?
• dedicated game
development companies,
including mainstream
game companies (ex. EA)
• marketing agencies &
interactive shops building
branded properties
• casual developers working
for fun / free. There is a
move towards “publishers”
funding games.
Facebook
• Currently owns social
games market (MySpace
distant #2)
• 70% games played
outside US
• FB Connect biggest driver
• FB Credits coming soon
• Average player is 35+
• Currently growing at 10%
Game developer qualifications
Game development is one of the best ways to expand your
abilities as a developer, but it requires a special type of
developer.
Multiplayer Game Development
Game Development
Application Development
Game development
Optimization
Holistic optimization of performance and memory.
Encompassing code, graphics, architecture, and
algorithms.
Code optimization
Syntactical and structural optimizations start with a good
understanding of the compiler, runtime, timing model, and
GC.
Profiling tools for Silverlight include XPerf, Silverlight Spy,
Eqatec Profiler.
Graphics optimization
Game developers need to look beyond code, and
understand the performance implications of graphics and
animation.
For example, the relative impact of vector vs. bitmap vs.
cached art, understanding GPU acceleration, and the cost
of shaders and 2.5D effects.
Creative architecture
Due to the performance critical nature of game logic, you
often must make practical trade-offs between architecture
and performance.
Abstraction and low coupling often come at the cost of
some performance overhead.
Algorithms
Games frequently rely on performance critical algorithms
for tasks like path finding, proximity detection, spacial
division, data manipulation, and physics simulation.
An understanding of algorithm growth rates, and the ability
to utilize / analyze / adapt existing algorithms is critical.
Math
At a bare minimum, you will require basic knowledge of
elementary math, spatial math, bitwise operations, and
trigonometry. Advanced trig and some calculus or physics
can pay off as well.
Things get vastly more complicated when you move into
3D. Hello quaternions!
Game experience
In game development the user experience is more tightly
bound to development than in RIA development. This
means the developer must have a genuine interest and
aptitude in creating quality gameplay.
Graphics & sound integration
• Graphics and audio are much more closely tied to
development in games than in most applications. It also
tends to be a much tighter iteration process.
• You will want to be very familiar with the import tools in
Blend. Knowing a bit about the tools your designers are
working with is also helpful for quick tweaks.
Interaction & display
• Games tend to require more granular control of
interactions (mouse & keyboard), and the display.
• For example, limitations with mouse leave, tracking key
down state (ex. KeyHandler), handling key repeat, etc.
Spiking
The process of creating small, isolated tests is broadly
useful in development, but is especially applicable to game
development.
Silverlight / VS is not particularly suited to spiking, but
we’ve found some approaches that work ok.
Spiking: Approach 1
1. Create solution in VS for your spikes & add any shared class
libraries
2. Create a web project, and set its start action to “current page”
3. Create new spikes as new projects in the solution.
Launching the project will display the project directory in IE, allowing you to select a
spike quickly.
Spiking: Approach 2
1. Create a new project for your spikes.
2. Create each new spike as a UserControl.
3. Switch the RootVisual for your application either in code.
Similarly to this, you can simply load in your spike as the primary
child of a simple harness app, and change it at runtime.
Programmatic motion
There are a lot of ways to move elements around on
screen. Understanding the pros and cons of each, and
being able to implement them is a must.
Ex. programmatic eases, linear, simple, acceleratory,
cartesian, vector / angular.
Collision Detection
Most game types require collision detection. There are
multiple approaches:
rectangular, point to shape
(VisualTreeHelper.FindElementsInHostCoordinates),
mathematical, & shape to shape (w/custom shader).
Multiplayer game development
Models
• Server as host: The server manages game state and
handles all significant logic. Clients act as views.
• Client as host: One client is promoted to host / super
client, and owns the definitive game state.
Turn-based asynchronous / social
Interactions between players are asynchronous or have
minimal intersection. The game continues across multiple
sessions. It may have alternating or adhoc “turns”.
Generally more traditional networking approach (http,
request based). Requires separate messaging. Game state
lives on the server and must be maintained for the life of
the game.
Turn-based synchronous
Players alternate turns in a single gaming session.
Can use either http requests & polling or socket
connections. Latency has little impact. State can live on the
client or on the server.
Real time
All players are active simultaneously, and can interact with each
other in real time.
Clients communicate through a socket server. Latency
management is critical. Game state can live on the client or
server.
Be very careful with random and time based logic.
Real time messaging
Typically broken into 3 message types: interactions, game
events, and state updates.
• Interactions - disseminate user interactions to server /
clients
• Game events - notifications of significant game events
• State updates - full or partial state information
Handling latency
Latency will generally range from 60-300ms (client to server to client).
Better connected and more localized servers will reduce this. Server
based game logic also greatly reduces the impact of latency.
Dealing with latency involves strategies like delaying user inputs to
account for latency, interpolating values based on known / estimated
latency, and making interactions “fuzzy” to reduce obvious
discrepancies.
Minimizing cheating
Gamers will spend an unbelievable amount of energy
hacking popular games. Packet sniffing / injection,
decompiling / modifying / redistributing your game client,
etc.
This can be minimized by keeping more logic on server,
random checks, client “honesty” heuristics, and
obfuscation.
Technology
Java is (surprisingly) still in use, but is rapidly losing
ground to Flash, the market leader. Silverlight is the
new kid on the block.
Java’s downfall
Lack of tooling / support for animation & interactive design
Higher barrier to entry for users & developers
Larger file size & slower initialization
Version fragmentation, complicated runtime distribution
Security considerations
Flash’s strengths
•
•
•
•
•
•
•
•
Ubiquity
Very low barrier to entry for developers & users
Strong toolset for animation, interactive design, & development
Simple run-time updating
Robust, approachable language
Good code performance, reasonable graphics performance
Very strong & vibrant community, lots of OSS code incl. game
frameworks
Portability to AIR, mobile, devices
Strengths: Development
• Robust language & excellent developer / debugging
•
•
•
tools
Server-side integration
Access to mature game libraries & commercial
components
Some XNA libraries can be used via Silversprite (and
similar projects)
Strengths: Performance
•
•
•
Code execution
Multi-threading
GPU support (limited)
Strengths: Portability
•
•
•
Portability to Windows Phone 7, XBLA, WPF
Very simple out of browser experience
Easy to move to native desktop application
Thank you!
@gskinner
gskinner.com/blog/
Questions?