A Python-based interactive theme park simulation that models patron behavior, attraction dynamics, and visual animation in a virtual amusement park environment.
This project simulates a theme park where virtual patrons enter, roam around, queue for attractions, ride them, and eventually exit. The simulation includes animated rides, realistic patron behavior, and a visual interface using Matplotlib.
-
Multiple Attraction Types:
- Pirate Ship (swinging animation)
- Ferris Wheel (rotating animation)
- Food Vendor (quick service)
- Sideshow Games (quick play)
-
Three Simulation Modes:
- Default Mode: Pre-configured sample park
- Interactive Mode: Customize park via command prompts
- Batch Mode: Load park configuration from CSV files
-
Realistic Patron Behavior:
- Patrons roam, queue, and ride attractions
- Visit 2-4 attractions before leaving
- Intelligent pathfinding with barrier avoidance
- Animation visualization with different colors for states
-
Visual Simulation:
- Real-time animation with Matplotlib
- Attraction-specific animations (swinging, rotating)
- Statistics overlay
- Color-coded patron states (blue=roaming, orange=leaving)
adventure-time-theme-park/
โ
โโโ adventureTime.py # Main entry point
โโโ attractions.py # Attraction classes (PirateShip, FerrisWheel, etc.)
โโโ theme_park.py # ThemePark class and file loading
โโโ patrons.py # Patron class and behavior
โ
โโโ map1.csv # Sample map configuration 1
โโโ map2.csv # Sample map configuration 2
โโโ para1.csv # Sample parameters 1
โโโ para2.csv # Sample parameters 2
โ
โโโ requirements.txt # Python dependencies
โโโ uml_class_diagram.svg # UML class diagram
โโโ README.md # This file
- Python 3.7+
- pip (Python package manager)
git clone https://github.com/ahmed-ali-codes/theme-park-simulator.git
cd theme-park-simulatorpip install matplotlibDefault Mode (pre-configured park):
python3 adventureTime.pyInteractive Mode (customize your park):
python3 adventureTime.py -iBatch Mode (load from CSV files):
python3 adventureTime.py -f map1.csv -p para1.csvtype,name,x,y,width,height
pirate_ship,Pirate Adventure,15,15,15,10
ferris_wheel,Sky Wheel,45,15,12,12
barrier,Park Boundary,0,0,100,5Types: pirate_ship, ferris_wheel, food_vendor, sideshow, barrier
parameter,value
timesteps,400
spawn_rate,4
park_width,100
park_height,100- Run
python3 adventureTime.py -i - Enter park dimensions (default 100x100)
- Specify number of each attraction type (0-5)
- Set simulation duration and spawn rate
- Watch the simulation run with real-time animation!
- Prepare your map CSV file with attractions and barriers
- Prepare your parameters CSV file
- Run:
python3 adventureTime.py -f your_map.csv -p your_params.csv
- Blue dots: Patrons roaming and visiting attractions
- Orange dots: Patrons leaving the park
- Green star: Park entrance
- Red star: Park exit
- Gray boxes: Barriers (patrons cannot walk through)
- Colored boxes: Attractions with queue/rider info
- Pirate Ship: Swings back and forth with realistic pendulum motion
- Ferris Wheel: Rotates continuously with visible pods
- Food Vendor: Quick service with small capacity
- Sideshow Games: Quick play time with few players
- Random attraction selection
- Barrier avoidance
- Queue management
- Visit counting before exit
- Stuck detection and recovery
- Real-time patron counts
- Queue and rider information per attraction
- Total spawned and exited patrons
- Attraction status (idle/running)
- Create a CSV file following the map format
- Place attractions strategically (avoid overlaps)
- Add barriers to create interesting park layouts
- Adjust parameters in the parameters CSV file
Edit attractions.py to change:
- Ride durations
- Capacities
- Animation speeds
- Visual appearance
Edit patrons.py to modify:
- Movement speed
- Number of visits before leaving
- Stuck detection thresholds
- Pathfinding logic
==================================================
Adventure Time - Default Mode
==================================================
Running with sample park configuration...
Watch patrons enter, visit multiple attractions, then exit!
==================================================
Park configured with 5 attractions
Spawn rate: Every 4 timesteps (slower entry)
Timesteps: 400
Blue dots = Roaming | Orange dots = Leaving to Exit
==================================================
Timestep: 0 | In Park: 0 | Spawned: 0 | Exited: 0
Timestep: 10 | In Park: 1 | Spawned: 1 | Exited: 0
Timestep: 20 | In Park: 4 | Spawned: 4 | Exited: 0
...
- Create a new class in
attractions.pyinheriting fromAttraction - Implement custom
step_change()for animation - Implement custom
plot_me()for visualization - Update
load_map_from_file()intheme_park.pyto handle new type
- Add different patron types (families, couples, singles)
- Implement weather effects
- Add day/night cycles
- Include revenue tracking
- Add more complex pathfinding algorithms
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Matplotlib for visualization capabilities
- Python Standard Library for robust data structures
- All contributors who help improve this simulation
For questions, issues, or feature requests:
- Open an issue on GitHub
- Provide detailed description of the problem or suggestion
- Include steps to reproduce if reporting a bug