Creating Multiplayer 1v1 shooter experience

Include the following details (edit as applicable):

  • Issue category: Semantic Segmentation / Multiplayer / Real-time Mapping-Depth / ARDK Documentation / Unity Example Package / Sample App aka ‘AR Voyage’ / ARDK Virtual Studio Tools / Developer Tools / Networking
  • Device type & OS version: Android / iOS / Other Ex. iPhone 8+ on iOS 13
  • Host machine & OS version: Mac / Windows / Linux / Other Ex. Mac on Big Sur x.x
  • Issue Environment : Unity Remote / Unity Mock / On Device / Dev Portal
  • Xcode version:
  • ARDK version:
  • Unity version:

Description of the issue: I am currently creating a multiplayer experience with lightship for an AR class. Essentially, a player joins a match, places 3D objects as cover in their environment, then they tap on the screen to shoot a projectile at another player. My group has come up with multiple builds in Unity. I’ll just list the issues we’re dealing with. We can place objects on a plane in our mock scene, however, we need the script to stop placing objects and start firing our bullet projectile when we click. Next, when we build to an Android device, the screen goes black, but the user is able to click on the screen, firing our bullet object every time they click. We’re not really concerned with the multiplayer aspect right now, we just want to be able to place objects and fire a projectile in a scene. I can provide pictures or video of our project as well as scripts if they would be useful. Thanks!

Hello Peyton,

One way to switch what objects are instantiated is to modify the code with counters and ‘if statements.’ For instance, create a Counter variable that increases each time you place a cover object. If that Counter becomes greater than 3 (for example), you can change the instantiated object from cover to projectile and add other methods to define the behavior of the projectile.

For the black screen issue, please make sure you have checked the following:

  • That you have added the Android Permission Requester component
  • That the scripts that require a Camera object have one assigned
  • That the camera permissions on your app are not causing any issues

Please refer to Building ARDK Apps for Android if the above did not resolve the issue

Thank you for your response! We have not been able to build our ARDK scene to an Android device yet, despite trying most of the solutions we’ve found. Good news is that we have most of our experience working, we can place objects, shoot, destroy targets, etc. If we could build to a device we’d be right on track. The other issue is multiplayer. We’ve been stuck on this for a while. Any links to a thorough multiplayer walkthrough or the code would be helpful. Thanks!

Hello Peyton,

Just to clarify, are you unable to successfully build to your Android device because of the black screen issue? Or are you facing other issues/errors? In addition to that clarification, could you also please provide the following information:

  • What is the OS of your Android device?
  • What is your host machine and OS version?
  • What version of ARDK are you using?
  • Are you using a specific ARDK Example Scene?
  • What version of Unity are you using?
  • If the build fails with errors, could you please share the error log?

For the multiplayer issues, have you checked out Lightship’s Developer Documentation on Multiplayer? The Creating a Multiplayer Experience document provides a good starting point that explains how to create sessions and provides some example code to help you do so. You can also check out the Unity Manual for additional information on how to set up a multiplayer project.