All Projects → tanis2000 → minigame-rust

tanis2000 / minigame-rust

Licence: MIT license
A simple game made in Rust that runs on desktop and mobile

Programming Languages

c
50402 projects - #5 most used programming language
objective c
16641 projects - #2 most used programming language
C++
36643 projects - #6 most used programming language
rust
11053 projects
java
68154 projects - #9 most used programming language
CMake
9771 projects

Projects that are alternatives of or similar to minigame-rust

CloudBuildManifest
CloudBuildManifest is library to get build information for Unity Cloud Build.
Stars: ✭ 18 (-84.75%)
Mutual labels:  game-dev
Wallop
Extensible, living/animated wallpaper engine built in C# using Silk.NET's OpenGL wrapper at its core.
Stars: ✭ 27 (-77.12%)
Mutual labels:  desktop
launchui-packager
Package applications using LaunchUI for Windows, Linux and OS X.
Stars: ✭ 69 (-41.53%)
Mutual labels:  desktop
OpenChess
A cross-platform chess game.
Stars: ✭ 18 (-84.75%)
Mutual labels:  desktop
SteamTradeBot
Open source steam trading bot. Accepting or declining trades based on the automatic value calculation.
Stars: ✭ 65 (-44.92%)
Mutual labels:  desktop
05 TestingGrounds
A Hunger-Games inspired FPS with large outdoor terrains. Advanced AI, basic networking, pickups, skeletal meshes, checkpoints and more. (ref: TG_URC) http://gdev.tv/urcgithub
Stars: ✭ 121 (+2.54%)
Mutual labels:  game-dev
qikQR
minimal desktop app to create QR codes.
Stars: ✭ 20 (-83.05%)
Mutual labels:  desktop
unboundbible
Unbound Bible is an open source and a free, multilingual Bible-reader program for Mac, Linux and Windows.
Stars: ✭ 25 (-78.81%)
Mutual labels:  desktop
ubuntu-vnc-xfce-chromium
Retired. Headless Ubuntu/Xfce container with VNC/noVNC and Chromium (Generation 1)
Stars: ✭ 20 (-83.05%)
Mutual labels:  desktop
SpaceProject
A top-down 2D, procedurally generated space exploration and shooter game using libGDX. Kinda like Asteroids, only a little bigger.
Stars: ✭ 28 (-76.27%)
Mutual labels:  desktop
mmo-arch
Base Architecture for creating scalable games using microservices through Angular, Phaser, NestJS, NATS, and MySQL
Stars: ✭ 25 (-78.81%)
Mutual labels:  game-dev
Smart-Text-Editor
The text editor that requires only a browser and a keyboard!
Stars: ✭ 60 (-49.15%)
Mutual labels:  desktop
larasar
Laravel + Quasar Framework
Stars: ✭ 77 (-34.75%)
Mutual labels:  desktop
ult
The Ultimate Dev Stack
Stars: ✭ 54 (-54.24%)
Mutual labels:  desktop
glimmer-dsl-tk
Glimmer DSL for Tk (Ruby Tk Desktop Development GUI Library)
Stars: ✭ 26 (-77.97%)
Mutual labels:  desktop
pranaOS
A unix operating system written from scratch in c that gives support for arm, x86
Stars: ✭ 138 (+16.95%)
Mutual labels:  desktop
harmony-ecs
A small archetypal ECS focused on compatibility and performance
Stars: ✭ 33 (-72.03%)
Mutual labels:  game-dev
tomb mates
t.me/memes4js
Stars: ✭ 40 (-66.1%)
Mutual labels:  game-dev
cim-spec
This repository hosts the specification for the Cartographic Information Model
Stars: ✭ 45 (-61.86%)
Mutual labels:  desktop
cl-liballegro
Common Lisp bindings and interface to the Allegro 5 game programming library
Stars: ✭ 44 (-62.71%)
Mutual labels:  game-dev

minigame

This is a basic sample game made with Rust that runs on both desktop and mobile platforms.

Supported platforms:

  • Windows
  • macOS
  • Linux
  • iOS
  • Android
  • Browser

Right now it's been tested on macOS, iOS, Android and the browser and it works as long as you do some steps by hand. The idea is to have the whole show running on its own without the need of any manual steps.

Screenshot

Screenshot of the game

Hot code reloading

This is a feature that is only available on the desktop but it's very handy when working with gameplay code.

Edit src/test_shared.rs and run cargo build to see hot reloading in action.

Run cargo run to run with the dynamic library Run cargo run --no-default-features to run the application with all of the code statically linked and with hotloading disabled.

Installing needed targets for mobile

# iOS. Note: you need *all* five targets
rustup target add aarch64-apple-ios armv7-apple-ios armv7s-apple-ios x86_64-apple-ios i386-apple-ios

