Default Featured Image

35 Open Source Python Games Code Free Download 2022

0Shares

If you were born in the decade of ’90s or even ‘2000 then you will definitely have the experience of playing 2D and 3D games on your mobile or computer. But have you ever wondered how these games were created?

In this blog, I will reveal a collection of open-source Python games. As the source code of these games is publicly available, so you have the opportunity to examine it in order to understand their inner working.

Python language is known for its simplicity and the high performance it offers. A perfect combination for game development I believe.

After viewing the source code, it will be great if you could try to clone them. This small task will polish your Python skills as well as help you explore many game development concepts.

Typically, Pygame is used to make 2D games in python. It is an open-source python programming language library.

Without any further ado, let’s have a look at the best free and open-source Python games. 


1. Pong

Pong is a 2D game and the idea of the game is derived from table tennis. There are two players in this game, player A and Player B. In this game, we use two paddles. One on right and one on the left to hit the ball.

If any player misses the ball, a point is assigned to the opposite player. The winner of the game is the one who scores 11 points first.

Download


2. Snake

Snake is a 2D game built using a Python library called Pygame. In this game when a snake eats food its size increases and the player got a point on every eat. You can control the snake by using Arrow keys to move the snake up, down, left, and right.

The player loses if the snake goes out of the screen or collides with his own body.

Download


3. Connect Four

Connect Four is a 2D game and in this game, there are 2 players and each of them has different color pieces. The player who gets four pieces of his own color into a row horizontally, vertically, or in a slope angle wins the game.

The players can use their pieces to block the opponent from winning or he can use them to get his own pieces in a row.

Download


4. Tetris

Tetris is a 2D game built using a Python library called Pygame. In this game, we just need to fill the rows with blocks. The game ends when the falling blocks touch the top.

By using arrow keys you can rotate the blocks to place them accurately. The player who survives for more time is the winner of the game.

Download


5. Rock Paper Scissors

It was basically a mini-project for Hacktoberfest. Basically, the participants were encouraged to create a Rock Paper Scissors game using Python Framework Tkinter or PySimpleGUI.

There are three symbols in this game rock, paper, and scissors. The rock is shown by a closed fist and paper is shown by a flat palm and scissors by the fist with two fingers out.

Both players make one of the symbols simultaneously and according to the rules rock beat scissors, scissors beat paper, and paper beat rock. If both players make the same symbol then it’s a tie.

Download


6. Hangman Game

Hangman is a simple guessing game between two players. One player is the guessing player and the other one makes the puzzle. Normally the player who made the puzzle comes up with the word but in this game, the computer will make the Puzzle.

The player has to guess the alphabet in the word if the alphabet is right computer write the alphabet in dashes. but if the alphabet is wrong then the computer draws the head of the man being hung. Each time the guessing player chooses the wrong alphabet a new body part is added to the hangman. Hangman consists of head, body, two arms, and two legs. If guessing player made the right word before the completion of hangman body parts he wins. But if he fails to do so he loses.

Download


7. Tic tac toe

Tic tac toe is a famous paper-pencil game played between two players and you are going to make it using python. The player has to mark either tick or cross on the board on his turn. And the board consists of three-time three grid.

The payer who succeeds in placing three of his marks in a row vertically, horizontally, or diagonally wins the match. The game over when one player succeeds and if the game ends without any player winning then the game is called a tie.

Download


8. Number guessing game

  In this game, the user has to predict the number. Computer asks the user to predict the number and give the clue to the user that the number is between these two numbers.

If the user guesses the number correctly, he won the game and the game is over. But if he guesses wrong then the computer gives clue to the user that the number is bigger or smaller than your guess.

You can download the code from the below link and run it on your computer.

Download


9. Game of life

Game of life is a python game consist of some squares and space. There are cells that can either be on or off. black is on and white is off you can either say it alive or dead.

Following are some rules according to which cells remain alive or dead.

  1. If your cell has less than two living neighbors then your cell dies.
  2. If your cell has exactly two or three living neighbors then your cell remains alive.
  3. If your cell has more than three living neighbors then your cell dies.

Download


10. Minecraft

Minecraft is the most popular game on the internet and you can play it on windows android and play station. By using the following code you are going to make the basic clone of Minecraft.

