XNA on Windows 8 with MonoGame

Report
Making $ on Windows 8
The First Mover Advantage
 With Over 630 Million Licenses in 200+ Countries,
Windows Has Unrivaled Global Reach
 Windows 8 Represents the Single Biggest Developer
Opportunity for Any Platform

In order for your app to be available for the holiday rush,
you need to get ready now!
 Hundreds of Thousands of Developers
Recognize the Opportunity, but…
 Only Some Will Have the Advantage
of These Programs
Generation App: Getting You There

Windows 8 DevCamps & Hackathons


30 To Launch






www.msdnevents.com/windows
Online training and tips from insiders
Tele-support with a Windows 8 architect
Exclusive one-on-one Metro style design consultation
Application Excellence Lab
<Evangelist’s 30toLaunch Link Here>
Application Excellence Labs

Your Opportunity to Get Into the Windows Store

aka.ms/apps
Developing a Windows 8 Store App
using XNA and MonoGame
[NAME]
[TITLE]
[ORG]
[BLOG]
[TWITTER]
introduction
introduction
introduction
• MonoGame is an Open Source implementation
of the Microsoft XNA 4 Framework
• The goal of MonoGame is to allow XNA
developers on Xbox 360, Windows & Windows
Phone to port their games to multiple
platforms including Windows 8 and the
Windows 8 Store
• MonoGame uses SharpDX, an open-source
project delivering the full DirectX API for
managed code (.NET) and Windows 8 (WinRT)
• By adding the MonoGame Framework to your
Visual Studio Solution, you are providing your
XNA code base the identical namespace and
class model it was based on
[your XNA code]
MonoGame
SharpDX
WinRT
demo
MonoGame
get store ready
logos, tiles and splash screens
• A tile is the front door into an app.
Sitting on the Start screen, it is an
extension of the app and can provide
much more personal and engaging
information than a traditional icon.
Invest in designing a great tile to draw
people into your app.
• Your brand should carry from your tile
to your splash screen as that is the first
thing a user sees when they run your
apps
Logo
150x150 pixels
Wide Logo
310x150 pixels
Splash screen
620x300 pixels
logos, tiles and splash screens
• Add references to your Tile and Splash
Screen artwork in the package.appmanifest
• In addition to the artwork, you can set the
name of the app, the background color for
the Splash Screen, app capabilities,
declarations and packaging details such as
version number
demo
Tiles, Splash Screen
using the MessageDialog
• You may want to look for opportunities to add Windows Style UI elements
to your game to create a more cohesive Windows 8 experience for the user.
MessageDialog is one way to do that.
• MessageDialog has a command bar that can support up to three commands
• If you don't specify any commands, then a default command is added to
close the dialog
• The dialog dims the screen behind it and blocks touch events from passing
to the app's canvas until the user responds
• Message dialogs should be used sparingly, and only for critical messages or
simple questions that must block the user's flow.
demo
MessageDialog
screen resolution support
• By being aware of the screen dimensions and changes to those
dimensions you can support screen resolution changes by the user,
switching between portrait and landscape mode and snap view
• You can add logic in your game to draw appropriately for each
possible state
code snippet – screen resolution
using Windows.UI.Core;
…
public enum WindowState { Full = 0, Snap1Quarter = 1, Snap3Quarter = 2 };
public static CoreWindow _window;
_window = CoreWindow.GetForCurrentThread();
_window.SizeChanged += _window_SizeChanged;
…
//called when the window is resized
static void _window_SizeChanged(CoreWindow sender, WindowSizeChangedEventArgs args)
{
if (args.Size.Width == _windowsBounds.Width)
_windowState = WindowState.Full;
else if (args.Size.Width <= 320.00)
_windowState = WindowState.Snap1Quarter;
else _windowState = WindowState.Snap3Quarter;
_windowsBounds.Height = args.Size.Height;
_windowsBounds.Width = args.Size.Width;
}
demo
Screen Resolution and Snap View
process lifetime management
suspend
• System resources focused on the app that
the user is interacting with in the foreground
• Inactive apps have no impact on battery life or responsiveness, they
are suspended by the OS
• Enables instant switching between apps!
termination
• User explicitly closes the app: soft termination
• System needs more memory
• User switch occurs
• System shutdown
• Apps crash
Apps do not get notified when
they are getting terminated
best practices
scenario
you should….
User is using your App
Save user data incrementally
App switched away
from (Suspending)
Save where the user is – what
screen they are on, for example
Not running App launched
by user (Activated)
Bring the user back and restore
their session as if they never left
Suspended App launched
by user (Resuming)
Do nothing
code snippet – PLM
using Windows.UI.Core;
…
public enum WindowState { Full = 0, Snap1Quarter = 1, Snap3Quarter = 2 };
public static CoreWindow _window;
…
_window.SizeChanged += _window_SizeChanged;
CoreApplication.Suspending += CoreApplication_Suspending;
CoreApplication.Resuming += CoreApplication_Resuming;
static void CoreApplication_Resuming(object sender, object e)
{
// coming back from suspend, don't do anything as current state is in memory
}
static void CoreApplication_Suspending(object sender, Windows.ApplicationModel.SuspendingEventArgs e)
{
// suspending, save appropriate game and user state
}
demo
PLM
other considerations
• Use a Live Tile to display updated current level, score, etc.
• Use Cloud Services such as Windows Azure for leaderboards and
multi-player configuration
• Use the Settings panel for user specified game settings
• Use Contracts to provide Search and Share within your app if it makes
sense for your gamer community
wrap up
• Microsoft LOVES XNA developers !!
• MonoGame provides a solution to get your code running as a
Windows Store App
• Follow the get store ready guidelines to make your app Windows 8
Store ready
• Original article on Bob Familiar’s blog
• Part 1 – Overview
• Part 2 – Developer System Configuration
• Part 3 – Get Store Ready
Making $ on Windows 8
The First Mover Advantage
 With Over 630 Million Licenses in 200+ Countries,
