Hello Falken is the quickest of our sample games to demonstrate the training flow.
By building the Hello Falken sample, you can verify that a client can connect to the Falken service and teach the AI to learn to play a simple game, where the goal is to steer a blue triangle ship to a red diamond goal.
Follow the instructions below to build, run, and play Hello Falken.
You must be running the service, as described in the service instructions before building and running Hello Falken C++.
-
Install CMake (version 3.17 or higher is required)
-
If you are running on Linux and do not have OpenGL installed:
sudo apt-get install libopengl-dev
-
Make a new subdirectory called build and go into that directory:
cd environments/cpp/hello_falken mkdir build cd build
-
Copy the
falken_config.json
generated from launching the service to thebuild
directory.- Windows:
copy ..\..\..\..\service\tools\falken_config.json falken_config.json
- macOS:
cp ../../../../service/tools/falken_config.json falken_config.json
- Linux:
cp ../../../../service/tools/falken_config.json falken_config.json
-
Configure the build: Point
<FALKEN_SDK_DIR>
in the commands below at the directory where you downloaded or built the Falken C++ SDK.The directory that you specify should contain a
Findfalken.cmake
file.- Windows:
cmake -DCMAKE_MODULE_PATH="<FALKEN_SDK_DIR>" -A x64 ..
Make sure to escape \s in the path for the Falken SDK directory.
- macOS:
cmake -DCMAKE_MODULE_PATH="<FALKEN_SDK_DIR>" -GXcode ..
- Linux:
cmake -DCMAKE_MODULE_PATH="<FALKEN_SDK_DIR>" ..
-
Build the project: Note the number of parallel build tasks
4
is required on macOS when building with Xcode other platforms this can be omitted.This can be changed to a number that matches the number of CPUs in your system to speed up builds.
- Windows
cmake --build . --config Release -j
- macOS
cmake --build . --config Release -j
- Linux
cmake --build . -j
-
Run the executable:
- Windows:
.\Release\HelloFalken.exe
- macOS (Xcode):
./Release/HelloFalken
- Linux:
./HelloFalken
- The goal is to steer the blue triangle ship into the red diamond goal, using WASD or arrow keys to control the steering and throttle of the ship.
- After successfully getting to the goal a few times, press the space bar to have Falken take over and automatically steer the ship to the goal.
- If Falken runs into trouble, you can press space bar to take control, correct the problem, and then press space bar again to return control to Falken. Falken will learn from these “corrections” which you should see in ~30 seconds.
- Press R to reset the board.
- Press E to force the start of an evaluation session without waiting for the training to be completed.
Falken Logs are located at:
- macOS:
$TMPDIR/falken.<random alphanumeric values>
- Windows:
C:/User/<username/AppData/Local/tmp/fa<random alphanumeric values>.tmp
Alongside the HelloFalken executable, a HelloFalkenDynamic executable will also
be created automatically.
This is functionally identical to HelloFalken, but exists to demonstrate how to
set actions and
observation attributes on the brain at runtime. The code used for this
executable is the same as HelloFalken,
with the exception of using falken_player_dynamic.h/cc
instead of
falken_player.h/cc
.
- Open the
hello_falken
folder with Android Studio. - Set
systemProp.falken_cpp_sdk.dir
with the Falken C++ SDK path inhello_falken/gradle.properties
. The Falken C++ SDK path is the directory where you downloaded or built the Falken C++ SDK. The path that you specify should contain aFindfalken.cmake
file. - Set
FALKEN_CMAKE_VERSION
with the semantic version number of the installed CMake inhello_falken/gradle.properties
. - Update
hello_falken/src/falken_player.cc
's kJsonConfig value to a stringified JSON converted from falken_config.json generated by the service. - Sync project.
- Build project.
- Install the app on an Android device.
- Make sure that the device is on the same Wi-Fi network as the machine running the service, open the port running the service, and configure the Wi-Fi network to allow the Android device to connect to the machine running the service.
- Launch app.
- The goal is to steer the blue triangle ship into the red diamond goal, using the arrow buttons to control the steering and throttle of the ship.
- After successfully getting to the goal a few times, press A to have Falken take over and automatically steer the ship to the goal.
- If Falken runs into trouble, you can press A to take control, correct the problem, and then press A again to return control to Falken. Falken will learn from these “corrections” which you should see in ~30 seconds.
- Press RESET to reset the board.
- Press B to force the start of an evaluation session w/o waiting for the training to be completed.