首页 > 其他分享 >Air Hockey Project

Air Hockey Project

时间:2024-06-12 10:54:23浏览次数:23  
标签:will should Project slider game Hockey branch Air pts

Assignment3 Jump to bottom

Air Hockey Project

Objectives:

In this project, you will be starting your 2-Player Air Hockey project. Checkout the gamedescription and onine Air Hockey game to get familiarised with the game.You will be accomplishing the following items:Get familiarized with the basic structure of the Game.Process keyboard input from the user.

Add a player movement system.

Add a goal based scoring system.

Add an initial welcome screen, where you mention the scoring system and player controls.

Implement win-lose scenario.Display the scores and the winner of the game.Save the 10 best win scores in a file.

Setting up the goal area on the top and bottom boundary of the zone.Game Over ScreenIncrease the slider size from 4 to 7.Different speed of ball in different levels.Add obstacles for different levels.Add color to the game.

Game levels

Easy : Ball speed - lowest, Obstacles - NoneMedium : Ball speed - 20% increase from the Easy level, Obstacles - NoneHard : Ball speed - 20% increase from the Medium level, Obstacles - 2

Updating your repository: You will need to pull the updates related to the Air Hockeyproject from the course repository. You can do this using thefollowing git command

sequence.

git fetch

git pull upstream main

You should now have an air_hockey directory in your repository. Note sometimes your "main" is

called "master".

Create a assignment_3 branch: You will be creating a branch where you will be doing thework for this phase of the project. The AIs will refer to this branch to do the grading. Thefollowing are the steps for creating a branch. This involves creating the branch, checking itout, and then pushing the branch to your github repo. You can get more information onbranching in the Pro Git branching chapter.

git branch assignment_3

git checkout assignment_3

git push origin assignment_3

Don't forget that you have been working on the "master" or "main" branch so far. Think of eachbranch as an independent version of the code. If you decide to go back to main branch, just usecheckout command. By the way, you could decide to merge branches together but that's notwhat we will need for now.This branch should only be for your work on this project. For other course assignments, pleaseremember to switch back to your main branch using the following command.git checkout mainYou can check which branch you're currently in using the this command.git branch

File Descriptions

air_hockey.cpp: This file has the main infinite game loop. Before starting the game loop, all gamecomponents are initialized. The game has a sleep of 200 milli-seconds.ball.cpp: This file contains functions that check if the ball is colliding with the slider and the left &right walls of the zone. You need to write a similar function which checks if the ball is collidingwith the goal area in order to determine the winner.

slider.cpp: This file contains functions that initialize, move, draw and undraw the slider.

zone.cpp: This file contains functions to intialize, draw and undraw the zone.

key.cpp: This file contains the functionality to read user input from the keyboard while the gameis being played. You have to update this file and add cases for 's' and 'S' to save the state of thegame to a file.

Overview:

In this project we are going to be building a 2-player Air Hockey game on Khoury Linux server. Tosimplify the development of the game, we will be using the ncurses library rather than a pixelbased graphics library such as GTK. Ncurses is a character based graphics library that has beenused to develop command line utilities and tools such as editors.ncurses documentationTo get your project started, you have been provided with a template in the air_hockey folder.Below is a summary of the files that have been provided with the project.

Makefile: This file is used to build the executable air_hockey. The following is an example ofhow to build air_hockey.

$ make

g++ -c -o main.o main.cpp -I../include -g -O0

g++ -c -o slider.o slider.cpp -I../include -g -O0

g++ -c -o air_hockey.o air_hockey.cpp -I../include -g -O0

g++ -c -o zone.o zone.cpp -I../include -g -O0

g++ -c -o ball.o ball.cpp -I../include -g -O0

g++ -c -o key.o key.cpp -I../include -g -O0

g++ -o air_hockey main.o slider.o air_hockey.o zone.o ball.o key.o -I../include -g -O0 -ln

$

To remove the build files, you can do a "make clean". This will remove the executable and theassociate object files (*.o). This is useful prior to committing files to the repository because youtypically do not want to include generated files in the repo.

$ make clean

make clean

