0% found this document useful (0 votes)
3 views12 pages

Groupproject TechnicalReport

The document outlines a group project where members developed a turn-based battle game using Python and Tkinter, allowing players to customize characters and engage in strategic combat against AI. It details game mechanics including character attributes, battle logic, AI behavior, and a logging system for tracking actions. The project emphasizes object-oriented programming principles and includes a test report confirming the functionality of various game features.

Uploaded by

chentianyoulucas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views12 pages

Groupproject TechnicalReport

The document outlines a group project where members developed a turn-based battle game using Python and Tkinter, allowing players to customize characters and engage in strategic combat against AI. It details game mechanics including character attributes, battle logic, AI behavior, and a logging system for tracking actions. The project emphasizes object-oriented programming principles and includes a test report confirming the functionality of various game features.

Uploaded by

chentianyoulucas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 12

IP GROUP PROJECT

GROUP 11

Group members:
Dylan 165z1ec6
Tianyou Chen 0837b84h
Zi jian jack Kew 901joumb
Lecturer: Julia Ge
Peer Evaluation Form
Dylan Tianyou Jack Total
Character 40% 30% 30% 100%
Creation
(Unit Class)
Battle 35% 35% 30% 100%
Actions
(Attack/Heal)
AI Behaviour 30% 40% 30% 100%
User 20% 50% 30% 100%
Interface
Event 25% 35% 40% 100%
logging
Game 30% 35% 35% 100%
Restart

Introduction of project
In this project, we developed a battle game by utilizing Python and Tkinter.
In this game, players can customize their characters by picking Warrior and
Tanker roles from the list and, consequently, fight against AI-controlled
enemies. These sections also feature an attack mechanism, a healing bond,
and a way of gaining levels while recording everything through a battle log.
By implementing OOP principles, we built the game on classes with functions
so as to support modularization and facilitate easy maintenance.

Every game character possesses distinct hero attributes that include HP,
ATK, DEF, and EXP. Players are able to strategically engage in combat and
bring down the AI using various forms of units while ensuring their units’
health and experience are acceptable. During the battle, it is a turn-based
strategy where both the player and AI are allowed to perform actions
alternatively.
The combat resolution equation includes attack power, defense, and the
stochastic or random variation factor, ensuring a thrilling outcome. When a
unit hits the 100 EXP threshold, their level up leads to an increment of ATK
and DEF stats, hence making them more effective warriors. AI enemies apply
a targeting system that is based on as many unique rules as possible; for
example, if one unit has the least HP, then the programmers will direct the AI
to attack them.

Created with Tkinter as our primary physical interface, this game contains an
interface with an interactive GUI where users can attack, heal, restart the
game, and view the characters' current status. In addition, by implementing
health bars and an event-log system that pulls all activity in real-time, the
player gets the chance to witness instant consequences of their actions. The
is also a file keeps actions in a log (battle_log.txt) for debugging and
reviewing.
a. Flowchart
Start

Get Player
Names

Initialise
characters

Display Game
Menu

Player turn
(Choose
Action)

Perform
action
(Attack/Heal)

Update
HP/Heal

Check Game
Status

Is Game Over

Yes No

Display Continue
Outcome Game

Restart
Next Player's
game?
Turn
(Yes/No)

Yes No

Restart the
Game

This flowchart shows how our game progresses starting from initialization
where player and AI are set up and battling phase where players choose
actions and AI take turns to attack. The game will loop until a win is met, at
that point the game will restart or end.
AI Action Logic

After the player completes their action, the AI takes its turn
automatically:

1. The AI selects a target:

AI will prioritize attacking the player unit with the lowest


HP.

If multiple player units have the same HP, AI will choose


randomly.

2. The AI performs an attack, reducing the target's HP.

3. The game updates the event log to record AI actions.

4. The game checks if all player units are defeated:

If all player units are dead, the AI wins and the game ends.

Otherwise, the game continues.

Player upgrade logic

If a player's unit earns 100 EXP, they will level up, increasing their
attack and defense stats:

1. When a unit levels up:

Attack power (ATK) increases by 1-5 points.


Defense (DEF) increases by 1-3 points.

2. The game displays a message showing the new ATK and DEF
values.

3. The game continues with the next turn.

Game over logic

At the end of each turn, the game checks if one side has lost all
its units:

1. If all AI units are defeated, the player wins.

2. If all player units are defeated, the AI wins.

3. The game displays a message indicating victory or defeat.

