A simple game using raylib and AOS/EDMS for jumping to survive.
The game is designed to demonstrate the use of AOS/EDMS for real-time data processing and interaction with a game environment. The information of the players and two immediate obstacles is sent via gateway to the player runnable, which then decides whether the player should jump or not based on the current game state. Thus, it contains two essential components:
- Environment Gateway: This component is responsible for sending the game state information to the player runnable. It collects data about the player and obstacles and sends it to the player runnable.
- Player Runnable: This component receives the game state information from the environment gateway and decides whether the player should jump or not. It implements the logic for controlling the player based on the current game state.
The game is designed to be simple and easy to understand, making it a great starting point for learning about game development and real-time data processing.
- Player could be controlled either automatically by the algorithm implemented in player.cpp or manually using the space key or left mouse button.
- The player must jump over obstacles to survive
-
Ubuntu 20 or 22
-
AOS: the example is tested for-
- v0.37.0 for Ubuntu 20
- v0.40.0 for Ubuntu 22
-
conan version >=1.60.0. It could be installed using
pip install conan==1.60.0 -
Add the following remotes to your local conan (required for downloading raylib dependencies):
conan remote add conancenter1 https://center.conan.io conan remote add conancenter2 https://center2.conan.io
-
raylib dependencies based on raylib:getting started (No need to install raylib separately. Just install the following dependencies)
sudo apt install libasound2-dev libx11-dev libxrandr-dev libxi-dev libgl1-mesa-dev libglu1-mesa-dev libxcursor-dev libxinerama-dev libwayland-dev libxkbcommon-dev
-
Opengl based dependencies
sudo xargs -a dep/packages.txt apt install -y
-
Packages in conanfile.py are called using
<package_name>/{os.getenv('AOS_VERSION')}@aos/{os.getenv('AOS_CHANNEL')}, example:aos_runtime_dev/{os.getenv('AOS_VERSION')}@aos/{os.getenv('AOS_CHANNEL')}. Thus, you need to set the two variables using. Let's say, if 0.35.0-beta2 is used, then:bash export AOS_VERSION="0.35.0-beta2" export AOS_CHANNEL="sdk" -
For the commands below, choose a relevant host profile ($PROFILE) and build directory ($BUILD_DIR), example:
x86_64_linux_gcc8_releaseandbuild_qosrespectively.
conan install -if $BUILD_DIR -pr:b x86_64_linux_gcc8_release -pr:h $PROFILE $(pwd) --build missing
conan build -if $BUILD_DIR -bf $BUILD_DIR $(pwd)
cd $BUILD_DIR
./bin/esme manifest.bin -1Build folder generally contains extra conan files. In order to deploy a clean folder to your target you could use conan package method. An example implementation could be found in conanfile.py in package() method It could be called using:
conan package -if=<install-directory> -bf=<build-directory> -pf=<package-directory> <tutorial-folder>
For the current example, it would be:
conan package -if $BUILD_DIR -bf $BUILD_DIR -pf $PACKAGE_DIR $(pwd)
This would generate you a $PACKAGE_DIR which could be deployed on your target.
To write an algorithm to improve the score, you can modify the player.cpp file. You can implement your own logic to enhance the player's performance in the game. This could be implemented by modifying the shouldPlayerJump method, which is called to determine if the player should jump based on the current game state.
All the related parameters for the enviornment passed to the gateway are available in startup.ini. This file is loaded both in runnable and the gateway. If you would like to use these parameters in your algorthim, you can access them using GetInteger and GetReal functions as also used in EnvironmentGateway.cpp
- Issue: Failed to open display
WARNING: GLFW: Error: 65550 Description: X11: Failed to open display :1-
Solution: Check what is the value of DISPLAY variable, using
echo $DISPLAY. Enter that value in either of manifest/manifest_u22.json ormanifest/manifest_u22.json depending on the operating system you use (Ubuntu 22 or Ubuntu 20), in the section:"processes": [ { "id": "ProcessId_environment_gateway_Gateway", "idx": 0, "activity_idx": 0, "process_type": "InternalProcess", "process": { "execution": { "executable_idx": 0, "arguments": [], "environment": ["ACTIVITY_INSTANCE_NAME=environment_gateway", "DISPLAY=:1"],
-

