Skip to content

Game engine project written in pure rust for learning about rust and game tech

License

Notifications You must be signed in to change notification settings

Davidster/ikari

Repository files navigation

Ikari

License: MIT

Ikari is a game engine project written in pure rust for learning about rust and game tech. It is developed to have decent visuals and good performance, ideally supporting frame rates of 144 or higher.

Most of the rendering features were implemented by following the awesome tutorials on learnopengl and learnwgpu.

Hopefully one day it will be used in a real game 😃

Features:

  • Linux, Windows & MacOS support
  • Web support via WASM/WebGPU
  • CLI for asset pre-processing
  • Rendering
    • Forward rendered with optional depth prepass
    • PBR + IBL
    • Soft shadows via PCF + poisson disk random sample
    • Cascaded shadow mapping
    • Bloom
    • Mesh skinning
    • Dynamic render scale / SSAA
    • GLTF
    • Skybox/environment map blending
    • BCN texture compression
    • Orthographic camera
    • Unlit & transparent materials
  • Integrations

Try it out

# install dependencies (Debian)
sudo apt install libasound2-dev

# native
cargo run --bin example_game
# web
rustup target add wasm32-unknown-unknown
cargo build_web --release --bin example_game

See console logs for list of available controls

clikari

The ikari CLI has the following capabilities:

  • compress jpg/png textures into GPU-compressed BCN format with baked mips
  • pre-process skybox + HDR env maps to be loaded much more efficiently into the game at runtime (500ms vs 10ms)

For example:

cargo run --bin clikari -- --command process_skybox --background_path ikari/src/textures/milkyway/background.jpg --environment_hdr_path ikari/src/textures/milkyway/radiance.hdr --out_folder ikari/src/skyboxes/milkyway

Screenshots / Videos:

PBR glTF assets

screenshot_1

Point-lights + shadows

screenshot_2

Mesh skinning + animations

2022-06-28_18-00-26.mp4

Rapier physics

physics_test.mp4

Auto-generated character collision meshes

character_collisions_test.mp4

Iced UI + wgpu-profiler

screenshot_3

Profiling

You can profile ikari with tracy via profiling crate. To do that you have to:

  • Download tracy 0.10
  • Run ikari and tracy (in any order), when the game is loading tracy will start profiling

If something does not work it is possible that the crate profiling has been updated and is no longer aligned with the tracy version and a more recent one must be used.

Tracy linux install:

Based on instructions from here: wolfpld/tracy#484

  • Install glfw, freetype2
    • (e.g. aur packages glfw-x11, freetype2). maybe different on Ubuntu
  • Install libcapstone
git clone [email protected]:libcapstone/libcapstone.git
cd libcapstone
PATH=/usr/local/bin:/usr/bin:/bin CC=clang CXX=clang++ make -j12
sudo make install
  • Install tracy 0.10
git clone [email protected]:wolfpld/tracy.git
cd tracy/profiler/build/unix
git checkout v0.10
# LEGACY=1 is needed for it to work on x11
LEGACY=1 make -j12
  • Run tracy
./Tracy_release
  • I made a desktop entry to make it easier to start from the system menus:
    • Not sure if it works in other distros, tested on Arch/KDE
    • Create file ~/.local/share/applications/tracy.desktop with contents:
      [Desktop Entry]
      Name=Tracy
      Exec=/home/david/Programming/tracy/profiler/build/unix/Tracy-release
      Type=Application
      

Tracy macos install:

  • Install deps:
brew install freetype2 glfw
# version 4.0.2, haven't tested with v5, maybe it works.
wget https://raw.githubusercontent.com/Homebrew/homebrew-core/442f9cc511ce6dfe75b96b2c83749d90dde914d2/Formula/c/capstone.rb
brew install ./capstone.rb
brew pin capstone
rm capstone.rb
  • Install tracy
cd tracy/profiler/build/unix
git checkout v0.10
# you might need to mess around with clang for this to work, not sure if the system default clang is able to perform the compilation
make -I/opt/homebrew/Cellar/capstone/4.0.2/include/capstone -j12
  • Run tracy
./Tracy-release

Running clippy for wasm target

# this will run clippy on the example game as well as ikari by dependency
# we need to pass --no-default-features now that tracy is enabled by default
RUSTFLAGS=--cfg=web_sys_unstable_apis cargo clippy --package example_game --target wasm32-unknown-unknown --no-default-features --features="audio"

About

Game engine project written in pure rust for learning about rust and game tech

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •