A high-performance classic platformer-style fighting-adventure game built with Python and Pygame, featuring a ninja protagonist and optimized for 60+ FPS gameplay.
- 75+ FPS Target: Optimized game loop with dynamic quality adjustment
- Sprite Culling: Only renders visible objects for better performance
- Multi-threaded Loading: Parallel sprite loading for faster startup
- Smart Caching: Intelligent sprite and animation caching system
- Reduced AI Updates: Performance-based AI update frequency
- Particle Limiting: Dynamic particle count management
- Smooth Camera: Interpolated camera movement
-
Ninja Player: Fast, agile protagonist with special abilities
- Enhanced movement speed and jump height
- Special attacks: Slide attack, Throwing stars
- Smooth climbing and wall-scaling abilities
- Fluid animation system with 10+ animation states
-
Zombie Enemies: Slow but persistent undead foes
- Realistic shambling movement
- Increased health and damage resistance
- Atmospheric animations
-
Jackfree Boss: Agile and dangerous boss enemy
- Fast movement and aggressive AI
- Special slide attacks and jump abilities
- Boss health bar display
- Multiple attack patterns
- Ninja Abilities:
- Space: Standard attack
- X: Special throwing attack
- C: Slide attack (destroys objects)
- Improved Combat: More responsive and fluid fighting system
- Better AI: Smarter enemy behavior with multiple patterns
- Visual Effects: Enhanced particle systems and hit effects
- Ninja Player Character: Fast and agile ninja with full animation set (idle, run, jump, attack, climb, slide, throw, hurt, death)
- Enhanced Enemy AI:
- Zombie enemies with shambling reactive behavior
- Jackfree boss with aggressive attacking patterns and special moves
- Static enemies that react when attacked
- High-Performance Engine:
- 75+ FPS optimized gameplay
- Dynamic quality adjustment based on performance
- Sprite culling and caching systems
- Multi-threaded asset loading
- Advanced Level System:
- Multi-layered platforms (solid, one-way, climbable)
- Interactive objects (boxes, barrels, ladders, lockers)
- Destructible objects that can be attacked
- Parallax scrolling background with smooth camera
- Comprehensive Inventory System:
- 20-slot inventory with visual UI
- Collectible items with different types and effects
- Item usage system with stat modifications
- Mouse and keyboard navigation
- Combat System: Realistic collision detection with visual and audio feedback
- Visual Effects: Advanced particle systems for hits, jumps, deaths, and item collection
- Sound System: Full audio with visual feedback when sound is disabled
- Level Editor: Built-in level editor for creating custom levels
- Performance Monitoring: Real-time FPS and performance statistics
- Movement: Arrow Keys or WASD
- Jump: Up Arrow or W
- Climb: Up/Down arrows when near ladders
- Attack: Spacebar (standard ninja attack)
- Special Attack: X key (throwing stars)
- Slide Attack: C key (destroys objects, fast movement)
- Inventory: I key
- Pause: ESC
- Performance Stats: P key (toggle performance display)
- Restart (when game over): R
- Arrow Keys: Navigate slots
- Enter/Space: Use selected item
- Mouse Click: Select and use items
- I/ESC: Close inventory
- Install Python 3.7 or higher
- Install Pygame:
Or install from requirements:
pip install pygame
pip install -r requirements.txt
python3 main.py
Or use the launcher:
./run_game.sh
Create custom levels with the built-in editor:
python3 level_editor.py
- 1/2/3: Select tool (Platform/Object/Item)
- TAB: Cycle through types
- Left Click: Place object
- Right Click: Remove object
- Arrow Keys: Move camera
- G: Toggle grid
- S: Save level
- L: Load level
- C: Clear level
- ESC: Exit editor
main.py
- Entry point (updated for optimized engine)optimized_game_engine.py
- High-performance game loop and state managementninja_player.py
- Ninja character with enhanced abilities and animationsnew_enemies.py
- Zombie and Jackfree enemy classes with optimized AIoptimized_sprite_loader.py
- Multi-threaded sprite loading systemperformance_manager.py
- FPS optimization and monitoring systemlevel.py
- Level system with platforms, objects, and itemsinventory.py
- Inventory management and UIsound_manager.py
- Audio system with visual feedbackvisual_effects.py
- Advanced particle systems and visual effectsbackground.py
- Parallax scrolling background systemsprite_loader.py
- Legacy sprite loading utilityconstants.py
- Game configuration and constants (updated for performance)level_editor.py
- Level creation toolperformance_test.py
- Performance testing and benchmarking tool
game_engine.py
- Original game engineplayer.py
- Original biker characterenemies.py
- Original punk and cybord enemies
- Solid: Standard platforms that block movement from all sides
- One-way: Platforms you can jump through from below
- Ladder: Climbable platforms for vertical movement
- Boxes/Barrels: Destructible objects that can be attacked
- Ladders: Climbable objects for reaching higher areas
- Lockers: Decorative objects
- Food (Bread, Meat): Restores health
- Drinks (Water): Minor health restoration
- Weapons (Staff): Increases attack power
- Armor (Divine Armor): Increases max health and defense
- Misc (Scrolls, Stones): Various effects and collectibles
- 20 Slots: Expandable inventory system
- Item Stacking: Similar items stack automatically
- Item Types: Food, weapons, armor, and miscellaneous items
- Visual UI: Mouse and keyboard navigation
- Item Effects: Use items for healing, stat boosts, and special effects
- Static: Enemies that stand still until attacked
- Reactive: Enemies that move toward the player when nearby
- Attacking: Aggressive enemies that actively hunt the player
- Dynamic Quality Adjustment: Automatically reduces quality when FPS drops
- Sprite Culling: Only renders objects visible on screen
- Multi-threaded Loading: Parallel asset loading for faster startup
- Smart Caching: Intelligent sprite and animation caching
- Optimized AI: Reduced update frequency for off-screen enemies
- Particle Management: Dynamic particle count limiting
- Smooth Camera: Interpolated camera movement
- Performance Monitoring: Real-time FPS and quality statistics
- Memory Optimization: Efficient memory usage and cleanup
- Enhanced Speed: 20% faster movement than original character
- Higher Jumps: 10% increased jump height
- Special Attacks:
- Slide Attack: Fast horizontal movement that destroys objects
- Throwing Stars: Ranged attack ability
- Wall Climbing: Enhanced climbing mechanics
- Faster Recovery: Reduced hurt and attack cooldowns
- Shambling Movement: Authentic zombie-like slow movement
- Increased Durability: 40% more health than standard enemies
- Persistent Pursuit: Continues following player longer
- Atmospheric Animations: Realistic undead movement patterns
- Aggressive AI: Actively hunts and corners the player
- Special Abilities:
- Slide Attack: Fast charging attack
- Jump Attacks: Aerial assault capabilities
- Pattern Variations: Multiple attack sequences
- Boss Features: Health bar display and enhanced stats
When audio is disabled or unavailable, the game provides visual notifications for:
- Jump sounds
- Attack sounds
- Hit effects
- Menu interactions
- Player damage
- Item collection
The game uses optimized sprite loading from:
/characters/ninja/
- Ninja player sprites (100+ animation frames)/characters/zombies/male/
- Zombie enemy sprites/characters/jackfree (enemy 1)/
- Jackfree boss sprites/objects/
- Interactive level objects/items/
- Collectible item sprites/tiles/
- Platform and level tiles/sounds/
- Audio files/background/
- Background layers
/characters/biker/
- Original player sprites/characters/punk/
- Original punk enemy sprites/characters/cybord/
- Original cybord boss sprites
If you encounter issues:
- Ensure all asset files are in the correct directories
- Check that Pygame is properly installed
- Verify Python version compatibility
- Missing assets will be replaced with colored placeholders
Test the game's performance:
python3 performance_test.py
This will run a 10-second performance test and display:
- Average FPS
- Quality level adjustments
- Optimization feature status
- Performance rating
The game is highly modular and optimized. You can:
- Add new characters by extending the OptimizedEnemy class
- Create new ninja abilities in the NinjaPlayer class
- Implement new optimization techniques in the PerformanceManager
- Design custom levels with the level editor
- Add new visual effects with the enhanced particle system
- Modify performance settings in constants.py
- Create new enemy AI patterns in the new_enemies.py
- Sprite Culling: Objects outside screen bounds aren't rendered
- Dynamic Quality: Automatically adjusts settings based on FPS
- Multi-threading: Parallel sprite loading during startup
- Smart Caching: Reuses loaded sprites and animations
- Reduced Updates: Off-screen enemies update less frequently
- Particle Limiting: Caps particle count for consistent performance
- Interpolated Camera: Smooth camera movement without performance cost
- Optimized Collision: Spatial partitioning for collision detection
- Memory Management: Automatic cleanup of unused resources
- Performance Monitoring: Real-time adjustment based on metrics
Levels are saved as JSON files with the following structure:
{
"platforms": [
{"x": 100, "y": 200, "width": 128, "height": 32, "type": "solid"}
],
"objects": [
{"x": 150, "y": 300, "type": "Box1"}
],
"items": [
{"x": 200, "y": 250, "type": "bread"}
]
}