rm -f *~ core /*~

rm -f air-hockeyrm -f *.o

$

Building the Game

The game should be built following the below logical progression. You will start working onsmaller tasks that we call: 'get-to-know-the-code-base' before making bigger changes to thecodebase. Note: You do not need to submit different parts separately; please provide a single,

complete submission.

Part 1:

You should implement the code necessary to implement the following functionality.

Welcome screen

This is the starting screen in your game, on pressing t should start the game. On this screen,you have to provide an overview of the scoring system.

Moving the Players

Currently the slider (player) cannot move from the starting position, so you need to add playerontrols.he slider (player) should be able to move left, right, up and down.The arrow-keys should be used for moving the bottom slider around the zone in left, right,up and down directions.w,W, a/A, s/S and d/D keys should be used for moving the top slider around the zone in left,right, up and down directions.The slider may not cross the center line when striking the puck.The slider may only strike the puck when it is on its side of the centerline.The provided filename {key.cpp} file helps detect key presses.

Pausing the Game

The game is paused when P/p is pressed and resumes on another press.

Ending the Game

The game will end naturally when the time limit is reached (fixed to 2 minutes).Additionally, the game can be ended prematurely by pressing q or Q. In either case, thegame should terminate gracefully without causing a segmentation fault.Increase the slider size from 4 configurable up to 7.

Till Part 2, you see that the size of the slider is 4, now increase it upto 7.Prompt the user to input the size before the game starts.

Scoring the Game

Since it is a 2-player game only two mallets need to be placed on the AirHockey playingsurface.The puck needs to be struck with the mallet and the puck must fully drop in the goal area tobe counted as a goal. Rebounds or pucks that get stuck halfway in do not count as a point.Keep track of how much goals the users score.Print out a running score total at the top of the screen.

Game Over Screen:

The game over screen should be visible after the end of the game. *It should displayinformation such as points scored by both the players, winner and time taken to win.

Part 2:

You should implement the code necessary to implement the following functionality.

Implement win-lose scenario:

The game will consist of N rounds played in each level. The user should be able to enter thenumber of games N on the welcome screen.A player wins a set if they win the majority of the games in that set.The overall winner of the game will be the player who wins the majority of the levels

Save 10 best win scores:

*The information about 10 best scores should be stored in a file. Save them in

./saves/save_best_10.game Extensions don't matter in Unix, you'll be able to open the file at any

time in an editor.

Set up the goal area:

By default, the goal area is the entire top and bottom edge of the zone.If the player controlling the top slider is not able to defend the ball and it hits the top goalarea, then the opposite player scores a goal and vice-versa.In this step, you need to take the width of the goal area as an input from the user before thestart of the game. The width of the goal area should be less than the width of the zone.Different difficulty levels - Obstacles and Speeds The game starts with a ball that runs at a default low speed.As the player progresses through the levels, the speed of the ball should increase andobstacles should be added according to the Game levels description above.The obstacles can be placed at fixed positions or randomly within the game zone, but theymust not be placed on the walls.

Coloring the game

Add color to the game to make it more visually appealing. Use the ncurses library toimplement colors. Refer to the relevant section of the ncurses documentation for details onhow to use colors.

What to turn in.

Check your game into your assignment_3 branch. The TAs will checkout this branch, makethe code, and then run it to grade your work.Submit the link to the branch/commit similar to what you have done for other assignments.

Scoring (worth 135 points)

5 pts: Welcome screen (with Instructions to run)

10 pts: Move the first player with the arrow keys.

10 pts: Move the second player with the control keys.

15 pts: Keep track of the player's score.

10 pts: Speed of the ball with different difficulties levels.

3 pts: Press P/p to pause the game, must resume on another press

2 pts: Press Q/q at any time to quit the game.

5 pts: Set up the goal area

10 pts: Implement win-lose scenario.

15 pts: Save 10 best win scores.

5 pts: Game Over Screen.

5 pts Slider size change

20 pts Color the game

20 pts Add Obstructions in the game

Note: If your code does not compile and run on khoury server, your grade will start at 50%.

Please build and test in this environment.

标签:will,should,Project,slider,game,Hockey,branch,Air,pts
From: https://www.cnblogs.com/qq99515681/p/18243191

相关文章

  • Airsim-PX4-ROS仿真环境搭建
    AirSim项目地址:https://github.com/microsoft/AirSimAirSim官方教程:Home-AirSim(microsoft.github.io)CSDN参考教程:AirSim学习(1)安装UnrealEngine和AirSim视频教程:【AirSim】我有自己的无人机啦-bilibiliChrisLovett的讲解在自己的Windows上实现AirSim仿真......
  • mORMot and Open Source friends SynProject Tutorial (SynProject教程)
    mORMotandOpenSourcefriendsSynProjectTutorial--(SynProject教程)第一步本页介绍SynProject的一些典型用法。我们将为mORMot框架本身创建一个源代码存储库和相关的文档。您要求文档,我们将通过SynProject自动生成它!我们需要什么因此,我们在硬盘上的D:\Dev\Lib文件夹中......
  • HiPPO: Recurrent Memory with Optimal Polynomial Projections
    目录概Motivation代码GuA.,DaoT.,ErmonS.,RudraA.andReC.HiPPO:Recurrentmemorywithoptimalpolynomialprojections.NIPS,2021.概看下最近很火的Mamba的前身.本文其实主要介绍的是一个如何建模历史信息在正交基上的稀疏的变化情况.Motivation对于......
  • 逐梦航天!AIRIOT大学计划暑期训练营来啦!
    品质训练营助力“小白”,开启大神之路!AIRIOT大学计划暑期训练营等你来!“产业赋能,教育创新",为了促进物联网产业的纵深发展和创新,推进教育链、产业链与创新链的有机结合,提升理论、实践和创新能力,扩展学生视野,促进学生交流,为中国最有前途的物联网人才成长助力,航天科技AIRIOT大学计......
  • 30万奖金池鼓励工控人,AIRIOT智慧物联应用场景创新大赛等你来战!
    随着工业和智慧领域数智化发展步伐的逐步加快,智慧物联应用场景越来越广泛,涵盖了智慧城市、智能园区、智慧能源、智慧电力、智能制造、工业物联网等多个领域。航天科技控股集团股份有限公司举办【AIRIOT智慧物联应用场景创新大赛】,30万奖金池鼓励智慧项目应用场景创新与落地!邀请工......
  • Mac专用投屏工具:AirServer 7 for Mac 激活版下载
    AirServer7是一款在Windows和macOS平台上运行的强大的屏幕镜像和屏幕录制软件。它能够将iOS设备、Mac以及其他AirPlay、GoogleCast和Miracast兼容设备的屏幕镜像到电脑上,并支持高质量的录制功能。总的来说,AirServer7是一款功能全面的屏幕镜像和录制工具,非......
  • [USACO17OPEN] Paired Up S
    --------------------------------------------------------------------------------------------------------------------------------- 题目描述有M(M为偶数)头奶牛,每头奶牛有一个产奶量,将这些奶牛两两配对,每对奶牛的产奶的时间为两头奶牛产奶量的总和。现在这M/2对奶牛......
  • Airgorah:一款功能强大的WiFi安全审计工具
    关于AirgorahAirgorah是一款功能强大的WiFi安全审计工具,该工具可以轻松发现和识别连接到无线接入点的客户端,并对特定的客户端执行身份验证攻击测试,捕捉WPA握手包,并尝试破解接入点的密码。在该工具的帮助下,广大研究人员可以对无线接入点和客户端的安全性进行检测和验证。该......
  • 关于使用 conda create -n blog_project 创建项目的时候报错问题
    大致报错如下:Traceback(mostrecentcalllast):File"E:\ProgramData\anaconda3\Lib\site-packages\conda\exception_handler.py",line17,in__call__returnfunc(*args,**kwargs)^^^^^^^^^^^^^^^^^^^^^File&......
  • MongoDB CRUD操作:投影Project详解
    MongoDBCRUD操作:投影Project详解文章目录MongoDBCRUD操作:投影Project详解返回文档的全部字段返回指定的字段和_id字段不输出_id字段指定排除的字段返回内嵌文档中的指定字段禁止内嵌文档中的特定字段数组中内嵌文档的投影聚合表达式的投影字段默认情况下,MongoDB查......