A modern implementation of the classic Snake game using Pyglet, featuring smooth graphics and a highly modular architecture.
- Smooth, OpenGL-accelerated graphics
- Modern Python practices and type hints
- Configurable game settings
- Custom map support
- Pixel-perfect collision detection
- Fullscreen support
- Ensure you have Poetry installed:
curl -sSL https://install.python-poetry.org | python3 -
- Clone and install:
git clone https://github.com/ericsonwillians/Super-PySnake.git
cd Super-PySnake
poetry install
- Run the game:
poetry run super-pysnake
- Arrow keys or WASD to move
- ESC to quit
super_pysnake/
├── .gitignore
├── README.md
├── pyproject.toml
├── config.json
├── assets/
│ ├── gfx/
│ │ ├── background.png
│ │ ├── brick.png
│ │ ├── food.png
│ │ ├── icon.ico
│ │ └── snake.png
│ └── maps/
│ └── default.json
└── game/
├── __init__.py
├── app.py
├── types.py
├── dungeon.py
├── food.py
├── snake.py
├── square.py
├── utils/
│ ├── __init__.py
│ └── serializable.py
└── main.py
The game can be configured through config.json
:
{
"screen": {
"width": 1024,
"height": 768,
"fullscreen": false
},
"game": {
"square_size": 32,
"speed": 0.1,
"locked_mouse": true
},
"assets": {
"map_file": "assets/maps/default.json",
"textures": {
"background": "assets/gfx/background.png",
"snake": "assets/gfx/snake.png",
"food": "assets/gfx/food.png",
"brick": "assets/gfx/brick.png"
}
}
}
Create custom maps by editing the JSON map file. The map format uses:
1
for walls0
for empty spaces
Example:
{
"map": [
[1, 1, 1, 1, 1],
[1, 0, 0, 0, 1],
[1, 1, 1, 1, 1]
]
}
This project uses:
- Poetry for dependency management
- Type hints throughout
- Modern Python features
- Modular architecture
For development:
# Install dev dependencies
poetry install --with dev
# Run tests
poetry run pytest
# Format code
poetry run black .
poetry run isort .
# Lint
poetry run pylint game/
Copyright © 2015-2025 Ericson Willians
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
Original Super PySnake game created by Ericson Willians in 2015. This modern refactor maintains the original game's charm while bringing it up to date with current Python practices and technologies.
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Open a Pull Request
We welcome:
- Bug fixes
- Feature additions
- Documentation improvements
- Code optimization
- Test coverage improvements