/temporal-polyglot-snake

Simple snake game powered by Temporal Java, Go, and PHP SDKs

Primary LanguageJava

Temporal Polyglot Example - Snake Game

Temporal Snake Game

This demo uses the following Temporal SDKs:

This demo shows how Temporal can be used to orchestrate multiple polyglot services responsible for different parts of a snake game.

Running the demo

Start the Temporal Server:

git clone https://github.com/temporalio/docker-compose.git
cd  docker-compose
docker compose up

Start the Game Services

Game Controller Service

The Game Controller Service is a Java App that uses the Temporal Java SDK

cd game-controller
mvn compile exec:java -Dexec.mainClass="io.temporal.snakegame.controller.ControllerStarter"
Game Info Service

The Game Info Service is a Go App that uses the Temporal Go SDK

cd game-info
go run worker/main.go
Game Movement Rules Service

The Game Movement Rules Services is a PHP App that uses the Temporal PHP SDK

cd game-rules
./rr serve

Start the Game

Snake Game

The Snake game is a Java app which uses the three started services for overall game control, game info such as images, text, fonts background, etc as well as movement controls.

cd game
mvn compile exec:java -Dexec.mainClass="io.temporal.snakegame.SnakeGameStarter"

Playing The Demo

Once the game starts you can use your keyboard LEFT RIGHT UP DOWN keys to move the snake across the board. The goal is to eat the apples. Once you eat an apple your snake will increase and another apple icon will get displayed on the board. If you run into any of the edges of the board, or into your snake itself the game is over.