Your game has gone out for testing and the unanimous response from testers
Ask Expert

Be Prepared For The Toughest Questions

Practice Problems

Your game has gone out for testing and the unanimous response from testers

Your game has gone out for testing and the unanimous response from testers was that the game was sluggish. The testers have suggested the following alternative model:

Handling of user input and re-drawing the screen should be decoupled.

We should keep the screen re-draw rate at 50 times per second.

User input should be checked more often (every 15 milliseconds).

To do this we've placed the screen drawing into a separate Thread.

The testers have also suggested that each Actor should also run in a separate Thread.

Note: the key points that you will be assessed on with the new gameplay are that you've used Threads for your Actors, and that your code is thread-safe.

Tasks

Make a change so that each Actor now runs in a separate Thread.

Examine the code, identify, and describe any thread-safety issues you have found.

Modify the program to make it thread-safe

Add a new, creative feature or implement some bug fixes.

Hint
Computer"Making each Actor run in a separate Thread:To make each Actor run in a separate Thread, we need to modify the Actor class to implement the Runnable interface, and move the existing game loop from the GamePanel class to the Actor class. We can then start a new Thread for each Actor in the GamePanel class, and call the start() method on the Thread object.Here's an example of how the modifie...

Know the process

Students succeed in their courses by connecting and communicating with
an expert until they receive help on their questions

1
img

Submit Question

Post project within your desired price and deadline.

2
img

Tutor Is Assigned

A quality expert with the ability to solve your project will be assigned.

3
img

Receive Help

Check order history for updates. An email as a notification will be sent.

img
Unable to find what you’re looking for?

Consult our trusted tutors.

Developed by Versioning Solutions.