Method and device for loading virtual game, storage medium, and electronic device
By using game clients and servers to synchronize virtual game level scenes and character data in AR technology, the problem of limited virtual scene projection in the existing technology is solved, and complete virtual game projection and multi-person interaction in real scenes are realized. Improved AR gaming experience.
Patent Information
- Application Number
- CN202010603335.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-06-29
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2040-06-29
AI Technical Summary
Existing AR technology is difficult to project a complete virtual scene into a real scene, resulting in limited multi-player AR gameplay, and ARKit's accuracy issues lead to position errors of virtual items, ruining the gaming experience.
Collect real scene information through the game client, use the game server to synchronize virtual game level scenes and character data, realize the projection and interaction of virtual game level scenes, keep the projection matrix of the virtual camera consistent with the real camera, and perform coordinate system conversion to project the virtual scene Go into real scenes and interact through microphones and gravity sensing.
It realizes the projection of complete virtual game scenes in real scenes, enhances the playability and interactivity of multiplayer AR games, reduces virtual item position errors, and improves the game experience.
Smart Images

Figure CN111744180B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method and device for loading a virtual game, a storage medium, and an electronic device. Background Art
[0002] In related technologies, AR stands for Augmented Reality, which is a technology that adds a virtual world created by a computer program to the real world captured by a camera. ARKit is a tool that projects the virtual world into the real world through views.
[0003] In the related technology, the iOS native API is used for scene management (including virtual item management). The coordinate system used by virtual items is directly the coordinate system of ARKit, and some built-in processing can bind virtual items to real items (actually mainly real planes), so that it looks like virtual items are directly displayed on real objects. In terms of synchronization, in addition to synchronizing the necessary coordinate system information (actually reference objects), WorldMap also directly puts the information of virtual items into WorldMap and synchronizes them together. Unity is used for virtual scene management, and the position information of the real camera is obtained through ARKit, and it is directly applied to Unity's virtual camera. Virtual items are generated by Unity, and the coordinate system used is converted from the coordinate system of ARKit to the coordinate system of Unity. The binding of virtual items to real planes needs to be done by yourself. During synchronization, WorldMap only synchronizes the coordinate system information, and the synchronization of virtual item information is completed by custom logic.
[0004] In the related technologies, most AR applications simply add a small amount of virtual objects to the "real" world, and rarely directly project the entire virtual scene into the "real" world, which limits the possibility of AR gameplay. Two-player AR applications generally require two people to be in the same place, and the handling of two people in different places is not perfect (this is not a technical problem, but more of an incomplete consideration when designing the gameplay). AR applications rarely combine "real" inputs, such as "blowing on the phone", "shaking the phone", "mobile phone viewpoint positioning", etc., which lack authenticity. Due to the accuracy problem of ARKit itself, when two people play games together in the same place, if the range of their activities is relatively large, the positions of the "virtual" objects seen by both in the "real" world will have obvious errors. Since ARKit relies on the stability of the device, when the phone is shaken significantly, ARKit's positioning will have a huge error, and it may not be able to return to normal, resulting in the destruction of the entire AR experience.
[0005] With respect to the above-mentioned problems existing in the related technologies, no effective solutions have been found so far. Summary of the invention
[0006] Embodiments of the present invention provide a method and device for loading a virtual game, a storage medium, and an electronic device.
[0007] According to one embodiment of the present invention, a method for loading a virtual game is provided, comprising: collecting scene information of a real scene through a first game client; projecting a virtual game level scene presented on the first game client into the real scene according to the scene information and corresponding projection information; synchronizing the scene information of the real scene collected by the first game client and the corresponding projection information to a second game client through a game server; adding a first virtual character controlled by the first game client to the virtual game level scene; adding a second virtual character controlled by the second game client to the virtual game level scene; and interacting game data between the first virtual character controlled by the first game client and the second virtual character controlled by the second game client in the virtual game level scene.
[0008] Optionally, the method also includes: synchronizing the virtual game level scene presented on the first game client to the second game client through the game server; projecting the virtual game level scene presented on the second game client into the real scene, and synchronizing the first virtual character data controlled by the first game client to the second game client through the game server.
[0009] Optionally, before synchronizing the virtual game level scene presented on the first game client to the second game client through the game server, the method also includes: obtaining first position information of the first game client and second position information of the second game client; determining whether the first game client and the second game client are in the same location based on the first position information and the second position information; if the first game client and the second game client are not in the same location, determining to synchronize the virtual game level scene presented on the first game client to the second game client through the game server.
[0010] Optionally, synchronizing the virtual game level scene presented on the first game client to the second game client through the game server includes at least one of the following: synchronizing the virtual line of sight presented on the first game client to the second game client through the game server; synchronizing the virtual trajectory of the object presented on the first game client to the second game client through the game server.
[0011] Optionally, after projecting the virtual game level scene presented on the first game client into the real scene, the method further includes: sending the scene information and corresponding projection information of the first game client to a game server, wherein the game server is used to establish and store an association between the scene information and the projection information and the virtual level room.
[0012] Optionally, synchronizing the scene information and corresponding projection information of the real scene collected by the first game client to the second game client through the game server includes: determining that the second game client enters the virtual level room where the first game client is located, and the second game client and the first game client are in the same physical location; if the first game client has synchronized the scene information and the corresponding projection information, the game server sends the scene information and the corresponding projection information to the second game client; if the first game client has not synchronized the scene information and the corresponding projection information, the game server sends the scene information and the corresponding projection information to the second game client after determining that the first game client has completed synchronization.
[0013] Optionally, the virtual game level scene presented on the first game client is projected into the real scene according to the scene information and the corresponding projection information, including: keeping the virtual camera of the virtual game level scene consistent with the projection matrix of the real camera of the first game client, wherein the scene information includes the real camera and the projection information includes the virtual camera; determining a first reference point of the real scene in a world coordinate system and a second reference point in the virtual game level scene in a screen coordinate system corresponding to the first reference point; converting the screen coordinate system into the world coordinate system according to the first reference point and the second reference point, and projecting the converted virtual game level scene into the real scene.
[0014] Optionally, converting the screen coordinate system into the world coordinate system according to the first reference point and the second reference point includes: calculating the element ratio K between the screen coordinate system and the world coordinate system; converting the screen coordinate system into the world coordinate system according to the following formula: P3=P1+(P2-P0)*K; wherein P3 is the coordinate position of the virtual camera, P1 is the coordinate position of the second reference point, P2 is the coordinate position of the real camera, and P0 is the coordinate position of the first reference point.
[0015] Optionally, the game data interaction between the first virtual character controlled by the first game client and the second virtual character controlled by the second game client in the virtual game level scene includes: collecting interaction information of the virtual game level scene through the first game client or the second game client; generating control instructions for the virtual game level scene based on the interaction information; and controlling the virtual game level scene according to the control instructions.
[0016] Optionally, when the interaction information is a viewpoint ray, generating a control instruction for the virtual game level scene based on the interaction information includes: locating the intersection position of the viewpoint ray to the virtual game level scene; determining the intersection position as the target position for the movement of the first virtual character; and generating a movement instruction according to the target position, wherein the movement instruction is used to instruct the first virtual character to move to the target position.
[0017] Optionally, when the interaction information is the ambient volume blown into a microphone, the control instructions for generating the virtual game level scene based on the interaction information include: triggering the ambient wind field according to the ambient volume, wherein the size of the ambient wind field corresponds to the size of the ambient volume; generating wind animation parameters according to the ambient wind field, and generating a first rendering instruction, wherein the first rendering instruction is used to instruct the use of the wind animation parameters to render wind animation effects in the virtual game level scene.
[0018] Optionally, when the interaction information is the position information of the first game client or the second game client, generating the control instruction of the virtual game level scene based on the interaction information includes: determining the movement trajectory of the first game client or the second game client according to the position information; searching for a character special effect matching the movement trajectory in a preset special effects library, and generating a second rendering instruction, wherein the second rendering instruction is used to instruct the rendering of the character special effect in the virtual game level scene.
[0019] Optionally, the game data interaction between the first virtual character controlled by the first game client and the second virtual character controlled by the second game client in the virtual game level scene includes: capturing or recording a display screen of the virtual game level scene on a display screen of the first game client or the second game client; and sharing or saving the display screen.
[0020] Optionally, after adding the second virtual character controlled by the second game client to the virtual game level scene, the method further includes: obtaining identification information of virtual elements in the virtual game level scene, and location information of the virtual elements in the real scene; after associating the identification information and the location information, storing them on a game server; when the first game client enters the virtual game level scene again, generating the virtual elements in the real scene according to the identification information and the location information.
[0021] Optionally, after adding the second virtual character controlled by the second game client to the virtual game level scene, the method further includes: storing world map data of the virtual game level scene at the first time, or obtaining world map data of the virtual game level scene at the first time from the second game client, wherein the world map data is used to generate an AR view of the virtual game level scene; and reconstructing or correcting the AR view of the virtual game level scene at the second time according to the world map data.
[0022] According to another embodiment of the present invention, there is provided a device for loading a virtual game, comprising: an acquisition module for acquiring scene information of a real scene through a first game client; a projection module for projecting a virtual game level scene presented on the first game client into the real scene according to the scene information and the corresponding projection information; a synchronization module for synchronizing the scene information of the real scene acquired by the first game client and the corresponding projection information to a second game client through a game server; a joining module for adding a first virtual character controlled by the first game client to the virtual game level scene, and adding a second virtual character controlled by the second game client to the virtual game level scene; and a control module for controlling the first virtual character controlled by the first game client and the second virtual character controlled by the second game client to interact with game data in the virtual game level scene.
[0023] Optionally, the device also includes: a second synchronization module, used to synchronize the virtual game level scene presented on the first game client to the second game client through the game server; a processing module, used to project the virtual game level scene presented on the second game client into the real scene, and synchronize the first virtual character data controlled by the first game client to the second game client through the game server.
[0024] Optionally, the device also includes: a first acquisition module, used to acquire first position information of the first game client and second position information of the second game client before the second synchronization module synchronizes the virtual game level scene presented on the first game client to the second game client through the game server; a judgment module, used to judge whether the first game client and the second game client are in the same location based on the first position information and the second position information; and a determination module, used to determine to synchronize the virtual game level scene presented on the first game client to the second game client through the game server if the first game client and the second game client are not in the same location.
[0025] Optionally, the second synchronization module includes at least one of the following: a first synchronization unit, used to synchronize the virtual line of sight presented on the first game client to the second game client through the game server; a second synchronization unit, used to synchronize the virtual trajectory of the object presented on the first game client to the second game client through the game server.
[0026] Optionally, the device also includes: a sending module, used to send the scene information and corresponding projection information of the first game client to the game server after the projection module projects the virtual game level scene presented on the first game client into the real scene, wherein the game server is used to establish and store the association relationship between the scene information and the projection information and the virtual level room.
[0027] Optionally, the first synchronization module includes: a first determination unit, used to determine that the second game client enters the virtual level room where the first game client is located, and that the second game client and the first game client are in the same physical location; a sending unit, used to if the first game client has synchronized the scene information and the corresponding projection information, the game server sends the scene information and the corresponding projection information to the second game client; if the first game client has not synchronized the scene information and the corresponding projection information, the game server sends the scene information and the corresponding projection information to the second game client after determining that the first game client has completed synchronization.
[0028] Optionally, the first synchronization module includes: a maintaining unit, used to keep the virtual camera of the virtual game level scene consistent with the projection matrix of the real camera of the first game client, wherein the scene information includes the real camera and the projection information includes the virtual camera; a second determining unit, used to determine a first reference point of the real scene in the world coordinate system, and a second reference point in the virtual game level scene corresponding to the first reference point in the screen coordinate system; a conversion unit, used to convert the screen coordinate system into the world coordinate system according to the first reference point and the second reference point, and project the converted virtual game level scene onto the real scene.
[0029] Optionally, the conversion unit includes: a calculation subunit, used to calculate the element ratio K between the screen coordinate system and the world coordinate system; a conversion subunit, used to convert the screen coordinate system into the world coordinate system according to the following formula: P3=P1+(P2-P0)*K; wherein P3 is the coordinate position of the virtual camera, P1 is the coordinate position of the second reference point, P2 is the coordinate position of the real camera, and P0 is the coordinate position of the first reference point.
[0030] Optionally, the control module includes: a collection unit, used to collect interaction information of the virtual game level scene through the first game client or the second game client; a generation unit, used to generate control instructions for the virtual game level scene based on the interaction information; and a control unit, used to control the virtual game level scene according to the control instructions.
[0031] Optionally, when the interaction information is a viewpoint ray, the generation unit includes: a positioning subunit, used to locate the intersection position of the viewpoint ray to the virtual game level scene; a first determination subunit, used to determine the intersection position as the target position for the movement of the first virtual character; and a first generation subunit, used to generate a movement instruction based on the target position, wherein the movement instruction is used to instruct the first virtual character to move to the target position.
[0032] Optionally, when the interactive information is the ambient volume blown into a microphone, the generating unit includes: a triggering subunit, used to trigger the ambient wind field according to the ambient volume, wherein the size of the ambient wind field corresponds to the size of the ambient volume; a second generating subunit, used to generate wind animation parameters according to the ambient wind field, and generate a first rendering instruction, wherein the first rendering instruction is used to instruct the use of the wind animation parameters to render wind animation special effects in the virtual game level scene.
[0033] Optionally, when the interaction information is the position information of the first game client or the second game client, the generation unit includes: a second determination subunit, used to determine the movement trajectory of the first game client or the second game client according to the position information; a third generation subunit, used to search for a character special effect matching the movement trajectory in a preset special effects library, and generate a second rendering instruction, wherein the second rendering instruction is used to instruct the rendering of the character special effect in the virtual game level scene.
[0034] Optionally, the control module includes: an acquisition unit, used to capture or record a display screen of the virtual game level scene on a display screen of the first game client or the second game client; and a sharing unit, used to share or save the display screen.
[0035] Optionally, the device also includes: a second acquisition module, used to obtain the identification information of the virtual elements in the virtual game level scene and the position information of the virtual elements in the real scene after the joining module adds the second virtual character controlled by the second game client to the virtual game level scene; a first storage module, used to associate the identification information and the position information and store them in the game server; and a generation module, used to generate the virtual elements in the real scene according to the identification information and the position information when the first game client enters the virtual game level scene again.
[0036] Optionally, the device also includes: a second storage module, used to store the world map data of the virtual game level scene at the first time after the joining module adds the second virtual character controlled by the second game client to the virtual game level scene, or to obtain the world map data of the virtual game level scene at the first time from the second game client, wherein the world map data is used to generate an AR view of the virtual game level scene; and a construction module, used to reconstruct or correct the AR view of the virtual game level scene at the second time according to the world map data.
[0037] According to yet another embodiment of the present invention, a storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any one of the above method embodiments when running.
[0038] According to yet another embodiment of the present invention, there is provided an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0039] Through the present invention, a virtual game level scene and virtual characters presented on a game client are projected based on scene information of the real scene, and game data interaction is performed in the virtual game level scene, thereby solving the technical problem in the related art that the virtual scene cannot be projected in the real scene, and providing a solution for projecting the entire game scene into the real scene, providing more game strategies and playability for multiplayer interactive games in the virtual game level scene, and realizing multiplayer AR clearance in the virtual game level scene by projecting virtual characters controlled by other game clients, thereby reducing the limitations on multiplayer AR gameplay. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0041] Figure 1 This is a hardware structure block diagram of a mobile phone loaded with a virtual game according to an embodiment of the present invention;
[0042] Figure 2 is a flow chart of a method for loading a virtual game according to an embodiment of the present invention;
[0043] Figure 3 This is a rendering of a virtual game shared by two people according to an embodiment of the present invention;
[0044] Figure 4 This is a rendering of the scene projection of an embodiment of the present invention;
[0045] Figure 5 This is an effect diagram of projecting a real scene of a level on a desktop according to an embodiment of the present invention;
[0046] Figure 6 is a schematic diagram of coordinate system conversion according to an embodiment of the present invention;
[0047] Figure 7 This is a rendering of the effect of controlling the movement of a character through viewpoint rays in an embodiment of the present invention;
[0048] Figure 8 This is a rendering of the special effect of melting ice and snow by blowing air according to an embodiment of the present invention;
[0049] Fig. 9 This is a rendering of the effect of releasing a character's skill by blowing air in an embodiment of the present invention;
[0050] Fig.10 This is a rendering of the effect of releasing a character's skill through gravity sensing in an embodiment of the present invention;
[0051] Fig.11 is a schematic diagram of saving a game screen by taking a screenshot according to an embodiment of the present invention;
[0052] Fig.12 It is a rendering of an embodiment of the present invention associating virtual elements in a real scene;
[0053] Fig.13 4 is a structural block diagram of a device for loading a virtual game according to an embodiment of the present invention. DETAILED DESCRIPTION
[0054] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only embodiments of a part of the present application, not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work should fall within the scope of protection of the present application. It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other without conflict.
[0055] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0056] Example 1
[0057] The method embodiment provided in the first embodiment of the present application can be executed in a mobile phone, tablet, computer or similar electronic terminal. Taking running on a mobile phone as an example, Figure 1 FIG. 1 is a hardware structure diagram of a mobile phone loaded with a virtual game according to an embodiment of the present invention. Figure 1 As shown, the mobile phone 10 may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data. Optionally, the mobile phone may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is for illustration only and does not limit the structure of the mobile phone. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.
[0058] The memory 104 can be used to store mobile phone programs, for example, software programs and modules of application software, such as a mobile phone program corresponding to a method for loading a virtual game in an embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the mobile phone program stored in the memory 104, that is, the above method is implemented. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the mobile phone 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof. In this embodiment, the processor 104 is used to respond to human-computer interaction instructions and game strategies, and control the target virtual character to perform specified operations to complete the game task. The memory 104 is used to store program scripts, configuration information, attribute information of virtual characters, etc. of electronic games.
[0059] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by the communication provider of the mobile phone 10. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0060] Optionally, the input-output device 108 also includes a human-computer interaction screen for obtaining human-computer interaction instructions through a human-computer interaction interface, and for presenting game screens in game tasks;
[0061] In this embodiment, a method for loading a virtual game is provided. Figure 2 is a flow chart of a method for loading a virtual game according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0062] Step S202, collecting scene information of the real scene through the first game client;
[0063] The real scene of this embodiment is the real scene of the physical space where the first game client is located, which is an actual three-dimensional world, such as a floor, a wall, a road, etc.
[0064] Step S204, projecting the virtual game level scene presented on the first game client into the real scene according to the scene information and the corresponding projection information;
[0065] When users play virtual games on a game client, a virtual game level scene will be displayed on the screen of the game client, including virtual information such as maps, characters, props, weather, etc., and a three-dimensional view will be presented through 3D rendering. By integrating the virtual game level scene with the real scene in a certain proportion, a hybrid scene combining the virtual and the real, namely, an AR scene, can be achieved. The virtual game level scene can be projected into the real scene based on the projection information, and the user can see the view of the virtual game level scene in the real scene.
[0066] Step S206, synchronizing the scene information of the real scene and the corresponding projection information collected by the first game client to the second game client through the game server;
[0067] Through data synchronization, the virtual game level scene presented on the second game client can be projected into the real scene.
[0068] Step S208, adding the first virtual character controlled by the first game client to the virtual game level scene, and adding the second virtual character controlled by the second game client to the virtual game level scene;
[0069] Step S210: a first virtual character controlled by a first game client and a second virtual character controlled by a second game client interact with each other in a virtual game level scene.
[0070] The game plot of the virtual game level scene requires two or more people to complete. By adding the virtual character controlled by the game client to the virtual game level scene and synchronizing the game data, multi-person interaction in the AR scene can be achieved. Figure 3 This is a rendering of a two-player shared virtual game according to an embodiment of the present invention. The virtual game level scene includes a first virtual character controlled by a first game client and a second virtual character controlled by a second game client. The first game client and the second game client are controlled by a first user and a second user respectively.
[0071] Through the above steps, the virtual game level scene and virtual characters presented on the game client are projected based on the scene information of the real scene, and game data interaction is performed in the virtual game level scene, which solves the technical problem that the virtual scene cannot be projected in the real scene in the related technology, and provides a solution for projecting the entire game scene into the real scene, which provides more game strategies and playability for multiplayer interactive games in the virtual game level scene, and realizes multiplayer AR clearance in the virtual game level scene by projecting virtual characters controlled by other game clients, reducing the restrictions on multiplayer AR gameplay.
[0072] In this embodiment, a game client (such as a mobile terminal such as a mobile phone) is used to build the coordinates of a virtual scene in the real space, and then the scene is projected. In some examples, the coordinate system of the real world is built through the ARKit tool, and the virtual game level scene, also called the Unity scene, is produced and rendered through the Unity tool (a virtual game development engine). The virtual game level scene is located in the Unity coordinate system. To achieve the conversion from the coordinate system of the world to the Unity coordinate system, the entire Unity scene is "projected" to the "real" world, which is achieved by setting the mapping relationship between the position and rotation of the game virtual camera and the real device camera. Since the scene allows players to "project" to any real position, in order to make the scene "look" always "fixed" at a certain position in the real world, it is necessary to "align" a certain point in the virtual scene (generally the center point of the scene) with a certain point in the real world (that is, a certain point in the virtual scene and a certain point in the real world will coincide when displayed on the screen).
[0073] In one implementation of this embodiment, the solution also includes: synchronizing the virtual game level scene presented on the first game client to the second game client through the game server; projecting the virtual game level scene presented on the second game client into the real scene, and synchronizing the first virtual character data controlled by the first game client to the second game client through the game server.
[0074] Optionally, before synchronizing the virtual game level scene presented on the first game client to the second game client through the game server, it is also possible to determine whether the GPS location information is the same location. If not, the above steps are performed, including: obtaining the first location information of the first game client and the second location information of the second game client; judging whether the first game client and the second game client are in the same location based on the first location information and the second location information; if the first game client and the second game client are not in the same location, determining to synchronize the virtual game level scene presented on the first game client to the second game client through the game server. After projecting the virtual game level scene presented on the first game client into the real scene, it also includes: sending the scene information and corresponding projection information of the first game client to the game server, wherein the game server is used to establish and store the association relationship between the scene information and the projection information and the virtual level room.
[0075] In this embodiment, the virtual game level scene presented on the first game client is projected onto the real scene according to the scene information to obtain the AR scene, including:
[0076] S11, keeping the virtual camera of the virtual game level scene consistent with the projection matrix of the real camera of the first game client, wherein the scene information includes the real camera and the projection information includes the virtual camera;
[0077] First of all, the projection matrix of the virtual camera must be consistent with the projection matrix of the real camera. Otherwise, the purpose cannot be achieved through a relatively simple camera coordinate transformation.
[0078] S12, determining a first reference point of the real scene in the world coordinate system, and a second reference point in the virtual game level scene in the screen coordinate system corresponding to the first reference point;
[0079] S13, converting the screen coordinate system into the world coordinate system according to the first reference point and the second reference point, and projecting the converted virtual game level scene into the real scene.
[0080] In one implementation of this embodiment, converting the screen coordinate system to the world coordinate system according to the first reference point and the second reference point includes: calculating the element ratio K of the screen coordinate system and the world coordinate system; converting the screen coordinate system to the world coordinate system according to the following formula: P3 = P1 + (P2-P0) * K; wherein P3 is the coordinate position of the virtual camera, P1 is the coordinate position of the second reference point, P2 is the coordinate position of the real camera, and P0 is the coordinate position of the first reference point. Through the conversion of the coordinate system, the conversion of virtual and real scenes in different coordinate systems can be realized.
[0081] Assuming that the position of the center point of the scene is P1 (Unity coordinate system), the corresponding position in the real world is P0 (ARKit coordinate system), and the ratio of objects in the virtual scene to objects in the real world is K, then the relationship between the virtual camera position P3 (Unity coordinate system) and the real camera (including the depth sensor) position P2 (ARKit coordinate system, i.e., world coordinate system) is: P3 = P1 + (P2 – P0) * K (the rotation of the camera is similar to this calculation). By maintaining the relationship between the virtual camera and the real camera, the effect of "projecting the scene" can be achieved. Figure 4 This is a scene projection effect diagram of an embodiment of the present invention, including a real scene and a virtual game level scene. Taking the real scene as a flat desktop as an example, Figure 5 This is an effect diagram of projecting a real scene of a level on a desktop according to an embodiment of the present invention. The left side is the first stage of rendering, and the right side is the second stage of rendering, projecting a complete virtual game level scene.
[0082] Figure 6 1 is a schematic diagram of the coordinate system conversion of an embodiment of the present invention. In a three-dimensional space, objects exist in the form of element models. Each model has its own coordinate system, just like the bounds of each graphic in a two-dimensional environment, which is the model coordinate system. Multiple objects are in the same environment, just like multiple elements in a game scene are in the same virtual scene. Each model has a corresponding coordinate position, corresponding to the frame of each graphic in the two-dimensional environment, which is the world coordinate system or the environment coordinate system. Since objects in the real world are in a three-dimensional environment, they need to be converted into two-dimensional images before they can be drawn on the screen. It is necessary to observe the model from a certain angle to see a two-dimensional picture. By setting a A virtual camera observes the model from a moving position and angle, and captures a two-dimensional picture, which is the observation coordinate system. Finally, the current environment is placed in a normalized device coordinate system. The coordinate range is based on the system settings. The normalized device coordinate system is a cube. The model in the scene is mapped to this cube. Since the coordinate range is fixed, it has nothing to do with the coordinate range of any output device. It is a normalized device coordinate system, mapped to a cube, and then cropped to crop the model that is not in the field of view. After cropping is completed, it is finally mapped to the screen coordinate system. The graphics are scanned and converted to the buffer, and then the GPU obtains the data from the buffer for display, and finally projected to the real scene.
[0083] WorldMap is used to save spatial information data scanned by the game client, such as planes, feature points, anchor points, etc., so that the application can be restored and continue to run after interruption. It can also be transmitted to other game clients so that the other party can see the same AR view in the same environment, thereby achieving a sharing effect. After an AR session has been opened for a period of time, if ARKit has recognized enough scene features, the scene features recognized by this AR session can be stored in the form of WorldMap. Other AR sessions (which can be another AR session opened later on the same device, or AR sessions on other devices) can try to parse this WorldMap. If the parsing is successful (that is, the scene "seen" by the new AR session can correspond to the scene corresponding to the WorldMap), then the new AR session can maintain the same coordinate system as the AR session corresponding to the WorldMap, providing a basis for the subsequent multi-person shared scenes and permanent storage of virtual items.
[0084] In this embodiment, game data interaction between a first virtual character controlled by a first game client and a second virtual character controlled by a second game client in a virtual game level scene includes: collecting interaction information of the virtual game level scene through the first game client or the second game client; generating control instructions for the virtual game level scene based on the interaction information; and controlling the virtual game level scene according to the control instructions.
[0085] Optionally, the first virtual character of the first game client and the second virtual character of the second game client may be a player-controlled character (PCC) or a non-player character (NPC). When controlling the first virtual character, the attributes of the virtual character may be changed by controlling the control instructions, for example, changing the character's movement state, releasing skill effects, changing the character's attack and defense state, adjusting the field of view, switching viewing angles, etc.
[0086] In an interactive scene, when the interactive information is a viewpoint ray, the control instructions for generating a virtual game level scene based on the interactive information include: locating the intersection position of the viewpoint ray to the virtual game level scene; determining the intersection position as the target position for the movement of the first virtual character; and generating a movement instruction based on the target position, wherein the movement instruction is used to instruct the first virtual character to move to the target position.
[0087] In this interactive scene, the movement of the character in the virtual game can be controlled by moving the viewpoint ray: when the player presses the screen, the viewpoint ray movement will be turned on. The ray is triggered from the virtual camera of the game and shot to the virtual scene of the game on the screen. The position where the line intersects with the scene is the target position of the character controlled by the player. When the ray intersects with the scene, the client will broadcast the starting point and end point of the ray to all other clients through the server, and then other clients can also see such a virtual "line of sight". If two players play the game in the same place, since the coordinates of the virtual world and the real world coordinates (ARKit coordinates) have been converted, the sight of other players looks like it is shot from the corresponding player's mobile phone. If the two players are in different places. Then you can still see a ray shot out from a certain position, just like there is a "hidden player" there. Figure 7 This is an effect diagram of controlling the movement of a character by using a viewpoint ray according to an embodiment of the present invention. When the viewpoint ray moves, the main control character in the virtual game also moves accordingly.
[0088] In an interactive scene, when the interactive information is the ambient volume blown into a microphone, the control instructions for generating a virtual game level scene based on the interactive information include: triggering the ambient wind field according to the ambient volume, wherein the size of the ambient wind field corresponds to the size of the ambient volume; generating wind animation parameters according to the ambient wind field, and generating a first rendering instruction, wherein the first rendering instruction is used to instruct the use of wind animation parameters to render wind animation effects in the virtual game level scene.
[0089] This interactive scene can realize the character blowing interaction. By analyzing the volume received by the microphone over a period of time, it can be determined whether the player is blowing into the phone (when blowing, the volume has a large amplitude). When the player's blowing is received, the character "seen" by the player at this time (actually the character photographed or controlled by the player's phone) will be triggered to play the animation of being blown if the distance is relatively close, and it will look like being blown down by the player. It can also trigger the wind field to control the character decorations or the scenery in the scene to flutter. Figure 8 This is a rendering of the special effect of melting ice and snow by blowing air in an embodiment of the present invention. By blowing air into the microphone, the melting of ice and snow in the virtual scene can be controlled. Fig. 9 This is a rendering of releasing a character's skill by blowing air in an embodiment of the present invention. By blowing air into a microphone, specific skills of a virtual character can be triggered.
[0090] In an interactive scenario, when the interactive information is the position information of the first game client, the control instructions for generating a virtual game level scene based on the interactive information include: determining the movement trajectory of the first game client or the second game client according to the position information; searching for character special effects matching the movement trajectory in a preset special effects library, and generating a second rendering instruction, wherein the second rendering instruction is used to instruct the rendering of the character special effects in the virtual game level scene.
[0091] This interactive scene can trigger special effects such as Qinggong by shaking the phone. By analyzing the gravitational acceleration of the phone over a period of time, it is estimated whether the player is shaking the phone upwards. When the player shakes the phone upwards, the character controlled by the player plays Qinggong movements, which looks like the player "shaking" the character up. In addition, the character's crawling effect can be triggered by putting the phone down, and the character's rolling effect can be triggered by climbing over the phone. Fig.10 This is a rendering of an embodiment of the present invention that releases character skills through gravity sensing. By shaking the game device, the virtual character's light work skills can be triggered to achieve the special effects of flying over eaves and walls.
[0092] In addition to the camera, positioning module, and microphone, the triggering hardware of this embodiment can also be a touch screen, volume button, power button, mute button, navigation button, etc. For each button, the correspondence between the button and the corresponding instruction can be pre-set. For the sensor, in addition to directly collecting the sensor status, the sensor status of a certain period can also be analyzed and processed to obtain continuous posture, gesture and other data, and the real input interaction information can be combined with the AR game strategy to make the "augmented reality" appear more realistic.
[0093] In some instances, the current AR scene can also be photographed and shared, and the game data interaction between the first virtual character controlled by the first game client and the second virtual character controlled by the second game client in the virtual game level scene includes: capturing or recording the display screen of the virtual game level scene on the display screen of the first game client or the second game client; sharing or saving the display screen.
[0094] Since both virtual objects and actual scenes are displayed on mobile phones, the photo sharing function is actually a simple screenshot function. After taking the screenshot, you get a shareable picture, which can be saved locally and shared in a variety of ways. Fig.11 It is a schematic diagram of saving a game screen by taking a screenshot according to an embodiment of the present invention.
[0095] Optionally, after adding the second virtual character controlled by the second game client to the virtual game level scene, it also includes: obtaining identification information of virtual elements in the virtual game level scene, and position information of the virtual elements in the real scene; after associating the identification information and the position information, storing them on the game server; when the first game client enters the virtual game level scene again, generating virtual elements in the real scene according to the identification information and the position information.
[0096] In some game strategies of virtual game level scenes, players are allowed to place virtual items on the virtual scene. Since the virtual scene is associated with the real physical location, the virtual items look like they are placed directly at the real location. The items placed by the players will be synchronized to other clients through the server, so each player can see the items placed by other players. If two players are in the same place, since the scenes of the two players are synchronized, the items they see will be in the same position in the real world.
[0097] In addition, the server will record all the items placed by the player in a room (record the item ID and item location) and store it together with the WorldMap data.
[0098] When the player enters the AR mode of the virtual game again at the same location or adjacent location, he can choose to use the scene data stored last time. In this case, the server will synchronize the WorldMap and all the previously stored item data to the client. If the client successfully parses the WorldMap through ARKit and re-establishes the coordinate system, the client will then use the received scene virtual item information to regenerate all virtual items at the corresponding position. It looks like the virtual items placed in the real world last time are still there. Fig.12 It is a rendering of an embodiment of the present invention associating virtual elements in a real scene.
[0099] When a new player joins the room of the host, if they are in the same location, the new player can see the items that the host had previously placed in the room, which is also accomplished through the same mechanism.
[0100] In one implementation of this embodiment, the view is restored and repaired through the stored historical world map data. After the second virtual character controlled by the second game client is added to the virtual game level scene, the method further includes: storing the world map data of the virtual game level scene at the first time, or obtaining the world map data of the virtual game level scene at the first time from the second game client, wherein the world map data is used to generate an AR view of the virtual game level scene; and reconstructing or correcting the AR view of the virtual game level scene at the second time according to the world map data.
[0101] Due to various reasons, the coordinate tracking function of ARKit session occasionally fails. In order to allow players to still have a chance to restore the AR session (AR session is the bridge between the underlying data and the AR view) in this case, ARKit can parse the WorldMap and rebuild the coordinate system. Players are allowed to re-download WorldMap related data and rebuild the scene. The reconstruction process is the same as that of players joining the room in multiplayer games.
[0102] In this embodiment, there are two sources of WorldMap data: data previously uploaded by the first game client; and data synchronized by the second game client. Therefore, players are allowed to extract and upload WorldMap data at any time, and are also allowed to download and reconstruct WorldMap data of other players in the room.
[0103] Using the correction mechanism of this embodiment, the game's AR player tolerance rate is higher, and it can self-repair and correct, avoiding the situation where the player cannot proceed due to an abnormal AR session. By adding a re-correction mechanism, the chance of the AR experience not being able to proceed normally due to the destruction of the ARSession can be reduced, which is an effective compensation solution for ARKit's own problems.
[0104] Optionally, determining the real scene based on the location information of the second game client includes: obtaining the location information of the second game client; determining whether the second game client and the first game client are in the same physical location based on the location information; if the second game client and the first game client are in the same physical location, determining the real scene based on the scene information of the first game client; if the second game client and the first game client are not in the same physical location, determining the real scene through the scene information of the current location collected by the second game client.
[0105] According to the above implementation, projecting the virtual game level scene onto the real scene includes the following examples:
[0106] Example 1: If the second game client and the first game client are in the same real scene, the world map information and scene projection information of the first game client are obtained from the game server, and the virtual game level scene is projected into the real scene according to the world map information and scene projection information;
[0107] Example 2: If the second game client and the first game client are not in the same real scene, a world map is constructed based on the scene information collected by the second game client, and the virtual game level scene is projected into the real scene based on the world map.
[0108] After the first game client logs in to the virtual game level scene, the player can then invite other players to join, either face-to-face or remotely, or the second game client can actively join, and the game server will automatically match, thereby enabling multiple players to share levels in the same game.
[0109] Here is an explanation of the game interaction process of multiplayer shared levels: when player B (corresponding to the second game client) wants to see the same scene at the same location as player A (corresponding to the first game client), in addition to synchronizing the coordinate system of ARKit through WorldMap, the projection point of player A (P0 in the above embodiment) also needs to be synchronized through the game server, and the synchronization point (P1) and K of the scene are consistent for all clients. With this information, player B also uses the same rules to handle the relationship between the virtual camera and the real camera position, and both can see the same virtual scene at the same real location.
[0110] In terms of game strategy, you can adopt the forms of "room", invitation, automatic matching, etc. Each player can create his own room and then project the scene by himself. Other players can be invited to enter the room, or actively enter the room of a friend. After entering the room of another player, the player can choose whether the two are in the same place.
[0111] If the two are in the same location, the host's WorldMap information and scene projection information will be sent to the new player through the server, and then both can see the same virtual scene in the same real location.
[0112] If two players are in different locations, the new player is allowed to project the scene by himself. In this way, although the effect of "seeing the same virtual items in the same physical location" cannot be achieved, all virtual items in the game scene can still be synchronized normally. Players can still see other players, interact with other players, transform virtual scenes together, and complete game tasks together.
[0113] In this embodiment, synchronizing the virtual game level scene presented on the first game client to the second game client through the game server includes at least one of the following: synchronizing the virtual line of sight presented on the first game client to the second game client through the game server; synchronizing the virtual trajectory of the object presented on the first game client to the second game client through the game server.
[0114] In order to maximize the gaming experience when two players are in different locations, most of the data synchronization is based on virtual scenes rather than real coordinates. For example: synchronization of virtual sight lines (players can see other players' virtual sight lines), synchronization of item trajectories (players' trajectory of launching virtual items in certain gameplay), etc. Even if they are in different places, two people can feel that the other person is right next to them.
[0115] When player A creates a virtual room on the first game client, the server will synchronize the room information to all of the player's friends, and the friends can choose to enter the room. After player A projects the scene to the real physical location, the client will collect the current WorldMap, and send the WorldMap and the associated scene data (scene projection point) to the server. The server will associate this data with the room and store it.
[0116] In some scenarios of the present embodiment, synchronizing the scene information and corresponding projection information of the real scene collected by the first game client to the second game client through the game server includes: determining that the second game client enters the virtual level room where the first game client is located, and the second game client and the first game client are in the same physical location; if the first game client has synchronized the scene information and the corresponding projection information, the game server sends the scene information and the corresponding projection information to the second game client; if the first game client has not synchronized the scene information and the corresponding projection information, the game server sends the scene information and the corresponding projection information to the second game client after determining that the first game client has completed synchronization.
[0117] When a new player B joins A's virtual room on the second game client, and both are in the same physical location. If A has synchronized his scene information, the server will directly send this data to B. Otherwise, B will not receive the corresponding data until A projects the scene and synchronizes the information. When B gets this data, the client will try to parse the WorldMap through ARKit and associate the world that A "sees" with the world that B "sees". After the association is successful, both can "see" the same world. If B and A are not in the same place, B will project the scene by himself, and then both will see the same virtual scene.
[0118] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0119] Example 2
[0120] In the present embodiment, a device for loading a virtual game is also provided, which is used to implement the above-mentioned embodiments and preferred embodiments, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceived.
[0121] Fig.13 is a structural block diagram of a device for loading a virtual game according to an embodiment of the present invention. Fig.13 As shown, the device includes: a collection module 130, a projection module 132, a first synchronization module 134, a joining module 136, and a control module 138, wherein:
[0122] The collection module 130 is used to collect scene information of the real scene through the first game client;
[0123] A projection module 132, configured to project the virtual game level scene presented on the first game client into the real scene according to the scene information and the corresponding projection information;
[0124] A first synchronization module 134, used to synchronize the scene information of the real scene and the corresponding projection information collected by the first game client to the second game client through the game server;
[0125] A joining module 136, configured to join a first virtual character controlled by a first game client to the virtual game level scene, and to join a second virtual character controlled by a second game client to the virtual game level scene;
[0126] The control module 138 is used to control the first virtual character controlled by the first game client and the second virtual character controlled by the second game client to interact with each other in the virtual game level scene.
[0127] Optionally, the device also includes: a second synchronization module, used to synchronize the virtual game level scene presented on the first game client to the second game client through the game server; a processing module, used to project the virtual game level scene presented on the second game client into the real scene, and synchronize the first virtual character data controlled by the first game client to the second game client through the game server.
[0128] Optionally, the device also includes: a first acquisition module, used to acquire first position information of the first game client and second position information of the second game client before the second synchronization module synchronizes the virtual game level scene presented on the first game client to the second game client through the game server; a judgment module, used to judge whether the first game client and the second game client are in the same location based on the first position information and the second position information; and a determination module, used to determine to synchronize the virtual game level scene presented on the first game client to the second game client through the game server if the first game client and the second game client are not in the same location.
[0129] Optionally, the second synchronization module includes at least one of the following: a first synchronization unit, used to synchronize the virtual line of sight presented on the first game client to the second game client through the game server; a second synchronization unit, used to synchronize the virtual trajectory of the object presented on the first game client to the second game client through the game server.
[0130] Optionally, the device also includes: a sending module, used to send the scene information and corresponding projection information of the first game client to the game server after the projection module projects the virtual game level scene presented on the first game client into the real scene, wherein the game server is used to establish and store the association relationship between the scene information and the projection information and the virtual level room.
[0131] Optionally, the first synchronization module includes: a first determination unit, used to determine that the second game client enters the virtual level room where the first game client is located, and that the second game client and the first game client are in the same physical location; a sending unit, used to if the first game client has synchronized the scene information and the corresponding projection information, the game server sends the scene information and the corresponding projection information to the second game client; if the first game client has not synchronized the scene information and the corresponding projection information, the game server sends the scene information and the corresponding projection information to the second game client after determining that the first game client has completed synchronization.
[0132] Optionally, the first synchronization module includes: a maintaining unit, used to keep the virtual camera of the virtual game level scene consistent with the projection matrix of the real camera of the first game client, wherein the scene information includes the real camera and the projection information includes the virtual camera; a second determining unit, used to determine a first reference point of the real scene in the world coordinate system, and a second reference point in the virtual game level scene corresponding to the first reference point in the screen coordinate system; a conversion unit, used to convert the screen coordinate system into the world coordinate system according to the first reference point and the second reference point, and project the converted virtual game level scene onto the real scene.
[0133] Optionally, the conversion unit includes: a calculation subunit, used to calculate the element ratio K between the screen coordinate system and the world coordinate system; a conversion subunit, used to convert the screen coordinate system into the world coordinate system according to the following formula: P3=P1+(P2-P0)*K; wherein P3 is the coordinate position of the virtual camera, P1 is the coordinate position of the second reference point, P2 is the coordinate position of the real camera, and P0 is the coordinate position of the first reference point.
[0134] Optionally, the control module includes: a collection unit, used to collect interaction information of the virtual game level scene through the first game client or the second game client; a generation unit, used to generate control instructions for the virtual game level scene based on the interaction information; and a control unit, used to control the virtual game level scene according to the control instructions.
[0135] Optionally, when the interaction information is a viewpoint ray, the generation unit includes: a positioning subunit, used to locate the intersection position of the viewpoint ray to the virtual game level scene; a first determination subunit, used to determine the intersection position as the target position for the movement of the first virtual character; and a first generation subunit, used to generate a movement instruction based on the target position, wherein the movement instruction is used to instruct the first virtual character to move to the target position.
[0136] Optionally, when the interactive information is the ambient volume blown into a microphone, the generating unit includes: a triggering subunit, used to trigger the ambient wind field according to the ambient volume, wherein the size of the ambient wind field corresponds to the size of the ambient volume; a second generating subunit, used to generate wind animation parameters according to the ambient wind field, and generate a first rendering instruction, wherein the first rendering instruction is used to instruct the use of the wind animation parameters to render wind animation special effects in the virtual game level scene.
[0137] Optionally, when the interaction information is the position information of the first game client or the second game client, the generation unit includes: a second determination subunit, used to determine the movement trajectory of the first game client or the second game client according to the position information; a third generation subunit, used to search for a character special effect matching the movement trajectory in a preset special effects library, and generate a second rendering instruction, wherein the second rendering instruction is used to instruct the rendering of the character special effect in the virtual game level scene.
[0138] Optionally, the control module includes: an acquisition unit, used to capture or record a display screen of the virtual game level scene on a display screen of the first game client or the second game client; and a sharing unit, used to share or save the display screen.
[0139] Optionally, the device also includes: a second acquisition module, used to obtain the identification information of the virtual elements in the virtual game level scene and the position information of the virtual elements in the real scene after the joining module adds the second virtual character controlled by the second game client to the virtual game level scene; a first storage module, used to associate the identification information and the position information and store them in the game server; and a generation module, used to generate the virtual elements in the real scene according to the identification information and the position information when the first game client enters the virtual game level scene again.
[0140] Optionally, the device also includes: a second storage module, used to store the world map data of the virtual game level scene at the first time after the joining module adds the second virtual character controlled by the second game client to the virtual game level scene, or to obtain the world map data of the virtual game level scene at the first time from the second game client, wherein the world map data is used to generate an AR view of the virtual game level scene; and a construction module, used to reconstruct or correct the AR view of the virtual game level scene at the second time according to the world map data.
[0141] According to another embodiment of the present invention, a system for loading a virtual game is provided, including a first game client, a second game client, and a game server, including the apparatus as described in the above embodiment.
[0142] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.
[0143] Example 3
[0144] An embodiment of the present invention further provides a storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.
[0145] Optionally, in this embodiment, the storage medium may be configured to store a computer program for performing the following steps:
[0146] S1, collecting scene information of a real scene through a first game client;
[0147] S2, projecting the virtual game level scene presented on the first game client into the real scene according to the scene information and the corresponding projection information;
[0148] S3, synchronizing the scene information of the real scene and the corresponding projection information collected by the first game client to the second game client through the game server;
[0149] S4, adding a first virtual character controlled by a first game client to the virtual game level scene, and adding a second virtual character controlled by a second game client to the virtual game level scene;
[0150] S5, a first virtual character controlled by the first game client and a second virtual character controlled by the second game client interact with each other in the virtual game level scene.
[0151] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.
[0152] An embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0153] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0154] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0155] S1, collecting scene information of a real scene through a first game client;
[0156] S2, projecting the virtual game level scene presented on the first game client into the real scene according to the scene information and the corresponding projection information;
[0157] S3, synchronizing the scene information of the real scene and the corresponding projection information collected by the first game client to the second game client through the game server;
[0158] S4, adding a first virtual character controlled by a first game client to the virtual game level scene, and adding a second virtual character controlled by a second game client to the virtual game level scene;
[0159] S5, a first virtual character controlled by the first game client and a second virtual character controlled by the second game client interact with each other in the virtual game level scene.
[0160] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.
[0161] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0162] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0163] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0164] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0165] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0166] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.
[0167] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A method for loading a virtual game, It is characterized in that include: Collecting scene information of the real scene through the first game client; Projecting the virtual game level scene presented on the first game client into the real scene according to the scene information and the corresponding projection information; Synchronize the scene information of the real scene and the corresponding projection information collected by the first game client to the second game client through the game server; Adding a first virtual character controlled by a first game client to the virtual game level scene; Adding a second virtual character controlled by a second game client to the virtual game level scene; A first virtual character controlled by a first game client and a second virtual character controlled by a second game client interact with each other in the virtual game level scene; Among them, the method for interacting with game data includes: collecting interaction information of the virtual game level scene through the first game client or the second game client; generating control instructions for the virtual game level scene based on the interaction information; controlling the virtual game level scene according to the control instructions; wherein, when the interaction information is a viewpoint ray, it specifically includes: locating the intersection position of the viewpoint ray to the virtual game level scene; determining the intersection position as the target position of the movement of the first virtual character; generating a movement instruction according to the target position, wherein the movement instruction is used to instruct the first virtual character to move to the target position.
2. The method according to claim 1, It is characterized in that The method further comprises: Synchronizing the virtual game level scene presented on the first game client to the second game client via the game server; The virtual game level scene presented on the second game client is projected into the real scene, and the first virtual character data controlled by the first game client is synchronized to the second game client through the game server.
3. The method according to claim 2, It is characterized in that Before synchronizing the virtual game level scene presented on the first game client to the second game client via the game server, the method further includes: Obtaining first location information of a first game client and second location information of a second game client; Determining whether the first game client and the second game client are in the same location according to the first location information and the second location information; If the first game client and the second game client are not in the same location, determine to synchronize the virtual game level scene presented on the first game client to the second game client through the game server.
4. The method according to claim 2, It is characterized in that Synchronizing the virtual game level scene presented on the first game client to the second game client through the game server includes at least one of the following: Synchronizing the virtual sight presented on the first game client to the second game client via the game server; The virtual track of the item presented on the first game client is synchronized to the second game client through the game server.
5. The method according to claim 1, It is characterized in that Synchronizing the scene information of the real scene and the corresponding projection information collected by the first game client to the second game client through the game server includes: Determining that the second game client enters the virtual level room where the first game client is located, and the second game client and the first game client are in the same physical location; If the first game client has synchronized the scene information and the corresponding projection information, the game server will send the scene information and the corresponding projection information to the second game client; if the first game client has not synchronized the scene information and the corresponding projection information, the game server will send the scene information and the corresponding projection information to the second game client after determining that the first game client has completed the synchronization.
6. The method according to claim 1, It is characterized in that Projecting the virtual game level scene presented on the first game client to the real scene according to the scene information and the corresponding projection information includes: Keeping the projection matrix of the virtual camera of the virtual game level scene consistent with the real camera of the first game client, wherein the scene information includes the real camera and the projection information includes the virtual camera; Determine a first reference point of the real scene in a world coordinate system, and a second reference point in the virtual game level scene in a screen coordinate system corresponding to the first reference point; The screen coordinate system is converted into the world coordinate system according to the first reference point and the second reference point, and the converted virtual game level scene is projected into the real scene.
7. The method according to claim 6, It is characterized in that Converting the screen coordinate system into the world coordinate system according to the first reference point and the second reference point comprises: Calculating the element ratio K of the screen coordinate system and the world coordinate system; The screen coordinate system is converted to the world coordinate system according to the following formula: P3 = P1 + (P2 – P0) * K; Among them, P3 is the coordinate position of the virtual camera, P1 is the coordinate position of the second reference point, P2 is the coordinate position of the real camera, and P0 is the coordinate position of the first reference point.
8. The method according to claim 1, It is characterized in that When the interaction information is the ambient volume blown into a microphone, the control instruction for generating the virtual game level scene based on the interaction information includes: triggering an environmental wind field according to the environmental volume, wherein the size of the environmental wind field corresponds to the size of the environmental volume; Wind animation parameters are generated according to the environmental wind field, and a first rendering instruction is generated, wherein the first rendering instruction is used to instruct the use of the wind animation parameters to render wind animation effects in the virtual game level scene.
9. The method according to claim 1, It is characterized in that When the interaction information is the position information of the first game client or the second game client, generating the control instruction of the virtual game level scene based on the interaction information includes: Determine a movement trajectory of the first game client or the second game client according to the position information; Searching for a character special effect matching the movement trajectory in a preset special effect library, and generating a second rendering instruction, wherein the second rendering instruction is used to instruct rendering the character special effect in the virtual game level scene.
10. The method according to claim 1, It is characterized in that After projecting the virtual game level scene presented on the first game client into the real scene, the method further includes: The scene information and corresponding projection information of the first game client are sent to a game server, wherein the game server is used to establish and store an association relationship between the scene information, the projection information and a virtual level room.
11. The method according to claim 1, It is characterized in that The game data interaction between the first virtual character controlled by the first game client and the second virtual character controlled by the second game client in the virtual game level scene includes: Intercepting or recording a display screen of the virtual game level scene on a display screen of the first game client or the second game client; Share or save the display.
12. The method according to claim 1, It is characterized in that After adding the second virtual character controlled by the second game client to the virtual game level scene, the method further includes: Acquire identification information of virtual elements in the virtual game level scene, and position information of the virtual elements in the real scene; After associating the identification information with the location information, the association is performed and the association is performed on a game server; When the first game client enters the virtual game level scene again, the virtual element is generated in the real scene according to the identification information and the position information.
13. The method according to claim 1, It is characterized in that After adding the second virtual character controlled by the second game client to the virtual game level scene, the method further includes: Storing world map data of the virtual game level scene at the first time, or acquiring world map data of the virtual game level scene at the first time from the second game client, wherein the world map data is used to generate an AR view of the virtual game level scene; The AR view of the virtual game level scene at a second time is reconstructed or corrected according to the world map data.
14. A device for loading a virtual game, It is characterized in that include: A collection module, used to collect scene information of a real scene through a first game client; A projection module, configured to project the virtual game level scene presented on the first game client into the real scene according to the scene information and the corresponding projection information; A first synchronization module, used to synchronize the scene information of the real scene and the corresponding projection information collected by the first game client to the second game client through the game server; A joining module, used to add a first virtual character controlled by a first game client to the virtual game level scene, and to add a second virtual character controlled by a second game client to the virtual game level scene; A control module, used to control a first virtual character controlled by a first game client and a second virtual character controlled by a second game client to interact with each other in the virtual game level scene; Among them, the control module is specifically used to collect interaction information of the virtual game level scene through the first game client or the second game client; generate control instructions for the virtual game level scene based on the interaction information; control the virtual game level scene according to the control instructions; wherein, when the interaction information is a viewpoint ray, it specifically includes: locating the intersection position of the viewpoint ray to the virtual game level scene; determining the intersection position as the target position of the movement of the first virtual character; generating a movement instruction according to the target position, wherein the movement instruction is used to instruct the first virtual character to move to the target position.
15. The device according to claim 14, It is characterized in that The device also includes: A second synchronization module, used to synchronize the virtual game level scene presented on the first game client to the second game client through the game server; The processing module is used to project the virtual game level scene presented on the second game client into the real scene, and synchronize the first virtual character data controlled by the first game client to the second game client through the game server.
16. The device according to claim 14, It is characterized in that The first synchronization module comprises: A maintaining unit, configured to keep the projection matrix of the virtual camera of the virtual game level scene consistent with the projection matrix of the real camera of the first game client, wherein the scene information includes the real camera and the projection information includes the virtual camera; A second determining unit, configured to determine a first reference point of the real scene in the world coordinate system, and a second reference point in the virtual game level scene in the screen coordinate system corresponding to the first reference point; A conversion unit is used to convert the screen coordinate system into the world coordinate system according to the first reference point and the second reference point, and project the converted virtual game level scene into the real scene.
17. A storage medium, It is characterized in that The storage medium stores a computer program, wherein the computer program is configured to execute the method according to any one of claims 1 to 13 when executed.
18. An electronic device comprising a memory and a processor, It is characterized in that A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 1 to 13.
