{"id":26561882,"url":"https://github.com/burnycoder/solar-system","last_synced_at":"2025-03-22T14:18:41.443Z","repository":{"id":281453092,"uuid":"945328054","full_name":"BurnyCoder/solar-system","owner":"BurnyCoder","description":"Interactive solar system simulation demonstrating gravitational interactions between celestial bodies in a 2D space using Python and Pygame","archived":false,"fork":false,"pushed_at":"2025-03-09T14:29:46.000Z","size":137,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-22T14:18:36.042Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BurnyCoder.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-09T06:40:47.000Z","updated_at":"2025-03-09T15:19:45.000Z","dependencies_parsed_at":"2025-03-09T07:37:02.172Z","dependency_job_id":null,"html_url":"https://github.com/BurnyCoder/solar-system","commit_stats":null,"previous_names":["burnycoder/planet-orbits","burnycoder/solar-system"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BurnyCoder%2Fsolar-system","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BurnyCoder%2Fsolar-system/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BurnyCoder%2Fsolar-system/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BurnyCoder%2Fsolar-system/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BurnyCoder","download_url":"https://codeload.github.com/BurnyCoder/solar-system/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244966518,"owners_count":20539797,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-22T14:18:40.554Z","updated_at":"2025-03-22T14:18:41.436Z","avatar_url":"https://github.com/BurnyCoder.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Orbiting Planets Simulation\n\nThis project simulates planets orbiting in a solar system using Python and Pygame. It demonstrates gravitational interactions between celestial bodies in a 2D space with an interactive interface.\n\n![image](https://github.com/user-attachments/assets/483a2f81-b20b-482e-97d7-ab3c63663597)\n\n## Features\n\n- Gravitational forces between celestial bodies\n- Realistic collision detection between all types of celestial bodies\n- Customizable masses, positions, and velocities\n- Interactive mode to add planets with a click\n- Asteroid creation with elliptical orbits\n- \"Alien Physics\" mode with 7 different creative physics simulations\n- Event message log system for feedback\n- Semi-transparent UI elements\n- Smooth animation with Pygame\n\n## Requirements\n\n- Python 3.6+\n- Pygame module (install with `pip install pygame`)\n\n## How to Run\n\n1. Make sure you have Python installed on your system\n2. Install Pygame if you haven't already:\n   ```bash\n   pip install pygame\n   ```\n3. Run the simulation:\n   ```bash\n   python solar_system.py\n   ```\n\n## Controls\n\n- **Click anywhere**: Add a new planet at that position\n- **ESC key**: Quit the simulation\n- **O key**: Toggle orbit display\n- **T key**: Toggle orbit trails\n- **C key**: Toggle circular orbit enforcement\n- **P key**: Toggle alien physics mode\n- **A key**: Add asteroid with elliptical orbit\n- **+/- keys**: Change simulation speed\n- **S key**: Reset simulation speed to normal\n- **Close window**: Exit the program\n\n## Advanced Features\n\n### Collision System\nThe simulation includes a sophisticated collision detection system that handles:\n- Sun-Planet collisions (sun destroys planets)\n- Sun-Asteroid collisions (sun destroys asteroids)\n- Planet-Asteroid collisions (planets absorb asteroids)\n\n### Alien Physics\nWhen enabled, the simulation cycles through 7 different physics modes every 10 seconds:\n- Magnetic Ballet\n- Orbital Waltz\n- Vibration Samba\n- Quantum Tango\n- Choreographed Orbits\n- Spiral Dance\n- Rhythmic Pulsation\n\nEach mode creates unique and visually interesting orbital patterns that defy conventional physics.\n\n### Message Log System\nA message log in the bottom left corner provides real-time feedback on events in the simulation, including:\n- New celestial body creation\n- Collisions and destructions\n- Physics mode changes\n- Setting toggles\n\n### Visual Design\n- Semi-transparent text for a cleaner interface\n- Color-coded status indicators\n- Planet trails and orbit visualization options\n- Dynamic planet and asteroid naming\n\n## Customization\n\nYou can modify the parameters in the script to create your own solar systems:\n\n- Change the mass of the sun (`Sun` class instantiation)\n- Modify how planets are created (the `add_random_planet` function)\n- Adjust the initial number of planets\n- Change the speed parameter for more stable or chaotic orbits\n- Customize the alien physics modes in the `calculate_gravity` method\n\n## How It Works\n\nThe simulation consists of four main classes:\n\n1. **Body**: Base class for all celestial bodies with physics properties\n2. **Sun**: Central gravitational body that other objects orbit around\n3. **Planet**: Regular orbital bodies that can have different colors and sizes\n4. **Asteroid**: Smaller bodies with elliptical orbits and special rendering\n5. **SolarSystem**: Manages all bodies and their interactions\n\nThe simulation primarily implements Newton's law of universal gravitation (`force = GRAVITY_STRENGTH * first.mass * second.mass / (distance * distance + DISTANCE_DAMPING)`), Newton's second law (`acceleration = force / mass`), orbital velocity inspired by Kepler's laws (`orbital_speed = math.sqrt(sun.mass / distance) * orbital_speed_factor`), basic kinematics for position and velocity updates, distance calculation using the Euclidean formula, and orbital correction formulas to maintain stable planetary orbits.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fburnycoder%2Fsolar-system","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fburnycoder%2Fsolar-system","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fburnycoder%2Fsolar-system/lists"}