adspace
You're developing a boss encounter in a 3D platformer game, and the boss has 15 different attacks. The game designers have asked you to make sure that the player sees as many of those 15 attacks as possible during the encounter, and that he seldom or never sees the same attack twice in a row. What are some ways you can do this? What does the attack selection algorithm look like in this case? Keep in mind that not all attacks are possible all the time -- for example, the boss has a melee attack that he can only do when the player is very close, and a bombardment attack he can only do when the player is far away.
Answer Posted / Vijay Saxena
The attack selection algorithm could be implemented using a priority queue or a weighted random selection. Here's an example of how it might look:
1. Initialize a list with all 15 attacks, each marked as 'unused'.
2. When the boss is about to perform an attack, select the next one from the list. If the list is empty, start again from step 1.
3. Mark the selected attack as 'used'.
4. If the player's position meets the conditions for the selected attack (e.g., close for melee, far for bombardment), perform the attack. Otherwise, choose a new attack from the list.
5. After a certain number of attacks have been used (let's say 10), shuffle the list to increase the chances of previously 'unused' attacks being selected.
6. If the boss has a cooldown period for each attack, wait until the cooldown is over before marking the attack as 'unused' again.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Given a circuit, draw its exact timing response?
How many concurrent programs you have customized, can you name some of them?
Hi, Need a interview question and answer for different company's please revert me soon Yash
Does any one have SAP basis B1 Resume format for 4 to 5 year experience? if any one have please send me on kishorekharche@gmail.com
Explain the types of operations? Draw the figure for shift and rotate operations?
sir,please send me the NIC exam questions
How much is the wordpress business plan?
where do you want to see yourself after 5 years?
How to set property in apache tajo?
How to Determine the last access time of a given file ?
How do I start sql server 2017?
Have you heard about SEZ's? Tell something about it.
What is rollup component?
why do you want to join nabard?
What does the yield curve look like now?