A Java-based Gomoku game with client-server architecture, user authentication, and persistent player data.
- Gomoku Game: Implements the classic Gomoku (Five in a Row) game logic.
- Client-Server Architecture: Uses a client-server model for multiplayer gameplay.
- User Authentication: Players can log in with a nickname and password.
- Player Profiles: Stores player data such as wins, losses, play time, and profile information in XML files.
- Game Lobby: Players can list available players and challenge them to a game.
- Persistent Data: Player profiles are saved in XML files using DOM parsing.
- Real-time Gameplay: Utilizes sockets for real-time communication between clients and the server.
- Automated Winner Detection: Determines if a player won or if it is a tie.
- Timeout Feature: Implements a timeout mechanic to prevent players from stalling.
- Language: Java
- Data Persistence: XML (DOM Parser)
- Networking: Sockets
-
Clone the repository:
git clone https://github.com/giannifloriddia/Projeto_IECD.git cd Projeto_IECD -
Import the project into Eclipse:
- Open Eclipse.
- Go to
File->Import->Existing Projects into Workspace. - Browse to the directory where you cloned the repository and select the
Projeto_IECDproject. - Click
Finish.
-
Set up the XML Data Directory:
- Ensure the following directory exists or create it:
src/main/webapp/WEB-INF/data/ - The project uses
Jogadores.xmlto store players data
- Ensure the following directory exists or create it:
-
Run the Server:
- In Eclipse, navigate to
src/main/java/server/ServidorTCP.java. - Run the
ServidorTCP.javafile. This will start the Gomoku server on port5025.
public static void main(String[] args) throws IOException { ServerSocket serverSocket = new ServerSocket(DEFAULT_PORT);
- In Eclipse, navigate to
-
Run the Client:
- Navigate to
src/main/java/clientSerial/Jogador.java. - Run the
Jogador.javafile. This will start a Gomoku client.
public static void main(String[] args) throws IOException, ClassNotFoundException { // Leitura de informações de login System.out.print("Digite seu nickname: "); String nickname = leitor.nextLine(); System.out.print("Digite sua password: "); String password = leitor.nextLine(); Jogador jogo = new Jogador();
- Navigate to
-
Play the Game:
- Enter your nickname and password when prompted.
- Use the
/listarcommand to view available players. - Use the
/desafiar <nickname>command to challenge a player. - The game will start once the challenge is accepted.
- Enter the number corresponding to the cell where you want to place your symbol.
Projeto_IECD/
├── src/
│ ├── main/
│ │ ├── java/
│ │ │ ├── clientSerial/
│ │ │ │ ├── Jogador.java
│ │ │ │ ├── JogadorPerfil.java
│ │ │ │ └── Jogo.java
│ │ │ ├── dados_persistentes/
│ │ │ │ ├── GerirJogadores.java
│ │ │ │ ├── JogadoresDataBase.java
│ │ │ │ └── Util.java
│ │ │ └── server/
│ │ │ ├── ConexaoJogador.java
│ │ │ ├── SalaDeEspera.java
│ │ │ ├── SalaDeJogo.java
│ │ │ └── ServidorTCP.java
│ │ └── webapp/
│ │ ├── META-INF/
│ │ │ └── MANIFEST.MF
│ │ ├── WEB-INF/
│ │ │ ├── data/
│ │ │ │ ├── Jogadores.xml
│ │ │ │ └── Jogadores.xsd
│ │ │ └── lib/
│ │ │ └── json-simple-1.1.1.jar
│ │ ├── game.jsp
│ │ ├── getPlayers.jsp
│ │ ├── login.jsp
│ │ ├── quadro_honra.jsp
│ │ └── settings.jsp
- Repository Name: Projeto_IECD
- Repository URL: https://github.com/giannifloriddia/Projeto_IECD
- Author: giannifloriddia