Giter Site home page Giter Site logo

raneyk / union-opensource-moba Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tammukul/union-opensource-moba

0.0 1.0 0.0 185.37 MB

Open Source MOBA made with Unity using PlayFab and Photon

License: Apache License 2.0

Mask 0.28% C# 59.76% Objective-C 8.19% C++ 0.02% C 0.02% Objective-C++ 0.98% Makefile 0.31% Java 30.34% GLSL 0.12%

union-opensource-moba's Introduction

Union: (A PlayFab-Photon MOBA) README

  1. Overview:

Union is a sample multiplayer online battle arena (MOBA) game for mobile devices, designed to show off Photon and PlayFab integration with a Unity game. It is fast-paced, intense and combat focused, with two teams of players teaming up for a common objective: destroy the enemy’s tower and all enemy players. All the assets, prefabs, models, sounds and code are open source and can be used in your own game.

This demo illustrates:
  • How to use PlayFab and Facebook for:
    • Getting and sending authentication tokens
    • Populate PlayFab account details with Facebook data (profile picture, account name)
  • Use PlayFab TitleData as a string table for 'hot-loading' your game's text content
  • Making Google Play IAP requests and validating the receipt with PlayFab
  • Example of how to create real-time multiplayer MOBA with Photon PUN
    • Simple game system examples (movement, combat, defense towers, UI, AI)
    • Dual touchscreen input for mobile platforms
    • Photon networking implementation using PUN, with extensive examples of Views, Syncs and RPCs
    • In-game store for character upgrades
    • Kills and win/loss ratios are tracked via PlayFab PlayerStatistics
    • Compare your stats to others via PlayFab Leaderboards
  1. Prerequisites:

To get the most from these samples you should:

  • Be familiar with the basics of PlayFab
  • Be familiar with the basics of Photon (PUN)
  • Play:
    • For best results:
      • Have the ability to build and deploy to an android device (.apk provided as an alternative)
      • Have a Facebook account for authentication purposes
    • Alternatively:
      • Run in the UnityEditor with mouse support
      • Requires a Facebook Developer Account to generate an authorization token

To connect to the PlayFab service, your machine must be running TLS v1.1 or better.

  1. Source Code & Key Repository Components:

This repository contains the entire Unity3d project.

Main Classes that drive featured functionality:

  • AccountManager
    • Persistent to control all account properties getters and setters. Communicates with Facebook and PlayFab, and holds every property any of these communications may return. Called anywhere in the game, because account’s properties can be changed on gameplay, on store, and will be shown in profile screen.
  • PhotonManager
    • Persistent to control connection. Connects to Photon and finds a room on ModeSelect, handles all gameplay syncs and events on MatchRoom, and gets destroyed on EndGame. This maintains connection between scenes.
  • AudioManager
    • Persistent to handle properties and play music. Has an AudioSource, that keeps playing menu (or gameplay) music in loop, and holds booleans for music enabled, and SFX enabled. Because there is SFX and music in every scene, the manager is persistent.

3rd Party Plugins:

Class Function External Site
Photon (PUN) SDK for accessing networking features https://www.photonengine.com/en/PUN
OpenIAB SDK for accessing native billing APIs https://github.com/onepf/OpenIAB
Unity-GCM SDK for registering to the GCM service https://github.com/kobakei/unity-gcm
Facebook SDK for accessing Facebook APIs https://developers.facebook.com/docs/unity

Singleton Usage, allows easy access to these systems from anywhere in the project

Documented here for posterity:
  • AccountManager
  • PlayFabManager
  • AudioManager
  • GameController
  • GameplayUI
  • PlayFabPlayerStats
  • PlayFabItemsController
  • GunDropsManager
  • GameController
  • GameplaySFXManager
  • InputManager
  • PushNotificationsManager
  • MultiplayerRoomsManager
  • ChatManager
  • InGameStoreAndCurrencyManager
  • InAppPurchaseManager
  1. Installation & Configuration Instructions:

After downloading, the Unity project will be under the Project folder. If some errors occurs, it is recommended to delete the folder Photon Unity Networking, and re-import the plugin PUN from Asset Store.

How to run the game in editor mode:
  • This requires you to have access to a Facebook developer account
  1. Find a Facebook App ID to use
  2. Enter the App ID in the Unity Facebook SDK editor menu (Facebook > Edit Settings > [App ID located in the inspector panel, paste in your App ID])
  3. Open the Landing.unity scene, Play in editor
  4. While logged in as a Facebook developer, navigate to the Facebook Access Token Tool
  1. Enter the provided UserToken as your credential
  2. To enable mouse support:
  • Find the GameControls GameObject in the scene
  • Check the UseWithMouse property on the InputManager
  • [note:] the mouse is acts as a single touch input. Although it may be a bit awkward in the editor, click->dragging on the left-half of the screen will move the character directionally, while click->dragging on the right-half of the screen will shoot directionally. For best results play on a multi-touch Android device.
How to replicate the Union PlayFab environment to your own title
  • InAppPurchasing will require you to have your own GooglePlay Account information
  • Obtain your own Photon Application ID via the Game Manager > Servers > Photon
  1. Upload the game logic (/Documentation/CloudScript.js) via the Game Manager > Servers > CloudScripts > Create New Revision
  2. Upload the game item catalog (/Documentation/InGameStore.json) via the Game Manager > Economy > Catalogs > Upload JSON
  3. Upload the TitleData via the Admin API
  • Run the following command for each title data element in /Documentation/TitleData.json: curl -XPOST https://2ABE.playfabapi.com/admin/SetTitleData \ -H "Content-Type: application/json" \ -H "X-SecretKey: 000-ENTER-YOUR-KEY-HERE-000" \ -d "COPY AND PASTE EACH ELEMENT FROM /Documentation/TitleData.json"
  1. Ensure your title's virtual currencies match those listed in /Documentation/VirtualCurrencies.json: --EITHER--

  2. Manually adding them via the Game Manager > Economy > Currencies --OR--

  3. Run the following Admin command with the data in /Documentation/VirtualCurrencies.json: curl -XPOST https://2ABE.playfabapi.com/admin/AddVirtualCurrencyTypes \ -H "Content-Type: application/json" \ -H "X-SecretKey: 000-ENTER-YOUR-KEY-HERE-000" \ -d "COPY AND PASTE THE CONTENTS FROM /Documentation/VirtualCurrencies.json"

  4. Usage Instructions:


The game must​ be played (started) from the Landing scene. It will initialize all the needed references (Facebook, PlayFab, audio manager, etc), and start the login process, to be able to access all features, and properly connect to Photon and join a room.

See extra documentation:

  1. Documentation/Union-Usagedocument.pdf

  2. Documentation/Union Visual Guide.pptx

  3. Troubleshooting:


For a complete list of available PlayFab APIs, check out the online documentation.

Contact Us

We love to hear from our developer community! Do you have ideas on how we can make our products and services better?

Our Developer Success Team can assist with answering any questions as well as process any feedback you have about PlayFab services.

Forums, Support and Knowledge Base

Known Issues:

  • Complete build for Android only. Building to other platforms may not work as expected
  • PUN does not currently support Photon webhooks
  • PlayerName & HealthBar UI sometimes separate from the actor GameObject
  • TouchScreen joystick UI is not under the touch
  1. Copyright and Licensing Information:

Apache License -- Version 2.0, January 2004 http://www.apache.org/licenses/

Full details available within the LICENSE file.

Special Thanks

  1. Version History:

  • (v1.00) Initial Release

union-opensource-moba's People

Contributors

zac-playfab avatar markval avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.