联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> C/C++编程C/C++编程

日期:2021-06-14 05:53

5CCGD003W: 3D Graphics Programming

Coursework 1 – 2D Game (2020/21)

Module leader Dr Anastassia Angelopoulou

Unit Coursework 1 – REFERRED/DEFERRED

Weighting: 40%

Qualifying mark 30%

Description 2D Game or GUI application

Learning Outcomes

Covered in this

Assignment:

This assignment contributes towards the following Learning

Outcomes (LOs):

? LO1 Use appropriate data structures for storing vertices,

faces and edges that define the shape of objects and

manipulate such objects by applying different

transformations;

? LO2 Be able to design and implement 2D real-time

scenes that respond to user interaction;

? LO5 Be able to critically assess the current problems and

appreciate some of solutions available through practical

exercises and demonstrate knowledge and appreciation

of some research related issues in computer graphics;

? LO6 Communicate and present ideas by oral, visual and

written means

Handed Out: 09/06/2021

Due Date 06/07/2021 at 13:00

Expected deliverables cpp file(s)

Method of

Submission:

Electronic submission on BB

Type of Feedback and

Due Date:

Formative feedback will be provided during tutorial sessions.

Verbal feedback on the submitted CW will be provided during

the CW presentation/viva. Students are encouraged to record

this feedback at this time.

Note: All marks will remain provisional until formally agreed by

an Assessment Board.

3D Graphics Programming - Coursework One - Referred/Deferred 5CCGD003W

2 @Dr Anastassia Angelopoulou

Assessment regulations

Refer to Student Handbook guide for undergraduate students for a clarification of

how you are assessed, penalties and late submissions, what constitutes plagiarism

etc.

Penalty for Late Submission

If you submit your coursework late but within 24 hours or one working day of the

specified deadline, 10 marks will be deducted from the final mark, as a penalty for

late submission, except for work which obtains a mark in the range 40 – 49%, in

which case the mark will be capped at the pass mark (40%). If you submit your

coursework more than 24 hours or more than one working day after the specified

deadline you will be given a mark of zero for the work in question unless a claim of

Mitigating Circumstances has been submitted and accepted as valid.

It is recognised that on occasion, illness or a personal crisis can mean that you fail to

submit a piece of work on time. In such cases you must inform the Campus Office in

writing on a mitigating circumstances form, giving the reason for your late or nonsubmission.

You must provide relevant documentary evidence with the form. This

information will be reported to the relevant Assessment Board that will decide

whether the mark of zero shall stand. For more detailed information regarding

University Assessment Regulations, please refer to the following

website:

BCS Criteria meeting in

this assignment:

2.1.1 Knowledge and understanding of facts, concepts, principles

& theories

2.1.5 Deploy theory in design, implementation and evaluation of

systems

2.1.8 Knowledge of management techniques to achieve

objectives

2.2.1 Specify, design or construct computer-based systems

2.2.4 Deploy tools effectively

2.3.2 Development of general transferable skills

4.1.2 Knowledge and understanding of mathematical and

statistical principles

4.1.3 Knowledge and understanding of computational modelling

4.2.1 Specify, deploy, verify and maintain computer-based

systems

3D Graphics Programming - Coursework One - Referred/Deferred 5CCGD003W

3 @Dr Anastassia Angelopoulou

Coursework One

Notes:

1) In order to pass the referred coursework significant improvements over any

previously submitted version must be demonstrated.

2) You MUST attend a viva – this is part of the assessment. No viva – MAXIMUM

mark of 30%

3) For referred cws only, in the viva you need to explain the improvements you

have made to previous submitted versions.

This coursework is worth 40% of the total module mark.

Please read carefully and read all sections. Raise any issues about this coursework

early with your lecturer/tutor. Also see additional support code on the Blackboard

site for the module under Assessment.

Learning Outcomes:

1. Creation of 2D graphics and the orthographic projection

2. Creating objects from primitives

3. Transformations

4. Correct use of GLUT and OpenGL libraries