You are going to make it in python using the Ursina engine. It is an open-source game engine for 3d game development in python. You can use Ursina only in Linux and windows it doesn’t run in Mac.

You are going to play with boxes in this game. you can create and destroy the blocks and in this game, you are going to make a house using these blocks.

Download


11. TextBase Adventure Game

TextBase adventure game is an old-fashioned game build on python. In this game, instead of using graphics, you rely on text. E.g a text is written on your console that “ A man is approaching you with a knife in his hand” instead of showing it graphically.

Text is entered by the player as an input and the computer responds according to it. Thousands of TextBase adventure games are designed by people over time. You can download the game from here and run it on your computer.

Download


12. Ludo Game

Ludo is a strategy board game build on python using the Tkinter library. It is played between two to four players and each player has four pieces. Every player rolls the dice on his turn and according to the number on dice the player moves his pieces.

The player has to protect his pieces from other players because other players can kill your pieces and you have to move all your pieces to the finish line before any other player. And the important point is that you can’t move your piece until you get six number on your dice.

Download


13. Flappy Bird

Flappy bird is a 2d game where you have to control the bird and avoid the bird from hitting the pillars which are placed randomly with an equal gap in the game. You have to control the bird using the up and down key so that you can avoid the bird from hitting the pillar.

If you hit the bird with a pillar then the game ends. Whenever the bird passes the pillar the point is assigned to the player on each pass. We are going to make this game in python using pygame.

Download


14. PacMan

PacMan is a 2D game build on python. The player has to control the Pacman with arrow keys and you need to eat all the dots inside the maze. You need to avoid the ghosts in the game. These four ghosts also travel within the maze and if they caught you, you will be killed.

If you eat all the dots avoiding these ghosts you will win the game otherwise you will lose the game.

Download


15. Chess Game

Chess is the most popular game played all over the world and we are all familiar with that game. By using the following code you can play chess on your computer. And this code also contains the option of multiplayer as well as you can play it with the computer.

This game is the same as a real-world chess game it includes King, Queen, Rook, Bishop, knight, and pawns. You can make moves according to your strategy in this game.

Download


16. Turtle Game

Turtle game is a 2d game build on python using simple graphics. This is a very basic level game and the developer of this game develop it just to educate programmers that how the basics of the game work.

When you start the game you can select the mode and level of the game. You can control your turtle with the help of the arrow keys.

You can use different keys for different functions. Use “s” to stop the game, use the space tab to increase the speed, ”b” to reduce speed, and “q” to quit the game.

Download


17. Space Invaders Game

Space invader game is a 2d shooting game and you are going to build it in python by using the following code. In this game, you have a spaceship and you have to kill the ships coming in the opposite direction.

The enemy’s ship also fires on your ship so you have to protect your ship as well as you also need to kill the enemy’s ship. There are also hurdles between your ship and the enemy ship and you can hide behind these hurdles.

 You got points on every kill and the points vary from ship to ship.

Download


18. Stolen Crown RPG Game

It is a 2d game build on python using the pygame library. It is a mini RPG game and music is also used in it. You have to enter the city and need to steal the crown. You can also save your mission using the module name pickle.

You have to move your player in front of the city where you have to do fight with three guards and by killing them you can enter into the city. You also need to do some more fights in the city to get the king’s crown.

Download


19. Blackjack

Blackjack is a card game build on python using pygame. Its rules are simple and common and there is not any need to explain the rules of this game. you can play this game as a multiplayer or you can play it even as a single player. By using the code you can also do betting and you can bet up to $100 using this code.

Download


20. Quiz-Game

It is a game where you have to answer a question from the topic of your interest. When you run your code you have two options to start or end the game. After starting the game you have to select the topic of your interest from the given topic.

You have to answer every question and at the end of the game feedback on each question is given to you that whether your answer is true or false along with the correct answer if your answer is false.

Download


21. Battleship

Battleship is a 2d board game build on python. The main objective of the game is to be the first player to sink the opponent ship. Each player has to place his ships on the grid horizontally or vertically. You are not allowed to place the ship diagonally.

The player attacks the opponent ship by selecting the grid on the diagonal. If the opponent ship is on the same diagonal the ship is gone hit.

