This is a demo project on how you can communicate with GoDice. Use it as a reference or starting point for your own application.
Here you can find a tutorial video of how to build the project in Unity for Android: https://youtu.be/SjlsfxbiFwc
2023.2.20f1
. It probabbly should work just fine with any previous major version of Unity. But there is a great chance that scripting define symbols will be missing and this will cause compilation errors. To fix it, add the following defines USE_ODIN_MOCKUP;DICE_DEBUG;BLUETOOTH_DEBUG;BLUETOOTH_OPERATIONS_DEBUG
Bluetooth plugin is not included in this repository due to legal issues. We strongly recommend using this plugin Bluetooth LE for iOS, tvOS and Android.
To add the Plugin to the project, do the following:
Feel free to reorder plugin's content as you like, but make sure to create an Assembly Definition (BLE in our case) for these scripts:
"Assets\Scripts\GoDice\App\Modules\Bluetooth"
, click the assembly refernece file GoDice.App.Modules.Bluetooth
and the reference to BLE
assembly definition (from the previous step) to the Assembly Definition Reference list (by dragging it to the end of the list), click Apply. Now everything supposed to compile.USE_BLE_PLUGIN
definition to the "Scripting Define Symbols" section. Click Apply. If you want to use another plugin for bluetooth communication, you have to make your own implementation of IBluetoothBridge
and disable USE_BLE_PLUGIN
define.FrostLib is an in-house set of scripts.
We encourage you to also add Odin Inspector to the project. It will provide you with a better inspector for simulated dice. And this is an awesome plugin in general. By default demo project has OdinMockup
assembly to keep the code compiled, but you if you add Odin Inspector and disable USE_ODIN_MOCKUP
Whatever plugin you'll decide to use for Bluetooth - don't forget to reference its assembly definition in GoDice.App.Modules.Bluetooth
Project is based on an event-handler approach with a custom DI and ServiceLocator pattern. If you are looking for an entry point - look at Bootstrapper
classes and Bootstapper
game objects on the scene.Demo.Bootstrapper
is an entry point to the project. Some code in the project is unused, but kept for demonstration sake. Some design decisions may seems redundant or overengineered, but keep in mind that all this code is transferred from GoDice companion project and part of much bigger and complex codebase.
Project contains following modules:
Here is a quick look at all c# projects in the solution
Contains very basic UI classes, starts common services and initializes other modules. Demonstrates how to connect to multiple dice and exchange messages.
Generally this is an abstraction and wrapper over bluetooth plugin. Module is responsible for:
IBluetoothBridge
Module is responsible for:
Module is responsible for:
IBluetoothBridge
implementationSimulation module is not 100% correct to the firmware of GoDice. Yet they are reasonably similar and allow reliable playtest dice in editor. In Editor simulated dice are always loaded by default in runtime. But you can have them instantiated on scene before entering play mode, if you want to have a persistent custom setup of dice.
Contains classes that are supposed to be shared across different modules. Kept for compatibility sake with the GoDice companion application.
Contains useful commands and hotkeys to work with dice in editor.