5. Writing understandable code

6. User interaction

7. Simple Collision Detection

Description

You are to build either a simple 2D game in OpenGL by using the Freeglut library,

already provided to you in the first tutorial or a simple 2D drawing canvas with a title.

You should choose ONLY ONE scenario to implement. It is entirely up to you which

of the two you choose. Both of them carry equal marks.

Note::: You also need to upload a video link where you will explain the CW and the

code. The video link should cover the marking scheme criteria and you should

explain all different parts of the code, for example, collisions, mouse or keyobard

interaction, etc. Please keep the video short and not more than 5min.

Game Scenario

The game is loosely based on the classic 80s games.

A mock-up of the 2D Car game screen is shown in figures 1 and 2.

3D Graphics Programming - Coursework One - Referred/Deferred 5CCGD003W

4 @Dr Anastassia Angelopoulou

Figure 1: A simple car with obstacles placed on the screen and a score panel

Figure 2: A detailed diagram of the different features

The game scenario consists of a racing car that needs to navigate through a simple

track as shown above. The car must avoid the hazards (5 randomly placed square

blocks) and exit at the green gate.

The car waits at the red gate until the user presses an arrow key to move the car.

The car shall turn/rotate to the appropriate orientation depending on which key will

be pressed next. The user moves the car around the hazards and out of the green

gate. Once the car has reached the green gate the game ends. If the car collides with

a square then 10 points are deducted from the score. The score starts from 50. A

successful game will lead to the award of 50 points (if no hazards are hit). Once the

car has exited the green gate the hazard blocks should re-spawn in different

positions (but not in contact with each other or on top of the car at the start gate).

The score shall accumulate until the application is closed.

3D Graphics Programming - Coursework One - Referred/Deferred 5CCGD003W

5 @Dr Anastassia Angelopoulou

Technical Details

The screen consists of several objects:

a) The car (controlled by left/right/up/down arrow keys or any other game

related keys such as A/D from the WASD keys)

b) The obstacles

c) The play area (white grid) and the 2 gates

d) The score panel

e) The pop-up menu

f) Some information about user interaction from the console

Notes: All the shapes in the figure are built from simple primitives and you are free

to copy this design without penalty.

User Requirements

R1: If the 'left key' is pressed the car moves left

R2: If the 'right key' is pressed the car moves right

R3: If the 'up key' is pressed the car moves up

R4: If the 'down key' is pressed the car moves down

R5: If the 'R key' is pressed the car turn/rotates to the appropriate orientation

R6: Right click to bring up a pop-up menu with options

Software Requirements

R7: By default, the application should load and show the car, the obstacles, the score

panel, the play area, and the two gates

R8: Objects shall be redrawn randomly for every new set of obstacles

R9: Every time an obstacle is hit the score reduces by 10 points.

2D drawing canvas scenario

You are to build a simple 2D drawing canvas with a title. The tool should have two

menus one on the left and one on the top from where you can choose primitives or

shapes to draw on the canvas. The shapes are in the form of non-filled and filled

polygons (see menus on left and right). See figure 3 below.

3D Graphics Programming - Coursework One - Referred/Deferred 5CCGD003W

6 @Dr Anastassia Angelopoulou

Figure 3: A simple drawing

The figure shows the menus, a highlighted primitive, in this case a line, (e.g., left

menu) a simple drawing in the middle of the canvas and text at the bottom of the

screen. You should be able to draw lines by clicking on a starting and an ending point

in the canvas. Appendix A shows some starting code. Figure 1 shows two versions;

one with grid and one without a grid. You should be able to turn the grid on and off

with the help of a pop-up menu as can be seen on the right version.

Animation in the Pop-up menu

The pop-up menu has 3 options. To turn the grid on and off and to start an

Animation. The Animation is a polygon shaped filled field (Figure 4) that drifts from

bottom to top with new shapes appearing from the bottom as the old shapes

disappear. Not all shapes have the same speed. Appendix B shows some starting

