Project Report 1

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 15

HANOI UNIVERSITY OF SCIENCE AND TECHNOLOGY

School of Electrical and Electronic Engineering


------

REPORT SUBJECT PROJECT


CATCHING POKEMON GAME ET2030E
Instructors: Hoang Quang Huy

Group 26
STT Họ và Tên MSSV
26 Trần Quang Minh 20233971
35 Trần Sơn Tùng 20233986

Hà Nội, 10/2024
TABLE OF CONTENTS

TABLE OF CONTENTS..............................................................................................3
Chapter 1: Overview.....................................................................................................4

1.1. Introduction........................................................................................................4

1.2. Reason to choosing the topic..............................................................................4

1.3. Benefits and drawbacks.....................................................................................5


1.3.1. Benefits..........................................................................................................5
1.3.2. Drawbacks......................................................................................................5

CHAPTER 2: REQUIREMENTS...............................................................................8

2.1. Non-technique requirements..............................................................................8

2.2. Technique requirements.....................................................................................8

CHAPTER 3: DESIGN AND CONTRUCTION PROCESS....................................9

3.1. Timeline of the project.......................................................................................9

3.2. Function diagram................................................................................................9

3.3. Use case..............................................................................................................10

3.4. Activity diagram...............................................................................................12

CHAPTER 4: RESULT AND CONCLUSION........................................................13

4.1. Product demonstration.....................................................................................13

4.2. Conclusion.........................................................................................................14

REFERENCES............................................................................................................16
Chapter 1: Overview

1.1. Introduction
A Catching Pokemon game is a type of game, typically aimed at children or casual
gamers, where the player’s objective is to catch pokemon in a virtual environment. The
game is often designed to be simple and entertaining, involving fun and colorful
graphics. The core mechanics of the game generally revolve around timing, reflexes, and
hand-eye coordination.
Pokemon catching games also help with rehabilitation a lot of benefits. For games
that involve using the hands or fingers to catch pokemon, it helps patients improve
dexterity and precision in small hand movements, which are crucial for everyday tasks.

1.2. Reason for choosing the topic

Understand the basic of Python opencv as well as mediapipe.


Create a simple and fun game for entertainment.
Connecting physical activityand relaxation.
Help recover basic functioning

1.3. Target

The player’s goal is to catch as many Pokemon as possible within a certain time
limit or until they reach a specific score.
Games that are popular for its simplicity and appeal to a wide range of players,
especially younger audiences or those looking for a relaxing experience.
The Catching Pokemon game is used in rehabilitation with the goal of aiding
patients' recovery by combining physical therapy exercises with a fun, interactive activity

1.4. Benefits and Drawbacks


1.4.1. Benefits
Engaging and Interactive: The game’s playful and interactive nature can
significantly increase patient motivation and enjoyment, making the rehabilitation
process more appealing and less monotonous.

Customizable: The game can be tailored to different levels of difficulty,


making it suitable for patients at various stages of recovery, from those just beginning
rehabilitation to those in advanced stages.

Physical and Cognitive Benefits: It targets both physical rehabilitation (motor


skills, coordination, range of motion) and cognitive rehabilitation (memory, attention,
problem-solving), making it versatile in its therapeutic applications.
Technological Integration: The game can be enhanced with virtual reality
(VR) or augmented reality (AR), providing an immersive and engaging rehabilitation
experience that can simulate real-world movements in a controlled, safe environment.

Positive Reinforcement: Instant feedback and rewards for completing tasks


(e.g., catching pokemons ) can motivate patients and boost their confidence, promoting
continued participation.

Multisensory Engagement: The game stimulates multiple senses (visual,


auditory, and motor), which is beneficial for individuals with sensory processing
issues or those requiring more immersive therapeutic methods.
1.4.2. Drawbacks
Dependence on Technology: For advanced versions (VR or AR), access to
technology may be limited due to costs, and technical issues can disrupt therapy
sessions. Equipment like VR headsets may not be readily available in all rehabilitation
centers.

Potential Over-Simplification: For some patients, especially those further


along in their rehabilitation, the game may become too simplistic and fail to challenge
them enough. If not designed properly, it might not push patients to their full
therapeutic potential.

Limited Physical Interaction: If the game relies solely on a screen or VR


system, it might lack real-world, tactile feedback, which is important for certain
physical therapies. Patients may need to perform complementary exercises outside of
the game.

Focus on Specific Abilities: While the game is designed to improve motor and
cognitive skills, it may not address all rehabilitation needs, such as emotional or social
aspects, unless integrated with broader therapy programs.
CHAPTER 2: REQUIREMENTS

2.1. Non-technique requirements


Therapeutic Goals: The program must be designed to target specific
rehabilitation goals, such as improving motor control, coordination, or cognitive
function. It should be adaptable to different levels of patient ability and provide
progressive difficulty based on the patient's improvement.
Accessibility: The program should be accessible to users with different levels of
computer proficiency.

