SPL1 Template
SPL1 Template
[Chor-Dakat-Police-Babu]
Submitted by
Submitted to
University of Dhaka
[25-03-2025]
Signature:
Table of Contents
1. Introduction
2. Background of the Project
2.1 Role-Based Games
2.2 Markov Chains in Game Design
2.3 Sorting Algorithms in Game Development
3. Description of the Project
3.1 System Architecture
3.2 Key Features
3.3 Game Flow
4. Implementation and Testing
4.1 Implementation Details
4.2 Testing Details
5. User Interface
6. Challenges Faced
7. Conclusion
8. References
9. Appendix
1. Introduction
Chor-Dakat-Police-Babu is a role-based strategy game where players
are assigned unique roles (Police, Chor, Dakat, Babu) and compete to
achieve their objectives. The game is designed to simulate a dynamic and
unpredictable environment using Markov chains for role assignment and
merge sort for leaderboard ranking. The project aims to provide an
engaging and strategic gaming experience while demonstrating the
application of advanced algorithms in game development.
The game is implemented using C++ and SFML (Simple and Fast
Multimedia Library) for graphics and user interaction. The project
showcases the use of stochastic models and efficient sorting
algorithms in real-time applications
Police:
o If the Police correctly guesses the Chor & Dakat they
earn 80 points.
Chor (Thief):
o If the Police guesses incorrectly, the Chor earns 40
points.
Dakat (Bandit):
o If the Police guesses incorrectly, the Dakat earns 60
points.
3. Outcome Resolution:
o If the Police guesses correctly:
4. Testing
Server:
o Acts as the central authority.
o Handles role assignment, score calculation, and
leaderboard updates.
Clients:
o Players connect to the server via LAN.
2. Key Components
1. Socket Programming:
o The server and clients communicate using TCP/IP
sockets.
3. Real-Time Updates:
o The server broadcasts game state updates (e.g., roles,
1. Server Setup:
o Create a server socket and bind it to a LAN IP address
and port.
Client Connection:
Clients connect to the server using the server's LAN IP address and
port.
1. Role Assignment:
o The server assigns roles to players using a Markov
2. Gameplay:
o Clients send inputs (e.g., Police guesses) to the server.
3. Broadcasting Updates:
o The server broadcasts updates (e.g., scores, round
4. Leaderboard Updates:
o The server sorts players using merge sort and sends the
updated leaderboard to clients.
4. Advantages of LAN Implementation
5. Example Workflow
1. Server: Starts and waits for client connections.
Challenges Faced
1. Markov Chain Implementation
Challenge: Ensuring fair and unpredictable role assignment.
Challenge 4: Scalability
o Issue: Scaling the server to support a larger number of
players.
Conclusion
The Chor-Dakat-Police-Babu project successfully demonstrates the
integration of advanced algorithms (Markov chains, merge sort) and
real-time networking (LAN-based server-client architecture) in game
development. The game provides an engaging and strategic experience,
showcasing the importance of efficient algorithms and robust server-
client communication. Key achievements include:
References
1. SFML Documentation:
https://www.sfml-dev.org/documentation/2.5.1/
o Official documentation for SFML, used for graphics, window
management, and event handling.
2. Markov Chains:
GeeksforGeeks (2023). "Markov Chains."
https://www.geeksforgeeks.org/markov-chains/
o Explanation of Markov chains and their applications.
4. Socket Programming:
Beej's Guide to Network Programming.
https://beej.us/guide/bgnet/
o Detailed guide on socket programming for LAN-based
communication.
Appendix
SFML Data
Window Size: 800x600 pixels.
UI Elements:
o Buttons: Single Player, 16 Rounds, 20 Rounds, 24 Rounds.
LAN Data
Port: 8080.
Max Clients: 4.