This Wargame is a turn-based strategy video game inspired by classic tabletop wargames like Bolt Action, developed in Python with Pygame. The game simulates battles between squads of units on a grid map, with simple rules and very low computer resource usage.
- Turn-based gameplay: Each player controls a squad of units and performs actions such as movement, attack, ambush, etc.
- Units: Infantry, tanks, machine guns, mortars, howitzers, armored vehicles, each with unique stats and abilities.
- Point system: Each unit has a point cost to balance the squads.
- Multi-shot attacks: Some weapons fire multiple shots per turn, each with its own hit probability.
- Terrain Properties : Use the battlefield to your advantage to exploit properties such as line of sight or defense bonus.
- Visual and sound effects: Explosion animations, missed shots, health bar, ambient and attack sounds.
- Supervised AI (MLP Neural Network)(in the future): The game can record matches and train a bot using a Multilayer Perceptron (MLP, via scikit-learn) and use it as an opponent.
- Customization: Easily add new units, change scenarios, rules, and maps via JSON files.
- Make sure you have a screen resolution larger than the game window (the size can be changed by global variables). See
custom.mdfor more details. - Python 3.8+
- pygame
- scikit-learn (only for the AI part)
- matplotlib (only for the AI part)
- seaborn (only for the AI part)
- All dependencies can be installed via pip:
pip install pygame scikit-learn matplotlib seaborn- Clone the repository and navigate to the project folder.
git clone https://github.com/Brodvd/Wargame.git
- Check the rulebook.
- Make sure you have the resource files (
assets/), configuration files (grid_properties.json, etc.). - Build your army respecting the 1000-point limit per squad (if you don't want to use the default one).
- Start the game with:
python main.py-
Scroll up: Use the mouse wheel or the pinch-out gesture on the touchpad to zoom in and see the map more closely.
-
Scroll down: Use the mouse wheel or pinch-in gesture on the touchpad to zoom out and see a larger portion of the map.
-
Keys: Use the arrow keys to move around the map.
-
Limits: The zoom is limited between the minimum and maximum values set by the game, so you can't zoom too close or too far.
-
Indicator: At the top right the current zoom value is shown in percentage.
Note: Zoom keeps the center of your view fixed, so you can explore the map without losing your bearings.
- Select a unit by clicking on it.
- Choose the action using the buttons that appear around the unit (Shoot, Forward, Move, Ambush, Rally, Down).
- Move units and attack enemies following the movement rules, line of sight, and weapon-target compatibility.
- The team that eliminates all enemy units and reaches 1000 points wins.
- The game can record each turn in a JSON file to train a supervised bot.
- The bot uses a Multilayer Perceptron (MLP) neural network to learn strategies from the collected data.
- For details on how to train and use the bot, see the separate
readme.mdand theMLP.pyfile.
- Units and squads: Editable via JSON files in the
assets/folder. - Rules: You can change unit parameters directly in the code.
- Animations, images, and sounds: Replace or add sprites and audio files in the
assets/folder. For more details, see thecustom.mdfile.
For detailed game rules, see the rulebook.
This project is distributed under the GPL-3 license. Images and sounds are for demonstration purposes only.
Some resources are temporary and will be improved in the future.
For anything, open an issue in this repository :)