Windows Has Unrivaled Global Reach
 Windows 8 Represents the Single Biggest Developer
Opportunity for Any Platform

In order for your app to be available for the holiday rush,
you need to get ready now!
 Hundreds of Thousands of Developers
Recognize the Opportunity, but…
 Only Some Will Have the Advantage
of These Programs
Generation App: Getting You There

Windows 8 DevCamps & Hackathons


30 To Launch






www.msdnevents.com/windows
Online training and tips from insiders
Tele-support with a Windows 8 architect
Exclusive one-on-one Metro style design consultation
Application Excellence Lab
<Evangelist’s 30toLaunch Link Here>
Application Excellence Labs

Your Opportunity to Get Into the Windows Store

aka.ms/apps
hands on – get started
developer environment configuration
system requirements
 Windows 8 [LINK]
 Games for Windows
 Visual Studio 2010 Express for Windows Phone
 Visual Studio 2012 for Windows 8 [LINK]
developer environment configuration
setup Git
 Setup a Git Account
 Setup a Git Client
developer environment configuration
clone the source for MonoGame
1. Run Git Shell
2. Navigate to the location on disk where you want to clone the source code (use CD command)
3. Type the following command to clone the Sickhead fork:
git clone https://github.com/SickheadGames/MonoGame
4. Once that command completes, navigate to the MonoGame directory by typing:
CD MonoGame
developer environment configuration
clone the source for MonoGame
5. Now we will initialize the project submodules by typing the command:
git submodule init
6. And then update the submodules:
git submodule update
Note: this may take some time
developer environment configuration
create the Visual Studio 2012 Template
1. Open an Explorer Window and navigate to the MonoGame Windows 8 Project templates folder:
C:\Users\[you]\Documents\GitHub\MonoGame\ProjectTemplates\VisualStudio11.M
onoGame.2.5\VS11MGWindowsMetroTemplate
2. Create a Zip of the all files in this directory
3. Copy the ZIP file to the VS2012 Visual C# Templates directory:
C:\Users\[you]\Documents\Visual Studio
2012\Templates\ProjectTemplates\Visual C#
developer environment configuration
test your developer environment
1. Open Visual Studio 2012 and select New Project
2. Under Visual C# you should see the MonoGame project
template listed. Select that and click OK.
developer environment configuration
test your developer environment
3. Right click on your solution in the Solution Explorer and
add the MonoGame Framework Windows 8 Project:
C:\Users\[you]\Documents\GitHub\MonoGa
me\MonoGame.Framework\MonoGame.Framewo
rk.Windows8.sln
4. Add a reference to the MonoGame Framework in your
game project by right clicking on references, select Add
Reference.
Under Projects choose the MonoGame Framework
project (check the box!) and click OK
developer environment configuration
test your developer environment
5. Compile and run the solution. You should get a
cornflower blue screen, the default XNA application.
content pipeline
• What is it? The Content Pipeline is a special set of assemblies included
with XNA Game Studio that use MSBuild to compile game assets such
as image and sound files into streamlined, pre-processed binary files
called XNBs (so named for the fact that the file extension of the
compiled version of a source file is changed to .xnb) which load quickly
at run-time.
• Visual Studio 2012 does not include an XNA development environment
so there is no Content Pipeline compiler
• Use Visual Studio 2010 Express with XNA Game Studio to compile
game assets and then move the XNB files to the VS2010 Project folder
Content Pipeline Process
Step 1. Create an XNA Game Studio project in VS 2010
Step 2. Add your graphic, sound, font and other game assets to the Content Project
Step 3. Compile the project
Step 4. Copy the resulting XNB files from this location
C:\Users\[you]\Documents\Visual Studio 2010\Projects\[project name]\[project
name]\[project name]\bin\x86\Debug\Content
to this location:
C:\Users\[you]\Documents\Visual Studio 2012\Projects\[project name]\[project
name]\bin\Debug\AppX\Content

similar documents