Skip to content

Latest commit

 

History

History
157 lines (140 loc) · 5.42 KB

README.md

File metadata and controls

157 lines (140 loc) · 5.42 KB

Hello Falken

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.

Build and Run Hello Falken (Desktop)

You must be running the service, as described in the service instructions before building and running Hello Falken C++.

  1. Install CMake (version 3.17 or higher is required)

  2. If you are running on Linux and do not have OpenGL installed:

    sudo apt-get install libopengl-dev
    
  3. Make a new subdirectory called build and go into that directory:

    cd environments/cpp/hello_falken
    mkdir build
    cd build
    
  4. Copy the falken_config.json generated from launching the service to the build directory.

    1. Windows:
    copy ..\..\..\..\service\tools\falken_config.json falken_config.json
    
    1. macOS:
    cp ../../../../service/tools/falken_config.json falken_config.json
    
    1. Linux:
    cp ../../../../service/tools/falken_config.json falken_config.json
    
  5. 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.

    1. Windows:
    cmake -DCMAKE_MODULE_PATH="<FALKEN_SDK_DIR>" -A x64 ..
    

    Make sure to escape \s in the path for the Falken SDK directory.

    1. macOS:
    cmake -DCMAKE_MODULE_PATH="<FALKEN_SDK_DIR>" -GXcode ..
    
    1. Linux:
    cmake -DCMAKE_MODULE_PATH="<FALKEN_SDK_DIR>" ..
    
  6. 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.

    1. Windows
    cmake --build . --config Release -j
    
    1. macOS
    cmake --build . --config Release -j
    
    1. Linux
    cmake --build . -j
    
  7. Run the executable:

    1. Windows:
    .\Release\HelloFalken.exe
    
    1. macOS (Xcode):
    ./Release/HelloFalken
    
    1. Linux:
    ./HelloFalken
    

Playing the Game

  • 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.

Build and Run Hello Falken (Android)

  1. Open the hello_falken folder with Android Studio.
  2. Set systemProp.falken_cpp_sdk.dir with the Falken C++ SDK path in hello_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 a Findfalken.cmake file.
  3. Set FALKEN_CMAKE_VERSION with the semantic version number of the installed CMake in hello_falken/gradle.properties.
  4. Update hello_falken/src/falken_player.cc's kJsonConfig value to a stringified JSON converted from falken_config.json generated by the service.
  5. Sync project.
  6. Build project.
  7. Install the app on an Android device.
  8. 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.
  9. Launch app.

Playing the Game

  • 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.