# Android
rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android

Building without hot reloading

cargo build --no-default-features --lib

Building the Rust library for iOS

minigame supports building for both the iOS simulator and real devices.

Building for the iOS simulator

To build for iOS simulator:

cargo build --no-default-features --target x86_64-apple-ios --lib

This command will also download SDL2 and compile it for both the simulator and iOS device

Building for an iOS device

To build for iOS simulator:

cargo build --no-default-features --target aarch64-apple-ios --lib

This command will also download SDL2 and compile it for both the simulator and iOS device

Compiling the iOS project

Just open the ios/minigame/minigame.xcodeproj Xcode project and run it and you should be done.

Building the Android standalone toolchain

/Users/tanis/Documents/android-sdk/ndk-bundle/build/tools/make_standalone_toolchain.py --arch arm --install-dir /Users/tanis/Documents/android-ndk-arm
/Users/tanis/Documents/android-sdk/ndk-bundle/build/tools/make_standalone_toolchain.py --arch arm64 --install-dir /Users/tanis/Documents/android-ndk-arm64
/Users/tanis/Documents/android-sdk/ndk-bundle/build/tools/make_standalone_toolchain.py --arch x86 --install-dir /Users/tanis/Documents/android-ndk-x86
/Users/tanis/Documents/android-sdk/ndk-bundle/build/tools/make_standalone_toolchain.py --arch x86_64 --install-dir /Users/tanis/Documents/android-ndk-x86_64

Configuration for Android linking

For the time being you have to use a standalone toolchain. I'm pretty sure this can be solved with some clever code in build.rs by setting the correct sysroot, but that's something left for later.

Edit .cargo/config and add the following:

[target.armv7-linux-androideabi]
linker = "/Users/tanis/Documents/android-ndk-arm/bin/arm-linux-androideabi-gcc"

[target.aarch64-linux-android]
linker = "/Users/tanis/Documents/android-ndk-arm64/bin/aarch64-linux-android-gcc"

[target.i686-linux-android]
linker = "/Users/tanis/Documents/android-ndk-x86/bin/i686-linux-android-gcc"

[target.x86_64-linux-android]
linker = "/Users/tanis/Documents/android-ndk-x86_64/bin/x86_64-linux-android-gcc"

Building the SDL2 library for Android

cd android/Minigame/sdl
../gradlew assemble

Building the Rust library for Android

The following used to work until I introduced dependent cargo libraries that wrap C/C++ code. It looks like .cargo/config parameters aren't being passed down the line, so we need a workaround.

cargo build --no-default-features --target armv7-linux-androideabi --lib
cargo build --no-default-features --target i686-linux-android --lib
cargo build --no-default-features --target x86_64-linux-android --lib

The workaround is to use the following and pass the reference to C, CXX and AR by hand (ugly!):

CC=/Users/tanis/Documents/android-ndk-arm/bin/arm-linux-androideabi-gcc CXX=/Users/tanis/Documents/android-ndk-arm/bin/arm-linux-androideabi-g++ AR=/Users/tanis/Documents/android-ndk-arm/bin/arm-linux-androideabi-ar cargo build --no-default-features --target armv7-linux-androideabi --lib

CC=/Users/tanis/Documents/android-ndk-x86/bin/i686-linux-android-gcc CXX=/Users/tanis/Documents/android-ndk-x86/bin/i686-linux-android-g++ AR=/Users/tanis/Documents/android-ndk-x86/bin/i686-linux-android-ar cargo build --no-default-features --target i686-linux-android --lib

CC=/Users/tanis/Documents/android-ndk-x86_64/bin/x86_64-linux-android-gcc CXX=/Users/tanis/Documents/android-ndk-x86_64/bin/x86_64-linux-android-g++ AR=/Users/tanis/Documents/android-ndk-x86_64/bin/x86_64-linux-android-ar cargo build --no-default-features --target x86_64-linux-android --lib

Copying the Rust library to the Android project

cp target/armv7-linux-androideabi/debug/libminigame.so android/Minigame/app/src/main/jniLibs/armeabi/
cp target/armv7-linux-androideabi/debug/libminigame.so android/Minigame/app/src/main/jniLibs/armeabi-v7a/
cp target/i686-linux-android/debug/libminigame.so android/Minigame/app/src/main/jniLibs/x86/
cp target/x86_64-linux-android/debug/libminigame.so android/Minigame/app/src/main/jniLibs/x86_64/

Buiding the actual Android application

cd android/Minigame/app
../gradlew assemble

Building for the web

Using Emscripten

Run the following command:

RUST_BACKTRACE=1 cargo web start --no-default-features --target wasm32-unknown-emscripten

Credits

Game background art by RottingPixels Game art by ansumuz

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].