Solar System Simulation - Haskell Project

Due to the large size of the video file showcasing the simulation, it has not been included within this ZIP file. Instead, the video can be accessed via the following shared link： https://uoe-my.sharepoint.com/:f:/g/personal/s2541969_ed_ac_uk/Er2krTraMQVHomFTqP9u4eQBr2KDTpdbWIrVbPxkFWGYeg?e=MEZ4HL


1.File Descriptions
Jupiter.png, Mars.png, Mercury.png, Neptune.png, Saturn.png, Sun.png, Uranus.png, Venus.png: These are the image files for each of the planets and the sun used in the simulation for rendering the celestial bodies.

LICENSE: The license file specifies the terms under which this software can be used, modified, and distributed.

Main.hs: This is the main Haskell program file that contains all the logic for the solar system simulation.

SolarSystemSimulator.cabal: The Cabal file that describes the project's configuration, dependencies, and build information.

SolarSystemSimulator.mp4: A video demonstrating the output of the simulation in action.

README.txt: This text file provides an overview of the project, instructions on how to run the simulation, and additional information on dependencies and acknowledgments.

2.Introduction
This Haskell program creates a visually engaging simulation of the solar system using the Graphics.Gloss library. The main focus of this project is to render a dynamic model of the solar system, where planets orbit around the sun at relative speeds and distances that reflect their actual properties in our solar system. The idea for this simulation was inspired by Python simulations of celestial mechanics, leading to the exploration of whether a similar result could be achieved using Haskell.

3.How to Run
To run this program, ensure you have the Haskell platform and the Graphics.Gloss package installed. Follow these steps:

Clone or download the repository to your local machine.
Navigate to the project directory in your terminal.
Compile the program using GHC (The Glasgow Haskell Compiler) with the command: ghc --make Main.hs.
Run the compiled executable, typically named Main or Main.exe, depending on your operating system.
Implementation Details
The program uses various modules from Graphics.Gloss to render and animate the planets. Key aspects of the implementation include:

Loading and scaling images for each planet and the sun.
Calculating the orbital radii and velocities for each planet.
Animating the planets' orbits around the sun over time.
File Structure
Main.hs: Contains the main program logic, including window settings, planet data initialization, and the main loop.
Image files: Images of the sun and each planet are stored in the specified directory and loaded by the program.

4.## Dependencies and Troubleshooting

This project uses the `GLUtil` library, which requires `freeglut` for window and context creation. Windows users may encounter an error like "Exception: user error (unknown GLUT entry glutInit)" if `freeglut` is not installed or not configured properly.

To resolve this issue:
1. Download `freeglut` from the official source or use a package manager like `vcpkg` or `chocolatey`.
2. Place the `freeglut.dll` file in the same directory as your compiled executable, or in a system path recognized by Windows.
3. Re-run the simulation. If the issue persists, verify the environment paths and dependency versions.

Please refer to the `freeglut` documentation for more detailed instructions specific to your operating system.

5.Additional Notes
Ensure that the image paths in the code match the location where you store the planet images on your system. The paths to the images may need to be updated depending on where the images are stored on your system.
You may need to adjust scaling factors or orbital parameters to achieve the desired visual effect.
This project is a part of the INF1A FP Competition and is not intended for commercial use.

6.References
The concept of this project was partly inspired by various online resources, including:
Python Simulation of Celestial Mechanics
Astronomical Simulation Discussions
Q&A on Celestial Mechanics Simulations
All images used in this simulation are publicly available and have been sourced from various educational websites.

By Carrie Li
2023/11/20