code. Some shapes move faster than others. The shapes should be drawn by using

polygons with fill polygon mode. Note:: You should use blended colours to give the

impression of texture on the polygonal shapes.

Figure 4: An animated filled-polygon field that drifts from bottom to top.

3D Graphics Programming - Coursework One - Referred/Deferred 5CCGD003W

7 @Dr Anastassia Angelopoulou

Controls

You should clear all the drawings from the canvas by pressing the space bar and exit

the application by pressing the escape key. You should also clear specific primitives

by pressing the relevant key. Finally, you should be able to use the special keys, up,

down, left and right to move the shapes. Basic collision between shapes and the

bars should be applied. There is no collision between the shapes. Shapes can overlap

each other.

Technical Details

An Orthographic projection should be used and the canvas consists of several

elements:

a) A title

b) Two menu bars with primitives

c) Inactive areas within the bars

d) Pop-up menu where the user can turn on and off the grid

e) Moving polygon shaped filled field

f) A grid with dashed polylines

g) A highlighted area when the selected primitive or shape is clicked on

h) Key control to clear off all the drawings and quit the application

i) Key control to clear specific group of primitives e.g. all lines, all circles, etc.

j) Some information about user interaction from the console (see figure below)

Figure 4: Output and instructions on the console

Notes: All the shapes in the figure are built from simple primitives and you are free

to copy this design without penalty.

User Requirements

R1: If the 'l' key is pressed all lines should be cleared from the canvas

R2: If the 't' key is pressed all triangles should be cleared from the canvas

R3: If the 'p' key is pressed all points should be cleared from the canvas

R4: If the 'c' key is pressed all circles should be cleared from the canvas

R5: If the 'r' key is pressed all rectangles should be cleared from the canvas

R6: If the 'escape' key is pressed the application should quit

R7: If the 'space bar' is pressed the canvas is cleared

R8: If the special keys are pressed the primitives can be moved

3D Graphics Programming - Coursework One - Referred/Deferred 5CCGD003W

8 @Dr Anastassia Angelopoulou

R9: Left click to select shapes from the menus

R10: Left click on the drawing area to draw

R11: Right click to bring up a pop-up menu

Software Requirements

R12: By default, the application should load and show the two menu bars, a title and

the grid on

R13: Objects shall be drawn inside the canvas

R14: The titles and labels shall accurately reflect the application.

R15: The Animation should stop when other options from the pop-up menu are

selected

Important Notes:

Make sure you attempt all of the above.

Create C/C++ functions that are sensibly named such as: drawAsteroids(…),

drawObstacles(…), drawSpaceship(…), asteroidCollision(…) , drawHit (..),

createMenu(…), etc.

You can also use C++ classes if you know how to.

Note even if you achieve a requirement you may not get full marks if it is

perceived by the marker that a better solution was possible.

All work is marked in a viva (THE VIVA IS COMPULSORY) and the marker’s

academic judgment is final and cannot be questioned.

Note that the maximum mark for work marked without a

viva/demonstration will be 30%.

Please comment your code extensively and put the author of any code that

is not your own in the comments above the code section. Note you may lose

marks for uncommented code.

ABSOLUTELY DO NOT COPY A SOLUTION TO THIS FROM THE INTERNET.

Please submit your code via Blackboard by 1PM on the due date.

-----------------

TIPS:

Design your application before coding.

3D Graphics Programming - Coursework One - Referred/Deferred 5CCGD003W

9 @Dr Anastassia Angelopoulou

Mark Breakdown and Guidelines – note this will be marked using a

Blackboard rubric during a compulsory viva

Note::: Not full marks will be given per section, even if the components have been

fully implemented, if the student cannot explain satisfactorily the code to the tutor.

Game

GLUT set up and console output?- 7%

Not done -

0%

Some code –

not working

max 1%

Works but

not correctly

or has other

major defect

such as no

console

output

max 3%

Minor

inconsistency or

defect (single

buffer leading to

poor redraw

etc.)

max 5%

