Skip to content

Latest commit

 

History

History
230 lines (152 loc) · 8.59 KB

README.md

File metadata and controls

230 lines (152 loc) · 8.59 KB

Mini Games

Platforms Platforms Platforms

Build Latest Release Google Play Docker

License: MIT GitHub Repo stars Fork Mini Games

Introduction

You can find here how to:

  • configure build files to build for Web, Android, iOS, Linux, MacOS and Windows
  • release your application with GitHub actions
  • write and use multiplatform clients and share model code with the backend of your application with the beauty of Kotlin Multiplatform

Project description

You can find project description in Essay.

Project presentation

Web client

You can go directly to the Mini Games website, where the static client of the application is deployed.

Android client

Android

iOS client

iOS

Local project compilation process

MiniGames.local.demo.mp4

Download and run application

Android released version is available on Google Play.

Get it on Google Play

You can download compiled version of application from release page.

Client applications are configured to work with the server deployed on test server. You can download them to play with "production" version of application - to run it locally, you should compile server and clients by yourself.

Please note that for running unsigned version of macOS application, you need to temporarily disable Gatekeeper, so executing command

sudo xattr -dr com.apple.quarantine  /Applications/MiniGames.app

is required to be able to run the app on macOS. You can learn more about this here.

To install Linux version run:

sudo dpkg -i  minigames.deb

You can try playing with default login credentials which are publicly available:

  • user: user
  • password: pass

You need a fast internet connection to have a good play experience in SnakeIO game.

Set up the project

Project contains two parts - client app and the server app.

Intellij Ultimate is highly recommended when working with server app.

In both cases, open main project directory when importing the project ( not the android-app, desktop-app nor server etc.) as the main directory contains the configuration common to both projects and has to be loaded.

Remember: When working with project use Rebase strategy as long as you can not to create extra merge commits. You'll be asked by the IDE probably during first push when some other developer also made changes.

Compile and run application

To compile client application you need Android SDK as well as JDK 17 (corretto version was used).

Server

Environment

There is a docker environment configured in docker-compose.yml required to run server application. It contains Postgres database for server data. You can start it with

./start.sh

on linux or some equivalent commands on other platform.

Run from terminal

The easiest way to run the instance of server is to start it from terminal by running Gradle

./gradlew server:run

from the root directory of project.

Run from Intellij

To run the server from the Intellij, go to the Server class and run the main function (starting database manually before).

Notice: You need to have environment variables loaded to build configuration to start application correctly. The easiest way is to copy the content of .env file and paste it in the build configuration in Intellij as committed version contains the definition of developer environment.

Compile to JAR file

Just run ./gradlew stage to build the server distribution. Build result will be located in server/build/libs/. You can run it with java -jar command, but you have to manually set the needed env variables to make application working.

Desktop

Run from terminal

The easiest way to run the instance of desktop client is to start it from terminal by running Gradle

./gradlew desktop-app:runDistributable

from the root directory of project.

iOS

Run from terminal

To run iOS version of client cocoapods pod needs to be compiled and installed to XCode project located in ios-app. The easiest way to compile and link all ios targets is to run

./gradlew linkPodReleaseFrameworkIosFat linkPodDebugFrameworkIosFat

from the root directory of project and then

./gradlew podInstall

to install the compiled resources to XCode.

The last step is to set up the XCode project by first changing the value of TEAM_ID in ios-app/Configuration/Config.xcconfig to your own and then open XCode workspace available in ios-app.

Android

Run from Intellij

The easiest way to run the instance of android client is to start it from Android Studio by running Gradle the generated build configuration android-app. It should build the debug version of application and deploy it on available emulator of android device. This is the only advised method of running the client application for android platform.

Web

Run from terminal

The easiest way to run the instance of wev client is to start it from terminal by running Gradle

./gradlew web-app:wasmJsBrowserProductionRun

from the root directory of project.

Project structure

Projects is configured as Gradle modules that may depend on each other. E.g. it contains module that is compiled to .jar distribution file of server for the application and some other module that can be compiled to Android .apk file.

Application modules

  • build-src - contains configuration of build logic (it's compiled before Gradle build of the other modules even starts)
  • shared - contains common logic for server and shared-client like domain model or rest api model, depends on build-src
  • shared-client - contains common logic for android-app (and future ios-app) like rest client, depends on build-src and shared
  • android-app - targets Android, depends on shared-client
  • desktop-app - targets any JVM desktop, depends on shared-client
  • web-app - targets web, depends on shared-client
  • server - targets JVM, depends on build-src and shared

Extra directories

  • dev-env - useful tools that should be used by developers that are working locally to test their current code and solutions
    • docker environment with Postgres database can be run with start.sh
    • http contains http requests definitions that can be run from Intellij. They're configured by the http-client.env.json to switch between different environments