[go: up one dir, main page]

WO2022032476A1 - Data processing method and apparatus for web game, and electronic device and computer readable storage medium - Google Patents

Data processing method and apparatus for web game, and electronic device and computer readable storage medium Download PDF

Info

Publication number
WO2022032476A1
WO2022032476A1 PCT/CN2020/108423 CN2020108423W WO2022032476A1 WO 2022032476 A1 WO2022032476 A1 WO 2022032476A1 CN 2020108423 W CN2020108423 W CN 2020108423W WO 2022032476 A1 WO2022032476 A1 WO 2022032476A1
Authority
WO
WIPO (PCT)
Prior art keywords
data processing
file
web game
code
binary character
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Ceased
Application number
PCT/CN2020/108423
Other languages
French (fr)
Chinese (zh)
Inventor
申基
林顺
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xiamen Yaji Software Co Ltd
Original Assignee
Xiamen Yaji Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Xiamen Yaji Software Co Ltd filed Critical Xiamen Yaji Software Co Ltd
Priority to PCT/CN2020/108423 priority Critical patent/WO2022032476A1/en
Publication of WO2022032476A1 publication Critical patent/WO2022032476A1/en
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/60Generating or modifying game content before or while executing the game program, e.g. authoring tools specially adapted for game development or game-integrated level editor

Definitions

  • the present application relates to the field of computer technology, and in particular, the present invention relates to a web game data processing method, apparatus, electronic device, and computer-readable storage medium.
  • Web games also known as web games, are online multiplayer interactive games based on web browsers. There is no need to download the client and there is no problem of insufficient machine configuration. However, for some large-scale scene games, heavy Massive Multiplayer Online (MMO), etc., there may be time-consuming data processing such as scene node update, scene cropping, skeletal animation update, particle update, etc., which limits the performance of web games. developing.
  • MMO Massive Multiplayer Online
  • a data processing method for a web game comprising:
  • the method further includes:
  • the glue code file is a file composed of JavaScript language.
  • the native language file includes binding code and data processing code
  • a preset compiler is used to convert the native language file of the web game into a glue code file and a binary character file, including:
  • the data processing code is converted into a glue code file and a binary character file by using the binding code.
  • Both the binding code and the data processing code are codes written in the native language.
  • a thread for performing data processing operations corresponding to each data processing request is established based on the binary character file, including:
  • a thread for performing data processing operations corresponding to each data processing request is respectively established, including:
  • the binary character file is called to establish a thread for performing data processing operations corresponding to each data processing request.
  • the default compiler is EmScripten.
  • a data processing device for a web game comprising:
  • the conversion module is configured to use a preset compiler to convert the native language file of the web game into a binary character file
  • the establishment module is configured to, when multiple data processing requests related to the web game are received, respectively establish a thread for performing data processing operations corresponding to each data processing request based on the binary character file;
  • the execution module is configured to execute the corresponding data processing operation based on the SOA data structure and the single instruction multiple data flow through each thread.
  • the conversion module is further configured to use a preset compiler to convert the native language file of the web game into a glue code file, where the glue code file is a file composed of JavaScript language.
  • an electronic device comprising:
  • processors one or more processors
  • One or more application programs wherein the one or more application programs are stored in memory and configured to be executed by one or more processors, the one or more programs are configured to: execute any of the above implementations.
  • a third aspect of the present application provides a computing device, including: a processor, a memory, a communication interface, and a communication bus, and the processor, the memory, and the communication interface communicate with each other through the communication bus;
  • the memory is used for storing at least one executable instruction, and the executable instruction enables the processor to perform operations corresponding to the data processing method of the web game shown in the first aspect of the present application.
  • a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, implements the data processing method for a web game according to the first aspect.
  • the relevant engine cannot directly call the native language, and the compiler converts the native language file into a binary character file, and the relevant engine can run the binary character file, and the execution efficiency of binary characters is similar to that of the native language.
  • the execution efficiency of the relevant engine for executing the binary character file is much higher than the execution efficiency of the relevant engine for executing the file designed based on JavaScript.
  • FIG. 1 is a schematic flowchart of a data processing method for a netizen game provided by an embodiment of the present application
  • FIG. 2 is a schematic structural diagram of a data processing device for a web game provided by an embodiment of the present application
  • Fig. 3 is a schematic structural diagram of an electronic device of a data processing apparatus for a web game provided by an embodiment of the present application.
  • the data of this structure can organize the data compactly, which is conducive to the efficient access of the central processing unit, that is, all the cores of the central processing unit can be used to process the data of this structure at the same time, and realize the hardware device (ie, the device running the native platform). for multithreading purposes.
  • SIMD Single Instruction Multiple Data
  • SIMD can copy multiple operands and pack them in a set of instruction sets of large registers, using a controller to control multiple processors and simultaneously process a set of data ( Also known as a data vector), each of which performs the same operation separately to implement spatial parallelism.
  • JavaScript is a literal translation scripting language. It is a dynamically typed, weakly typed, prototype-based language with built-in support types. The emergence of JavaScript enables a real-time, dynamic, and interactive interaction between web pages and users. relationship, so that the web page contains more active elements and more exciting content.
  • the JavaScript engine is a part of the browser and is widely used as a client-side scripting language. It was first used to add dynamic functions to hypertext markup language web pages. Compared with native languages such as C++, JavaScript has lower execution efficiency, which limits the development of some Web games, such as the time-consuming rendering of games to be developed.
  • the data processing method, device, electronic device and storage medium for web games provided by the present application aim to solve the above technical problems in the prior art.
  • An embodiment of the present application provides a data processing method for a web game, as shown in FIG. 1 , the method may include:
  • the native language file is a file that uses native language programming, such as a native language file that uses C/C++ language programming.
  • a binary character file is a file composed of binary characters, such as a WebAssembly file.
  • the compiler can convert native language files into binary character files, such as EmScripten, etc. For example, WebAssembly files can be compiled by EmScripten.
  • EmScripten is a compiler project that can convert C++ language code into WebAssembly files, and improve computing efficiency through the direct invocation of WebAssembly files by web game engines.
  • Many browser game engines support calling WebAssembly files, such as Google Chrome, Microsoft Edge, Mozilla Firefox, and Safari.
  • the web game engine When multiple data processing requests related to web games are received, the web game engine directly calls the binary character file, and based on the binary character file, establishes a thread for performing data processing operations corresponding to each data processing request, and executes the data processing operation by multiple threads at the same time. Multiple data processing operations to speed up data processing.
  • each thread executes a data processing operation, it performs similar processing on multiple data at the same time according to the data processing instruction for executing the data processing operation. Further speed up data processing.
  • the SOA data structure When the traditional structure array performs data processing operations, data processing is performed in the form of processing x1 ⁇ y1 ⁇ z1 first, then processing x2 ⁇ y2 ⁇ z2, and then processing x3 ⁇ y3 ⁇ z3 again.
  • the SOA data structure When the SOA data structure performs data processing operations, it can perform data processing in the form of x ⁇ y ⁇ z according to a data processing instruction, that is, first process the data x (including x1, x2, x3, etc.) to obtain the data y (including y1, y2, y3, etc.), and then process data y to obtain data z (including z1, z2, z3, etc.). Therefore, the data structure of SOA is more conducive to the operation of single instruction and multiple data streams, so that one processing instruction can perform parallel calculation of multiple data and improve the operation rate.
  • the relevant engine cannot directly call the native language, and the native language file is converted into a binary character file by a compiler.
  • the relevant engine can run the binary character file, and the binary character
  • the execution efficiency of the corresponding engine is similar to the execution efficiency of the native language, and the execution efficiency of the relevant engine executing the binary character file is much higher than the execution efficiency of the relevant engine executing the file designed based on JavaScript.
  • a thread corresponding to each data processing request is established, and through each thread, the corresponding data processing operation is performed based on the SOA data structure and single instruction multiple data stream, and the corresponding data processing operation can be performed. The time required for data processing is further shortened, and the restrictions on the development of web games are lowered.
  • the method may further include S104 (not marked in the figure):
  • the native language file includes binding code and data processing code
  • a preset compiler is used to convert the native language file of the web game into a glue code file and a binary character file (S101 and S104), including S105 (not marked in the figure):
  • the data processing code is converted into a glue code file and a binary character file by using the binding code, and both the binding code and the data processing code are codes written in native languages.
  • native language codes can be converted into binary character files in two ways. Take the default compiler as the EmScripten tool, the native language code as the C++ code, and the binary character file as the WebAssembly file as an example:
  • the C++ code also includes data processing code.
  • a js file and a wasm file are generated.
  • the js file is the glue code file that connects the JavaScript and the wasm file
  • the wasm file is a binary character file. This method is suitable for newly developed modules, and can write binding code while writing C++ code.
  • the binding code is also known as the export code.
  • the binding code is written in the native language, and the compiler can know the interface that needs to be exposed to the engine of the web game according to the binding code, so that the compiler can base the binding code on the interface.
  • Glue code is also called glue code in the field of computer programming. Glue code does not implement any function required by the program, and usually appears in the code to enable existing libraries or programs to interoperate in external function interfaces (such as Java native interfaces). Glue code is very efficient in rapid prototyping, allowing several Components are quickly integrated into a single language or framework.
  • the EmScripten tool the data processing code in the native language file can be converted into a glue code file and a binary character file according to the binding code.
  • the native language file is the code written by the engineer using the native language, such as the code file written in the C language, C++ language, etc., including the binding code and the data processing code.
  • the glue code file is obtained after the compiler converts the data processing code based on the binding code, and is a file composed of the JavaScript language.
  • the binary character file is obtained after the compiler converts the data processing code based on the binding code, and is a file composed of binary characters, such as a WebAssembly file.
  • S102 may include S1021 (not marked in the figure) and S1022 (not marked in the figure):
  • S102 may include S1023 (not marked in the figure):
  • the preset compiler is EmScripten.
  • the engine of the web game can use the glue code file to call and read the binary character file. Based on the binary character file, multiple threads for performing data processing operations corresponding to the data processing request are established. Based on the SOA data structure and single instruction multiple data stream execution Corresponding data processing operations.
  • the data processing code includes code for establishing multiple threads for performing data processing operations corresponding to data processing requests, code for performing corresponding data processing operations based on SOA data structures, and performing corresponding data processing based on single instruction multiple data streams.
  • Operation code When the compiler uses the binding code to convert the data processing code into a glue code file and a binary character file, the binary character file corresponds to the code that establishes multiple threads for performing data processing operations corresponding to the data processing request, and the SOA-based data structure. The code for performing the corresponding data processing operation and the code for performing the corresponding data processing operation based on the single instruction multiple data stream.
  • the relevant engine cannot directly call the native language, and the native language file is converted into a binary character file by a compiler.
  • the relevant engine can run the binary character file, and the binary character
  • the execution efficiency of the related engine is similar to that of the native language, and the execution efficiency of the relevant engine to execute the binary character file is much higher than the execution efficiency of the relevant engine to execute the file designed based on JavaScript.
  • the data processing apparatus 20 for a web game may include: a conversion module 201, a creation module 202, and an execution module 203, wherein,
  • the conversion module 201 is configured to use a preset compiler to convert the native language file of the web game into a binary character file;
  • the establishment module 202 is configured to, when receiving multiple data processing requests related to the web game, respectively establish a thread for performing data processing operations corresponding to each data processing request based on the binary character file;
  • the execution module 203 is configured to execute corresponding data processing operations based on the SOA data structure and the single instruction multiple data flow through each thread.
  • the data processing apparatus for a web game in this embodiment can execute the data processing method for a web game provided in Embodiment 1 of the present application, and the implementation principle thereof is similar, which will not be repeated here.
  • the relevant engine cannot directly call the native language, and the native language file is converted into a binary character file by a compiler.
  • the relevant engine can run the binary character file, and the binary character
  • the execution efficiency of the related engine is similar to that of the native language, and the execution efficiency of the relevant engine to execute the binary character file is much higher than the execution efficiency of the relevant engine to execute the file designed based on JavaScript.
  • the conversion module 201 is further configured to use a preset compiler to convert the native language file of the web game into a glue code file, where the glue code file is a file composed of JavaScript language.
  • the native language file includes binding code and data processing code:
  • the conversion module 201 is further configured to convert the data processing code into a glue code file and a binary character file by using a binding code based on a preset compiler, where both the binding code and the data processing code are codes written in native languages.
  • the establishment module 202 may include a reading module (not shown in the figure) and a first establishment module (not shown in the figure):
  • the reading module is configured to read the binary character file through the glue code file when receiving multiple data processing requests related to the web game
  • the first establishment module is configured to establish, based on the binary character file, threads for executing data processing operations corresponding to respective data processing requests.
  • the establishment module 202 is further configured to use the engine of the web game to call the binary character file to respectively establish a thread for performing data processing operations corresponding to each data processing request.
  • the preset compiler is EmScripten.
  • the data processing apparatus for a web game in this embodiment can execute the data processing method for a web game provided in Embodiment 1 of the present application, and the implementation principle thereof is similar, which will not be repeated here.
  • the relevant engine cannot directly call the native language, and the native language file is converted into a binary character file by a compiler.
  • the relevant engine can run the binary character file, and the binary character
  • the execution efficiency of the related engine is similar to that of the native language, and the execution efficiency of the relevant engine to execute the binary character file is much higher than the execution efficiency of the relevant engine to execute the file designed based on JavaScript.
  • the electronic device 2000 shown in FIG. 3 may include: a processor 2001 and a transceiver 2004 .
  • the processor 2001 is connected to the transceiver 2004, for example, through the bus 2002.
  • the electronic device 2000 may further include a memory 2003 .
  • the transceiver 2004 is not limited to one, and the structure of the electronic device 2000 does not constitute a limitation to the embodiments of the present application.
  • the processor 2001 may be applied in the embodiments of the present application to implement the functions of the execution module 203 shown in the foregoing embodiments.
  • the transceiver 2004 includes a receiver and a transmitter, and the transceiver 2004 is used in the embodiments of the present application to implement the functions of the establishment module 202 shown in the foregoing embodiments.
  • the processor 2001 may be a CPU, general purpose processor, DSP, ASIC, FPGA or other programmable logic device, transistor logic device, hardware component, or any combination thereof. It may implement or execute the various exemplary logical blocks, modules and circuits described in connection with this disclosure.
  • the processor 2001 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and the like.
  • the bus 2002 may include a path to transfer information between the aforementioned components.
  • the bus 2002 may be a PCI bus, an EISA bus, or the like.
  • the bus 2002 can be divided into an address bus, a data bus, a control bus, and the like. For ease of presentation, only one thick line is used in FIG. 3, but it does not mean that there is only one bus or one type of bus.
  • the memory 2003 can be ROM or other types of static storage devices that can store static information and instructions, RAM or other types of dynamic storage devices that can store information and instructions, or EEPROM, CD-ROM or other optical disk storage, optical disk storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or capable of carrying or storing desired program code in the form of instructions or data structures and capable of being executed by a computer Access any other medium without limitation.
  • the memory 2003 is used to store the application code for executing the solution of the present application, and the execution is controlled by the processor 2001 .
  • the processor 2001 is configured to execute the application program code stored in the memory 2003, so as to realize the actions of the data processing apparatus for the web game provided by the above embodiments.
  • Embodiments of the present application provide a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, implements the data processing method of the web game shown in the foregoing embodiments.
  • the embodiment of the present application provides a computer-readable storage medium.
  • the relevant engine cannot directly call the native language, and the compiler is used to convert the native language file into binary characters. file, the relevant engine can run the binary character file, and the execution efficiency of the binary character is similar to that of the native language, and the execution efficiency of the relevant engine executing the binary character file is much higher than the execution efficiency of the relevant engine executing the file designed based on JavaScript.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

A data processing method and apparatus for a web game, and an electronic device and a computer readable storage medium. The method comprises: converting a native language file of a web game into a binary character file by using a preset compiler (S101); when multiple data processing requests related to the web game are received, respectively establishing, on the basis of the binary character file, threads executing data processing operations and corresponding to the data processing requests (S102); and by means of the threads, executing the corresponding data processing operations on the basis of a data structure of SOA and a single-instruction multi-data stream (S103). According to the method, the execution efficiency of the web game is preliminarily improved by using the binary character file, the time required for data processing is shortened, and on this basis, the corresponding data processing operations are executed by using the multiple threads for executing the data processing operations, the data structure of SOA, and the single-instruction multi-data stream, so that the time required for data processing is further shortened, and restrictions on the development of web games are reduced.

Description

网页游戏的数据处理方法、装置、电子设备及计算机可读存储介质Data processing method, device, electronic device and computer-readable storage medium for web game 技术领域technical field

本申请涉及计算机技术领域,具体而言,本发明涉及一种网页游戏数据处理方法、装置、电子设备及计算机可读存储介质。The present application relates to the field of computer technology, and in particular, the present invention relates to a web game data processing method, apparatus, electronic device, and computer-readable storage medium.

背景技术Background technique

网页游戏又称Web游戏,是基于Web浏览器的网络在线多人互动游戏,无需下载客户端且不存在机器配置不够的问题。但对于一些大型场景游戏、重度大型多人在线游戏(Massive Multiplayer Online,MMO)等,可能存在场景节点更新、场景裁剪、骨骼动画更新、粒子更新等比较耗时的数据处理,限制了网页游戏的发展。Web games, also known as web games, are online multiplayer interactive games based on web browsers. There is no need to download the client and there is no problem of insufficient machine configuration. However, for some large-scale scene games, heavy Massive Multiplayer Online (MMO), etc., there may be time-consuming data processing such as scene node update, scene cropping, skeletal animation update, particle update, etc., which limits the performance of web games. developing.

发明内容SUMMARY OF THE INVENTION

第一方面,提供了一种网页游戏的数据处理方法,该方法包括:In a first aspect, a data processing method for a web game is provided, the method comprising:

利用预设的编译器将网页游戏的原生语言文件转化为二进制字符文件;Use the preset compiler to convert the native language files of web games into binary character files;

当接收到与网页游戏相关的多个数据处理请求时,基于二进制字符文件分别建立与各个数据处理请求对应的执行数据处理操作的线程;When multiple data processing requests related to the web game are received, a thread for performing data processing operations corresponding to each data processing request is established respectively based on the binary character file;

通过各个线程,基于SOA的数据结构和单指令多数据流执行相应的数据处理操作。Through each thread, the corresponding data processing operations are performed based on the SOA data structure and single instruction multiple data flow.

在一个可能的实现方式中,该方法还包括:In a possible implementation, the method further includes:

利用预设的编译器将网页游戏的原生语言文件转化为胶水代码文件,胶水代码文件为由JavaScript语言组成的文件。Use a preset compiler to convert the native language file of the web game into a glue code file, and the glue code file is a file composed of JavaScript language.

在一个可能的实现方式中,原生语言文件包括绑定代码和数据处理代码,利用预设的编译器将网页游戏的原生语言文件转化为胶水代码文件及二进制字符文件,包括:In a possible implementation manner, the native language file includes binding code and data processing code, and a preset compiler is used to convert the native language file of the web game into a glue code file and a binary character file, including:

基于预设的编译器,利用绑定代码将数据处理代码转化为胶水代码文件和二进制字符文件,绑定代码和数据处理代码均为由原生语言编写的代码。Based on the preset compiler, the data processing code is converted into a glue code file and a binary character file by using the binding code. Both the binding code and the data processing code are codes written in the native language.

在一个可能的实现方式中,当接收到与网页游戏相关的多个数据处理请求时,基于二进制字符文件分别建立与各个数据处理请求对应的执行数据处理操作的线程,包括:In a possible implementation manner, when multiple data processing requests related to the web game are received, a thread for performing data processing operations corresponding to each data processing request is established based on the binary character file, including:

当接收到与网页游戏相关的多个数据处理请求时,通过胶水代码文件读取二进制字符文件;When multiple data processing requests related to the web game are received, read the binary character file through the glue code file;

基于二进制字符文件,分别建立与各个数据处理请求对应的执行数据处理操作的线程。Based on the binary character file, threads for performing data processing operations corresponding to each data processing request are established respectively.

在一个可能的实现方式中,基于二进制字符文件分别建立与各个数据处理请求对应的执行数据处理操作的线程,包括:In a possible implementation manner, based on the binary character file, a thread for performing data processing operations corresponding to each data processing request is respectively established, including:

利用网页游戏的引擎,调用二进制字符文件分别建立与各个数据处理请求对应的执行数据处理操作的线程。Using the engine of the web game, the binary character file is called to establish a thread for performing data processing operations corresponding to each data processing request.

在一个可能的实现方式中,预设的编译器为EmScripten。In a possible implementation, the default compiler is EmScripten.

第二方面,提供了一种网页游戏的数据处理装置,该装置包括:In a second aspect, a data processing device for a web game is provided, the device comprising:

转化模块,被配置为利用预设的编译器将网页游戏的原生语言文件转化为二进制字符文件;The conversion module is configured to use a preset compiler to convert the native language file of the web game into a binary character file;

建立模块,被配置为当接收到与网页游戏相关的多个数据处理请求时,基于二进制字符文件分别建立与各个数据处理请求对应的执行数据处理操作的线程;The establishment module is configured to, when multiple data processing requests related to the web game are received, respectively establish a thread for performing data processing operations corresponding to each data processing request based on the binary character file;

执行模块,被配置为通过各个线程,基于SOA的数据结构和单指令多数据流执行相应的数据处理操作。The execution module is configured to execute the corresponding data processing operation based on the SOA data structure and the single instruction multiple data flow through each thread.

在一个可能的实现方式中,转化模块,还被配置为利用预设的编译器将网页游戏的原生语言文件转化为胶水代码文件,胶水代码文件为由JavaScript语言组成的文件。In a possible implementation manner, the conversion module is further configured to use a preset compiler to convert the native language file of the web game into a glue code file, where the glue code file is a file composed of JavaScript language.

第三方面,提供了一种电子设备,该电子设备包括:In a third aspect, an electronic device is provided, the electronic device comprising:

一个或多个处理器;one or more processors;

存储器;memory;

一个或多个应用程序,其中一个或多个应用程序被存储在存储器中并被配置为由一个或多个处理器执行,一个或多个程序配置用于:执行上述实现方式中任一项所述的网页游戏的数据处理方法。One or more application programs, wherein the one or more application programs are stored in memory and configured to be executed by one or more processors, the one or more programs are configured to: execute any of the above implementations. The data processing method of the web game described above.

例如,本申请的第三方面,提供了一种计算设备,包括:处理器、存储器、通信接口和通信总线,处理器、存储器和通信接口通过通信总线完成相互间的通信;For example, a third aspect of the present application provides a computing device, including: a processor, a memory, a communication interface, and a communication bus, and the processor, the memory, and the communication interface communicate with each other through the communication bus;

存储器用于存放至少一可执行指令,可执行指令使处理器执行如本申请的第一方面所示的网页游戏的数据处理方法对应的操作。The memory is used for storing at least one executable instruction, and the executable instruction enables the processor to perform operations corresponding to the data processing method of the web game shown in the first aspect of the present application.

第四方面,提供了一种计算机可读存储介质,计算机可读存储介质上存储有计算机程序,该计算机程序被处理器执行时实现根据第一方面的网页游戏的数据处理方法。In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, implements the data processing method for a web game according to the first aspect.

本申请实施例提供的技术方案带来的有益效果是:The beneficial effects brought by the technical solutions provided in the embodiments of the present application are:

由于网页游戏一般是基于JavaScript设计的,相关引擎不能直接调用原生语言,利用编译器将原生语言文件转化为二进制字符文件,相关引擎能够运行该二进制字符文件,且二进制字符的执行效率近似于原生语言的执行效率,相关引擎执行该二进制字符文件的执行效率远高于相关引擎执行基于JavaScript设计的文件的执行效率。进一步地,接收到与网页游戏相关的多个数据处理请求时,建立与各个数据处理请求对应的线程,通过各个线程,基于SOA的数据结构和单指令多数据流执行相应的数据处理操作,能进一步缩短数据处理所需的时间,降低对网页游戏发展的限制。Since web games are generally designed based on JavaScript, the relevant engine cannot directly call the native language, and the compiler converts the native language file into a binary character file, and the relevant engine can run the binary character file, and the execution efficiency of binary characters is similar to that of the native language. The execution efficiency of the relevant engine for executing the binary character file is much higher than the execution efficiency of the relevant engine for executing the file designed based on JavaScript. Further, when multiple data processing requests related to the web game are received, a thread corresponding to each data processing request is established, and through each thread, the corresponding data processing operation is performed based on the SOA data structure and single instruction multiple data stream, and the corresponding data processing operation can be performed. The time required for data processing is further shortened, and the restrictions on the development of web games are lowered.

附图说明Description of drawings

为了更清楚地说明本申请实施例中的技术方案,下面将对本申请实施例描述中所需要使用的附图作简单地介绍。In order to illustrate the technical solutions in the embodiments of the present application more clearly, the following briefly introduces the accompanying drawings that need to be used in the description of the embodiments of the present application.

图1为本申请实施例提供的一种网友游戏的数据处理方法的流程示意图;1 is a schematic flowchart of a data processing method for a netizen game provided by an embodiment of the present application;

图2为本申请实施例提供的一种网页游戏的数据处理装置的结构示意图;2 is a schematic structural diagram of a data processing device for a web game provided by an embodiment of the present application;

图3为本申请实施例提供的一种网页游戏的数据处理装置的电子设备 的结构示意图。Fig. 3 is a schematic structural diagram of an electronic device of a data processing apparatus for a web game provided by an embodiment of the present application.

具体实施方式detailed description

下面详细描述本申请的实施例,所述实施例的示例在附图中示出,其中自始至终相同或类似的标号表示相同或类似的元件或具有相同或类似功能的元件。下面通过参考附图描述的实施例是示例性的,仅用于解释本申请,而不能解释为对本发明的限制。The following describes in detail the embodiments of the present application, examples of which are illustrated in the accompanying drawings, wherein the same or similar reference numerals refer to the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application, but not to be construed as limiting the present invention.

本技术领域技术人员可以理解,除非特意声明,这里使用的单数形式“一”、“一个”、“所述”和“该”也可包括复数形式。应该进一步理解的是,本申请的说明书中使用的措辞“包括”是指存在所述特征、整数、步骤、操作、元件和/或组件,但是并不排除存在或添加一个或多个其他特征、整数、步骤、操作、元件、组件和/或它们的组。应该理解,当我们称元件被“连接”或“耦接”到另一元件时,它可以直接连接或耦接到其他元件,或者也可以存在中间元件。此外,这里使用的“连接”或“耦接”可以包括无线连接或无线耦接。这里使用的措辞“和/或”包括一个或更多个相关联的列出项的全部或任一单元和全部组合。It will be understood by those skilled in the art that the singular forms "a", "an", "the" and "the" as used herein can include the plural forms as well, unless expressly stated otherwise. It should be further understood that the word "comprising" used in the specification of this application refers to the presence of stated features, integers, steps, operations, elements and/or components, but does not preclude the presence or addition of one or more other features, Integers, steps, operations, elements, components and/or groups thereof. It will be understood that when we refer to an element as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may also be present. Furthermore, "connected" or "coupled" as used herein may include wirelessly connected or wirelessly coupled. As used herein, the term "and/or" includes all or any element and all combination of one or more of the associated listed items.

为使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请实施方式作进一步地详细描述。In order to make the objectives, technical solutions and advantages of the present application clearer, the embodiments of the present application will be further described in detail below with reference to the accompanying drawings.

首先对本申请涉及的几个名词进行介绍和解释:面向数据架构(Structure Of Array,SOA)的数据结构。这种结构的数据能够将数据紧凑的组织在一起,有利于中央处理器高效访问,即同一时间可以利用中央处理器的所有内核处理该结构的数据,实现硬件设备(即运行原生平台的设备)的多线程处理目的。单指令多数据流(Single Instruction Multiple Data,SIMD)能够复制多个操作数,并把它们打包在大型寄存器的一组指令集,采用一个控制器来控制多个处理器,同时对一组数据(又称数据向量)中的每一个分别执行相同的操作从而实行空间上的并行性的技术。First, several terms involved in this application are introduced and explained: data structure oriented to data architecture (Structure Of Array, SOA). The data of this structure can organize the data compactly, which is conducive to the efficient access of the central processing unit, that is, all the cores of the central processing unit can be used to process the data of this structure at the same time, and realize the hardware device (ie, the device running the native platform). for multithreading purposes. Single Instruction Multiple Data (SIMD) can copy multiple operands and pack them in a set of instruction sets of large registers, using a controller to control multiple processors and simultaneously process a set of data ( Also known as a data vector), each of which performs the same operation separately to implement spatial parallelism.

传统的Web游戏引擎都是采用JavaScript开发。JavaScript是一种直译式脚本语言,是一种动态类型、弱类型、基于原型的语言,内置支持类型,JavaScript的出现使得网页和用户之间实现了一种实时性的、动态 的、交互性的关系,使网页包含更多活跃的元素和更加精彩的内容。JavaScript引擎为浏览器的一部分,广泛用于客户端的脚本语言,最早用来给超级文本标记语言网页增加动态功能。JavaScript与原生语言如C++等相比执行效率较低,限制了某些Web游戏的开发,如要开发的游戏渲染比较耗时等。Traditional web game engines are developed using JavaScript. JavaScript is a literal translation scripting language. It is a dynamically typed, weakly typed, prototype-based language with built-in support types. The emergence of JavaScript enables a real-time, dynamic, and interactive interaction between web pages and users. relationship, so that the web page contains more active elements and more exciting content. The JavaScript engine is a part of the browser and is widely used as a client-side scripting language. It was first used to add dynamic functions to hypertext markup language web pages. Compared with native languages such as C++, JavaScript has lower execution efficiency, which limits the development of some Web games, such as the time-consuming rendering of games to be developed.

本申请提供的网页游戏的数据处理方法、装置、电子设备和存储介质,旨在解决现有技术的如上技术问题。The data processing method, device, electronic device and storage medium for web games provided by the present application aim to solve the above technical problems in the prior art.

下面以具体地实施例对本申请的技术方案以及本申请的技术方案如何解决上述技术问题进行详细说明。下面这几个具体的实施例可以相互结合,对于相同或相似的概念或过程可能在某些实施例中不再赘述。下面将结合附图,对本申请的实施例进行描述。The technical solutions of the present application and how the technical solutions of the present application solve the above-mentioned technical problems will be described in detail below with specific examples. The following specific embodiments may be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below with reference to the accompanying drawings.

实施例一Example 1

本申请实施例提供了一种网页游戏的数据处理方法,如图1所示,该方法可以包括:An embodiment of the present application provides a data processing method for a web game, as shown in FIG. 1 , the method may include:

S101,利用预设的编译器将网页游戏的原生语言文件转化为二进制字符文件;S101, using a preset compiler to convert the native language file of the web game into a binary character file;

原生语言文件为利用原生语言编程的文件,如利用C/C++语言编程的原生语言文件等。二进制字符文件为由二进制字符组成的文件,如WebAssembly文件等。编译器能将原生语言文件转化为二进制字符文件,如EmScripten等,例如,WebAssembly文件可由EmScripten编译而成。The native language file is a file that uses native language programming, such as a native language file that uses C/C++ language programming. A binary character file is a file composed of binary characters, such as a WebAssembly file. The compiler can convert native language files into binary character files, such as EmScripten, etc. For example, WebAssembly files can be compiled by EmScripten.

具体的,EmScripten是一个编译器项目,可将C++语言代码转化为WebAssembly文件,通过网页游戏引擎对WebAssembly文件的直接调用,提升计算效率。很多浏览器的游戏引擎都支持调用WebAssembly文件,如谷歌浏览器(Google Chrome)、微软浏览器(Microsoft Edge)、火狐浏览器(Mozilla Firefox)和Safari浏览器等。Specifically, EmScripten is a compiler project that can convert C++ language code into WebAssembly files, and improve computing efficiency through the direct invocation of WebAssembly files by web game engines. Many browser game engines support calling WebAssembly files, such as Google Chrome, Microsoft Edge, Mozilla Firefox, and Safari.

S102,当接收到与网页游戏相关的多个数据处理请求时,基于二进制字符文件分别建立与各个数据处理请求对应的执行数据处理操作的线程;S102, when multiple data processing requests related to the web game are received, establish a thread for performing data processing operations corresponding to each data processing request based on the binary character file;

接收到与网页游戏相关的多个数据处理请求时,网页游戏引擎直接调用二进制字符文件,基于该二进制字符文件分别建立与各个数据处理请求 对应的执行数据处理操作的线程,由多个线程同时执行多个数据处理操作,加快数据处理的速度。When multiple data processing requests related to web games are received, the web game engine directly calls the binary character file, and based on the binary character file, establishes a thread for performing data processing operations corresponding to each data processing request, and executes the data processing operation by multiple threads at the same time. Multiple data processing operations to speed up data processing.

S103,通过各个线程,基于SOA的数据结构和单指令多数据流执行相应的数据处理操作。S103, through each thread, perform a corresponding data processing operation based on the SOA data structure and the single instruction multiple data stream.

在每个线程上,基于SOA的数据结构和单指令多数据流,使每个线程执行一个数据处理操作时,依据执行该数据处理操作的数据处理指令,对多个数据同时进行同类处理,更进一步加快数据处理速度。On each thread, based on the SOA data structure and single instruction multiple data stream, when each thread executes a data processing operation, it performs similar processing on multiple data at the same time according to the data processing instruction for executing the data processing operation. Further speed up data processing.

进一步地,传统的结构体数组,如数据结构为structrue{x,y,z},其数组在内存中的结构如下表1所示,而基于SOA的存储方式如下表2所示。Further, for a traditional structure array, such as the data structure is structtrue{x, y, z}, the structure of the array in memory is shown in Table 1 below, and the storage method based on SOA is shown in Table 2 below.

表1Table 1

数据1data 1 x1x1 y1y1 z1z1 数据2data 2 x2x2 y2y2 z2z2 数据3data 3 x3x3 y3y3 z3z3 ……... ……... ……... ……...

表2Table 2

数据1data 1 x1x1 x2x2 x3x3 数据2data 2 y1y1 y2y2 y3y3 数据3data 3 z1z1 z2z2 z3z3 ……... ……... ……... ……...

传统的结构体数组在执行数据处理操作时,依据先处理x1→y1→z1,其次处理x2→y2→z2,再次处理x3→y3→z3等形式进行数据处理。而SOA的数据结构在执行数据处理操作时,可依据一条数据处理指令,执行x→y→z的形式进行数据处理,即先对数据x(包括x1、x2、x3等)进行处理得到数据y(包括y1、y2、y3等),再对数据y进行处理得到数据z (包括z1、z2、z3等)。因此,SOA的数据结构更有利于进行单指令多数据流的运算,使得一条处理处理指令可以进行多个数据的并行计算,提高运算速率。When the traditional structure array performs data processing operations, data processing is performed in the form of processing x1→y1→z1 first, then processing x2→y2→z2, and then processing x3→y3→z3 again. When the SOA data structure performs data processing operations, it can perform data processing in the form of x→y→z according to a data processing instruction, that is, first process the data x (including x1, x2, x3, etc.) to obtain the data y (including y1, y2, y3, etc.), and then process data y to obtain data z (including z1, z2, z3, etc.). Therefore, the data structure of SOA is more conducive to the operation of single instruction and multiple data streams, so that one processing instruction can perform parallel calculation of multiple data and improve the operation rate.

在本申请实施例中,由于网页游戏一般是基于JavaScript设计的,相关引擎不能直接调用原生语言,利用编译器将原生语言文件转化为二进制字符文件,相关引擎能够运行该二进制字符文件,且二进制字符的执行效率近似于原生语言的执行效率,相关引擎执行该二进制字符文件的执行效率远高于相关引擎执行基于JavaScript设计的文件的执行效率。进一步地,接收到与网页游戏相关的多个数据处理请求时,建立与各个数据处理请求对应的线程,通过各个线程,基于SOA的数据结构和单指令多数据流执行相应的数据处理操作,能进一步缩短数据处理所需的时间,降低对网页游戏发展的限制。In the embodiment of the present application, since web games are generally designed based on JavaScript, the relevant engine cannot directly call the native language, and the native language file is converted into a binary character file by a compiler. The relevant engine can run the binary character file, and the binary character The execution efficiency of the corresponding engine is similar to the execution efficiency of the native language, and the execution efficiency of the relevant engine executing the binary character file is much higher than the execution efficiency of the relevant engine executing the file designed based on JavaScript. Further, when multiple data processing requests related to the web game are received, a thread corresponding to each data processing request is established, and through each thread, the corresponding data processing operation is performed based on the SOA data structure and single instruction multiple data stream, and the corresponding data processing operation can be performed. The time required for data processing is further shortened, and the restrictions on the development of web games are lowered.

在又一个具体的实施例中,该方法还可以包括S104(图中未标出):In yet another specific embodiment, the method may further include S104 (not marked in the figure):

S104,利用预设的编译器将网页游戏的原生语言文件转化为胶水代码文件,胶水代码文件为JavaScript语言组成的文件。S104, using a preset compiler to convert the native language file of the web game into a glue code file, and the glue code file is a file composed of JavaScript language.

在又一个具体的实施例中,原生语言文件包括绑定代码和数据处理代码,利用预设的编译器将网页游戏的原生语言文件转化为胶水代码文件及二进制字符文件(S101和S104),包括S105(图中未标出):In yet another specific embodiment, the native language file includes binding code and data processing code, and a preset compiler is used to convert the native language file of the web game into a glue code file and a binary character file (S101 and S104), including S105 (not marked in the figure):

S105,基于预设的编译器,利用绑定代码将数据处理代码转化为胶水代码文件和二进制字符文件,绑定代码和数据处理代码均为由原生语言编写的代码。S105 , based on a preset compiler, the data processing code is converted into a glue code file and a binary character file by using the binding code, and both the binding code and the data processing code are codes written in native languages.

具体地,利用预设的编译器,原生语言代码可以通过两种方式转化为二进制字符文件。以预设的编译器为EmScripten工具、原生语言代码为C++代码、二进制字符文件为WebAssembly文件为例:Specifically, using a preset compiler, native language codes can be converted into binary character files in two ways. Take the default compiler as the EmScripten tool, the native language code as the C++ code, and the binary character file as the WebAssembly file as an example:

1、在每个C++代码的cpp代码中写入绑定代码,C++代码中除绑定代码之外还包括数据处理代码,利用EmScripten工具对C++代码进行编译后,生成一个js文件和一个wasm文件,js文件为连接JavaScript和wasm文件的胶水代码文件,wasm文件为二进制字符文件。此种方式适合新开 发的模块,可以在写C++代码的同时,写入绑定代码。1. Write the binding code in the cpp code of each C++ code. In addition to the binding code, the C++ code also includes data processing code. After compiling the C++ code with the EmScripten tool, a js file and a wasm file are generated. , the js file is the glue code file that connects the JavaScript and the wasm file, and the wasm file is a binary character file. This method is suitable for newly developed modules, and can write binding code while writing C++ code.

2、首先将绑定代码写入单个idl的文件中,利用包含数据处理代码的文件和包含绑定代码的idl文件,生成glue.cpp文件,利用EmScripten工具对glue.cpp文件进行编译,生成js文件和wasm文件,js文件为连接JavaScript和wasm文件的胶水代码文件,wasm文件为二进制字符文件。此种方式适合移植整个工程或者项目。2. First, write the binding code into a single idl file, use the file containing the data processing code and the idl file containing the binding code to generate the glue.cpp file, and use the EmScripten tool to compile the glue.cpp file to generate js files and wasm files, js files are glue code files that connect JavaScript and wasm files, and wasm files are binary character files. This method is suitable for migrating the entire project or project.

具体地,绑定代码又称导出代码,在原生语言中写入绑定代码,编译器能根据该绑定代码得知需要暴露给网页游戏的引擎调用的接口,便于编译器基于该绑定代码生成胶水代码文件和二进制字符文件。胶水代码在计算机编程领域也叫粘合代码。胶水代码不实现程序要求的任何功能,通常出现在代码中,使现有的库或者程序在外部函数接口(如Java本地接口)中进行互操作,胶水代码在快速原型中非常高效,可以让几个组件被快速集成到单个语言或者框架中。利用EmScripten工具,可以根据绑定代码,将原生语言文件中的数据处理代码转化为胶水代码文件和二进制字符文件。Specifically, the binding code is also known as the export code. The binding code is written in the native language, and the compiler can know the interface that needs to be exposed to the engine of the web game according to the binding code, so that the compiler can base the binding code on the interface. Generate glue code files and binary character files. Glue code is also called glue code in the field of computer programming. Glue code does not implement any function required by the program, and usually appears in the code to enable existing libraries or programs to interoperate in external function interfaces (such as Java native interfaces). Glue code is very efficient in rapid prototyping, allowing several Components are quickly integrated into a single language or framework. Using the EmScripten tool, the data processing code in the native language file can be converted into a glue code file and a binary character file according to the binding code.

原生语言文件为工程师利用原生语言编写的代码,如利用C语言、C++语言等撰写的代码文件,包括绑定代码和数据处理代码。胶水代码文件为编译器基于绑定代码对数据处理代码进行转化后得到的,是JavaScript语言组成的文件。二进制字符文件为编译器基于绑定代码对数据处理代码进行转化后得到的,为由二进制字符组成的文件,如WebAssembly文件。The native language file is the code written by the engineer using the native language, such as the code file written in the C language, C++ language, etc., including the binding code and the data processing code. The glue code file is obtained after the compiler converts the data processing code based on the binding code, and is a file composed of the JavaScript language. The binary character file is obtained after the compiler converts the data processing code based on the binding code, and is a file composed of binary characters, such as a WebAssembly file.

在又一个具体的实施例中,S102可以包括S1021(图中未标出)和S1022(图中未标出):In yet another specific embodiment, S102 may include S1021 (not marked in the figure) and S1022 (not marked in the figure):

S1021,当接收到与网页游戏相关的多个数据处理请求时,通过胶水代码文件读取二进制字符文件;S1021, when multiple data processing requests related to the web game are received, read the binary character file through the glue code file;

S1022,基于二进制字符文件,分别建立与各个数据处理请求对应的执行数据处理操作的线程。S1022 , based on the binary character file, respectively establish a thread for performing data processing operations corresponding to each data processing request.

在另一个具体的实施例中,S102可以包括S1023(图中未标出):In another specific embodiment, S102 may include S1023 (not marked in the figure):

S1023,利用网页游戏的引擎,调用二进制字符文件分别建立与各个 数据处理请求对应的执行数据处理操作的线程。S1023, using the engine of the web game, call the binary character file to respectively establish a thread for performing data processing operations corresponding to each data processing request.

在又一个具体的实施例中,预设的编译器为EmScripten。In yet another specific embodiment, the preset compiler is EmScripten.

网页游戏的引擎可以利用胶水代码文件调用并读取二进制字符文件,基于二进制字符文件,建立多个与数据处理请求对应的执行数据处理操作的线程,基于SOA的数据结构和单指令多数据流执行相应的数据处理操作。The engine of the web game can use the glue code file to call and read the binary character file. Based on the binary character file, multiple threads for performing data processing operations corresponding to the data processing request are established. Based on the SOA data structure and single instruction multiple data stream execution Corresponding data processing operations.

具体地,数据处理代码包括建立多个与数据处理请求对应的执行数据处理操作的线程的代码、基于SOA的数据结构执行相应的数据处理操作的代码和基于单指令多数据流执行相应的数据处理操作的代码。编译器利用绑定代码将数据处理代码转化为胶水代码文件和二进制字符文件时,二进制字符文件对应的包括建立多个与数据处理请求对应的执行数据处理操作的线程的代码、基于SOA的数据结构执行相应的数据处理操作的代码和基于单指令多数据流执行相应的数据处理操作的代码。因此,网页游戏的引擎利用胶水代码文件调用并读取二进制字符文件时,基于二进制字符文件,建立多个与数据处理请求对应的执行数据处理操作的线程,基于SOA的数据结构和单指令多数据流执行相应的数据处理操作。Specifically, the data processing code includes code for establishing multiple threads for performing data processing operations corresponding to data processing requests, code for performing corresponding data processing operations based on SOA data structures, and performing corresponding data processing based on single instruction multiple data streams. Operation code. When the compiler uses the binding code to convert the data processing code into a glue code file and a binary character file, the binary character file corresponds to the code that establishes multiple threads for performing data processing operations corresponding to the data processing request, and the SOA-based data structure. The code for performing the corresponding data processing operation and the code for performing the corresponding data processing operation based on the single instruction multiple data stream. Therefore, when the engine of the web game uses the glue code file to call and read the binary character file, based on the binary character file, multiple threads for performing data processing operations corresponding to the data processing request are established, based on the SOA data structure and single instruction multiple data Streams perform corresponding data processing operations.

在本申请实施例中,由于网页游戏一般是基于JavaScript设计的,相关引擎不能直接调用原生语言,利用编译器将原生语言文件转化为二进制字符文件,相关引擎能够运行该二进制字符文件,且二进制字符的执行效率近似于原生语言的执行效率,相关引擎执行该二进制字符文件的执行效率远高于相关引擎执行基于JavaScript设计的文件的执行效率。进一步地,接收到与网页游戏相关的多个数据处理请求时,建立与各个数据处理请求对应的线程,通过各个线程,基于SOA的数据结构和单指令多数据流执行相应的数据处理操作,能进一步缩短数据处理所需的时间,降低对网页游戏发展的限制。In the embodiment of the present application, since web games are generally designed based on JavaScript, the relevant engine cannot directly call the native language, and the native language file is converted into a binary character file by a compiler. The relevant engine can run the binary character file, and the binary character The execution efficiency of the related engine is similar to that of the native language, and the execution efficiency of the relevant engine to execute the binary character file is much higher than the execution efficiency of the relevant engine to execute the file designed based on JavaScript. Further, when multiple data processing requests related to the web game are received, a thread corresponding to each data processing request is established, and through each thread, the corresponding data processing operation is performed based on the SOA data structure and single instruction multiple data stream, which can The time required for data processing is further shortened, and the restriction on the development of web games is lowered.

实施例二Embodiment 2

本申请实施例提供了一种网页游戏的数据处理装置,如图2所示,该网页游戏的数据处理装置20可以包括:转化模块201、建立模块202以及执行模块203,其中,An embodiment of the present application provides a data processing apparatus for a web game. As shown in FIG. 2, the data processing apparatus 20 for a web game may include: a conversion module 201, a creation module 202, and an execution module 203, wherein,

转化模块201,被配置为利用预设的编译器将网页游戏的原生语言文件转化为二进制字符文件;The conversion module 201 is configured to use a preset compiler to convert the native language file of the web game into a binary character file;

建立模块202,被配置为当接收到与网页游戏相关的多个数据处理请求时,基于二进制字符文件分别建立与各个数据处理请求对应的执行数据处理操作的线程;The establishment module 202 is configured to, when receiving multiple data processing requests related to the web game, respectively establish a thread for performing data processing operations corresponding to each data processing request based on the binary character file;

执行模块203,被配置为通过各个线程,基于SOA的数据结构和单指令多数据流执行相应的数据处理操作。The execution module 203 is configured to execute corresponding data processing operations based on the SOA data structure and the single instruction multiple data flow through each thread.

本实施例的网页游戏的数据处理装置可执行本申请实施例一提供的一种网页游戏的数据处理方法,其实现原理相类似,此处不再赘述。The data processing apparatus for a web game in this embodiment can execute the data processing method for a web game provided in Embodiment 1 of the present application, and the implementation principle thereof is similar, which will not be repeated here.

在本申请实施例中,由于网页游戏一般是基于JavaScript设计的,相关引擎不能直接调用原生语言,利用编译器将原生语言文件转化为二进制字符文件,相关引擎能够运行该二进制字符文件,且二进制字符的执行效率近似于原生语言的执行效率,相关引擎执行该二进制字符文件的执行效率远高于相关引擎执行基于JavaScript设计的文件的执行效率。进一步地,接收到与网页游戏相关的多个数据处理请求时,建立与各个数据处理请求对应的线程,通过各个线程,基于SOA的数据结构和单指令多数据流执行相应的数据处理操作,能进一步缩短数据处理所需的时间,降低对网页游戏发展的限制。In the embodiment of the present application, since web games are generally designed based on JavaScript, the relevant engine cannot directly call the native language, and the native language file is converted into a binary character file by a compiler. The relevant engine can run the binary character file, and the binary character The execution efficiency of the related engine is similar to that of the native language, and the execution efficiency of the relevant engine to execute the binary character file is much higher than the execution efficiency of the relevant engine to execute the file designed based on JavaScript. Further, when multiple data processing requests related to the web game are received, a thread corresponding to each data processing request is established, and through each thread, the corresponding data processing operation is performed based on the SOA data structure and single instruction multiple data stream, which can The time required for data processing is further shortened, and the restriction on the development of web games is lowered.

在又一个具体的实施例中,In yet another specific embodiment,

转化模块201,还被配置为利用预设的编译器将网页游戏的原生语言文件转化为胶水代码文件,胶水代码文件为由JavaScript语言组成的文件。The conversion module 201 is further configured to use a preset compiler to convert the native language file of the web game into a glue code file, where the glue code file is a file composed of JavaScript language.

在又一个具体的实施例中,原生语言文件包括绑定代码和数据处理代码:In yet another specific embodiment, the native language file includes binding code and data processing code:

转化模块201,还被配置为基于预设的编译器,利用将绑定代码将数据处理代码转化为胶水代码文件和二进制字符文件,绑定代码和数据处理代码均为由原生语言编写的代码。The conversion module 201 is further configured to convert the data processing code into a glue code file and a binary character file by using a binding code based on a preset compiler, where both the binding code and the data processing code are codes written in native languages.

在又一个具体的实施例中,建立模块202可以包括读取模块(图中未标出)和第一建立模块(图中未标出):In yet another specific embodiment, the establishment module 202 may include a reading module (not shown in the figure) and a first establishment module (not shown in the figure):

读取模块,被配置为当接收到与网页游戏相关的多个数据处理请求时,通过胶水代码文件读取二进制字符文件;The reading module is configured to read the binary character file through the glue code file when receiving multiple data processing requests related to the web game;

第一建立模块,被配置为基于二进制字符文件,分别建立与各个数据处理请求对应的执行数据处理操作的线程。The first establishment module is configured to establish, based on the binary character file, threads for executing data processing operations corresponding to respective data processing requests.

在又一个具体的实施例中,In yet another specific embodiment,

建立模块202,还被配置为利用网页游戏的引擎,调用二进制字符文件分别建立与各个数据处理请求对应的执行数据处理操作的线程。The establishment module 202 is further configured to use the engine of the web game to call the binary character file to respectively establish a thread for performing data processing operations corresponding to each data processing request.

在又一个具体的实施例中,预设的编译器为EmScripten。In yet another specific embodiment, the preset compiler is EmScripten.

本实施例的网页游戏的数据处理装置可执行本申请实施例一提供的一种网页游戏的数据处理方法,其实现原理相类似,此处不再赘述。The data processing apparatus for a web game in this embodiment can execute the data processing method for a web game provided in Embodiment 1 of the present application, and the implementation principle thereof is similar, which will not be repeated here.

在本申请实施例中,由于网页游戏一般是基于JavaScript设计的,相关引擎不能直接调用原生语言,利用编译器将原生语言文件转化为二进制字符文件,相关引擎能够运行该二进制字符文件,且二进制字符的执行效率近似于原生语言的执行效率,相关引擎执行该二进制字符文件的执行效率远高于相关引擎执行基于JavaScript设计的文件的执行效率。进一步地,接收到与网页游戏相关的多个数据处理请求时,建立与各个数据处理请求对应的线程,通过各个线程,基于SOA的数据结构和单指令多数据流执行相应的数据处理操作,能进一步缩短数据处理所需的时间,降低对网页游戏发展的限制。In the embodiment of the present application, since web games are generally designed based on JavaScript, the relevant engine cannot directly call the native language, and the native language file is converted into a binary character file by a compiler. The relevant engine can run the binary character file, and the binary character The execution efficiency of the related engine is similar to that of the native language, and the execution efficiency of the relevant engine to execute the binary character file is much higher than the execution efficiency of the relevant engine to execute the file designed based on JavaScript. Further, when multiple data processing requests related to the web game are received, a thread corresponding to each data processing request is established, and through each thread, the corresponding data processing operation is performed based on the SOA data structure and single instruction multiple data stream, which can The time required for data processing is further shortened, and the restriction on the development of web games is lowered.

实施例三Embodiment 3

本申请实施例提供了一种电子设备,如图3所示,图3所示的电子设备2000可以包括:处理器2001和收发器2004。其中,处理器2001和收发器2004相连,如通过总线2002相连。可选的,电子设备2000还可以包括存储器2003。需要说明的是,实际应用中收发器2004不限于一个,该电子设备2000的结构并不构成对本申请实施例的限定。An embodiment of the present application provides an electronic device. As shown in FIG. 3 , the electronic device 2000 shown in FIG. 3 may include: a processor 2001 and a transceiver 2004 . The processor 2001 is connected to the transceiver 2004, for example, through the bus 2002. Optionally, the electronic device 2000 may further include a memory 2003 . It should be noted that in practical applications, the transceiver 2004 is not limited to one, and the structure of the electronic device 2000 does not constitute a limitation to the embodiments of the present application.

其中,处理器2001可以应用于本申请实施例中,用于实现上述实施例所示的执行模块203的功能。收发器2004包括接收机和发射机,收发器2004应用于本申请实施例中,用于实现上述实施例所示的建立模块202的功能。The processor 2001 may be applied in the embodiments of the present application to implement the functions of the execution module 203 shown in the foregoing embodiments. The transceiver 2004 includes a receiver and a transmitter, and the transceiver 2004 is used in the embodiments of the present application to implement the functions of the establishment module 202 shown in the foregoing embodiments.

处理器2001可以是CPU、通用处理器、DSP、ASIC、FPGA或者其他可编程逻辑器件、晶体管逻辑器件、硬件部件或者其任意组合。其可以实现或执行结合本申请公开内容所描述的各种示例性的逻辑方框,模块和电路。处理器2001也可以是实现计算功能的组合,例如包含一个或多个微处理器组合,DSP和微处理器的组合等。The processor 2001 may be a CPU, general purpose processor, DSP, ASIC, FPGA or other programmable logic device, transistor logic device, hardware component, or any combination thereof. It may implement or execute the various exemplary logical blocks, modules and circuits described in connection with this disclosure. The processor 2001 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and the like.

总线2002可包括一通路,在上述组件之间传送信息。总线2002可以是PCI总线或EISA总线等。总线2002可以分为地址总线、数据总线、控制总线等。为便于表示,图3中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。The bus 2002 may include a path to transfer information between the aforementioned components. The bus 2002 may be a PCI bus, an EISA bus, or the like. The bus 2002 can be divided into an address bus, a data bus, a control bus, and the like. For ease of presentation, only one thick line is used in FIG. 3, but it does not mean that there is only one bus or one type of bus.

存储器2003可以是ROM或可存储静态信息和指令的其他类型的静态存储设备,RAM或者可存储信息和指令的其他类型的动态存储设备,也可以是EEPROM、CD-ROM或其他光盘存储、光碟存储(包括压缩光碟、激光碟、光碟、数字通用光碟、蓝光光碟等)、磁盘存储介质或者其他磁存储设备、或者能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质,但不限于此。The memory 2003 can be ROM or other types of static storage devices that can store static information and instructions, RAM or other types of dynamic storage devices that can store information and instructions, or EEPROM, CD-ROM or other optical disk storage, optical disk storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or capable of carrying or storing desired program code in the form of instructions or data structures and capable of being executed by a computer Access any other medium without limitation.

可选的,存储器2003用于存储执行本申请方案的应用程序代码,并由处理器2001来控制执行。处理器2001用于执行存储器2003中存储的应用程序代码,以实现上述实施例提供的网页游戏的数据处理装置的动作。Optionally, the memory 2003 is used to store the application code for executing the solution of the present application, and the execution is controlled by the processor 2001 . The processor 2001 is configured to execute the application program code stored in the memory 2003, so as to realize the actions of the data processing apparatus for the web game provided by the above embodiments.

本申请实施例提供了一种计算机可读存储介质,该计算机可读存储介质上存储有计算机程序,该计算机程序被处理器执行时实现上述实施例所示的网页游戏的数据处理方法。Embodiments of the present application provide a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, implements the data processing method of the web game shown in the foregoing embodiments.

本申请实施例提供了一种计算机可读存储介质,与现有技术相比,由于网页游戏一般是基于JavaScript设计的,相关引擎不能直接调用原生语言,利用编译器将原生语言文件转化为二进制字符文件,相关引擎能够运行该二进制字符文件,且二进制字符的执行效率近似于原生语言的执行效率,相关引擎执行该二进制字符文件的执行效率远高于相关引擎执行基于JavaScript设计的文件的执行效率。进一步地,接收到与网页游戏相关的多个数据处理请求时,建立与各个数据处理请求对应的线程,通过各个线 程,基于SOA的数据结构和单指令多数据流执行相应的数据处理操作,能进一步缩短数据处理所需的时间,降低对网页游戏发展的限制。The embodiment of the present application provides a computer-readable storage medium. Compared with the prior art, because web games are generally designed based on JavaScript, the relevant engine cannot directly call the native language, and the compiler is used to convert the native language file into binary characters. file, the relevant engine can run the binary character file, and the execution efficiency of the binary character is similar to that of the native language, and the execution efficiency of the relevant engine executing the binary character file is much higher than the execution efficiency of the relevant engine executing the file designed based on JavaScript. Further, when multiple data processing requests related to the web game are received, a thread corresponding to each data processing request is established, and through each thread, the corresponding data processing operation is performed based on the SOA data structure and single instruction multiple data stream, which can The time required for data processing is further shortened, and the restriction on the development of web games is lowered.

本申请实施例提供了一种计算机可读存储介质适用于上述方法实施例。在此不再赘述。The embodiments of the present application provide a computer-readable storage medium suitable for the foregoing method embodiments. It is not repeated here.

应该理解的是,虽然附图的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,其可以以其他的顺序执行。而且,附图的流程图中的至少一部分步骤可以包括多个子步骤或者多个阶段,这些子步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,其执行顺序也不必然是依次进行,而是可以与其他步骤或者其他步骤的子步骤或者阶段的至少一部分轮流或者交替地执行。It should be understood that although the various steps in the flowchart of the accompanying drawings are sequentially shown in the order indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless explicitly stated herein, the execution of these steps is not strictly limited to the order and may be performed in other orders. Moreover, at least a part of the steps in the flowcharts of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but may be executed at different times, and the execution sequence is also It does not have to be performed sequentially, but may be performed alternately or alternately with other steps or at least a portion of sub-steps or stages of other steps.

以上所述仅是本发明的部分实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本发明的保护范围。The above are only some embodiments of the present invention. It should be pointed out that for those skilled in the art, without departing from the principles of the present invention, several improvements and modifications can also be made. It should be regarded as the protection scope of the present invention.

Claims (10)

一种网页游戏的数据处理方法,所述方法包括:A data processing method for a web game, the method comprising: 利用预设的编译器将网页游戏的原生语言文件转化为二进制字符文件;Use the preset compiler to convert the native language file of the web game into a binary character file; 当接收到与所述网页游戏相关的多个数据处理请求时,基于所述二进制字符文件分别建立与各个数据处理请求对应的执行数据处理操作的线程;When multiple data processing requests related to the web game are received, respectively establishing a thread for performing data processing operations corresponding to each data processing request based on the binary character file; 通过各个线程,基于SOA的数据结构和单指令多数据流执行相应的数据处理操作。Through each thread, the corresponding data processing operations are performed based on the SOA data structure and single instruction multiple data flow. 根据权利要求1所述的方法,所述方法还包括:The method of claim 1, further comprising: 利用预设的编译器将网页游戏的原生语言文件转化为胶水代码文件,所述胶水代码文件为由JavaScript语言组成的文件。The native language file of the web game is converted into a glue code file by using a preset compiler, and the glue code file is a file composed of the JavaScript language. 根据权利要求2所述的方法,其中,所述原生语言文件包括绑定代码和数据处理代码,利用预设的编译器将网页游戏的原生语言文件转化为胶水代码文件及二进制字符文件,包括:The method according to claim 2, wherein the native language file includes binding code and data processing code, and a preset compiler is used to convert the native language file of the web game into a glue code file and a binary character file, including: 基于预设的编译器,利用所述绑定代码将所述数据处理代码转化为所述胶水代码文件和所述二进制字符文件,所述绑定代码和所述数据处理代码均为由原生语言编写的代码。Based on a preset compiler, the data processing code is converted into the glue code file and the binary character file by using the binding code, and the binding code and the data processing code are both written in native languages code. 根据权利要求3所述的方法,其中,所述当接收到与所述网页游戏相关的多个数据处理请求时,基于所述二进制字符文件分别建立与各个数据处理请求对应的执行数据处理操作的线程,包括:The method according to claim 3, wherein when a plurality of data processing requests related to the web game are received, the execution data processing operation corresponding to each data processing request is established based on the binary character file. threads, including: 当接收到与所述网页游戏相关的多个数据处理请求时,通过所述胶水代码文件读取所述二进制字符文件;When multiple data processing requests related to the web game are received, read the binary character file through the glue code file; 基于所述二进制字符文件,分别建立与各个数据处理请求对应的执行数据处理操作的线程。Based on the binary character file, threads for performing data processing operations corresponding to each data processing request are established respectively. 根据权利要求1至4任意一项所述的方法,其中,基于所述二进制字符文件分别建立与各个数据处理请求对应的执行数据处理操作的线程,包括:The method according to any one of claims 1 to 4, wherein, based on the binary character file, respectively establishing a thread for performing data processing operations corresponding to each data processing request, comprising: 利用所述网页游戏的引擎,调用所述二进制字符文件分别建立与各个数据处理请求对应的执行数据处理操作的线程。Using the engine of the web game, the binary character file is called to establish a thread for performing data processing operations corresponding to each data processing request. 根据权利要求1至5任意一项所述的方法,其中,所述预设的编译器为EmScripten。The method according to any one of claims 1 to 5, wherein the preset compiler is EmScripten. 一种网页游戏的数据处理装置,所述装置包括:A data processing device for a web game, the device comprising: 转化模块,被配置为利用预设的编译器将网页游戏的原生语言文件转化为二进制字符文件;The conversion module is configured to use a preset compiler to convert the native language file of the web game into a binary character file; 建立模块,被配置为当接收到与所述网页游戏相关的多个数据处理请求时,基于所述二进制字符文件分别建立与各个数据处理请求对应的执行数据处理操作的线程;an establishment module, configured to respectively establish a thread for performing data processing operations corresponding to each data processing request based on the binary character file when multiple data processing requests related to the web game are received; 执行模块,被配置为通过各个线程,基于SOA的数据结构和单指令多数据流执行相应的数据处理操作。The execution module is configured to execute the corresponding data processing operation based on the SOA data structure and the single instruction multiple data flow through each thread. 根据权利要求7所述的装置,其中,The apparatus of claim 7, wherein, 所述转化模块,还被配置为利用预设的编译器将网页游戏的原生语言文件转化为胶水代码文件,所述胶水代码文件为由JavaScript语言组成的文件。The conversion module is further configured to use a preset compiler to convert the native language file of the web game into a glue code file, where the glue code file is a file composed of JavaScript language. 一种电子设备,所述电子设备包括:An electronic device comprising: 一个或多个处理器;one or more processors; 存储器;memory; 一个或多个应用程序,其中所述一个或多个应用程序被存储在所述存储器中并被配置为由所述一个或多个处理器执行,所述一个或多个程序配置用于:执行根据权利要求1~6任一项所述的网页游戏的数据处理方法。one or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs are configured to: execute The data processing method of the web game according to any one of claims 1 to 6. 一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现权利要求1-6任一项所述的网页游戏的数据处理方法。A computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, implements the data processing method of the web game according to any one of claims 1-6.
PCT/CN2020/108423 2020-08-11 2020-08-11 Data processing method and apparatus for web game, and electronic device and computer readable storage medium Ceased WO2022032476A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/108423 WO2022032476A1 (en) 2020-08-11 2020-08-11 Data processing method and apparatus for web game, and electronic device and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/108423 WO2022032476A1 (en) 2020-08-11 2020-08-11 Data processing method and apparatus for web game, and electronic device and computer readable storage medium

Publications (1)

Publication Number Publication Date
WO2022032476A1 true WO2022032476A1 (en) 2022-02-17

Family

ID=80247562

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/108423 Ceased WO2022032476A1 (en) 2020-08-11 2020-08-11 Data processing method and apparatus for web game, and electronic device and computer readable storage medium

Country Status (1)

Country Link
WO (1) WO2022032476A1 (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012173355A2 (en) * 2011-06-17 2012-12-20 (주)네오위즈게임즈 Device and method for executing task files in a game server
CN107526582A (en) * 2016-09-02 2017-12-29 腾讯科技(深圳)有限公司 web game control method and device
CN108369510A (en) * 2015-12-18 2018-08-03 英特尔公司 Instructions and logic for permutation with out-of-order loading
CN108563517A (en) * 2018-03-30 2018-09-21 腾讯科技(深圳)有限公司 The call method and device of system interface
CN109670128A (en) * 2018-11-06 2019-04-23 北京居然设计家网络科技有限公司 A kind of web application implementation method and device based on WebAssembly
CN111803950A (en) * 2019-04-26 2020-10-23 厦门雅基软件有限公司 Data processing method and device for web game, electronic equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012173355A2 (en) * 2011-06-17 2012-12-20 (주)네오위즈게임즈 Device and method for executing task files in a game server
CN108369510A (en) * 2015-12-18 2018-08-03 英特尔公司 Instructions and logic for permutation with out-of-order loading
CN107526582A (en) * 2016-09-02 2017-12-29 腾讯科技(深圳)有限公司 web game control method and device
CN108563517A (en) * 2018-03-30 2018-09-21 腾讯科技(深圳)有限公司 The call method and device of system interface
CN109670128A (en) * 2018-11-06 2019-04-23 北京居然设计家网络科技有限公司 A kind of web application implementation method and device based on WebAssembly
CN111803950A (en) * 2019-04-26 2020-10-23 厦门雅基软件有限公司 Data processing method and device for web game, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN109740747B (en) Computing method, device and related products
CN110678840B (en) tensor register file
CN110678841B (en) Tensor Processor Instruction Set Architecture
CN113826070B (en) Workflow Engine Tools
US11163677B2 (en) Dynamically allocated thread-local storage
US20150199787A1 (en) Distribute workload of an application to a graphics processing unit
JP2013545169A (en) Runtime-independent representation of user code for execution by the selected execution runtime
CN111679860B (en) Distributed information processing method and device
JP7025104B2 (en) Information processing equipment, methods and programs
KR20230138031A (en) Dynamic allocation of executable code for multi-architecture heterogeneous computing.
CN110598855A (en) Deep learning model generation method, device, equipment and storage medium
US9990216B2 (en) Providing hypercall interface for virtual machines
Daverio et al. Latfield2: A c++ library for classical lattice field theory
WO2016008317A1 (en) Data processing method and central node
CN106445645A (en) Method and device for executing distributed computation tasks
US20110173595A1 (en) Language-based model for asynchronous operations
CN105335203B (en) The binary translation of shared library executes method and apparatus
CN111803950B (en) Data processing method and device for web game, electronic equipment and storage medium
US9448823B2 (en) Provision of a download script
WO2022032476A1 (en) Data processing method and apparatus for web game, and electronic device and computer readable storage medium
CN104615496B (en) The parallel-expansion method of reconstruction structure based on multi-level heterogeneous structure
CN113961861A (en) Page returning method and device
CN103942035B (en) Method, compiler and the instruction processing unit of process instruction
TWI766056B (en) Method, apparatus, computer program, and computer-readable storage medium for data processing
Chard et al. Productive Parallel Programming with Parsl

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20948975

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20948975

Country of ref document: EP

Kind code of ref document: A1