This document discusses using Construct2 to build games that connect to cloud services. It introduces WebStorage for local and session storage, Windows 8 roaming data, and Azure Mobile Services for cloud backend functionality. It provides links and code snippets for setting up a mobile service in Azure and connecting a Construct2 game to it using the Azure Mobile Services plugin. Authentication using Twitter login is also demonstrated. Tips for exporting effective Windows 8 games from Construct2 are included.
1 of 11
Download to read offline
More Related Content
Zero260 14 may-2013
1. Make your Construct2 game
talk to the cloud
Matt Harrington
Developer Evangelist
Microsoft SF
http://ohours.org/mattharrington
http://blogs.msdn/com/matt-harrington
@mh415
3. Promotions
Students
http://www.DreamSpark.com
App Builder
http://aka.ms/genappsignup
Keep the Cash
http://aka.ms/ikeepthecash
Construct2 Windows 8 Summer Competition
https://www.scirra.com/blog/113/windows-8-summer-competition
App Factor Learn Win8 at an in-person event
http://www.windows8appfactor.com
5. WebStorage and Win8 Roaming Data
WebStorage object
Local storage: Semi-permanent. Stored until user clears cache.
Session storage: only lasts until browser restarts
Docs: https://www.scirra.com/manual/120/webstorage
Strings only
Set a key & value as an action
Retrieve with int(WebStorage.LocalValue("score"))
Win8 Roaming Data
https://www.scirra.com/manual/145/windows-8
Set roaming key as an action
Retrieve with Windows8.RoamingValue(score)
7. Azure Mobile Services
1. Get Azure free trial on windowsazure.com
Consider BizSpark (startups) or education offerings (windowsazure.com/education)
2. Install Azure Mobile Services SDK for JavaScript
http://aka.ms/wams4c2may
This is a previous version. Current version doesnt work with C2 plugin
3. Create a new Mobile Service in the portal (windowsazure.com)
a) Pick URL
b) Create database
c) Create People table
d) Note your Mobile Service URL
e) Note your Application Key
http://azureforc2.codeplex.com/documentation
8. Azure Mobile Services Plugin Basics
1. Docs on http://azureforc2.codeplex.com
2. Download and install the plugin
a) Find it in Downloads link on azureforc2 page
b) Drag plugin on top of a running instance of Construct2
3. Download the .capx example
4. In Construct2, add your App URL and App Key to the plugin
5. Export as Win8 app
6. Add Internet (Client) capability in package.appxmanifest
http://azureforc2.codeplex.com/documentation
9. Authentication with Twitter
1. Create a table called Identities
2. Change permissions to Only Scripts and Admins on Insert, Update,
and Delete. Change to Only Authenticated Users on Read.
3. Change the Read script per the documentation
4. Set up Twitter authentication http://aka.ms/wamstwitter
5. Add Twitter consumer key and consumer secret to Identity page
6. Restrict permissions on People to Only Authenticated Users
http://azureforc2.codeplex.com/documentation
10. Construct2 quick tips
1. Include Windows 8 and Touch objects
2. Menu -> Preferences -> Backups -> Keep up to 5 Backups
3. Change Preview Browser from (default) to Internet Explorer
4. Sometimes you need to quit all instances of IE
5. Name, Author, and Description need to be short, with no trailing spaces
6. Dont accidentally export as Windows Phone 8 instead of Windows 8
7. Uncheck Minify Script when exporting for Windows 8
8. Export to a new folder each time
11. Construct2 Event Sheet Walkthrough
Concepts:
Instance variables: attached to one particular instance
Local variables: available in one event sheet. Contrast with global variables
Dictionary: Key/Value pairs, e.g. name and Matt
JSON example: {name: Matt, score: 8704}
Array
1D: [apple, banana, kiwi]
2D: [ [name, Matt] , [score, 8704] ]
Loop: do something multiple times. loopindex is the counter.
For-each loop: loop over a collection like an array