CN115878085A - Method and system for putting NPC in virtual reality game - Google Patents

Method and system for putting NPC in virtual reality game Download PDF

Info

Publication number
CN115878085A
CN115878085A CN202211336673.5A CN202211336673A CN115878085A CN 115878085 A CN115878085 A CN 115878085A CN 202211336673 A CN202211336673 A CN 202211336673A CN 115878085 A CN115878085 A CN 115878085A
Authority
CN
China
Prior art keywords
npc
scene
virtual reality
spline
interface
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.)
Pending
Application number
CN202211336673.5A
Other languages
Chinese (zh)
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.)
Shenzhen Realis Multimedia Technology Co Ltd
Original Assignee
Shenzhen Realis Multimedia Technology 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 Shenzhen Realis Multimedia Technology Co Ltd filed Critical Shenzhen Realis Multimedia Technology Co Ltd
Priority to CN202211336673.5A priority Critical patent/CN115878085A/en
Publication of CN115878085A publication Critical patent/CN115878085A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Processing Or Creating Images (AREA)

Abstract

The invention relates to a method for putting NPC in a virtual reality game, which comprises the following steps: constructing a release interface in a UE4 blueprint to obtain a virtual reality scene model; drawing a spline, and generating a corresponding NPC at the starting point of the spline so as to enable the NPC to move along with the coordinates of the spline; returning the position of the NPC in the scene to the launching interface at regular time; and after receiving the data, the putting interface converts the 3D coordinates in the scene where the NPC is located into 2D coordinates to realize the putting of the NPC, so that the requirement set by the virtual reality game can be met.

Description

