A plan for killing and ancillary rewards

Source: Internet
Author: User

In multiplayer, the allocation of rewards is also a very important design.

For example, multiple individuals attack an NPC, and when the NPC is killed, it gives a reward to each player involved in the attack. Will show kills, assists and so on.

Okay, here's the question, how do we calculate the credit?

The general design is that the last knife for the winner, the most rewarding. All involved in the attack are assists.

However, this design is not fair, for example, "grab the head", is a player to play with the strength of the suckling for half a day, see to extremely easy, suddenly killed a bite gold, a knife ended the final battle.

Worked hard but got an assist in the name of the head.

And many people assists in the case, all give the same reward, is unfair.

It is fair to reward the player by calculating the total number of attacks and total damage to the NPC.

Because different players have different properties, the number of attacks is not equal to the attack damage. The number of attacks is designed for "elbow grease" players to give corresponding rewards.

This is the design of the idea, followed by the implementation of the scheme. This is very simple, I call it, the injustice has a head, the debt has the Lord.

Use the queue to save the data in units of the attacking NPC, each time it is injured, the number of attackers, times, and the damage value. When the NPC dies, it starts counting the people who are involved in killing the NPC.

What if head! is calculated? Head!, or the last, is sorted by queue, simply by placing the last attacker at the end of the queue. The last attacker is the head!.

How to count the helpers? Traverse the queue.

How to reward? By calculating the damage value, the damage value is the same, and the number of attacks is sorted by attack.

The pseudo code is as follows:

Structure:

person{count, Damage,att}

npc{list< person;}

Void Attack () {

person.count++;

Person.damage+=att;

If (! List.cons (person)) {

List.add (person);

}

Sort (List);

}

Void Getbigrew () {

Return List.getlast ();

}

Void Countreward () {

Sort by attack count and damage value

List.sortif (person.cout);

List.sortif (Person.damage);

}

Void getpersons () {

Return List;

}

OK, so that the simple code is enough to reward. While it may seem fun to grab a head, a fair battle reward is also a plan to motivate players to play. And it's not so hard to implement in code.

A plan for killing and ancillary rewards

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.