ParticulaCode / GoDiceUnityDemo

GoDice Unity Demo
Other
12 stars 5 forks source link

Questions about the Main Scene #3

Closed ghettokon closed 3 months ago

ghettokon commented 2 years ago

I am currently using 2021.2.19f1 to test out this project with my GoDice. All the dice had previously tested and working fine on the official Android GoDice app. When I open this project, the official app is off and all 6 dice are charged and ready to go.

When open the project, USE_ODIN_MOCKUP;DICE_DEBUG;BLUETOOTH_DEBUG;BLUETOOTH_OPERATIONS_DEBUG has already been defined in the "Scripting Define Symbols", I added USE_BLE_PLUGIN and import the Bluetooth LE for iOS, tvOS and Android plug-in as instructed.

I then created the Assembly Definition and named it BLE inside of "Assets\Plugins" by right clicked on the Plugins folder — I was a little confused if this (Plugins) is the right folder to right click. Finally, I added the BLE reference to the reference list in the GoDice.App.Modules.Bluetooth

When I play the Main scene on my PC, I was only able to see 6 simulated dice even though my GoDice are also waiting to connect as well. What did I do wrong? Thanks for your time, best.

blinky465 commented 1 year ago

I'm having a similar problem. I have used the BTLE plugin before to connect my own bluetooth hardware devices (using PIC/AVR and Arduino). I set up the BLE as per the instructions in the ReadMe (as described above). If I add some logging in the void IBluetoothBridge.ScanForPeripherals function, I can see that this method is never called; it's as if the check for USE_BLE is passed as true, but the Bluetooth bridge is not set up.

In order to get the library working (to some degree) I had to change SetUpBridgeCommand.cs and get rid of the IF statement, so it reads:

var providedBridge = Servicer.Get<IBluetoothBridge>();
 _bridge =  new BridgeToLib();

Now I can connect to the different dice and when I click on them on screen, the dice LEDs flash. When the physical dice are rolled, I can see the incoming message in the debug window once they have settled, but the onscreen dice don't update.

MarkZaytsev commented 1 year ago

When I play the Main scene on my PC, I was only able to see 6 simulated dice even though my GoDice are also waiting to connect as well. What did I do wrong? Thanks for your time, best.

Hi there. Plugin that you are using is for "iOS, tvOS and Android" only. It will not work on PC. That is why only simulated dice are available. On Android/iOS device it should work with the GoDice just fine =)

MarkZaytsev commented 1 year ago

In order to get the library working (to some degree) I had to change SetUpBridgeCommand.cs and get rid of the IF statement, so it reads:


var providedBridge = Servicer.Get<IBluetoothBridge>();
 _bridge =  new BridgeToLib();

Hey) Try to trace with log all the way from bluetooth layer to the dice views layer. Seems like view-model setup is correct, since it reacts on tap and messages clearly go from view to device. But get lost/blocked/ignored when go in opposite direction.

It goes like this:

native platform
  |> bluetooth plugin
  |> bridge wrapper 
  |> device characteristics reader, assigned to the device on connection
  |> device model 
  |> die model 
  |> corresponding event dispatched
  |> handler, subscribed to this event is created
  |> in handler, data from event matched and passed to a corresponding in-game model/dialog/view/service
  |> view updates its visuals

I guess you have issues somewhere in the end of the pipeline, resulting to a view not updating. Hope this helps =)