Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ivan-1f/phichain/llms.txt
Use this file to discover all available pages before exploring further.
phichain-game
Thephichain-game crate is a Bevy-based game engine for rendering and playing Phigros charts. It handles rendering, animations, hit effects, scoring, and user interface.
Installation
Add this to yourCargo.toml:
Dependencies
The crate depends on:bevy0.16.1 (game engine)phichain-chart(chart data structures)phichain-assets(asset management)bevy_prototype_lyon(for rendering shapes)bevy_kira_audio0.23.0 (audio playback)image0.25.2 (image processing)
Core Plugin
The main Phigros game plugin.This plugin provides:
- Updating translations for entities with Lines and Notes
- Multi-highlight support for notes
- Hit effects with animations and particles
- Curve note generation based on CurveNoteTracks
- Score calculation and display
- Game UI rendering
Resources
GameConfig
Configuration for game behavior and rendering.
GameConfig Fields
GameConfig Fields
note_scale: f32- Scale multiplier for note rendering (default: 1.0)fc_ap_indicator: bool- Show Full Combo/All Perfect indicators (default: true)multi_highlight: bool- Highlight multiple simultaneous notes (default: true)hide_hit_effect: bool- Hide hit effects when notes are hit (default: false)name: String- Song name displayed in UIlevel: String- Difficulty level displayed in UIhit_effect_follow_game_time: bool- Use chart time for hit effects (useful for rendering)
GameViewport
Defines the game rendering viewport.
ChartTime
Current time position in the chart (in seconds).
Paused
Indicates whether the chart is paused.
Loading Charts
Theloader module provides functions to load charts into the game world.
Load a complete project into the Bevy world.
- Spawns line entities with
Linecomponents - Spawns note entities as children of lines
- Spawns event entities linked to lines
- Loads and spawns illustration images
- Inserts
OffsetandBpmListresources
Audio System
Theaudio module handles music and sound effects.
Rendering
Line Rendering
Lines are automatically rendered based on their components:LinePosition- Position in screen coordinatesLineRotation- Rotation angle in degreesLineOpacity- Alpha transparency (0.0 to 1.0)
Note Rendering
Notes are rendered with different sprites based on theirNoteKind:
- Tap notes: Circular sprite
- Drag notes: Drag sprite
- Hold notes: Head, body, and tail sprites
- Flick notes: Flick sprite with indicator
Hit Effects
Hit effects are automatically spawned when notes are hit, including:- Particle animations
- Expanding circles
- Fade-out effects
Scoring
The scoring system tracks:- Perfect hits (32ms window)
- Good hits (160ms window)
- Bad hits (180ms window)
- Misses
- Combo count
- Score calculation
- FC (Full Combo) and AP (All Perfect) status
User Interface
Theui module provides game UI components:
- Score display
- Combo counter
- Song name and difficulty
- FC/AP indicators
- Progress bar
Complete Example
System Sets
System set for all game-related systems. Use this to control system ordering.
Non-blocking Loader
For loading charts asynchronously without blocking the main thread:See Also
- phichain-chart - Chart data structures
- phichain-compiler - Chart compilation
- phichain-assets - Asset management
- Bevy Documentation - Bevy game engine docs