jakeard / Network-Tic-Tac-Toe

This is a Tic-Tac-Toe game that I made to learn about and practice networking in python using the sockets library. Give it a try!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Networking Tic-Tac-Toe

This is my Networking Tic-Tac-Toe software. I decided to make this game to learn about and show what I can do from learning about networking and sockets in Python.

This game has a server and client file. The server is started first and only on one machine, and is what gives the clients their starting information, and connects and allows them to send messages to each other. The first person who starts the client will be given a waiting message, and then the second person that joins will be shown the board and prompted for a spot to go. This spot is sent over the server to the other client, and both client's boards are updated. This continues until someone wins, or until there is a tie, in which case the clients are disconnected from the server.

To play, one person has to start the server by typing: py server.py, and then both people enter the IP provided when the server starts in the client file next to the word SERVER. To start the client, both people type: py client.py (or client_colors.py if you are in a terminal that supports colored characters).

Software Demo Video

Network Communication

This program uses a client/server connection, where multiple clients can connect to one server. At the moment, only 2 clients may connect to the server at a time, but this can be increased as the server uses threading and can therefore handle many clients and their requests.

This program uses a TCP based server to communicate between server and clients. The default port being used is 5050, but this can be changed.

Messages are encoded using UTF-8, which is a Unicode character encoding method. When they are received by the opposite client, they are decoded and used by that client to update the board.

Development Environment

Some tools that I used to make this program are:

  • Python
  • Visual Studio Code
  • Python sockets library
  • Python threading library

Useful Websites

Future Work

  • Modify the server to accept more than 2 clients, pair up 2 clients out of the many, and start a game for each pair
  • Use the client/server model on a different and more complex game
  • Learn about and use UDP as opposed to TCP

About

This is a Tic-Tac-Toe game that I made to learn about and practice networking in python using the sockets library. Give it a try!


Languages

Language:Python 100.0%