4. The game automatically resets, allowing a new match to start.


b. Hierarchical Chart
Main
Game
Loop
Game
Initialisatio
n

Player
AI Setup
Setup

Character Generate
Creation AI Team

Game
Action
Handling

Attack
Logic

Heal Logic

Turn Logic

This hierarchical chart shows the relationship of the functions in our game.
The chart starts with the main game loop and branches to specific operations
relating to our game.

Unit Class and Character Actions

Each unit (player or AI) is created using the Unit class, which defines
essential attributes such as:

 HP (Health Points) – Determines how much damage a unit can take


before being defeated.
 ATK (Attack Power) – Defines the damage potential of the unit.

 DEF (Defense Power) – Determines how much damage the unit can
mitigate.

 EXP (Experience Points) – Tracks experience gained from battles.

 Level – Increases when EXP reaches a threshold, improving ATK and


DEF.

Battle Logging System

The game includes a logging system that records all actions in real time:

1. Records player actions (attack, heal).

2. Records AI actions (target selection and attack).

3. Tracks level-ups and displays updated stats.

4. Writes all logs into a file (battle_log.txt).

c. Test Report
The test report provides info on the tests conducted to ensure that the game
functions as it should.
1. Test 1: Character Creation

 Test: Create a character with the “Warrior” role.

 Likely result: The character should be generated with the


selected role, health points (HP), attack, and defence values.

 Result: Passed. Character created successfully with randomised


stats.

2. Test 2: Battle Logic

 Test: When a player attacks an AI unit, the target’s HP should


decrease by the attack value minus the defence of the target.

 Likely result: Correct amount of damage should be applied to


the target.

 Result: Passed. Damage was correctly calculated and applied to


the target.

3. Test 3: Healing Action

 Test: When a player uses the heal action, the player’s HP should
increase within the healing range.

 Likely result: HP should not exceed 100 after healing.

 Result: Passed. Healing function works correctly and ensures HP


does not exceed 100.

4. Test 4: Level up Function

 Test: When a player’s experience points reach 100, the player


levels up, increasing attack and defence stat.

 Likely result: Player’s level, attack, and defence values should


increase.

 Result: Passed. Level up correctly input stat increases.

5. Test 5: AI Attack Logic

 Test: AI unit attacks the player after every turn.

 Likely result: AI selects the player unit with the lowest HP as its
attack target.
 Result: Passed. AI correctly selects the player unit with the
lowest HP and attacks it.

6. Test 6: Game End Condition

 Test: The game should end when all player or AI units are
defeated.

Likely result:

If all player units are defeated, the game should display “AI
Wins” and restart.

If all AI units are defeated, the game should display “You Win”
and restart.

 Result: Passed. The game correctly detects when all units are
eliminated and displays the correct victory message.

Conclusion

This project successfully created a turn-based battle game utilizing Python


and Tkinter, employing object-oriented programming principles and an
event-driven graphical user interface design. The game features a character
creation where players pick two specific roles (Warrior and Tanker) and the
players can engage in strategic fights against the AI. The fight system
provides core mechanics such as attack, healing, experience points (EXP)
accumulation, and level up interaction, ensuring that players have a good
time.

The game mechanics were strictly verified to ensure their accuracy. The
Combat now accurately applies damage calculations basing on attack power,
defense values, and a randomized modifier. The healing functionality
restores HP at a range defined not to exceed the maximum limit. Character
level up, which is provided after players gain 100 EXP, will allow for the boost
in stats and also the characters' capabilities to attack and defense.
Furthermore, the AI mechanisms play a crucial role in advancing the game
by choosing the player unit with the least amount of HP for its attack target,
thus introducing an element of strategy in attack and combat.

The battle log system behaves as an automated notary and records all
moves made by both player and AI, assuring the transparent nature of the
game and supporting the debugging process. The battle system user
interface facilitates easy interactions by showing HP ahead of time, the
growing level of a character, and the battle events. The implementation of a
structured game loop is able to point errors and ensure that the transitions
and inputs are properly posted, and unexpected actions will not be at the
right time.

Through the game, we can successfully see how programming concepts are
applied, how algorithms are thought up, and how to develop a graphical user
interface (GUI). The project succeeds in its concept by joining fight
mechanisms, the AI model's decision, and in-game event tracking, which in
the end makes it possible to have an equitable and well-functioning fighting
system. The structured approach to game design consideration and
production will hold the system together and provides a great gaming
experience for the user.

You might also like