{"id":21406397,"url":"https://github.com/chandler767/cube-fight","last_synced_at":"2025-07-14T00:32:31.331Z","repository":{"id":40379615,"uuid":"148680124","full_name":"chandler767/Cube-Fight","owner":"chandler767","description":"Multiplayer augmented reality game using Magic Leap powered by PubNub.","archived":false,"fork":false,"pushed_at":"2019-02-21T19:28:53.000Z","size":104986,"stargazers_count":9,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-07T20:21:27.565Z","etag":null,"topics":["augmented-game","augmented-reality","csharp","eye-tracking","game","gaze-tracking","magic-leap","magicleap","magicleapone","publish","pubnub","pubsub","subscribe","tutorial","unity","virtual-reality"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chandler767.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-09-13T18:24:49.000Z","updated_at":"2025-03-31T01:50:04.000Z","dependencies_parsed_at":"2022-09-15T06:41:30.086Z","dependency_job_id":null,"html_url":"https://github.com/chandler767/Cube-Fight","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/chandler767/Cube-Fight","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chandler767%2FCube-Fight","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chandler767%2FCube-Fight/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chandler767%2FCube-Fight/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chandler767%2FCube-Fight/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chandler767","download_url":"https://codeload.github.com/chandler767/Cube-Fight/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chandler767%2FCube-Fight/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265227897,"owners_count":23731059,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["augmented-game","augmented-reality","csharp","eye-tracking","game","gaze-tracking","magic-leap","magicleap","magicleapone","publish","pubnub","pubsub","subscribe","tutorial","unity","virtual-reality"],"created_at":"2024-11-22T16:39:36.430Z","updated_at":"2025-07-14T00:32:28.162Z","avatar_url":"https://github.com/chandler767.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cube Fight\n\n### Multiplayer augmented reality game powered by [PubNub](https://www.pubnub.com/?devrel_gh=Cube-Fight).\n\n\u003cimg src=\"/Magic-Leap-Multiplayer-Demo-op.gif?raw=true\" alt=\"Magic Leap Multiplayer Demo\" width=\"350\" align=\"right\" /\u003e\n\nAugmented reality is a fresh new layer for gaming that promises new experiences for users and more revenue for game studios. However, AR brings new challenges to traditional game design when you start to build multi-user games and need to sync content between them. Even in single player games where there's no content to sync, there's a significant demand from users to add social experiences like \u003ca href=\"https://www.pubnub.com/products/chatengine/?devrel_gh=Cube-Fight\" target=\"_blank\" rel=\"noopener\"\u003echat\u003c/a\u003e and \u003ca href=\"https://www.pubnub.com/blog/realtime-highscores-leaderboards-in-unity/?devrel_gh=Cube-Fight\" target=\"_blank\" rel=\"noopener\"\u003eleaderboards\u003c/a\u003e.\n\nThe objective of \u003ca href=\"https://github.com/chandler767/Cube-Fight\" target=\"_blank\" rel=\"noopener\"\u003eCube Fight\u003c/a\u003e is to take cubes from other players by using the \u003ca href=\"https://creator.magicleap.com/learn/tutorials/eye-gaze-unity\" target=\"_blank\" rel=\"noopener\"\u003eMagic Leap Eye Gaze\u003c/a\u003e feature to select a cube and the trigger on the controller to take it. PubNub will handle transmission of messages regarding the ownership state of each cube.\n\nLearn more about how to build your own multiplayer AR game with Magic Leap and PubNub from the [tutorial](https://www.pubnub.com/blog/Multiplayer-Augmented-Reality-Game-Magic-Leap-unity/?devrel_gh=Cube-Fight).\n\n\u003ca href=\"https://www.pubnub.com/blog/Multiplayer-Augmented-Reality-Game-Magic-Leap-unity/?devrel_gh=Cube-Fight\"\u003e\n    \u003cimg alt=\"PubNub Blog\" src=\"https://i.imgur.com/aJ927CO.png\" width=260 height=98/\u003e\n\u003c/a\u003e\n\n## Why PubNub and Magic Leap?\n\u003cem\u003eThis is Part three of my Magic Leap series. Check out the other projects/posts \u003ca href=\"https://www.pubnub.com/blog/getting-started-with-magic-leap-and-unity?devrel_gh=cube-fight\" target=\"_blank\" rel=\"noopener\"\u003eGetting Started with Magic Leap and PubNub\u003c/a\u003e and \u003ca href=\"https://www.pubnub.com/blog/magic-leap-controlling-internet-connected-devices-lights-doors-with-hand-gestures/?devrel_gh=Cube-Fight\" target=\"_blank\" rel=\"noopener\"\u003eControlling Internet-connected Devices with Magic Leap Hand Gestures\u003c/a\u003e.\u003c/em\u003e\n\nDevelopers have been building multiplayer games and other multi-user experiences with PubNub for years, and \u003ca href=\"https://www.pubnub.com/blog/getting-started-with-magic-leap-and-unity?devrel_gh=Cube-Fight\" target=\"_blank\" rel=\"noopener\"\u003ePubNub definitely sees AR as next on the horizon\u003c/a\u003e. PubNub is a natural fit in the AR world and their technology can power the realtime interaction between AR headsets or physical objects in the same location, or even across the Earth.\n\nFor instance, when a Magic Leap user throws a ball in the virtual world, that motion is synchronized in realtime across every other connected user. Or if a user uses a hand gesture to turn on a light, \u003ca href=\"https://github.com/chandler767/Magic-Leap-IoT-Example\" target=\"_blank\" rel=\"noopener\"\u003ePubNub is sending the message to that light to turn on\u003c/a\u003e. Multi-user experiences, or the relationship between the AR headset and the physical world around us, is where PubNub is required and excels.\n\n## How it Works\nThis game uses \u003ca href=\"https://creator.magicleap.com/learn/tutorials/eye-gaze-unity\" target=\"_blank\" rel=\"noopener\"\u003eMagic Leap Eye Gaze\u003c/a\u003e to select game objects (the cubes) and the trigger on the controller to take them. Additionally, there's an eye position indicator to aid the user in knowing where the device thinks they are looking.\n\nThere are three states/colors each cube can be in:\n\n* Not Focused (\u003cstrong\u003ered\u003c/strong\u003e) - The user is \u003cstrong\u003enot looking\u003c/strong\u003e directly at the cube, has \u003cstrong\u003enot taken\u003c/strong\u003e the cube, and\u003cstrong\u003e another player owns\u003c/strong\u003e the cube.\n\n\u003cimg src=\"https://www.pubnub.com/blog/wp-content/uploads/2018/10/image-red-1024x768.jpg\" alt=\"Not Focused Cube Fight Cube\" width=\"300\" align=\"center\" /\u003e\n\n * Focused (\u003cstrong\u003edark red\u003c/strong\u003e) - The user has \u003cstrong\u003elooked at\u003c/strong\u003e, but \u003cstrong\u003enot taken\u003c/strong\u003e the cube and\u003cstrong\u003e another player owns\u003c/strong\u003e the cube. Notice the eye position indicator is on the cube (the blue sphere).\n \n \u003cimg src=\"https://www.pubnub.com/blog/wp-content/uploads/2018/10/selected-1024x768.jpg\" alt=\"Focused Cube Fight Cube\" width=\"300\" align=\"center\" /\u003e\n \n * Owned (\u003cstrong\u003eblue\u003c/strong\u003e) - The user has \u003cstrong\u003elooked at\u003c/strong\u003e and\u003cstrong\u003e took the cube\u003c/strong\u003e by pulling the trigger.\n \n \u003cimg src=\"https://www.pubnub.com/blog/wp-content/uploads/2018/10/image-blue-1024x768.jpg\" alt=\"Owned Cube Fight Cube\" width=\"300\" align=\"center\" /\u003e\n \nEach cube has the script \u003ca href=\"https://github.com/chandler767/Cube-Fight/blob/master/Cube-Fight/Assets/EyeSelection.cs\" target=\"_blank\" rel=\"noopener\"\u003e\"EyeSelection\"\u003c/a\u003e as a component. This script handles eye tracking and controller events. When the player looks directly at a cube and pulls the trigger a message is published to PubNub to inform other players of the ownership change. When the players receive a message the cube color is updated to reflect the current state of the cube.\n\n## How to Build \n\nThe tutorial [*Create a Multiplayer Augmented Reality Game with Magic Leap and Unity*](https://www.pubnub.com/blog/Multiplayer-Augmented-Reality-Game-Magic-Leap-unity/?devrel_gh=Cube-Fight) details how to build and run this project in full.\n\n## What's Next?\nThe augmented world is your oyster with Magic Leap + PubNub. Here are a few ideas to get you started:\n\u003cul\u003e\n \t\u003cli\u003eBuild a AR chess game.\u003c/li\u003e\n \t\u003cli\u003eCreate a AR zombie shooter.\u003c/li\u003e\n \t\u003cli\u003e\u003ca href=\"https://github.com/chandler767/Magic-Leap-Gesture-IoT-Example\" target=\"_blank\" rel=\"noopener\"\u003eUse gesture recognition \u003c/a\u003eto control devices like a lamp or fan.\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cstrong\u003eHave suggestions or questions about the content of this post? Reach out at \u003ca href=\"mailto:devrel@pubnub.com\" target=\"_blank\" rel=\"noopener\" data-rawhref=\"mailto:devrel@pubnub.com\"\u003edevrel@pubnub.com\u003c/a\u003e.\u003c/strong\u003e\n\n\u003cem\u003eThis is Part three of my Magic Leap series. Check out the other projects/posts \u003ca href=\"https://www.pubnub.com/blog/getting-started-with-magic-leap-and-unity?devrel_gh=cube-fight\" target=\"_blank\" rel=\"noopener\"\u003eGetting Started with Magic Leap and PubNub\u003c/a\u003e and \u003ca href=\"https://www.pubnub.com/blog/magic-leap-controlling-internet-connected-devices-lights-doors-with-hand-gestures/?devrel_gh=Cube-Fight\" target=\"_blank\" rel=\"noopener\"\u003eControlling Internet-connected Devices with Magic Leap Hand Gestures\u003c/a\u003e.\u003c/em\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchandler767%2Fcube-fight","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchandler767%2Fcube-fight","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchandler767%2Fcube-fight/lists"}