CPSC 427 Assignment A2 - Game AI and Collision Handling

Hello, if you have any need, please feel free to consult us, this is my wechat: wx91due

Assignment A2 - Game AI and Collision Handling

Due date: Feb 26, 2024, 11:59 p.m.

In this assignment, you will extend the basic game from A1 to introduce basic collision handling and game AI.

Required Work: (80%)

Game speed

Make the plus (+/=) and minus (-) keys increase or decrease the speed and frequency of bugs and eagles to make the new features easier to see. Set an initial speed less than A1 and then adjust with the plus/minus keys during testing.

Collisions (40%)

Bouncing bugs: spawn the bugs with a randomized velocity in a right-left direc!on and make them bounce off the walls, flipping their direction along the wall normal. Make sure the bugs still collide with the chicken and that they bounce off the wall when trying to avoid the chicken (see AI below).

Prevent the chicken from leaving the game window screen (top, bottom, left, or right). Use the chicken's bounding box to make the computations efficient. Be mindful that the chicken is not square.

Implement a debug-mode toggle (using the "d" key) that visualizes the bounding boxes for the bugs and the chicken. This will make it easier to see and test your collision resolu!ons. Also, change the bounding box colour when a collision occurs to help highlight collisions versus default bounding box.

Game AI (40%)

Make the bugs smarter by enabling them to avoid the chicken. The bugs should avoid the chicken by trying to stay at least some minimum distance (safe_bug_distance) away from the chicken. When the chicken is within the safe_bug_distance, the bugs should change their direction away from the chicken to try and avoid it. The goal path should be updated every X frames. The frequency X with which these paths are recomputed should be user-controlled.

Extend the debug mode to visualize the computed direction for each bug on the screen. When in debug mode, draw each bugs' computed direction.

Creative Part (20%):

The required code changes described so far will let you earn up to 80% of the grade. To earn the remaining 20% you will need to make the game more appealing by implemen!ng one advanced feature. Marks for the advanced features will be given only if both they and all of the basic features are fully implemented and func!onal.

Suggested advanced features:

Make the bugs even smarter by accounting not just for the chicken’s current posi!on, but also for its anticipated motion trajectory.

Replace the randomly spawned eagles with a single smart eagle that chases the chicken, while at the same time avoiding the bugs. The eagles path should be updated every X frames. The frequency X with which the path is recomputed should be user-controllable. This should use a path finding algorithm such as A* (A-star).

Make the eagles respond to the player by moving towards the player when the player is within a certain radius of the eagle. If the player moves out of this radius then the eagle continues to move in their current direction rather than towards the player's new position. Visualize this radius in debug mode as a ring or box around each eagle.

Use your imagina!on to make additions other than the ones listed above, however, please make sure you focus on tasks involving collision, geometry, AI, and debugging knowledge.

To support both basic and advanced visualization and control features, you need to add a toggle op!on where the user switches between the two modes by pushing the ‘a’ and ‘b’ keys (‘a’ for advanced mode and ‘b’ for basic mode; either at startup or during the game).

Document all the features you add in the README.md file you submit with the assignment. Advice: implement and test all the required tasks first before star!ng the free-form part.

Deliverables:

1. In addition to your source code, fill in the README.md file (Markdown language as used on GitHub) with your name and a list and description of your custom features.

2. Zip all code, README.md, and the CMake.txt files as present in the template source code and exclude any executables and compiled files. For example, exclude the “out” and “.vs” folders.

3. Name your file: A2-.zip, for example: A2-411111111.zip.

4. Double check that you excluded all generated files, such as /build, .vs, /out! These consume a lot of space on our server and points will be deducted if the zip file contains any of them. For reference, your submission zip file should be similar in size to the A1_template.zip that you downloaded.

5. Upload the zip to Canvas.





发表评论

电子邮件地址不会被公开。 必填项已用*标注