CN101239240A - Control method of non-player role - Google Patents

Control method of non-player role Download PDF

Info

Publication number
CN101239240A
CN101239240A CNA2007100372536A CN200710037253A CN101239240A CN 101239240 A CN101239240 A CN 101239240A CN A2007100372536 A CNA2007100372536 A CN A2007100372536A CN 200710037253 A CN200710037253 A CN 200710037253A CN 101239240 A CN101239240 A CN 101239240A
Authority
CN
China
Prior art keywords
shadow
role
player
player role
control method
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CNA2007100372536A
Other languages
Chinese (zh)
Other versions
CN101239240B (en
Inventor
章霁诚
袁飞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
SHENGQU INFORMATION TECHNOLOGY (SHANGHAI) Co Ltd
Shengqu Information Tech
Original Assignee
SHENGQU INFORMATION TECHNOLOGY (SHANGHAI) Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by SHENGQU INFORMATION TECHNOLOGY (SHANGHAI) Co Ltd filed Critical SHENGQU INFORMATION TECHNOLOGY (SHANGHAI) Co Ltd
Priority to CN2007100372536A priority Critical patent/CN101239240B/en
Publication of CN101239240A publication Critical patent/CN101239240A/en
Application granted granted Critical
Publication of CN101239240B publication Critical patent/CN101239240B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Processing Or Creating Images (AREA)

Abstract

The present invention provides a control method of non-player character, controlling non-player character by shadow mode, including following steps: (1)establishing a data organization for storage shadow information; (2) adding shadow information; (3) moving shadow, storage the moving track of each shadow, and judging the moving track of the shadow in a next time whether the moving track of the shadow is the moving track of the last shadow or not, if yes, the moving track of the last shadow or player character is changed into the after shadow after moving in the fixed distance; (4) attacking, attacked and disappearing shadow. The control method not only wholly controls the action of the non-player character, but also easily operates, simplifies fussy operating steps.

Description

A kind of control method of non-player role
Technical field
The present invention relates to a kind of control method of computer program, relate in particular to a kind of control method of non-player role.
Background technology
Non-player role (None Player Character is hereinafter to be referred as NPC) refers in particular in video-game or the online game and the friend side in the same camp of player role.Player role refers to the dominant role of player's control in video-game or the online game.
Under the prior art, NPC control has dual mode:
One, AI controls automatically:
AI controls down automatically, and the action of NPC is fully by AI (artificial intelligence, ArtificialIntelligence is hereinafter to be referred as AI) control, and the user can't control maybe and can only simply control (attacking, defend, follow, stop multiple AI state such as switching).
Advantage: under this control mode, do not need the user that extra operation is arranged, as long as the control player role.
Shortcoming: control not freely, NPC can make the behavior that some users do not expect.
Existing recreation is given an example: the human skeleton of wizard's calling in " the legend world ".
Two, the user manually controls:
The user manually controls, and by AI control, the user can't control fully in the action of NPC.
Advantage: under this control mode, the action of the major part of NPC is controlled by the user, can not make the behavior that some users do not expect.
Shortcoming: operate loaded down with trivial details because need a plurality of roles of control, so user's operation meeting is very loaded down with trivial details.
Existing recreation is given an example: the nihility passerby of wizard's calling in " World of Warcraft ".
Summary of the invention
The technical problem to be solved in the present invention provides a kind of control method of non-player role, both can fully control the behavior of NPC, can control easily again, has simplified loaded down with trivial details operating procedure.
For solving the problems of the technologies described above, the control method of a kind of non-player role of the present invention adopts the shadow mode to control non-player role, comprises the steps: the data structure of (1) foundation preservation shadow information; (2) add shadow information; (3) shadow moves: the motion track of storing each shadow, and judge track that following a period of time of shadow moves whether be on it shadow at the motion track of this section in the time, if, then after moving, the track of previous shadow or player role body is updated to a back shadow through fixed range; (4) shadow is attacked, attacked and is disappeared.
Described shadow information comprises identifier, position, direction and the animate of shadow.
Step (1) also is included in uses special array to deposit shadow information in the info class of player role.
Step (2) is specific as follows: adopting the mode of client-requested, server response, when player role obtains interpolation shadow stage property or receive server interpolation shadow message, is that this player role adds shadow information.
The motion track of the shadow described in the step (3) is that shadow or player role body track add a fixed range value on it, calculate displacement according to mobile start position and institute's elapsed time, the particular location of shadow obtains by key point position interpolation, described key point position comprises: the role begins when mobile, when the role changes speed, when the role changed direction, when role's displacement reached fixed range, the role stopped when mobile.
When the role moves to fixed range, not only need recorded key point position in the step (3), also will upgrade key point position information.
In the step (3),, obtain the distance that shadow current location: A. begins to have moved from key point according to Time Calculation by the following method in non-key occasion; B. search smaller or equal to the pairing node of the ultimate range of this distance in mobile key position information array according to this distance; C. according to the node that finds as the mobile computing starting point, next node carries out interpolation calculation as terminal point, the position that obtains is exactly the shadow current location.
Beneficial effect of the present invention is: adopt the inventive method, the player does not need to control moving of shadow (NPC), and shadow can be followed all the time at the player role rear; Therefore the player can control shadow and move to any its place that moves to of wanting, and shadow can not hinder the user and handle moving of its main player role, and shadow can not made the shift action that any player does not think that it is made yet.When the player attacks (push away ice or open ice), shadow can turn to the player current towards, and do attack (push away ice or open ice); Therefore the player can control shadow and attacks to any direction, and shadow can not hinder the user to be handled its main player role and attack, and shadow can not made any player and do not think that it makes attack.To sum up, the present invention both can fully control the behavior of NPC, can control easily again and did not have loaded down with trivial details operation.
Description of drawings
Fig. 1 is the schematic diagram that shadow moves in the inventive method;
Fig. 2 is the schematic diagram that shadow is attacked in the inventive method.
The specific embodiment
Below in conjunction with drawings and Examples the present invention is described in more detail.
With " pushing away chivalrous " recreation be example, and in " pushing away chivalrous ", NPC is that the appearance forrns with shadow shows, and shadow is being followed player role all the time, and as the another one role, shadow can help player role to attack (promotion ice cube or open ice).
The control method of a kind of non-player role of the present invention comprises following concrete steps:
One, sets up a data structure of preserving shadow information
1, preserve the data structure SHADOWPLAYER of shadow information, the information of shadow comprises the identifier of shadow, position, direction and animate etc.;
2, in the info class of player role, use special array to deposit shadow information.
Two, add shadow information
Identical with the player role ontology information, the information of shadow also need all be carried out record the server and client side, so the generation of shadow is still adopted client-requested, the mode of server response.When the role obtains interpolation shadow stage property or receive server interpolation shadow message, call the AddShadowPlayer function and add shadow information for this role.
Three, shadow moves (shadow is followed)
The player does not need to control moving of shadow, and shadow can be followed all the time at the player role rear; Therefore the player can control shadow (NPC) and move to any its place that moves to of wanting, and shadow can not hinder the user and handle moving of its main player role, and shadow can not made the shift action that any player does not think that it is made yet.As shown in Figure 1, as gluttonous snake, the player does not need to control moving of shadow, and shadow can followed the player all the time, the virtual center point of shadow can be all the time at the point at the preceding 40pix place of player's virtual center point.
It is Core Feature during the shadow function realizes that shadow is followed.Shadow can followed the player all the time, the location track of shadow should be that shadow (or player role body) track adds a fixed range value on it, can overlap with the position of last shadow (or player role body) before this section is mobile after the distance moving fixedly guaranteeing, thereby reach the requirement of following.
In order to reach the requirement that shadow is followed, can be by keeping the motion track of each shadow, search the track position that satisfies fixed range before it then and reach the planning designing requirement.But this mode need expend very big data space, and the search operation meeting of mass data reduces program efficiency, therefore needs to consider to be optimized on this basis.
Consider that shadow will overlap with the position of a last shadow through fixed range, thus the track that moves of following a period of time of shadow a shadow is at the motion track of this section in the time on it just, so the motion track major part of shadow is identical.According to this judgement, then to consider after moving, the track of previous shadow (or body) to be updated to a back shadow through fixed range, a back shadow moves according to the track of previous shadow.Just do not need to keep whole motion tracks with this scheme, and only keep the track position of certain distance, compare a scheme and just saved with regard to memory space and improved search efficiency.
But even so, consider present recreation to play up action more frequent, if it is still bigger than normal to keep the position data output of role when playing up and shadow thereof at every turn.Because the role carries out linear uniform motion in recreation at present, move distance and time retention wire sexual intercourse then can calculate its displacement according to mobile start position and institute's elapsed time.Therefore, only need to keep several Key Points (be exactly the position of role's mobile status when changing, with this position as mobile starting point, change speed as the role, when the role changes direction) the position, inquire about these key point positions, the particular location of shadow can obtain by these key point position interpolation.
At present generally at following occasion recorded key point:
● the role begins when mobile;
● when the role changes speed;
● when the role changes direction;
● role's displacement (not being displacement) is when reaching fixed range;
● the role stops when mobile.
When the occasion of needs records (during full 40 pixels, the role begins to move, and the role changes speed, and the role changes direction, role stop to move etc.) upgrades in the key point position.For example, when the role moves to fixed range, not only need recorded key point position, also will upgrade key point position information.
In non-key occasion, obtain the shadow current location by the following method:
A. the distance that begins to have moved from key point according to Time Calculation;
B. search smaller or equal to the pairing node of the ultimate range of this distance in mobile key position information array according to this distance;
C. according to the node that finds as the mobile computing starting point, next node carries out interpolation calculation as terminal point, the position that obtains is exactly the current position of shadow.
Four, the attack of shadow
When the player attacks (push away ice or open ice), shadow can turn to the player current towards, and do attack (push away ice or open ice); Therefore the player can control shadow (NPC) and attacks to any direction, and shadow can not hinder the user to be handled its main player role and attack, and shadow can not made any player and do not think that it makes attack.As shown in Figure 2, when the player by pushing away ice or when opening ice, shadow can turn to the player current towards, and do the action that pushes away ice or open ice; When the player turns to an ice cube and position own is stopped by ice cube and when not having displacement, shadow also can turn to the player current towards; Shadow is regarded as player role during the judgement behavior, and shadow also has the role to belong to the notion of lattice decision metric, judges that shadow attack loca method is identical with player's decision method.
When shadow pushes away the brick attack, all push away brick at each shadow and attack decision operation, its decision operation is identical with the judgment mode of player role body, and concrete grammar is as follows:
At first, whether exist according to two lattice before the present cell positive direction of living in of shadow to push away object, distinguish the attack mode: can not push away object if do not exist in the last lattice of cell positive direction, then carry out the sky push operation; If can push away object if the interior existence of the last lattice of cell positive direction can push away not exist in object and preceding second lattice of cell positive direction, then carry out push operation; If can push away object if the interior existence of the last lattice of cell positive direction can push away also to exist in object and preceding second lattice of cell positive direction, then break operation;
Then, the identification information of record shadow, the operation information that is carried out and can push away object information sends shadow to server and attacks request;
Then, server judges that according to solicited message if think that this attack is legal, the instruction of then loopback success attack is carried out playing up of shadow attack in client, and its mode is identical with the player role body, so repeat no more.
Five, shadow is attacked and is disappeared
When shadow is attacked, shadow itself and its next stage shadow all will disappear.The implementation procedure that the processing procedure that shadow disappears and role's body disappear is basic identical, judges whether shadow is pushed, and the deletion shadow mainly illustrates the processing mode that shadow itself and its next stage shadow disappear here:
At first, confirm the to be killed identifier of shadow;
Then, according to this identifier (ID), in role's shadow, search corresponding sequence number;
Then, remove on the later shadow infologic of this sequence number, play shadow in the performance and attacked the back action that disappears.

Claims (7)

1. the control method of a non-player role is characterized in that, adopts the shadow mode to control non-player role, comprises the steps: the data structure of (1) foundation preservation shadow information; (2) add shadow information; (3) shadow moves: the motion track of storing each shadow, and judge track that following a period of time of shadow moves whether be on it shadow at the motion track of this section in the time, if, then after moving, the track of previous shadow or player role body is updated to a back shadow through fixed range; (4) shadow is attacked, attacked and is disappeared.
2. the control method of non-player role as claimed in claim 1 is characterized in that, described shadow information comprises identifier, position, direction and the animate of shadow.
3. the control method of non-player role as claimed in claim 1 is characterized in that, step (1) also is included in uses special array to deposit shadow information in the info class of player role.
4. the control method of non-player role as claimed in claim 1, it is characterized in that, step (2) is specific as follows: the mode that adopts client-requested, server response, when player role obtains interpolation shadow stage property or receive server interpolation shadow message, be that this player role adds shadow information.
5. the control method of non-player role as claimed in claim 1, it is characterized in that, the motion track of the shadow described in the step (3) is that shadow or player role body track add a fixed range value on it, calculate displacement according to mobile start position and institute's elapsed time, the particular location of shadow obtains by key point position interpolation, described key point position comprises: the role begins when mobile, when the role changes speed, when the role changes direction, when role's displacement reached fixed range, the role stopped when mobile.
6. the control method of non-player role as claimed in claim 5 is characterized in that, when the role moves to fixed range, not only needs recorded key point position in the step (3), also will upgrade key point position information.
7. the control method of non-player role as claimed in claim 5 is characterized in that, in the step (3), in non-key occasion, obtains the distance that shadow current location: A. begins to have moved from key point according to Time Calculation by the following method; B. search smaller or equal to the pairing node of the ultimate range of this distance in mobile key position information array according to this distance; C. according to the node that finds as the mobile computing starting point, next node carries out interpolation calculation as terminal point, the position that obtains is exactly the shadow current location.
CN2007100372536A 2007-02-07 2007-02-07 Control method of non-player role Active CN101239240B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2007100372536A CN101239240B (en) 2007-02-07 2007-02-07 Control method of non-player role

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2007100372536A CN101239240B (en) 2007-02-07 2007-02-07 Control method of non-player role