All correct –

sensibly names

call backs

/projection

correct

max 7%

Comment:

Car model and navigation control – model and rotation code (15% for model

primitives and 15% for rotation code and user controls - e.g. rotation, move of the

car left/right/up/down) - 30%

Not done -

0%

Some code,

partially

working

max 9%

Works but

not correctly

or has other

major defect

(no user

control for

rotation of

the car)

max 18%

Working but

minor

inconsistency

or defect

(such as not

well coded,

jerky motion)

max 24%

Works correctly no

jerky movement,

good model and

smooth movement

of the car and

rotation to the

correct direction

max 30%

Comment:

Collision code for Obstacles and re-spawning (5% for the model and 20% for

random or predetermined redraw code with working collision detection) – 25%

3D Graphics Programming - Coursework One - Referred/Deferred 5CCGD003W

10 @Dr Anastassia Angelopoulou

Not done -

0%

Some code,

partially

working, no

collisions

max 5%

Static only or

major defect

such as no

redraw or car

collision is

not working

properly

max 12%

Some minor

inconsistency

or defect or

not randomly

generated

redraws

max 19%

Works as required

with no issues

max 25%

Comment:

Play area and Gates?- 5%

Not done -

0%

Some code –

not working

max 1%

Works but

not correctly

or has other

major defect

such as no

play area

defined

max 3%

Minor

inconsistency or

defect, such as

same colour for

the gates

max 4%

All correct –

max 5%

Comment:

Mouse interaction for the pop-up menu (e.g. grid and pattern code) -11%

Not done -

0%

Some code,

partially

working such

as static

pattern when

the screen

loads

max 4%

Works but

not correctly

or has other

major defect

such as only

one option to

click

max 6%

Minor issues –

mostly works

but has minor

issues (e.g.

the pattern

and grid only

change once)

max 8%

All correct –

efficient code –

easy to extend.

max 11%

Comment:

3D Graphics Programming - Coursework One - Referred/Deferred 5CCGD003W

11 @Dr Anastassia Angelopoulou

Working Score panel – 12%

Not done -

0%

Some code,

partially

working or

only static

text

max 4%

Works but

not correctly

or has other

major defect

max 6%

Working but

minor

inconsistency

or defect, for

example,

points are not

deducted

from the

game

max 8%

Works as required

with no issues

max 12%

Comment:

Explanation of code/Computer Graphics principles in the viva -10%

Very poor or

no

understanding

(would

probably fail

the

coursework)

0%

Weak

understanding

– cannot

explain code

though still

has some

knowledge.

Code is

unclear and

difficult to

understand

max 3%

Some major

gaps in

knowledge.

No

comments in

the code

max 5%

Some minor

weakness in

knowledge –

need to revise

some points.

Names in the

variable not

appropriate

or difficult to

understand

max 7%

Good

understanding –

can answer all

questions and

understands all

code.

max 10%

Comment: Tutor should point out areas that the

student should revise or strengthen their

knowledge of (if required).

3D Graphics Programming - Coursework One - Referred/Deferred 5CCGD003W

12 @Dr Anastassia Angelopoulou

Mark Breakdown and Guidelines

2D Drawing Canvas

GLUT set up, console output and Title?- 7%

Not done -

0%

Some code –

not working

max 2%

Works but

not correctly

or has other

major defect

such as no

console

output or

Title

max 4%

Minor

inconsistency or

defect (single

buffer leading to

poor redraw

etc.)

max 5%

All correct –

sensibly names

call backs

/projection

correct

max 7%

Comment:

Visualisation code of the grid data?- 8%

Not done -

0%

Some code,

partially

working

max 2%

Works but

not correctly

or has other

major defect

- only vertical

or horizontal

lines

max 5%

Minor issues –

straight lines

used instead

of dashed

polylines

max 7%

Complete and

correct.

max 8%

Comment:

Visualisation code of the canvas? - 25%

Not done -

0%

Some code,

partially

working

(only drawing

of objects)