Download


22. CheckiO

CheckIO is also known as the game of the developer and we are going to make this using python. The process of learning how to code can be boring and hard but CheckiO has made it interesting.

The player has to solve the puzzle to level up in the game and the player has to write the code to solve the puzzle. And you can download different coding sample for the CheckiO game from here.

Download


23. Car Dodging Game

Car dodging game is a 2d car game build on python using the pygame library. In this game, you have to avoid your car from hitting the other cars coming from the opposite direction. Whenever you pass the car you get a point. The game ends when you hit the car with the opposite car.

Download


24. Sliding Puzzle

Sliding puzzle is a 2d game build on python. You have to make a puzzle in some defined order in which it can make some sense. You have to move the boxes up, down, right and left with the help of the arrow keys to make a puzzle. The puzzle can be anything it can be some picture or numbers in ascending or descending order or a list of odd numbers or even numbers.

Download


25. Othello

Othello is a 2d board game build on python using the pygame library. This game is played between two-player and each player has 8 tiles each. One player has tiles of black color and the other player has tiles of white color.

If the tile of any player is surrounded by the two tiles of the opponent player. Then the opposing player gets the tile of the first player. So the player who grabs the majority of the tiles wins the game.

Download


26. Mancala

Mancala is one of the oldest game. it is a board game with 12 small holes 6 on each side and two large holes. And there are some small beads or buttons which are placed in these 12 small holes. Four beads are placed in each hole.

Every player has to pick these beads and placed them in the holes. And when the holes of one side of the board are empty the game ends and the player which has the most beads win the game. And we are going to make this game using the pygame library of python.

Download


27. Quarto

Quarto is a board game build on python. There are 16 holes in which we can place our pieces. The pieces are of different shapes, colors, and sizes.  The piece can be lighter or darker, taller or shorter, square or circular and it can be hollow or solid.

If the player is successful in placing 4 pieces with the same characteristics in a single line vertically, horizontally, or diagonally then that player wins the game.

Download


28. GO

Go is a 2d board game and we are going to make it using python. The game consists of two players black and white and each player have to place the stone of their color on the board. The stone is captured if it does not have any adjacent empty vertex.

The goal of the game is to surround as much territory as any player can. And the player can end the game and pass the game if he thinks that there is no adventitious move left for him in the game.

Download


29. Grid Lock

GridLock is also known as Traffic jam and this game consists of a grid containing cards in it .we have one targeted card in the grid and we have to move it outside from the grid. But the other cards in the grid stop the targeted card from moving outside from the grid.

We have to move other cards vertically and horizontally in such a way that it makes a safe exit for the targeted card from the grid.

Download


30. Quoridor

Quoridor increase your planning and problem-solving skill it is the two to the four-player game. In this game, every player tries to move his pawn across the board. And the player who succeeded in moving his pawn across the board first won the game.

You can use your fences as a hurdle to stop other players from reaching their destination. You can move your pawn up, down, forward, and backward using the arrow key.

Download


31. Abalone

Abalone is a 2d board game build on python. Each player contains an equal amount of marbles and they have to place marbles on the hexagonal board this hexagonal board also has 6 edges. The player who succeeded in moving 6 marbles of the opposite player into the edges of the board wins the game.

Download


32. Asteroids

Asteroids is a 2d game in python in which the player has to kill all the other ships approaching him from every direction. The player can control his ship by using arrow keys and the player doesn’t have any breaks. We also have to protect our ship from enemies’ ships.

Download


33. Duck Hunt

Duck Hunt is the game in which you have to shoot the bird flying on your screen. A time limit of one minute is given to you in which you have to shoot as many birds as you can. At the end of the game, the result is shown to you that what is your accuracy of shooting.

Download


34. Type speed

Type speed is a game where the alphabet appears on the screen and it moves toward the right side of the screen. we have to type the word before it hit the right side and if we are successful in writing the word disappears. The game ends when the targeted number of words hits the right side of the screen.

Download


35. Fruit ninja

Fruit ninja is a 2d game build on python using the pygame library.  Fruits are thrown over the screen and the player has to touch these fruits using a cursor. But be careful here some objects work as a killer if you touch these objects then you lose and the game ends.

Download

0Shares

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.