User-Centric Design:
 Engagement: The game should be engaging and motivating for users,
especially those undergoing long-term therapy.
 Age Appropriateness: The design, visual style, and difficulty level
should cater to the target audience, which could be children, adults, or
elderly users.
 Fun and Enjoyable: Rehabilitation can be tedious, so the game should
aim to reduce monotony through fun elements, such as interactive
environments or playful rewards (points, stars, or new levels).
 Efficiency: The program should execute commands and queries
quickly to provide a smooth user experience.

Accessibility: The game should be designed for people with disabilities or


impairments (e.g., low vision, limited motor skills).

Ease of Use: The game should have an intuitive interface that does not require a
lot of training or instructions and provide therapists with the ability to monitor progress
and customize game parameters according to the patient's needs.

2.2. Non-technique requirements


Input Devices: The game could use cameras (e.g., Kinect), wearables (sensors),
or handheld controllers to track the player’s movements, allowing them to "catch"
Pokemon through real-time interaction. If used on tablets or touchscreens, the game
should accurately register touch gestures, allowing users to "tap" or "swipe" to catch
Pokemon.

Game Mechanics:
 Pokemon Movement: Pokemon should follow dynamic, random, or
patterned paths that increase in difficulty as the player progresses,
requiring greater agility or precision.
 Collision Detection: The game must accurately detect when the player
has “caught” a Pokemon (either through motion or touch).
 Adaptive Difficulty: The game should adjust the challenge automatically
based on the player’s performance (e.g., if the player is struggling, make
butterflies slower; if progressing well, increase their speed).

Error Handling and Fail-Safes:


 Ensure robust error detection to prevent the game from crashing or
freezing during therapy sessions, with built-in fail-safes to save progress
in case of system failure.

User Feedback:
 Immediate and progressive feedback on user performance.
 Corrective prompts for movement errors or device issues.
 Adaptive game difficulty and positive reinforcement based on
performance.
 Visual, auditory, and potentially haptic feedback to enhance user
engagement.
CHAPTER 3: DESIGN AND CONTRUCTION PROCESS

3.1. Timeline of the project

Figure 3. 1: Timeline

The timeline for the Catching pokemon game in Python outlines the project's
development stages over several weeks.
In Weeks 4-5, the project begins with brainstorming ideas. During Weeks 6-7,
relevant references for the project are gathered. By Weeks 8-9, the necessary diagrams
are drawn, and initial coding and report slides are started.
Weeks 10-12 focus on fixing bugs, completing the basic functional code, and
testing features. Finally, in Weeks 12-18, the project is wrapped up with finishing the
report, finalizing slides, and coding any additional new features. This structured
approach ensures the project is systematically planned and executed.

3.2. Function diagram.

Figure 3.2: Function diagram.


3.3.Use case

Figure 3.3: Use case teacher’s version


The use case diagram for pokemon catching game in Python highlights key
functionalities such as start the game by selecting the "Play Game" option, viewing
scores, playing tutorial to better understand the game

3.3. Activity diagram

Figure 3.6: Activity diagram.


CHAPTER 4: RESULT AND CONCLUSION

I. Product demonstration
1. Pokémon with types and their GIFs
 Purpose: defines a list of Pokémon, where each element is a dictionary containing
detailed information about each Pokémon.
 Implementation:
 name: Name of Pokémon.
 gif: Path to a GIF file of the Pokémon. This GIF file contains frames that help
animate the Pokémon.
 rarity: Pokémon rarity, which represents the probability of a Pokémon
appearing in the game. The higher the rarity value, the rarer and harder to find
the Pokémon.
 type: The Pokémon's type (e.g. Land, Water, Flying), helps determine the area
in which it appears in the game.
 points: The score the player receives when catching that Pokémon.
2. Zones of different Pokémon types
 Purpose: Defines a dictionary named spawn_zones, which specifies the
coordinates for different Pokémon types to appear in the game
 Implementation:

 "Water": Represents the type of Pokémon that can appear in water areas.
 "Land": Represents Pokémon that spawn on land.
 "Flying": Represents Pokémon that appear in areas like trees or heights.

3. Hàm __init__(self, root)

3.1. Hàm self.root


 Purpose: Give the application window a title so that the user knows that the
application is open as the "Catch Pokémon!" game.
 Implementation:
 sets the main window to the root object.

3.2. Hàm self.canvas

 Purpose: places the canvas in the window.


 Implementation:
 creates a canvas of specified dimensions (732x412) for displaying images
and animations.
 The canvas is where game elements, such as the background and Pokémon,
will be displayed.

3.3. Hàm self.background

 Purpose: Load a background image (GIF) and display it on the canvas, then
create an animation by changing between the frames (frames) of the GIF.
 Implementation:
 Command from PIL library to open GIF image file • Create a list containing
GIF image frames to create animation.
 loop through each frame of the GIF and convert each frame to a format usable
on Tkinter.
 From there, each frame is saved to self.background_frames, making it easy to
