This repo is the AR social functions of L33tKidz's launch product. It is based on AR Foundation and AzureSpatialAnchor. It aims to build a multi-platform AR shared experience including ARCore (Android), ARKit (IOS), and WMR (HoloLens). Currently, it is tested on ARCore platform only.
This game supports 3 different modes as following.
- Two developer enabled and ARCore capable Android devices
- Unity 2019.1.14f1 including the Android Build Support and Android SDK 9.+(Q) & NDK Tools modules
- Git
- Set up your Azure Spatial Anchor Account.
Follow the Azure Spatial Anchor Tutorial, do the following 2 steps.- Create an Azure account.
- Create a
Spatial Anchors
resource.
Store theAccount ID
andPrimary Key
into some places. In this project, theAccount ID
XXXXPrimary Key
XXXX
- Set up your Sharing Anchors Service and Plan.
Follow the Tutorial: Share Azure Spatial Anchors across sessions and devices to do the following 3 steps.- Download the Unity sample project
- Deploy your Sharing Anchors Service
- After you publish your ASP.NET web app, copy the the URL of the web page. In this project, it is
https://sharingserviceforsocialar.azurewebsites.net
- [Optional] Set up Azure Cosmos DB to store Anchors permanently.
If you want to store your anchors into CosmosDB other than InMemory, follow the [Tutorial: Share Azure Spatial Anchors across sessions and devices with an Azure Cosmos DB back end] to do the following steps.- Create a database account.
- Deploy the sharing anchors service.
- After you publish your ASP.NET web app, copy the the URL of the web page.
- Configure this project.
- Download or clone this project, use Unity to open this project, from
Window - Package Manger
, install the following packages if neededAR Foundation
AR Core XR Plugin
AR Kit XR Plugin
Windows Mixed Reality
Multiplayer HLAPI
XR Legacy Input Helpers
- In the project, navigate to
Assets\AzureSpatialAnchors.SDK\Resources\SpatialAnchorConfig
, in the inspector, paste yourAzure Account ID
andPrimary Key
created in step 1 to corresponding positions - Open
Assets\Scenes\main
, in the Hierarchy, selectAzureSpatialAnchors
. In the Inspector, paste the URL of the web page got from step 2 or step 3 to theBase Sharing URL
- Download or clone this project, use Unity to open this project, from
- Build and Deploy.
- Open
File - Build Settings
- Under Scenes in build, make sure the first one is
Scenes/RobotSelection
and the second one isScenes/main
- In the platform, click
Android
, then clickSwitch Platform
- Connect your phone to PC via USB. Make sure you open the
Developer Mode
in your phone and allowingUSB Debugging
- Click
Build And Run
in Unity, the project will be built and deployed automatically to your phone. The total build settings should be as follows.
- Open
- Make sure your two phones connected the same WiFi
- When you deploy the apk to your phone, an App called
SocialRobot
on your phone. It looks like as follows - Open the App, now you are in a robot selection page, you can switch the robot that you want to use in the following game play. There are also three buttons in the bottom-left corner, which provide you our 3 modes to play:
PVP
,PVP AR
,PVE
.
- select your favorite robot and the
PVP
mode in the robot selection page, and then clickConfirm
, you can join a factory map. - By clicking the
NoRoom
button, you can open the room manager. - In the first phone, tap
Create
, then you will create a room in the server, and the room name will appear in the button. - In the second phone, tap
Check
, the existing rooms in the server will appear. - Touch
Join
to join the room that the first phone created. Now, the two robot can fight with each other. - More information of fight will include in the following part.
- In the robot selection page, select a robot and the
PVP AR
mode to join the AR scene. Now you can see your environment through the camera. - Similar to the
PVP
mode, open the room manager and create a room in the first phone. - Tap the red plane to place an anchor and then you need to move your phone to scan the environment
- After scan the environment, tap the red plane again to place your robot in real environment.
- Join this room in the similar way of
PVP
mode in the second phone.
- In the robot selection page, select a robot and the
PVE
mode to join a factory map. - In the factory map, you can walk around and pick up materials, which is your resources to build more robot in your factory.
- There are also several AI enemies in the map which patrol in specific areas but they will chase and attack you when they find you.
- Whatever mode and robot you choose, the fighting control is the same. We provide several button and corresponding actions.
Button | Action | Harm | Consume MP | Cause Other Still | Other info |
---|---|---|---|---|---|
Button 'Fist' | Single attack | 1 HP | 0 MP | No | By clicking several times to make multi-segment attack |
Button A | Skill 1 | 10 HP | 20 MP | No | Multi-segment attack, faster than normal attack |
Button B | Skill 2 | 20 HP | 40 MP | Yes | Multi-segment attack, AOE |
Button X | Jump | Different when stand jump and run jump |
- Users can also use the joystick to control the movement of the robot. Users can also touch the screen to adjust the camera view.
- There is a HP bar (red) and MP bar (blue) showing robots' status. Player's HP and MP bar is in the top-left, others' including other players and enemies are in the top of their head.
- By touching other players or enemies, you can open the
Attack Correction
. In this mode, there will be a red arrow in the top of the head of other robots, all the direction of attack actions will be corrected to the direction towards the robot. By clicking theLock
icon, you can unlock theAttack Correction
. The red arrow disappears and your attack direction in the forward of your player.