max 7%

Works but

not correct.

Or has other

major defect

(only one

menu bar, no

inactive

areas)

Minor defect.

Mostly correct

with minor

issues such as

no highlighted

primitives

max 20%

Complete and

correct.

max 25%

3D Graphics Programming - Coursework One - Referred/Deferred 5CCGD003W

13 @Dr Anastassia Angelopoulou

max 13%

Comment:

Drawing on the canvas? - 20%

Not done -

0%

Some code,

partially

working

(drawing only

a single line

or point)

max 5%

Works but

not correct.

Or has other

major defect

(drawing

starts always

from the

centre or can

draw only in

one area)

max 10%

Minor defect.

Mostly correct

with minor

issues such as

drawing goes

over the

inactive areas

of the menu

bars

max 15%

Complete and

correct.

max 20%

Comment:

Animation? - 13%

Not done -

0%

Some code,

partially

working

(only static

polygon field)

max 5%

Works but

not correct.

Or has other

major defect

(covers the

whole canvas

area, drifts

from bottom

to top only

once)

max 8%

Minor defect.

Mostly correct

with minor

issues such as

no colour

blending of

the shapes

max 11%

Complete and

correct.

max 13%

Comment:

Mouse interaction for the menu bars and the pop-up menu -8%

Not done -

0%

Some code,

partially

working

(no pop-up

menu but

Major defect

(pop-up

menu with

only 1 option

no mouse

Minor issues –

mostly works

but has minor

issues.

max 6%

All correct –

efficient code –

easy to extend.

max 8%

3D Graphics Programming - Coursework One - Referred/Deferred 5CCGD003W

14 @Dr Anastassia Angelopoulou

some mouse

clicks)

max 2%

control in the

drawing

area)

max 4%

Comment:

Key controls and Collision with the bars -9%

Not done -

0%

Some code –

not working

max 2%

Works but

not correctly

or has other

major defect

– wrong keys

assigned/only

partially

working, no

collision with

the bar

max 5%

Minor

inconsistency

or defect

max 7%

All correct and

work

max 9%

Comment:

Explanation of code and good writing of code -10%

Very poor or

no

understanding

(would

probably fail

the

coursework)

0%

Weak

understanding

– cannot

explain code

though still

has some

knowledge.

Code is

unclear and

difficult to

understand

max 3%

Some major

gaps in

knowledge.

No

comments in

the code

max 5%

Some minor

weakness in

knowledge –

need to revise

some points.

Names in the

variable not

appropriate

or difficult to

understand

max 7%

Good

understanding –

can answer all

questions and

understands all

code.

max 10%

Comment: Tutor should point out areas that the

student should revise or strengthen their

knowledge of (if required).

3D Graphics Programming - Coursework One - Referred/Deferred 5CCGD003W

15 @Dr Anastassia Angelopoulou

Appendix A

This is an example of a line class to be able to draw a line. You can follow

similar concept for other shapes such as triangles and rectangles.

// Line class

class Line

{

public:

Line(int x1Val, int y1Val, int x2Val, int y2Val)

{

x1 = x1Val; y1 = y1Val; x2 = x2Val; y2 = y2Val;

}

void drawLine();

private:

int x1, y1, x2, y2; // x and y co-ordinates of

endpoints.

};

3D Graphics Programming - Coursework One - Referred/Deferred 5CCGD003W

16 @Dr Anastassia Angelopoulou

Appendix B

For example, you can use structures to store the data for the shapes.

//structure for the animated shapes

struct Shapes {

GLfloat x, y;

GLfloat vx, vy;

};

//the randomised function assigns different numbers to the

coordinates and their velocity. this helps with the

different speed to the shapes

for (i = 0; i < num_shapes; i++)

{

shapes[i].x = rand() % weidth ;

shapes[i].y = rand() % height ;

shapes[i].vx = (rand() / (float)RAND_MAX) * 3;

shapes[i].vy = (rand() / (float)RAND_MAX) * 5;

}


版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp