- Blockchain Council
- September 25, 2024
Subway Surfers is a popular game where you run endlessly. In the game, players move through subway tracks, dodging trains and obstacles, and grabbing coins along the way. A policeman constantly chases the player, trying to catch them. Although the original version is available for mobile devices, various Subway Surfers GitHub projects offer different versions of the game. These projects use different coding languages and frameworks to recreate or modify the game.
Various Versions of Subway Surfers GitHub
Developers and hobbyists have created multiple Subway Surfers versions on GitHub. These range from simple clones to complex models driven by AI. Depending on what you’re looking for, you can play a basic browser-based version, set up an AI to play for you, or tweak game mechanics to create your own variant.
1. Playing the Browser-Based Version
If you’re only interested in playing a simplified version directly in your browser, there’s a project by sarnas15 that you can try with minimal effort. Here’s how:
- Access the Repository: Visit the project’s GitHub page.
- Clone or Download: Click the “Clone or Download” button to get the code on your computer.
- Run the Game: Open the game.html file in your browser. Use the arrow keys for movement and press the spacebar to jump.
This browser-based version is simple, with basic controls, but it resembles the original game well.
2. Using AI to Play Subway Surfers
For those curious about AI and machine learning, there are several GitHub projects showcasing how to train an AI to play Subway Surfers using methods like reinforcement learning or supervised learning.
Using Supervised Learning
The subwAI project employs a convolutional neural network (CNN) to teach an AI model to play. The process involves:
- Data Collection: Play the game yourself while the script captures screenshots and logs the actions.
- Training the Model: The AI learns to replicate your moves based on the images recorded.
- Running the AI: After training, test the model to see how it handles the game. It might even find ways to improve its performance, like using glitches.
This is a good choice if you’re interested in exploring machine learning in gaming, but some knowledge of Python and relevant libraries is needed.
Using Reinforcement Learning
Another project, subway-surfers-AI-main, uses reinforcement learning methods like Deep Q-Networks (DQN). Here’s how to begin:
- Set Up the Environment: Follow the given steps to prepare the game setup.
- Train the Agent: The AI learns through trial and error, making choices based on rewards and penalties.
- Test the Model: After training, evaluate the AI’s performance in navigating obstacles and collecting coins.
This approach is more complex and is suited for those interested in deep AI research and development.
3. Modifying the Game Using Unity
For those wanting to get into game development, the Subway Surfers Unity project is a great option. This version brings the classic game into the Unity engine, where you can modify game mechanics, graphics, and controls. To get started:
- Download the Project: Clone or download the repository from GitHub.
- Open in Unity: Launch the project using the Unity Editor. You’ll see all assets and scripts used in the game.
- Modify and Build: Make your own changes, like adding new levels, changing animations, or adjusting difficulty.
- Play and Share: After building the game, you can share it with friends or run it on your computer.
4. JavaScript & WebGL Versions
For those interested in a more complex browser version using JavaScript and WebGL, follow these steps:
- Clone the Repository: Clone a repository like stive0321’s using:
git clone https://github.com/stive0321/subway-surfersbb.git
- Set Up a Local Server: WebGL games need a local server. Use Python’s http.server module or Node.js to set one up:
cd subway-surfersbb
python3 -m http.server
- Launch the Game: Open your browser and go to http://localhost:8000. The game should start, and you can control it with the arrow keys.
Customization and Expansion
All these projects are open-source, meaning you can modify and expand them as desired. Here are some ideas:
- Add New Features: Introduce new power-ups or challenges using JavaScript and WebGL. For instance, tweak the subway.js or game.js files in repositories like KSVSC’s project.
- Enhance AI Performance: Experiment with different neural network structures in the subwAI repository. Adjust the layers or use data augmentation to improve AI performance.
- Change the Interface: Customize the user interface by modifying HTML and CSS files. Adjust the game’s look to suit your taste.
Playing Subway Surfers on Your PC
Basic Controls
- Move Left/Right: Press the left and right arrows to change lanes.
- Jump: Use the up arrow key to leap over obstacles.
- Slide: Press the down arrow key to duck under barriers.
- Activate Hoverboard: Double-tap the space bar or use a key set in your game settings.
Power-Ups and Their Uses
- Super Sneakers: Jump higher, reaching coins and power-ups that are normally out of reach.
- Coin Magnet: Attracts all coins nearby, saving you from moving over them.
- 2x Multiplier: Doubles your score for a short time, boosting your total points.
- Jetpack: Fly over tracks, avoiding all obstacles while gathering coins.
Tips for High Scores
- Use Hoverboards Carefully: Hoverboards last 30 seconds and act as a shield. Use them when needed.
- Upgrade Power-Ups: Focus on improving the Coin Magnet and 2x Multiplier for better scores and faster coin collection.
- Complete Challenges and Missions: These offer extra rewards and keep the game engaging.
Final Thoughts
Subway Surfers projects on GitHub provide great opportunities for both players and developers. You can enjoy a simple browser version, experiment with AI, or delve into game development using Unity. Each version has its own setup. It includes different features. This appeals to various interests. Exploring these projects can be both fun and a way to build technical skills.