Clone this repo:

Branches

  1. 65896c7 Use the "roaming" instead of "generic" runtime factory. by Asim Shankar · 6 years ago master
  2. 989c93c croupier: Flutter Mega Upgrade by Alex Fandrianto · 6 years ago
  3. baa88da TBR: croupier: Make all versions 'v23-0.1'. by Nicolas Lacasse · 6 years ago
  4. 0c0bdac croupier: Step #1 of simplified Syncbase API transition by Adam Sadovsky · 6 years ago
  5. fa2c845 croupier: v.io/x/devtools: start to use profile-v23 by Cosmos Nicolaou · 6 years ago

Croupier

Croupier is a Vanadium demo app of a general card playing game for multiple devices. Croupier utilizes Syncbase and P2P Discovery as the foundations for game formation and state synchronization.

This repository contains two implementations of Croupier, one in Go and the other in Mojo and Flutter. As Croupier's primary card game is Hearts, the two sides are meant to interoperate with that game. The Flutter version also supports Solitaire and is built so that more games can be added in the future.

Instructions for running the program with Flutter on Android follow. TODO(alexfandrianto): Add instructions for running the Go version.

Prerequisites

Mojo

Currently, development is heavily tied to an existing installation of Mojo. Please ensure that your Mojo checkout is located at $MOJO_DIR and has built out/android_Debug. Instructions are available here.

Flutter

Development now also depends on the alpha branch of the Flutter repo. It is possible that the pubspec.yaml file will need to be modified to accomodate your installation of Flutter. Instructions are available here.

The last known version of Flutter guaranteed to work with this project is present inside the FLUTTER_VERSION file.

Dart

Flutter depends on a relatively new version of the Dart SDK. Therefore, please ensure that you have installed the following version or greater:

Dart VM version: 1.13.0-dev.3.1 (Thu Sep 17 10:54:54 2015) on "linux_x64"

If you are unsure what version you are on, use dart --version.

To install Dart, visit their download page. You may need to manually download a specific version of Dart. If so, visit their archives for exact downloads.

Vanadium

A Vanadium installation is not required since Croupier pulls all of its Vanadium-related dependencies from pub.

Running Croupier

Credentials

There are two ways to get credentials. These are used to determine who can access your Syncbase instance. You do not need to follow both instructions.

On-Device OAuth Credentials

One way to obtain them is through OAuth. When Syncbase is started on Android, it will ask you to select an account. You must have an account added on the Android device for this to work.

Test Credentials

During tests, it may be more convenient to create test credentials locally and push them onto the phone. Note: running the following command will pop-up the standard principal seekblessings tab in order to obtain your approval to use OAuth.

make creds

If you clean the credentials, you will need to obtain fresh credentials.

Note on Multiple Devices

If you have more than 1 device plugged into the computer, you will need to specify which device to use. adb devices will tell you the order of your devices.

It is highly recommended that you mark/remember the order of the devices; it is the same as the order they were plugged into the computer/workstation.

For later devices, instead of ANDROID=1 use 2, 3, 4, etc.

Note: Running Croupier on multiple Android devices simultaneously is still a work-in-progress. The workaround is to launch Croupier on a single device at a time.

Note: This example currently relies on a mount table on the local network at 192.168.86.254:8101. To avoid this, use the set the GLOBAL environment variable to true (see below).

Start

Start Croupier on your USB-debugging enabled Android device.

ANDROID=1 make start

Alternatively, use a different integer. Since the first device creates a syncbase instance that the others are mounted upon, it is recommended that this one is started before the other devices.

Shortcuts

In order to run the app without being connected to a workstation, you need to load a shortcut onto your Android devices.

ANDROID=1 make shortcut

Note: The command above loads a file that affects how make start runs. To return to normal development, you should clean up the shortcut file.

ANDROID=1 make shortcut-remove

Global Flag

If you want to run the app on the global public mount table (recommended), you should set the GLOBAL environment variable to true.

GLOBAL=true ANDROID=1 make start
GLOBAL=true ANDROID=1 make shortcut

Using the global mount table can make app performance a little slower, but you will not need to run a local mount table at 192.168.86.254:8101.

Deleting Mojo Shell

On your Android device, go to the Apps that you downloaded and Uninstall Mojo Shell from there. This cleanup step is important for when Mojo is in a bad state.

Note: Syncgroup data and some Syncbase data is not cleaned up between runs. This means that deleting Mojo Shell can often be helpful in cases where clearing Mojo Shell's data is insufficient.

Cleaning Up

Due to some issues with mojo_shell, you may occasionally fail to start the program due to a used port. Follow the error's instructions and try again.

Between builds of Mojo and Syncbase, you may wish to clean up the app and database info.

ANDROID=1 make clean

You can also clean credentials instead:

ANDROID=1 make clean-creds

Don't forget to do make creds to rebuild them.

Lastly, you can also clear out the pub packages:

make veryclean