This project aims at developing a puzzle game for Mixed Reality Environment as Hololens 2 (on which I have worked). This puzzle game challenges the user to solve 3d holographic puzzle games. There is 3 different level of difficulty. A tutorial is also provided to teach the user how to interact with holographic pieces.
As this game was used for data collection purposes, for each session (1/2/3) the game analytics are saved on the Hololens storage and an Azure container using blobs (Thanks to this unity package). The analytics collected are :
- Time
- Player Position and Rotation
- Puzzle ID
- Level of Difficulty
- Time to solve
- Mental Effort the user had to put in a puzzle to solve it (player assessment)
- Difficulty of the puzzle felt by the user (player assessment)
- Puzzle state (every second)
The puzzle played in the game are pre-generated with the python notebook Game_mx.ipynb, with this script you can generate 200 (or how many you want) puzzles and write the grid in a json file. This file will be loaded when the user launches a game session. To generate this json file:
- Open the jupyter notebook (requirements Python 3.X and numpy)
- Use the function generate_json("puzzle_data.json",SIZE_OF_PUZZLE,NUMBER_OF_PIECES,STANDARD_DEVIATION_OF_PIECE_SIZE,STD_INTERVALL) and replace :
- SIZE_OF_PUZZLE by an integer N (the puzzle grid generated will be a N x N x N matrix). N = 4 for example
- NUMBER_OF_PIECES by an integer K which is the number of pieces in your grid. K = 11 for example
- STANDARD_DEVIATION_OF_PIECE_SIZE by a float S which is the standard deviation of the piece size. S = 1.6 for example
- STD_INTERVAL by a float I which represents the interval such as a grid is considered valid if the standard deviation of the piece size is in the interval [S-I;S+I]. I = 0.1 for example
- Your puzzle grid json file is generated in the same folder as Game_mx.ipynb. Note that the name puzzle_data.json can be changed but requires modifying Read_Write_json.cs file in the unity package
If you want to use or modify the game :
- Create a new 3d core Unity Project (version 2020.3.28f1 or above to avoid UnityWebRequest issue).
- Set up your Project for Mixed Reality using MRTK. This tutorial gives all the guidelines to set up your project.
- Then in Unity : Assets>Import Package>Custom Package... and select the Game.unitypackage.
- Open the scene "Game_MX" in the file scene.
- In Unity : Edit>Project Settings>Player>Publishing Settings>Capabilities check :
Click to see all requirements
✅ Internet client
✅ Internet Client Server
✅ PrivateNetworkClientServer
✅ RemovableStorage
✅ SharedUserCertificates
✅ WebCam
✅ Microphone
✅ HumanInterfaceDevice
✅ CodeGeneration
✅ SpatialPerception
✅ InputInjectionBrokered
✅ LowLevelDevices
✅ PointOfService
✅ RecordedCallsFolder
✅ RemoteSystem
✅ SystemManagement
✅ UserDataTasks
✅ UserNotificationListener
✅ GazeInput
In our case, we used Azure to load the puzzle file grid (that was stored on an azure container) feel free to load the file directly from the device by modifying the code. If you want to use this solution, you will need to configure Azure :
- Create/Sign in with an azure account.
- Go to Storage accounts and create a new storage account
- Basics : Name : mxdatacollection - Region : your choice - Performance : your choice - Redundancy : your choice
- Advanced : Require secure transfer for REST API operations : DISABLED
- Once the storage account is created, click on it and create 2 new containers in it (choose Blob or Container for Public Access Level) named data and puzzlejson.
(Note that all proposed names can be changed, yet you will need to modify them in the c# script Read_Write_json.cs)
- Upload the puzzle grid json file "puzzle_data.json" in the puzzlejson container.
- In azure go to your Storage Account>Access Key and copy one of the key values and paste it as the value of the variable accessKey in the script Read_Write_json.cs.
- Build your Unity Project.
- When your unity project will be build : go to the built file and open ./Nameofyourapp/Package.appxmanifest and in the section add the line : <uap:Capability Name="documentsLibrary"/> and save it.
- Deploy your solution on your device.
- You are ready to play !