Method and system for putting NPC in virtual reality game
Technical Field
The present invention relates to the field of virtual engine technology, and in particular, to a method, a system, a computer device, and a storage medium for delivering an NPC in a virtual reality game.
Background
The UE4 engine is an open source and cross-platform game development engine. The UE4 engine is suitable for heavyweight game development, which focuses more on PC end games and high-end hand games. The UE4 engine supports blueprints and C + +, and the learning cost is higher. In the current era, the fantasy engine has very powerful functions, is shown in various fields to different degrees, and how to successfully put in various NPCs in the UE4 virtual reality game is a problem to be solved by the current UE4 engine game development.
Disclosure of Invention
The invention aims to overcome the defects of the prior art and provides a method, a system, computer equipment and a storage medium for putting NPC in a virtual reality game, which can meet the requirement of putting NPC function in a map in the virtual reality game of a UE4 virtual engine.
In order to solve at least one technical problem, in a first aspect, an embodiment of the present invention provides a method for delivering an NPC in a virtual reality game, where the method includes:
constructing a release interface in a UE4 blueprint to obtain a virtual reality scene model;
drawing a spline, and generating a corresponding NPC at the starting point of the spline so as to enable the NPC to move along with the coordinates of the spline;
returning the position of the NPC in the scene to the launching interface at regular time;
and after receiving the data, the putting interface converts the 3D coordinates in the scene where the NPC is located into 2D coordinates so as to realize the putting of the NPC.
The step of constructing the release interface in the UE4 blueprint comprises the following steps: the UI component may be used to build the launch interface in the UE4 blueprint.
Alternatively, different NPCs may be delivered at the option of different users.
The drawing spline comprises: the required spline line pattern can be drawn through the control of the program code.
Optionally, when the required spline line pattern is a circle, adding a spline point to the spline line through an AddPoint function, rotating the spline line by a change angle according to the point, executing 9 times of codes, adding 9 points to the spline line, and determining the radius of the circle according to the starting point and the center position of the spline line so as to draw the circular spline line.
The timing returning of the position of the NPC in the scene to the launching interface comprises the following steps: and returning the position of the NPC in the scene to the launching interface every 0.1 second.
The converting the 3D coordinates in the scene where the NPC is located into the 2D coordinates includes:
acquiring the pixel size (X, Y) of the NPC icon;
measuring the length and the width of the virtual reality scene, and dividing the pixel size of the NPC icon by 2;
and subtracting the acquired actual coordinate in the scene where the NPC is located from the scene length, and finally multiplying the actual coordinate by the proportion of the 2D map on the screen, so that the 3D coordinate in the scene where the NPC is located is converted into the 2D coordinate.
In a second aspect, the present invention provides a system for delivering NPC in a virtual reality game, where the method for delivering NPC in a virtual reality game according to the first aspect is applied to a system for delivering NPC in a virtual reality game, where the system for delivering NPC in a virtual reality game includes a building module, a drawing module, and a delivering module, and the delivering module, the drawing module, and the building module are sequentially connected;
the building module is used for building a launching interface in a UE4 blueprint to obtain a virtual reality scene model;
the drawing module is used for drawing a sample line and generating a corresponding NPC at the starting point of the sample line so as to enable the NPC to move along with the coordinate of the sample line;
the releasing module is used for returning the position of the NPC in the scene to a releasing interface at regular time; and after receiving the data, the putting interface converts the 3D coordinates in the scene where the NPC is located into 2D coordinates so as to realize the putting of the NPC.
In a third aspect, an embodiment of the present invention further provides a computer device, including: the system comprises a memory, a processor and an application program stored on the memory and capable of running on the processor, wherein the processor realizes the steps of the method of any embodiment when executing the application program.
In a fourth aspect, the present invention further provides a computer-readable storage medium, on which an application program is stored, where the application program, when executed by a processor, implements the steps of any of the above-mentioned embodiments of the method.
The invention relates to a method and a system for releasing NPC in a virtual reality game, which comprises the steps of firstly constructing a releasing interface in a UE4 blueprint to obtain a virtual reality scene model; then drawing a spline line, and generating a corresponding NPC at the starting point of the spline line so as to enable the NPC to move along with the coordinates of the spline line; finally, the position of the NPC in the scene is returned to the launching interface at regular time; and after receiving the data, the putting interface converts the 3D coordinates in the scene where the NPC is positioned into 2D coordinates so as to realize the putting and displaying of the NPC, thereby meeting the set requirements of the virtual reality game.
Drawings
FIG. 1 is a flow chart of a method for delivering an NPC in a virtual reality game in an embodiment of the present invention;
fig. 2 is a schematic diagram of a drop interface built in a UE4 blueprint in an embodiment of the present invention;
FIG. 3 is a schematic diagram of 3 portions of a drop interface in accordance with an embodiment of the present invention;
FIG. 4 is a schematic diagram illustrating an effect of NPC delivery according to an embodiment of the present invention;
FIG. 5 is a schematic structural diagram of a system for delivering an NPC in a virtual reality game according to an embodiment of the present invention;
fig. 6 is a schematic structural component diagram of a computer device in the embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
An embodiment of the present invention provides a method for delivering an NPC in a virtual reality game, as shown in fig. 1, the method includes the following steps:
s102, constructing a launching interface in a UE4 blueprint to obtain a virtual reality scene model;
the UI component may be used to build a delivery interface in the UE4 blueprint, or different NPCs may be delivered according to different user selections. The specifically constructed launch interface is shown in fig. 2.
The NPC is game terminology, is an abbreviation of non-player character, is a character type in a game, means a non-player character, and refers to a game character which is not manipulated by a real player in an electronic game.
In one embodiment, as shown in FIG. 3, the drop interface may be divided into 3 sections: the left throwing column, the middle aerial view map and the right deployment column are arranged;
the left throwing fence can throw different NPCs (neutral point controller) such as helicopters, fighters, scouts and the like according to the selection of a user, and after the NPCs are compiled and deployed, the corresponding NPC throwing fence can enter cooling time.
The intermediate aerial view map can present the NPC thrown by the user in the form of icons, and meanwhile, the user can select a sample line path (shown as a path in the middle of the map) and fly the NPC according to the selected path. The deployment column on the right side is a column for displaying the NPC which is being deployed by the user, and the number of NPCs can be limited.
S104, drawing a sample line, and generating a corresponding NPC at the starting point of the sample line so as to enable the NPC to move along with the coordinates of the sample line;
specifically, the required spline line pattern can be drawn through the control of the program code. When the required spline line pattern is circular, spline points are added to the spline line through an AddPoint function, the spline line rotates by changing angles according to the points, 9 times of codes are executed, 9 points are added to the spline line (because each point is added with 36 degrees upwards, the 9 points can form 360 degrees and are exactly a circle), and then the radius of the circle is determined through the starting point and the position of the circle center of the spline line, so that the circular spline line is drawn.
S106, regularly returning the position of the NPC in the scene to a launching interface; specifically, the position of the NPC in the scene can be returned to the launch interface every 0.1 second.
And S108, after the data are received by the releasing interface, converting the 3D coordinates in the scene where the NPC is located into 2D coordinates so as to realize the releasing of the NPC.
Wherein, convert the 3D coordinate in the scene that NPC is located into the 2D coordinate, include:
acquiring the pixel size (X, Y) of the NPC icon;
measuring the length and the width of the virtual reality scene, and dividing the pixel size of the NPC icon by 2;
and subtracting the acquired actual coordinate in the scene where the NPC is located from the scene length, and finally multiplying the actual coordinate by the proportion of the 2D map on the screen, so that the 3D coordinate in the scene where the NPC is located is converted into the 2D coordinate.
After the above steps are completed, an effect interface for releasing the NPC as shown in fig. 4 can be implemented.
In an embodiment, referring to fig. 5, the present invention further provides a system for delivering an NPC in a virtual reality game, where the method for delivering an NPC in a virtual reality game is applied to a system for delivering an NPC in a virtual reality game, the system for delivering an NPC in a virtual reality game includes a building module 302, a drawing module 304, and a delivering module 306, and the delivering module 302, the drawing module 304, and the building module 306 are sequentially connected;
the building module 302 is configured to build a launch interface in a UE4 blueprint to obtain a virtual reality scene model;
the drawing module 304 is configured to draw a spline, and generate a corresponding NPC at a start point of the spline, so that the NPC moves along with coordinates of the spline;
the releasing module 306 is configured to periodically return the position of the NPC in the scene to a releasing interface; and after receiving the data, the putting interface converts the 3D coordinates in the scene where the NPC is located into 2D coordinates so as to realize the putting of the NPC.
For a specific limitation of a system for delivering an NPC in a virtual reality game, reference may be made to the above limitation on a method for delivering an NPC in a virtual reality game, and details thereof are not repeated here. The various modules in a system for delivering NPCs in a virtual reality game described above may be implemented in whole or in part by software, hardware, and combinations thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
The computer-readable storage medium provided by the embodiments of the present invention stores an application program thereon, and when the application program is executed by a processor, the application program implements a method for delivering an NPC in a virtual reality game according to any one of the embodiments. The computer-readable storage medium includes, but is not limited to, any type of disk including floppy disks, hard disks, optical disks, CD-ROMs, and magneto-optical disks, ROMs (Read-Only memories), RAMs (Random AcceSS memories), EPROMs (EraSable Programmable Read-Only memories), EEPROMs (Electrically EraSable Programmable Read-Only memories), flash memories, magnetic cards, or optical cards. That is, a storage device includes any medium that stores or transmits information in a form readable by a device (e.g., a computer, a cellular phone), and may be a read-only memory, a magnetic or optical disk, or the like.
The embodiment of the invention also provides a computer application program which runs on a computer and is used for executing the method for delivering the NPC in the virtual reality game in any one of the above embodiments.
Fig. 6 is a schematic structural diagram of a computer device in the embodiment of the present invention.
An embodiment of the present invention further provides a computer device, as shown in fig. 6. The computer apparatus includes a processor 602, a memory 603, an input unit 604, a display unit 605, and the like. Those skilled in the art will appreciate that the device structure illustrated in fig. 3 does not constitute a limitation of all devices, and may include more or fewer components than those illustrated, or some of the components may be combined. The memory 603 may be used to store the application program 601 and various functional modules, and the processor 602 executes the application program 601 stored in the memory 603, thereby performing various functional applications of the device and data processing. The memory may be internal or external memory, or include both internal and external memory. The internal memory may include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), flash memory, or random access memory. The external memory may include a hard disk, a floppy disk, a ZIP disk, a usb disk, a magnetic tape, etc. The disclosed memory includes, but is not limited to, these types of memory. The disclosed memory is by way of example only and not by way of limitation.
The input unit 604 is used for receiving input of signals and receiving keywords input by a user. The input unit 604 may include a touch panel and other input devices. The touch panel can collect touch operations of a user on or near the touch panel (for example, operations of the user on or near the touch panel by using any suitable object or accessory such as a finger, a stylus and the like) and drive the corresponding connecting device according to a preset program; other input devices may include, but are not limited to, one or more of a physical keyboard, function keys (e.g., play control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like. The display unit 605 may be used to display information input by the user or information provided to the user and various menus of the terminal device. The display unit 605 may take the form of a liquid crystal display, an organic light emitting diode, or the like. The processor 602 is a control center of the terminal device, connects various parts of the entire device using various interfaces and lines, and performs various functions and processes data by operating or executing software programs and/or modules stored in the memory 603 and calling data stored in the memory.
As one embodiment, the computer device includes: one or more processors 602, memory 603, one or more applications 601, wherein the one or more applications 601 are stored in the memory 603 and configured to be executed by the one or more processors 602, and wherein the one or more applications 601 are configured to perform a method of delivering NPCs in a virtual reality game in any of the above embodiments.
In addition, the method, the apparatus, the computer device and the storage medium for delivering NPC in a virtual reality game provided by the embodiment of the present invention are described in detail above, a specific example should be used herein to explain the principle and the implementation of the present invention, and the description of the above embodiment is only used to help understanding the method and the core idea of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (10)

1. A method of delivering an NPC in a virtual reality game, the method comprising:
constructing a release interface in a UE4 blueprint to obtain a virtual reality scene model;
drawing a spline, and generating a corresponding NPC at the starting point of the spline so as to enable the NPC to move along with the coordinates of the spline;
returning the position of the NPC in the scene to the launching interface at regular time;
and after receiving the data, the putting interface converts the 3D coordinates in the scene where the NPC is located into 2D coordinates so as to realize the putting of the NPC.
2. The method of claim 1, wherein constructing the delivery interface in the UE4 blueprint comprises: the UI component may be used to build the launch interface in the UE4 blueprint.
3. The method of delivering NPCs of claim 1, wherein different NPCs are delivered according to different user selections.
4. The method of delivering the NPC of claim 1, wherein the drawing a spline comprises: the required spline line pattern can be drawn through the control of the program code.
5. The method of claim 4, wherein when the required spline line pattern is a circle, the AddPoint function is used to add spline points to the spline line, the spline line is rotated by a variable angle according to the points, the code is executed for 9 times, 9 points are added to the spline line, and the radius of the circle is determined according to the starting point and the center of the spline line, so as to draw a circle spline line.
6. The method of claim 1, wherein the timing the position of the NPC in the scene back to the interface comprises: and returning the position of the NPC in the scene to the launching interface every 0.1 second.
7. The method of claim 1, wherein the converting the 3D coordinates of the scene in which the NPC is located into 2D coordinates comprises:
acquiring the pixel size (X, Y) of the NPC icon;
measuring the length and the width of the virtual reality scene, and dividing the pixel size of the NPC icon by 2;
and subtracting the acquired actual coordinate in the scene where the NPC is located from the scene length, and finally multiplying the actual coordinate by the proportion of the 2D map on the screen, so that the 3D coordinate in the scene where the NPC is located is converted into the 2D coordinate.
8. A system for putting NPC in a virtual reality game, a method for putting NPC in a virtual reality game as claimed in any one of claims 1 to 7 is applied to a system for putting NPC in a virtual reality game,
the system for releasing the NPC in the virtual reality game comprises a construction module, a drawing module and a releasing module, wherein the releasing module, the drawing module and the construction module are sequentially connected;
the building module is used for building a release interface in a UE4 blueprint to obtain a virtual reality scene model;
the drawing module is used for drawing a sample line and generating a corresponding NPC at the starting point of the sample line so as to enable the NPC to move along with the coordinates of the sample line;
the releasing module is used for returning the position of the NPC in the scene to a releasing interface at regular time; and after receiving the data, the putting interface converts the 3D coordinates in the scene where the NPC is located into 2D coordinates so as to realize the putting of the NPC.
9. A computer device comprising a memory, a processor and an application program stored on the memory and executable on the processor, wherein the processor implements the steps of the method of any one of claims 1 to 7 when executing the application program.
10. A computer-readable storage medium, on which an application program is stored, which when executed by a processor implements the steps of the method of any one of claims 1 to 7.
CN202211336673.5A 2022-10-28 2022-10-28 Method and system for putting NPC in virtual reality game Pending CN115878085A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211336673.5A CN115878085A (en) 2022-10-28 2022-10-28 Method and system for putting NPC in virtual reality game

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211336673.5A CN115878085A (en) 2022-10-28 2022-10-28 Method and system for putting NPC in virtual reality game

Publications (1)

Publication Number Publication Date
CN115878085A true CN115878085A (en) 2023-03-31

Family

ID=85759111

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211336673.5A Pending CN115878085A (en) 2022-10-28 2022-10-28 Method and system for putting NPC in virtual reality game

Country Status (1)

Country Link
CN (1) CN115878085A (en)

Similar Documents

Publication Publication Date Title
CN110354489B (en) Virtual object control method, device, terminal and storage medium
US9283473B2 (en) Game providing device
JP2022527502A (en) Virtual object control methods and devices, mobile terminals and computer programs
US11810234B2 (en) Method and apparatus for processing avatar usage data, device, and storage medium
CN111330272B (en) Virtual object control method, device, terminal and storage medium
KR102650002B1 (en) Virtual object control method and apparatus, computer device, and storage medium
CN113272033A (en) Method for facilitating user interaction in a gaming environment
US20230285855A1 (en) Virtual scene display method and apparatus, terminal, and storage medium
CN115878085A (en) Method and system for putting NPC in virtual reality game
CN114225372B (en) Virtual object control method, device, terminal, storage medium and program product
CN115120979A (en) Display control method and device of virtual object, storage medium and electronic device
CN115105831A (en) Virtual object switching method and device, storage medium and electronic device
JP2019205514A (en) Program, method, and information terminal device
CN113797527A (en) Game processing method, device, equipment, medium and program product
CN113694514A (en) Object control method and device
KR102557808B1 (en) Gaming service system and method for sharing memo therein
JP7272799B2 (en) Game program, method, and information processing device
KR102462205B1 (en) Method and system for providing game using continuous automatic battle function
CN110314377B (en) Method and device for randomly generating object moving path in three-dimensional space
CN112221123B (en) Virtual object switching method and device, computer equipment and storage medium
CN114504821A (en) Method and device for controlling warning operation of virtual object in UE4 virtual reality
CN117046099A (en) Role control method and device, readable storage medium and electronic equipment
CN115155052A (en) Method and device for controlling cursor through handle, electronic equipment and storage medium
CN115501599A (en) Virtual object control method, device, medium and equipment
CN117899451A (en) Game processing method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination