Tag Archives: networking

Multiplayer TicTacToe

Project  Link on Github

This project was undertaken as part of my Distributed Systems class in college. The goal of the project was to create a game of TicTacToe that could be played on two different platforms and played cross platform. This project was completed with another person in my class. I wrote the java client for the game while he wrote an android app to play the game. We wrote the server code in python together and used mysql for our database.

The first step was to create the individual clients to play the game locally. I had to create a java client using the swing library for graphics. This wasn’t too hard task as I had experience with the library in previous projects. I had to have a game screen which could be used to play games, a lobby screen used to join games and a login/register screen to log in to the system.

gamelobby

We then had to create the server code. We wrote python scripts and hosted them using XAMPP on one of our laptops. The python scripts were written for each part of the system, to login users, register users, join games, create games, update games and get leaderboard statistics. Each script interacted with the database using mysql and sent the result back to the client using json. We then had a json parser to get the results in the client and check and use each part.

 

games  users

 

The clients are able to play cross platform as they both access the server in the same way. This means a user can play on either platform and play opponents on either platform. Game states are updated on the server and update all the clients connected to a game. All the code can be seen on github as well as more screen shots and the full report of the project at this link

login

 

 

Advertisements
Tagged , , , ,