Skip to content

PrinceSP/platformer-game-amazon-q-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Industrial Fighter Game - Ninja Edition

A high-performance classic platformer-style fighting-adventure game built with Python and Pygame, featuring a ninja protagonist and optimized for 60+ FPS gameplay.

🆕 New Features & Performance Improvements

âš¡ Performance Optimizations

  • 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

🥷 New Characters

  • 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

🎮 Enhanced Gameplay

  • 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

Features

  • 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

Controls

Gameplay

  • 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

Inventory

  • Arrow Keys: Navigate slots
  • Enter/Space: Use selected item
  • Mouse Click: Select and use items
  • I/ESC: Close inventory

Installation

  1. Install Python 3.7 or higher
  2. Install Pygame:
    pip install pygame
    Or install from requirements:
    pip install -r requirements.txt

Running the Game

python3 main.py

Or use the launcher:

./run_game.sh

Level Editor

Create custom levels with the built-in editor:

python3 level_editor.py

Level Editor Controls

  • 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

Game Structure

  • main.py - Entry point (updated for optimized engine)
  • optimized_game_engine.py - High-performance game loop and state management
  • ninja_player.py - Ninja character with enhanced abilities and animations
  • new_enemies.py - Zombie and Jackfree enemy classes with optimized AI
  • optimized_sprite_loader.py - Multi-threaded sprite loading system
  • performance_manager.py - FPS optimization and monitoring system
  • level.py - Level system with platforms, objects, and items
  • inventory.py - Inventory management and UI
  • sound_manager.py - Audio system with visual feedback
  • visual_effects.py - Advanced particle systems and visual effects
  • background.py - Parallax scrolling background system
  • sprite_loader.py - Legacy sprite loading utility
  • constants.py - Game configuration and constants (updated for performance)
  • level_editor.py - Level creation tool
  • performance_test.py - Performance testing and benchmarking tool

Legacy Files (Original Game)

  • game_engine.py - Original game engine
  • player.py - Original biker character
  • enemies.py - Original punk and cybord enemies

Level System

Platform Types

  1. Solid: Standard platforms that block movement from all sides
  2. One-way: Platforms you can jump through from below
  3. Ladder: Climbable platforms for vertical movement

Interactive Objects

  • Boxes/Barrels: Destructible objects that can be attacked
  • Ladders: Climbable objects for reaching higher areas
  • Lockers: Decorative objects

Collectible Items

  • 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

Inventory System

  • 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

Enemy Behaviors

  1. Static: Enemies that stand still until attacked
  2. Reactive: Enemies that move toward the player when nearby
  3. Attacking: Aggressive enemies that actively hunt the player

Performance Features

  • 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

Character Abilities

Ninja Player

  • 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

Zombie Enemies

  • 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

Jackfree Boss

  • 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

Visual Feedback

When audio is disabled or unavailable, the game provides visual notifications for:

  • Jump sounds
  • Attack sounds
  • Hit effects
  • Menu interactions
  • Player damage
  • Item collection

Assets

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

Legacy Assets

  • /characters/biker/ - Original player sprites
  • /characters/punk/ - Original punk enemy sprites
  • /characters/cybord/ - Original cybord boss sprites

Troubleshooting

If you encounter issues:

  1. Ensure all asset files are in the correct directories
  2. Check that Pygame is properly installed
  3. Verify Python version compatibility
  4. Missing assets will be replaced with colored placeholders

Performance Testing

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

Development

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

Optimization Techniques Used

  1. Sprite Culling: Objects outside screen bounds aren't rendered
  2. Dynamic Quality: Automatically adjusts settings based on FPS
  3. Multi-threading: Parallel sprite loading during startup
  4. Smart Caching: Reuses loaded sprites and animations
  5. Reduced Updates: Off-screen enemies update less frequently
  6. Particle Limiting: Caps particle count for consistent performance
  7. Interpolated Camera: Smooth camera movement without performance cost
  8. Optimized Collision: Spatial partitioning for collision detection
  9. Memory Management: Automatic cleanup of unused resources
  10. Performance Monitoring: Real-time adjustment based on metrics

Custom Level Format

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"}
  ]
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
close