Thank you for your interest in contributing to Asteroids!
Asteroids is a Python game project created for programming practice and learning. Contributions that improve the code, documentation, gameplay, performance, or overall project structure are welcome.
Please read these guidelines before opening an issue or submitting a pull request.
You can contribute by:
- Reporting bugs
- Fixing existing bugs
- Improving documentation
- Refactoring or simplifying code
- Improving game performance
- Suggesting gameplay improvements
- Adding sound effects or visual effects
- Improving collision detection
- Adding tests
- Adding small, focused features
- Improving installation and setup instructions
Before working on a contribution:
- Check the existing issues and pull requests.
- Make sure someone is not already working on the same change.
- Open an issue before starting a large feature or major redesign.
- Keep each contribution focused on one specific improvement.
Small bug fixes and documentation improvements usually do not require an issue first.
To work on this project, you should have:
- Git
- Python
uv- A GitHub account
You can verify the tools are installed with:
git --version
python --version
uv --versionOpen the repository on GitHub and select Fork.
This creates a copy of the repository under your GitHub account.
Replace YOUR-USERNAME with your GitHub username:
git clone https://github.com/YOUR-USERNAME/asteroids.git
cd asteroidsgit remote add upstream https://github.com/antonisloukis/asteroids.gitConfirm that the remotes were added correctly:
git remote -vYou should see:
originpointing to your forkupstreampointing to the original repository
uv syncuv run python main.pyMake sure the game starts correctly before making changes.
Do not make contributions directly on the main branch.
First, make sure your local main branch is current:
git checkout main
git fetch upstream
git merge upstream/mainCreate a new branch for your change:
git checkout -b feature/your-feature-nameExamples:
git checkout -b feature/add-score-system
git checkout -b fix/collision-detection
git checkout -b docs/improve-installation-guideRecommended branch prefixes:
feature/for new featuresfix/for bug fixesdocs/for documentation changesrefactor/for code restructuringtest/for test-related changeschore/for maintenance work
When modifying the project:
- Keep your changes focused and reasonably small.
- Follow the existing project structure.
- Follow the existing Python coding style.
- Use descriptive names for variables, functions, classes, and files.
- Avoid unrelated changes in the same pull request.
- Remove debugging code before submitting.
- Do not commit generated files or local environment files.
- Add comments only when they explain something that is not obvious from the code.
- Update the documentation when behavior or setup instructions change.
Avoid committing:
- Virtual environments
- IDE configuration files
- Temporary files
- Cache directories
- Personal settings
- Secrets, passwords, or API keys
Follow standard Python conventions:
- Use four spaces for indentation.
- Use
snake_casefor variables and functions. - Use
PascalCasefor classes. - Use uppercase names for constants.
- Keep functions focused on one responsibility.
- Prefer clear code over unnecessarily clever code.
- Add type hints where they improve clarity.
- Keep imports organized.
- Remove unused imports and unreachable code.
Example:
class Asteroid:
def update_position(self, delta_time: float) -> None:
self.position += self.velocity * delta_timeBefore submitting a pull request, run the game:
uv run python main.pyCheck that:
- The game starts without errors.
- Player movement still works.
- Shooting still works.
- Asteroids appear and move correctly.
- Collision detection still works.
- The game closes correctly.
- Your new feature works as expected.
- Your change has not broken existing behavior.
For gameplay or visual changes, test the feature several times under different conditions.
If tests are added to the project, run the complete test suite before submitting your pull request.
Use clear and descriptive commit messages.
Good examples:
Add player score tracking
Fix asteroid collision detection
Improve game setup instructions
Refactor player movement logic
Add sound effect configuration
Avoid vague messages such as:
Update
Changes
Fix stuff
Work
Final version
Try to keep each commit focused on one logical change.
Stage and commit your changes:
git add .
git commit -m "Add player score tracking"Before submitting your pull request, update your branch with the latest version of the original repository:
git fetch upstream
git checkout main
git merge upstream/main
git checkout feature/your-feature-name
git merge mainResolve any merge conflicts and test the game again.
Push your branch to your GitHub fork:
git push origin feature/your-feature-nameGitHub will then allow you to open a pull request.
When opening a pull request:
- Target the original repository's
mainbranch. - Use a clear and descriptive title.
- Explain what you changed.
- Explain why the change is useful.
- Describe how you tested it.
- Link any related issue.
- Include screenshots or recordings for visual or gameplay changes.
- Keep the pull request focused on one feature or fix.
Example pull-request title:
Add player score tracking
Example pull-request description:
## Summary
Adds a score counter that increases whenever the player destroys an asteroid.
## Changes
- Added a player score variable
- Increased the score after successful asteroid collisions
- Displayed the score during gameplay
## Testing
- Started the game successfully
- Destroyed multiple asteroids
- Confirmed that the score updates correctly
- Confirmed that existing movement and shooting still work
## Related Issue
Closes #12Before reporting a bug:
- Check that the bug has not already been reported.
- Make sure you are using the latest project version.
- Reproduce the problem more than once when possible.
A useful bug report should include:
- A clear title
- A description of the problem
- Steps to reproduce it
- The expected behavior
- The actual behavior
- Relevant error messages
- Your operating system
- Your Python version
- Screenshots or recordings when useful
Example:
## Bug Description
The game crashes when the player collides with two asteroids at the same time.
## Steps to Reproduce
1. Start the game.
2. Move toward a group of asteroids.
3. Collide with two asteroids simultaneously.
4. Observe the crash.
## Expected Behavior
The game should detect the collision and end normally.
## Actual Behavior
The game closes and displays an error.
## Environment
- Operating system: Windows 11
- Python version: 3.x
- Installation method: uvFeature suggestions are welcome.
A useful feature request should explain:
- The problem or limitation
- The proposed feature
- Why it would improve the project
- Possible implementation ideas
- Any alternatives you considered
Please open an issue before implementing a large feature so it can be discussed first.
A contribution may be declined when it:
- Breaks existing functionality
- Introduces unnecessary complexity
- Contains unrelated changes
- Does not follow the project structure
- Duplicates an existing contribution
- Adds a major feature without prior discussion
- Includes copyrighted material without permission
- Includes secrets, credentials, or sensitive information
- Does not follow the Code of Conduct
A declined contribution is not necessarily a bad contribution. It may simply not fit the project's current direction.
After submitting a pull request:
- The code may be reviewed and tested.
- Changes may be requested.
- You may need to update your branch.
- Discussions should remain respectful and focused on the contribution.
- The pull request may be merged, closed, or postponed depending on the project's needs.
Please do not open duplicate pull requests for the same change.
All contributors must follow the repository's Code of Conduct.
Be respectful, constructive, and professional when communicating through issues, discussions, reviews, and pull requests.
By contributing to this repository, you agree that your contributions may be distributed under the same license as the project.
Thank you for helping improve Asteroids!