Skip to content

1 Unicorn Battle Backend Guide

zac-playfab edited this page Jun 14, 2016 · 16 revisions

###Key Files:

The Unicorn Battle data is distributed across many cloud-based technologies. Using the PlayFab API, we exported Unicorn Battle's data and saved this data in raw JSON format. Using said data, our UB_Uploader clones the back-end to a title of your choosing.

This project also serves as an example of how to use the Admin API to configure a title. Tools like this can be helpful when you need to frequently reset large amounts of configuration data.

###Introducing the UB_Uploader We built this handy tool to clone the Unicorn Battle back-end to a PlayFab title of your choosing.

####Creating your clone of Unicorn Battle:

  1. Download the directory or compile the solution
  2. Update the /PlayFabData/TitleSettings.json file with your TitleId and corresponding developer secret key.
  3. Locate and run UB_Uploader.exe
  4. A log [PreviousUploadLog.txt] of the results will be generated within the exe's working directory. If no errors were reported, then you are ready to move on.
  5. Log into Game Manager
  6. Click your UB Clone Title
  7. Navigate to Settings > API Features
  8. Ensure that your clients are allowed to post player statistics. *
    * note: this would not be a good idea if this was a competitive game.

##Post Setup ###What did UB_Uploader just do? PlayFab is designed around combining systems specializing in availability and scalability into a single service. In doing so, we have many service components that can be found aggregated within our web API portal.

While complete coverage of components is outside the scope of this document, here are the specifics as they are used by Unicorn Battle:

  • Game Manager > Settings > Title Data: These fields enable the developer to fine tune their player's experience while not having to update the client code.
| Key | Value Type | Details
---: | :---: | :--- 
Achievements | JSON Dictionary | The threshold data for evaluating achievements.
CharacterLevelRamp | JSON Dictionary | The level up curve thresholds
Classes | JSON Dictionary | The defining values for our character classes
CommunityWebsite | String | URL to open when "Community Website" is clicked in-game.
DefaultBossCreeps | JSON Dictionary | A collection of enemy boss encounters. Used by the quest system.
DefaultCreeps | JSON Dictionary | A collection of basic enemy encounters. Used by the quest system.
DefaultMegaCreeps | JSON Dictionary | A collection of tough enemy encounters. Used by the quest system.
DefaultHeroEncounters | JSON Dictionary | A collection of hero encounters. Used by the quest system.
DefaultRareCreeps | JSON Dictionary | A collection of rare enemy encounters. Used by the quest system.
DefaultStoreEncounters | JSON Dictionary | A collection of merchant encounters. Used by the quest system.
Events | JSON Dictionary | The event calendar for running in-game events
Levels | JSON Dictionary | A collection of locations. Used by the quest system.
MinimumInterstitialWait | Number | The number of seconds to wait during the interstitial screen.
Offers | JSON Dictionary | A collection of offers. System currently in-development.
Sales | JSON Dictionary | The sales calendar for running in-game sales
Spells | JSON Dictionary | The overall spells table shared by Players and NPCs
StartingCharacterSlots | Number | How many character slots are provided for free.
  • Game Manager > Promotions > Title News: This component is being used to drive the in-game tips system (displayed during interstitial loading screens)

  • Game Manager > Server > Cloud Script: Cloud-hosted game logic for processing quests and other transactions

    Method Details
    CreateCharacter Creates a new Character
    DeleteCharacter Deletes and existing Character
    InitializeNewCharacterData Defines values for a new character
    SaveProgress Saves character progress after a quest
    SubtractLife Removes lives from a character
    PurchaseItem Purchases an item for a character.
    ConsumeItem Consume uses from a character's ItemInstance
    UnlockContainer Try to Unlock and unpack a container for a character
    GetCharacterStatistics aggregate and return statistics for all owned characters
    UpdateCharacterStats update statistics for a character
    EvaluateAchievements determine if an achievement has passed its threshold
    TransferItemToPlayer Transfers an ItemInstance to a Player's inventory
    TransferItemToCharacter Transfers an ItemInstance to a Character's inventory
    TransferVcToPlayer Transfers Virtual Currency to a Player's inventory
    TransferVCToCharacter Transfers Virtual Currency to a Character's inventory
  • Game Manager > Economy:

    • > Currencies: Defines the mediums of exchange for this title
    • > Catalogs: A collection of CatalogItems. These Items can be edited in the Game Manager
    • > Drop-tables: Are weighted distribution tables that control the probability of getting specific items
    • > Stores: Are subsets of CatalogItems that makeup in-game stores. These items can be sold at prices differing from the primary catalog.
  • Player Statistics Definitions: Contain settings that alter the default behavior of Player Statistics

    • Additional information on this topic can be found here
  • Content Deliver Network: While not accessible via GameManager, everything we need exists in the Admin API.

    • Unicorn Battle uses simple AssetBundles that contain updated art for sales and events.
    • Additional information on this topic can be found here.

##Next Steps

Clone this wiki locally