display each frame in order to create animation effect.
 self.background_frame_index is initialized to 0, i.e. starting from the first
frame of the GIF.• The coordinate (0, 0) places the image at the top left
corner of the canvas.
 ensures that the image is aligned from the top left corner.
 The ID of this image is saved to self.background_image_id, making it easy to
change the next frame in the animation.
 Finally, self.animate_background() is called to start the background animation
process by changing the displayed frame every certain amount of time,
animating the background.
3.4. Hàm self.score

 Purpose: To initialize and display the player’s score at the top of the window.
 Implementation:
 Initializes the score variable to 0 at the start of the game, as the player
begins with no points.
 Creates a Label widget in Tkinter to display the score.
 The text parameter is set to show "Score: 0" initially. f"Score: {self.score}"
is used so that self.score can be dynamically updated as the game
progresses.
 font=("Arial", 16) sets the font style and size.
 Adds the score_label to the main window so that it’s visible to the player.

3.5. Hàm self.curent_pokemon

 Purpose: allows the player to interact with the game by catching Pokémon,
which affects the score.
 Implementation: To initialize the variable for the currently displayed Pokémon
and call the show_pokemon() function, which will select and display a
Pokémon on the screen.

4. Hàm animate_background(self)

 Purpose: This function loops through the background GIF frames, creating a
continuous animated effect for the background.
 Implementation:
 Increments each time the function is called to cycle through the background
frames.
 Updates the canvas with the current frame.
 Sets a timer to call animate_background again every 100 milliseconds to create
a smooth looping animation.

5. Hàm show_pokemon(self)

 Purpose: This function randomly selects and displays a Pokémon on the screen
with an animation, using Pokémon rarity to influence the selection.
 Implementation:

 Uses the rarity attribute of each Pokémon to choose one with weighted
probability.
 loads the GIF of the selected Pokémon, and self.frames stores each frame for
animating the Pokémon.
 Selects a spawn location based on Pokémon type, with a default location if no
specific type is found.
 self.pokemon_image places the Pokémon on the canvas at a random spot within
the selected spawn area.
 self.root.after(100, self.animate_pokemon) initiates the Pokémon's animation by
calling animate_pokemon every 100 milliseconds.
 self.canvas.tag_bind(...) binds a click event to catch_pokemon, allowing the
player to "catch" the Pokémon by clicking on it.

6. Hàm animate_pokemon(self)
 Purpose: Similar to animate_background, this function animates the selected
Pokémon by cycling through its GIF frames.
 Implementation:

 self.frame_index increments each time to show the next frame of the Pokémon
GIF.
 self.canvas.itemconfig(self.pokemon_image,
image=self.frames[self.frame_index]) updates the canvas image to the current
frame.
 self.root.after(100, self.animate_pokemon) re-calls animate_pokemon every
100 milliseconds to loop through the GIF frames.

7. Hàm catch_pokemon(self, event)

 Purpose: This function handles the logic when a player clicks on a Pokémon,
updating the score and spawning a new Pokémon.

 Implementation:

 self.score += self.current_pokemon["points"] adds the points of the caught


Pokémon to the player's score.
 self.score_label.config(text=f"Score: {self.score}") updates the displayed score.
 self.canvas.delete(self.pokemon_image) removes the caught Pokémon from the
screen.
 self.show_pokemon() is called again to spawn a new Pokémon.

8. Main game loop

 Purpose:

 The code creates the visual interface where users will interact with the
game.

 Game Initialization: It sets up all necessary components and initializes the


game state.
 Event Handling: The main loop keeps the application responsive, ensuring
that all animations and interactions happen smoothly.

 root = tk.Tk() :This line initializes the main application window by creating an
instance of the Tk class. This instance (root) serves as the primary window for
your application where all the UI components, such as the canvas, buttons, and
labels, will be displayed.
 game = PokemonGame(root): This initialization triggers the __init__ method in
the PokemonGame class, which sets up the game’s user interface, initializes the
game state, and begins the background animation and Pokémon display.
 root.mainloop(): In the context of the Pokémon game, this loop allows
animations to continue running (like the moving background and the Pokémon
animations) and processes user interactions (like catching Pokémon).

II. Conclusion

Compared to the set goals:


- Completed the set goals.
- The functions work well.
- However, there are still some missing functions
- Development direction:
• Build more functions for the game, for example: pause the game, adjust the
game volume, ...
• Deploy the game to a website for everyone to play.
REFERENCES
- Youtube:
 https://www.youtube.com/watch?v=JrEYWFFIRG8&t=472s
 https://www.youtube.com/watch?v=UlGs_rUomow
- Mediapipe Tutorial:
 https://ai.google.dev/edge/mediapipe/solutions/vision/hand_landmarker?hl=vi
 https://mediapipe.readthedocs.io/en/latest/solutions/hands.html
- Other sources:
 https://github.com/mo-kasiri/catch_ball

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy