Introduction to MMORPG Development (I): Task System Design

Source: Internet
Author: User
Recently I have been thinking about the design of MMORPG's task system. The following are the design goals: 1. Task logic and Program The logic is completely separated; 2. After the server-side program and client program provide limited functions, the script programmer can complete the task writing; 3. The task must be updated conveniently. Of course, the specific implementation of the task system is greatly affected by the Planning case. Here I just want a general implementation solution: <Scenario Editing>: The scenario data files and tasks are mainly related to npc and investigation triggers (for example, investigating a stone tablet ). When a player talks to an NPC or investigates an item, a specific task needs to be started. Tasks that can be enabled for an object and the conditions for enabling the task must be edited to the scenario data file in advance. Task conditions can also be written to the task script file. <Server>: 1. Each role can have up to n task bodies (20 for wow). The task body should include the task name or number and several task variables (for use by task scripts, number depends on planning, but not too many); 2. Each task stores a script file. When a specific event occurs in the game, you should first query the scenario data to see if a new task is enabled, and then notify the scripts of the existing task one by one, each task script executes its own independent task logic. For example, the script file quest_001.script is as follows:
Ontalknpc (string npcid)
{
If (npcid = "James ")
{
If (getquestvar (0)> = 10 )// Enough
{
Showdlg (" You killed 10 Tigers so quickly? Very powerful !");
Incplayexp (1250 );// Experience rewards
}
Else
Showdlg (" Hi !"); // Send a command to the client to display the dialog box
}
}
Onkillmonster (INT monsterid)
{
If (monsterid = 1000123 )// Is the monster specified by the task
{
Incquestvar (0 );// Modify task Variables
}
} 3. Because most tasks can only be executed once, the server also needs to record the tasks completed by this role. <Client>:
    1. You can query which tasks may be enabled for objects in the field of view, and give some prompts if the player meets the conditions, for example, placing an exclamation mark on the top of the head;
    2. Send a notification to the server when the player is talking to the NPC or investigating an item;
    3. Receives messages from the server and updates the display information of the task.
Take a typical task as an example: when a player talks with James to trigger the task, killing ten tigers, and returning to the task can get 1250 points of experience.

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.