代写辅导接单-CSC 481/581 Fall 22 Homework 4 Due: 11/14/22 by the start of class

欢迎使用51辅导,51作业君孵化低价透明的学长辅导平台,服务保持优质,平均费用压低50%以上! 51fudao.top

Overview

CSC 481/581 Fall 22 Homework 4 Due: 11/14/22 by the start of class

Your task for this assignment is to add an event system to your game engine. As with previous assignments, you will be using your existing engine code to add additional functionality. You will submit your code and a writeup of your results, including screenshots where appropriate. This is an individual assignment, you are to work alone. As always, you are expected to abide by the University’s Academic Integrity Policy (http://policies.ncsu.edu/policy/pol-11-35-01), which includes providing appropriate attribution for all external sources of information consulted while working on this assignment.

There are 125 points available on this assignment. Students enrolled in 481 are required to complete Parts 1 & 2 and the writeup, but may also choose to complete Part 3. Students enrolled in 481 earning scores above 100 will receive a 100 on the assignment. Students enrolled in 581 are required to complete all parts (1–3) and the writeup, and will receive a grade as the percentage of the 125 points they earn. All students are required to submit the writeup addressing the sections of the assignment they have completed.

Part 1: Event Management System (35 Pts)

For this part of the assignment, you are tasked with adding an event management system to your game engine. You must queue events, and must allow different priorities for events (at the minimum a timestamp). In order to make your priority system work, you will also need to keep track of game time and time stamp all of your events accordingly (i.e., you will need a functioning timeline implementation). You must provide solutions to the four design decisions of event management:

1. Event Representation 2. Event Registration

3. Event Raising

4. Event Handling

You will need to write an event manager class to keep track of which engine systems or game objects are registered to receive events of arbitrary types (registration), receive events after they have occurred (raising), and dispatch those events to the appropriate objects or subsystems at the appropriate time (handling). You must make use of your Timeline class in event management for creating timestamps for event priorities and for determining which events to be handles form the priority queue.

To demonstrate your event management system, create at least four types of events: character collision, character death, character spawn, and user input. Reimplement each of those functions of your game from Assignment 3 using your EventManager (you may not use sf::Event in lieu of your own event representation and associated functions).

Depending on your design choices for HW3, you may wish to implement an EventHandler as part of your runtime object model (this is a suggestion, not a requirement). Some questions to think about for your writeup: How and why did you implement and represent events? What changes to your design did you need to make to accomplish this? How does your design promote reuse and extensibility?

1

 

Part 2: Networked Event Management (35 Pts)

Your task for this part of the assignment is to ensure your event handling can occur in a networked client- server environment. There are two basic approaches:

1. Server-centric: In this design, event registration, event queuing, and the scheduling of event handling should be done on the server. Events can be raised anywhere (server or any client), but should be handled on the server, and clients’ states should be updated based on the results.

2. Distributed: In this design, both the clients and the server are to implement all features of event handling (registration, queuing, and scheduling handling). In this scenario, any machine (server or clients) can raise events that are sent (possibly via the server) to all other machines to be handled.

Note: These are two extremes on the design spectrum of networked event handling—you need not limit yourself to selecting exactly one of these options.

Take care to ensure that your events are either Serializable or can be shared across the network in some way (e.g., packing pertinent data in a json string). Note: this requirement does not mean that your event objects (should you choose to use objects) must be able to be sent over the network; it is perfectly acceptable to use any protocol of your choosing provided the event information can be re-constructed by the receiving process.

You must demonstrate at least one example of events being sent across the network. These may be one or more of the four events types you’ve implemented for Part 1, but may be new events you create specifically for networked use as well. Put some thought into the interaction between your network architecture and your event management systems. In particular, if an event occurs on the client, where does it get queued and handled? For some ides to seed your planning, read ahead to Part 3 of this assignment (especially if you’re enrolled in CSC 581).

Note: Completing Part 2 with at least the four required events types from Part 1 will sufficiently demon- strate Part 1 as well—there is no need to submit separate versions of your code for Parts 1 and 2.

Part 3: Replays (581 required, 481 optional; 25 Pts)

Your next task is to use your event system and timeline capabilities to implement a replay system. You should be able to press a button while controlling a client to begin recording a replay, another button to terminate recording. Playback of the recording may begin immediately or upon an additional input.

The starting and stopping of recordings must be handled as events (i.e., there are at least two additional event types required for this part of the assignment). When the replay is done, the client state should return to where it was prior to the replay playback and the engine should continue. Replays need only be displayed on the client used to record them, although all other clients’ characters and movements should be shown in the replay.

To further simplify things, it is not necessary for character or object movement to pause on all clients during a replay on one client. Further, the character controlled by the client displaying the replay can remain in a fixed location on other clients.

Hint: it may be advantageous to refactor your code so all movement (either from characters of other moving objects) generates an event, which may require you create yet another event type.

If your event management system is implemented with the appropriate flexibility, you should be able to record events in a log file or memory buffer and replay the list of events by raising events according to the correct (local) timeline. Here are a few things to consider:

• It may be advantageous to support “wildcard” registration in your event manager, so, for example, your replay system can register to be notified of every event.

  2

 

• You will need to take care to ensure that the initial state of your replay is dealt with appropriately, perhaps by teleporting characters and objects on the screen (which could also be events!).

• You will also need to make sure that you timestamp events appropriately, so that you can control the timing of their replay.

Pay close attention to how you represent time. If you are successful at these tasks, your event management system should “handle” the rest and replays should require little more effort than teleporting objects, reading the log of events, and raising them at the appropriate time.

Note: You will definitely need to be careful about event chains, where handling of an event triggers another. In those cases, the replay event and the event raised due to chaining may conflict. That’s a boundary case you need to design for explicitly. You may find an explicit “age” in your event representation useful for this application.

Some questions to ponder for your writeup: Were you successful at leveraging your event system for replays simply, or did it require a lot of work? What changes to your design did you have to make to get it working?

Writeup (30 Pts)

Now that you have designed and implemented a number of engine components, write a 2-–3 page paper summarizing your design. That is a minimum of 2 FULL single-spaced pages. It is strongly suggested that you do not limit yourself to only answering the questions posed in this assignment. Think creatively about what you have done. Why did you make the design decisions you made? What did they enable for this assignment? What will they enable in the future? The most successful writeups will contain evidence that you have thought deeply about these decisions and implementations and what they can produce and have gone beyond what is written in the assignment.

As an appendix to your paper, please include all relevant screenshots to support your discussion. The appendix does not count toward your 2—3 page requirement.

What to Submit

By the start of class on 11/14/22, please upload to moodle a .zip file containing your code, a compiled executable of your system, a README file with compilation and run instructions, and a .pdf of your writeup. Please make sure your README not only addresses how to run your game, but also how to play it (i.e., what buttons to press to move the character, change a replay speed, etc.).

3

 

 

51作业君

Email:51zuoyejun

@gmail.com

添加客服微信: abby12468