Ben-Ton is a retro-themed First Person Shooter (FPS) game built using Python. It leverages the Aptos Python SDK to manage player scores and maintain a leaderboard directly on the blockchain. By integrating blockchain technology, Ben-Ton ensures secure, transparent, and tamper-proof score tracking and leaderboard management.
- Retro FPS Gameplay: Experience classic first-person shooter mechanics with a nostalgic retro aesthetic.
- Blockchain Integration: Utilize the Aptos blockchain to securely manage and store player scores.
- On-Chain Leaderboard: View and compete on a transparent, tamper-proof leaderboard maintained on-chain.
- Custodial Wallet Management: The game manages player wallets, simplifying the blockchain interaction process.
- Asynchronous Operations: Smooth gameplay experience with asynchronous blockchain interactions.
- Extensible Architecture: Modular codebase allowing for easy feature additions and modifications.
Follow these instructions to set up and run Ben-Ton on your local machine for development and testing purposes.
- Python 3.10 or later: Ensure you have Python installed. You can download it from Python's official website.
- Pygame: Used for game development.
- Aptos Developer Account: Required to interact with the Aptos blockchain and deploy smart contracts.
- Aptos CLI: For managing and deploying smart contracts. Installation Guide
- Node.js and npm (optional): If you plan to extend the project with frontend components.
-
Clone the Repository
git clone https://github.com/itsrealkaran/ben-ton.git cd ben-ton -
Create a Virtual Environment
It's recommended to use a virtual environment to manage dependencies.
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install Dependencies
pip install -r requirements.txt
If
requirements.txtis not available, install dependencies manually:pip install pygame aptos-sdk
-
Set Up Environment Variables
Create a
.envfile in the project root directory and add your Aptos node and faucet URLs if different from the defaults.NODE_URL=https://fullnode.devnet.aptoslabs.com/v1 FAUCET_URL=https://faucet.devnet.aptoslabs.com CONTRACT_ADDRESS=0xc9e9c2805af30b768fd1ac9d4b37ac114a3f16c675abdfc985c44ac5061fcd20
-
Deploy the Smart Contract
Ensure that the
leader.movesmart contract is deployed on the Aptos DevNet and note the contract address.aptos move compile aptos move publish --package-dir path/to/contract --named-address benton=YOUR_ADDRESS
Replace
YOUR_ADDRESSwith your Aptos address obtained from the Aptos CLI. -
Update Configuration
Update the
contract_addressinmain.pyif it's different from the default provided.self.contract_address = "0xc9e9c2805af30b768fd1ac9d4b37ac114a3f16c675abdfc985c44ac5061fcd20"
-
Activate the Virtual Environment
source venv/bin/activate # On Windows: venv\Scripts\activate
-
Run the Game
python main.py
The smart contract is written in Aptos Move and manages the leaderboard functionality. It handles account initialization, score updates, and fetching leaderboard data.
-
Compile the Smart Contract
aptos move compile
-
Publish the Smart Contract
aptos move publish --package-dir path/to/contract --named-address benton=YOUR_ADDRESS
Replace
YOUR_ADDRESSwith your Aptos address. -
Verify Deployment
Ensure that the contract is successfully deployed by checking the Aptos DevNet explorer.
Contributions are welcome! Please follow these steps:
-
Fork the Repository
-
Create a Feature Branch
git checkout -b feature/YourFeature
-
Commit Your Changes
git commit -m "Add some feature" -
Push to the Branch
git push origin feature/YourFeature
-
Open a Pull Request
This project is licensed under the MIT License.
