Get the security and flexibility of custom game logic without the cost and hassle of running your own game servers. Make changes to your game without recertifying and protect against client-side cheating. With PlayFab’s Cloud Script you can easily create and experiment with custom rewards for your players or use it to resolve interactions between players. In this webinar we will show you how to get started using Cloud Script to easily extend your game.
In this webinar you will learn:
* How to implement Cloud Script.
* How server authentication protects against client-side cheating.
* How to upload your custom JavaScript files.
* Best practices for using Cloud Script.
2. Overview
• Cloud Script Fundamentals
• Adding a Cloud Script
• Revision Control
• Calling a Cloud Script
• Photon Webhooks
• Debugging
• Usage Scenarios
• Limitations
• Resources
September 10, 2015 1
3. Cloud Script Fundamentals
• JavaScript handlers
• Executes in the context of the user,
but with server authority
• Can call external endpoints
• Excellent tool for:
• Game updates
• Push notifications
• Cheat prevention
• Player coordination
• Cross-service coordination
September 10, 2015 2
6. Revision Control
• Two revisions are active
• Test == latest
• Live == deployed
• Deploy any revision
• Note: Live immediately
• Versions
September 10, 2015 5
7. Calling a Cloud Script
• Query for the active Cloud Script URL
POST /client/GetCloudScriptUrl HTTP/1.1
Host: {{TitleID}}.playfabapi.com
Content-Type: application/json
X-Authentication:{{SessionTicket}}
{
"Testing": true
}
• Response
{
"code": 200,
"status": "OK",
"data": {
"Url": "https://{{TitleID}}.playfablogic.com/1/test"
}
}
September 10, 2015 6
9. Photon Webhooks
• Partnership with Exit Games
• Photon Cloud free with Premium tier
• Integrated authentication
• Integrated Webhooks
• So what are Webhooks?
• Calls from Photon Cloud to PlayFab on Room
actions
• RoomCreated
• RoomJoined
• RoomEventRaised
• RoomPropertyUpdated
• RoomLeft
• RoomClosed
September 10, 2015 8
10. Debugging
• Basic debugging via logging
• http://cloudscript.playfab.com/classes/log.html
• debug
• error
• info
• Returned with results from script
• ActionLog
• Debugger in planning
• Let us know what you need!
September 10, 2015 9
11. Scenario 1: Updates
September 10, 2015 10
• Updating a title is more than just the executable
• Changing items
• User data
• Save values
• User Internal Data to track player version
• Have an “onLogin” handler
• Calls current version handler (“updateToRevN”), passing in player version
• If not at this version, call previous version handler
• Once returned, update for latest version
• onLogin then sets player version
12. Scenario 2: Player Actions
September 10, 2015 11
• For competitive games
• Resolution of player action must be server authoritative
• Player selects moves, which are sent to Cloud Script
• Evaluate moves
• Are they possible?
• Does the player have the right items?
• etc.
• On failure, write info to User Internal Data
• Use cheat tracking to have cheaters play together
13. Scenario 3: Rewards
September 10, 2015 12
• Determination of rewards for player actions
• Player actions are sent to Cloud Script
• Evaluate actions
• Has enough time passed?
• Are the values reasonable?
• etc.
• On failure, write info to User Internal Data
• Use cheat tracking to decide how to manage them
14. Scenario 4: Messaging
September 10, 2015 13
• Push Messages
• Require Server authority
• Player attacking another player’s base
• Player beat a friend’s score
• etc.
• Player-to-player messages
• Write them to Shared Group Data, using ID of PlayFabId
• Arbitrary messages, with arbitrary payloads
15. Scenario 5: Extra Leaderboard Columns
September 10, 2015 14
• Shared Group Data
• Storage not tied to a particular player
• Readable by any player (permission set Public)
• Data value per player
• Key is the PlayFab ID of the player
• Write extra data when updating score
• One API call to read players in display
16. Limitations
• An API call is an API call
• Total API calls
• Apply portion control to your data
• Total data returned
• How complex is too complex?
• Total compute time
September 10, 2015 15