# cube_space **Repository Path**: silwings/cube_space ## Basic Information - **Project Name**: cube_space - **Description**: 一款经典方块消除益智游戏,玩家通过移动、旋转下落的方块来填满整行并消除得分。游戏包含多种模式、124 个精心设计的关卡、自定义关卡编辑器,以及多风格音效系统。 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-02-20 - **Last Updated**: 2026-02-20 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # CubeSpace (方寸间) [中文](./README.md) A puzzle game for Android built with Kotlin and Jetpack Compose. ## About CubeSpace is a classic block-clearing puzzle game. Move and rotate falling blocks to fill complete rows and score points. It features multiple game modes, 124 hand-crafted levels, a custom level editor, and a multi-style sound system. ## Game Modes ### Endless Mode Blocks fall continuously with increasing difficulty (faster drop speed). Level up every 10 lines cleared. Supports 5 save slots so you can save and resume anytime. ### Level Mode 124 preset levels, each with a unique initial block layout. The goal is to clear all pre-placed blocks. Scoring is based on efficiency — fewer pieces used means a higher score. ### Custom Levels Create your own levels with a visual grid editor: - Freely paint initial block layouts - Save, edit, and delete custom levels - Share levels with other players via compressed encoding ## Features ### Controls - Button controls: left, right, rotate, soft drop, hard drop - Swipe gestures: swipe left/right to move, swipe up to rotate, swipe down to hard drop - Soft drop: hold the button to accelerate (50ms interval), release to resume normal speed - Hard drop: instantly drops the piece to the bottom - Auto-repeat: direction and rotate buttons support long-press auto-repeat (200ms initial delay, 80ms repeat interval) - Ghost piece: translucent preview showing where the piece will land ### Scoring - Line clears: 1 line = 100, 2 lines = 300, 3 lines = 500, 4 lines = 800 - Chain multiplier: 1.5× per chain level - Level multiplier: score × current level - Hard drop bonus: +2 per row; soft drop +1 per row - Level mode: base 10,000 points, −200 per piece used, minimum 500 ### Chain System After clearing lines, floating blocks fall automatically, triggering chain reactions. Deeper chains produce more intense particle effects. ### Sound System 4 BGM styles: - 8-bit Retro - Ghibli - New Year - Local music file 3 SFX styles: - 8-bit Retro - Ghibli - Firecrackers (New Year) All sound effects are synthesized in real time via AudioTrack — no audio resource files needed. BGM and SFX can be toggled independently; switching styles auto-pairs them. ### Visual Effects - Line-clear particle animation: 3 particles per cell, 6 colors, with physics simulation (gravity, velocity, opacity decay) - Chain reactions double the particle count - Line-clear flash animation (300ms) - Button press scale animation - 7 piece types, each with a unique color ### Save System - 5 save slots: save, load, delete, overwrite - Compressed encoding (Deflate + Base64 + CRC32 checksum) - Export/share and import saves - Clipboard auto-detection: automatically recognizes save or level data in the clipboard when returning to the app ### Custom Levels - Visual grid editor with touch painting - 7-color palette + eraser - Name, edit, copy, rename, delete levels - Publish mechanism: mark a level as published and track high scores - Compressed export/share; import levels from other players ## Technical Details - Language: Kotlin - UI: Jetpack Compose - Architecture: MVVM (GameViewModel + GameEngine) - State management: StateFlow + collectAsState - Piece generation: 7-bag randomizer - Rotation: SRS + Wall Kick (offsets: 0, −1, 1, −2, 2) - Persistence: SharedPreferences (saves, high scores, settings, custom levels) - Audio: AudioTrack real-time waveform synthesis - Concurrency: Kotlin Coroutines for game loop and async operations ### Game Parameters | Parameter | Value | |-----------|-------| | Grid size | 15 × 21 | | Piece types | I, O, T, L, S, Z, J (7) | | Preview pieces | 4 | | Initial drop interval | 800ms | | Fastest drop interval | 100ms | | Speed increase per level | 70ms | | Lines to level up | 10 | | Preset levels | 124 | | Save slots | 5 |