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


Please Help Members By Posting Answers For Below Questions

Given a circuit, draw its exact timing response?

3793


How many concurrent programs you have customized, can you name some of them?

44


Hi, Need a interview question and answer for different company's please revert me soon Yash

2463


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

1500


Explain the types of operations? Draw the figure for shift and rotate operations?

3424


sir,please send me the NIC exam questions

2084


How much is the wordpress business plan?

211


where do you want to see yourself after 5 years?

1112


How to set property in apache tajo?

40


How to Determine the last access time of a given file ?

1843


How do I start sql server 2017?

1023


Have you heard about SEZ's? Tell something about it.

1230


What is rollup component?

1354


why do you want to join nabard?

1606


What does the yield curve look like now?

1153