Publications (2)

Publication Number Publication Date
CN101239240A true CN101239240A (en) 2008-08-13
CN101239240B CN101239240B (en) 2011-06-22

Family

ID=39931237

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2007100372536A Active CN101239240B (en) 2007-02-07 2007-02-07 Control method of non-player role

Country Status (1)

Country Link
CN (1) CN101239240B (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104463773A (en) * 2014-12-22 2015-03-25 深圳市八零年代网络科技有限公司 Movable graph efficient output method and system
CN106861192A (en) * 2017-01-24 2017-06-20 腾讯科技(深圳)有限公司 Event execution method and device
WO2018130135A1 (en) * 2017-01-13 2018-07-19 腾讯科技(深圳)有限公司 Method and device for controlling way-finding of simulation object, and server
CN109843403A (en) * 2016-10-31 2019-06-04 喀普康有限公司 The control method of game system and game system
CN110292773A (en) * 2019-07-04 2019-10-01 珠海西山居移动游戏科技有限公司 A kind of role movement follower method and device calculate equipment and storage medium
CN112437689A (en) * 2018-07-19 2021-03-02 Cy游戏公司 Game system, game system control method, server, and program
CN112755521A (en) * 2015-09-30 2021-05-07 索尼互动娱乐美国有限责任公司 System and method for providing time-shifted intelligent synchronized gaming video

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006252291A (en) * 2005-03-11 2006-09-21 Namco Bandai Games Inc Program, information storage medium and image generation system

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104463773A (en) * 2014-12-22 2015-03-25 深圳市八零年代网络科技有限公司 Movable graph efficient output method and system
CN112755521A (en) * 2015-09-30 2021-05-07 索尼互动娱乐美国有限责任公司 System and method for providing time-shifted intelligent synchronized gaming video
CN109843403A (en) * 2016-10-31 2019-06-04 喀普康有限公司 The control method of game system and game system
CN109843403B (en) * 2016-10-31 2022-10-14 喀普康有限公司 Game system and control method of game system
WO2018130135A1 (en) * 2017-01-13 2018-07-19 腾讯科技(深圳)有限公司 Method and device for controlling way-finding of simulation object, and server
CN106861192A (en) * 2017-01-24 2017-06-20 腾讯科技(深圳)有限公司 Event execution method and device
CN112437689A (en) * 2018-07-19 2021-03-02 Cy游戏公司 Game system, game system control method, server, and program
CN110292773A (en) * 2019-07-04 2019-10-01 珠海西山居移动游戏科技有限公司 A kind of role movement follower method and device calculate equipment and storage medium
CN110292773B (en) * 2019-07-04 2023-03-21 珠海西山居数字科技有限公司 Role movement following method and device, computing equipment and storage medium

Also Published As

Publication number Publication date
CN101239240B (en) 2011-06-22

Similar Documents

Publication Publication Date Title
CN101239240B (en) Control method of non-player role
US11185778B2 (en) Computer-readable non-transitory recording medium, game system, and method for controlling a game system
US10086279B2 (en) Cross-realm zones for interactive gameplay
WO2018059540A1 (en) Method, device and storage medium for generating character behaviors in game
US11529559B2 (en) Method and device for adjusting region, storage medium, and electronic device
CN106139593A (en) A kind of game data processing method and game client
CN111298430A (en) Virtual item control method and device, storage medium and electronic device
KR102585917B1 (en) Map switching method and device, and storage medium and device
CN112691376B (en) Virtual object control method and device, storage medium and electronic equipment
CN106102849B (en) It is created for the method and system for the multi-player video game environment that single player uses
CN107890669B (en) Display control method, device and storage medium
WO2022165991A1 (en) Method and apparatus for broadcasting signal in game, electronic device, and storage medium
US10322346B2 (en) Interactive collectible card games with defense and offence team formations
WO2021143318A1 (en) Control method and device for virtual operating object, storage medium, and electronic device
CN103577704A (en) Event handling method and device through NPC in game system
WO2023051168A1 (en) Method, apparatus, and device for controlling item in virtual scene, and storage medium
CN109876449A (en) Game unit formation control and method to game unit intelligent control
CN112717399A (en) Game object combat control method, computer readable storage medium and intelligent terminal
WO2024093940A1 (en) Method and apparatus for controlling virtual object group in virtual scene, and product
WO2022156106A1 (en) Battle control method for game objects, and computer-readable storage medium and intelligent terminal
WO2024093941A1 (en) Method and apparatus for controlling virtual object in virtual scene, device, and product
EP2350967A2 (en) Interactive network game and methods thereof
CN113694512A (en) Control method and device of virtual role and electronic equipment
Hsu et al. The design of multiplayer online video game systems
CN115591237A (en) Weather effect-based interaction method, device and product in virtual game

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant