CN111813445A - Double-engine system capable of supporting LUA and JavaScript - Google Patents

Double-engine system capable of supporting LUA and JavaScript Download PDF

Info

Publication number
CN111813445A
CN111813445A CN202010538502.5A CN202010538502A CN111813445A CN 111813445 A CN111813445 A CN 111813445A CN 202010538502 A CN202010538502 A CN 202010538502A CN 111813445 A CN111813445 A CN 111813445A
Authority
CN
China
Prior art keywords
engine
lua
javascript
layer
dual
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010538502.5A
Other languages
Chinese (zh)
Inventor
曹祝华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Leap Learner Technology Shanghai Co ltd
Original Assignee
Leap Learner Technology Shanghai Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Leap Learner Technology Shanghai Co ltd filed Critical Leap Learner Technology Shanghai Co ltd
Priority to CN202010538502.5A priority Critical patent/CN111813445A/en
Publication of CN111813445A publication Critical patent/CN111813445A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/76Adapting program code to run in a different environment; Porting

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a dual-engine system capable of supporting LUA and JavaScript, which comprises the following steps: the method comprises the following steps: integrating source codes of the LUA engine and the JavaScript engine into the game APP; step two: through the switching layer, memory switching is carried out on the LUA engine and the JavaScript engine; step three: through the middle layer, when the LUA engine and the JavaScript engine are switched, the data structures, the method drivers and the engine handles of the LUA engine layer and the JavaScript engine layer are saved. The beneficial effects are that: the invention integrates LUA and JavaScript dual-engine systems, is convenient to switch, can enable different development teams and game APPs of different development languages to be integrated under a large platform, and can normally work; in addition, products developed by different languages can be integrated without reconstruction, development cost is greatly reduced, and learning cost of a uniform technical scheme of different technical stacks of different teams is reduced.

Description

Double-engine system capable of supporting LUA and JavaScript
Technical Field
The invention relates to the technical field of game development, in particular to a dual-engine system capable of supporting LUA and JavaScript.
Background
With the increasing demand of mobile terminal APP and mobile games, a plurality of language technologies for game development in the market are basically LUA or JavaScript, the two technologies ensure that the speed and the efficiency of the game development can be correspondingly ensured, so that the yield of game products is improved, game development companies can quickly iterate the products which the game development companies want, a game underlying engine developed by two scripts is cos2d-x, and the cos2d-x can perfectly support the running of the two scripts.
At present, more and more games are developed based on the two games, and a plurality of game developers need to make a concept of a game platform, wherein if some games are developed by LUA, some games are developed by JavaScript. The two games cannot be integrated on a game platform, because the Cocos2d-x native does not support the coexistence of two runtimes at the same time, if the games are integrated on a game platform, the following problems exist: the script codes are developed in a unified game, so that games which are not in different scripts need to be reconstructed, and the development cost is huge; in addition, the game APP needs to be quitted first, and then the game APP enters, so that the user experience is very poor, and the user stickiness is very poor
Disclosure of Invention
The invention aims to provide a dual-engine system capable of supporting LUA and JavaScript, integrates the LUA and JavaScript dual-engine system, is convenient to switch, and can enable game APPs of different development languages of different development teams to be integrated under a large platform and normally work.
The technical scheme of the invention is realized as follows:
a dual-engine system capable of supporting LUA and JavaScript comprises the following steps:
the method comprises the following steps: integrating source codes of the LUA engine and the JavaScript engine into the game APP;
step two: through the switching layer, memory switching is carried out on the LUA engine and the JavaScript engine;
step three: through the middle layer, when the LUA engine and the JavaScript engine are switched, the data structures, the method drivers and the engine handles of the LUA engine layer and the JavaScript engine layer are saved.
Further, in step one, the source codes of the LUA engine and the JavaScript engine are integrated into the game APP in the form of LIB.
Further, in the second step:
when the LUA engine layer is switched, clearing the memory Runtime of the current JavaScript engine;
and when the JavaScript engine layer is switched, clearing the Runtime of the LUA engine.
Furthermore, in the CPP layer, the data structures, method drivers and engine handles of the LUA engine and the JavaScript engine are saved, so that the LUA engine and the JavaScript engine can be conveniently switched, and data is not lost when different engines are switched.
Further, the LUA engine and the JavaScript engine may be concurrently present in the running game APP of Cocos2 d-x.
The invention has the beneficial effects that: the invention integrates LUA and JavaScript dual-engine systems, is convenient to switch, can enable different development teams and game APPs of different development languages to be integrated under a large platform, and can normally work; in addition, products developed by different languages can be integrated without reconstruction, development cost is greatly reduced, and learning cost of a uniform technical scheme of different technical stacks of different teams is reduced.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings needed in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
FIG. 1 is a block diagram of the system of the present invention;
FIG. 2 is a flow chart of the present invention for switching JavaScript engines;
FIG. 3 is a flow chart of switching LUA engines according to the present invention;
FIG. 4 is a flowchart of switching between JavaScript and LUA engines according to the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments.
In the description of the present invention, it is to be understood that the terms "upper", "lower", "front", "rear", "left", "right", "top", "bottom", "inner", "outer", and the like, indicate orientations or positional relationships based on the orientations or positional relationships shown in the drawings, are merely for convenience in describing the present invention and simplifying the description, and do not indicate or imply that the device or element being referred to must have a particular orientation, be constructed and operated in a particular orientation, and thus, should not be construed as limiting the present invention.
According to the embodiment of the invention, a dual-engine system capable of supporting LUA and JavaScript is provided.
Referring to fig. 1 to 4, a dual-engine system capable of supporting LUA and JavaScript according to an embodiment of the present invention includes the following steps:
the method comprises the following steps: integrating source codes of the LUA engine and the JavaScript engine into the game APP;
step two: through the switching layer, memory switching is carried out on the LUA engine and the JavaScript engine;
step three: through the middle layer, when the LUA engine and the JavaScript engine are switched, the data structures, the method drivers and the engine handles of the LUA engine layer and the JavaScript engine layer are saved.
In one embodiment, in step one, the source code of both the LUA engine and the JavaScript engine are integrated into the game APP in the form of LIB.
In one embodiment, in step two:
when the LUA engine layer is switched, clearing the memory Runtime of the current JavaScript engine;
and when the JavaScript engine layer is switched, clearing the Runtime of the LUA engine.
In one embodiment, in the CPP layer, the data structures, method drivers and engine handles of the LUA engine and the JavaScript engine are saved, so that the LUA engine and the JavaScript engine can be switched conveniently, and data is not lost when different engines are switched.
In one embodiment, the LUA engine and the JavaScript engine may be concurrently present in a running game APP of Cocos2 d-x.
As shown in fig. 2, the method comprises the following steps
(1) Entering an APP;
(2) switching the APP into the middle layer, and initializing a JavaScript and LUA engine;
(3) initializing a common data layer;
(4) switching to a JavaScript engine according to the development language of the game, and destroying the LUA engine;
(5) entering a JavaScript engine to perform game operation;
(6) and exiting the game APP.
See fig. 3, comprising the following steps
(1) Entering an APP;
(2) switching the APP into the middle layer, and initializing a JavaScript and LUA engine;
(3) initializing a common data layer;
(4) switching to an LUA engine according to the development language of the game, and destroying a JavaScript engine;
(5) entering a JavaScript engine to perform game operation;
(6) and exiting the game APP.
See fig. 4, comprising the following steps
(1) Entering a game APP;
(2) switching the APP into the middle layer, and initializing a JavaScript and LUA engine;
(3) initializing a common data layer;
(4) entering a JavaScript engine according to a game development language, and destroying the LUA engine;
(5) entering a game and performing game operation;
(6) quitting the game, returning to the middle layer, and initializing a JavaScript and LUA engine;
(7) entering an LUA engine according to a game development language, and destroying a JavaScript engine;
(8) entering an LUA engine game and performing game operation;
(9) and exiting the APP.
The LUA engine and the JavaScript engine can be simultaneously stored in the running game APP of the Cocos2d-x, so that the situation that mini games developed by different languages cannot be integrated on the same platform is avoided, and different game development teams can select the technique with great proficiency to develop products.
The invention has the beneficial effects that: the invention integrates LUA and JavaScript dual-engine systems, is convenient to switch, can enable different development teams and game APPs of different development languages to be integrated under a large platform, and can normally work; in addition, products developed by different languages can be integrated without reconstruction, development cost is greatly reduced, and learning cost of a uniform technical scheme of different technical stacks of different teams is reduced.
The above description is only for the preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art should be considered to be within the technical scope of the present invention, and the technical solutions and the inventive concepts thereof according to the present invention should be equivalent or changed within the scope of the present invention.

Claims (5)

1. A dual-engine system capable of supporting LUA and JavaScript is characterized by comprising the following steps:
the method comprises the following steps: integrating source codes of the LUA engine and the JavaScript engine into the game APP;
step two: through the switching layer, memory switching is carried out on the LUA engine and the JavaScript engine;
step three: through the middle layer, when the LUA engine and the JavaScript engine are switched, the data structures, the method drivers and the engine handles of the LUA engine layer and the JavaScript engine layer are saved.
2. The dual engine system of claim 1, wherein in step one, the source code of both the LUA engine and the JavaScript engine are integrated into the game APP in LIB form.
3. The dual-engine system capable of supporting LUA and JavaScript according to claim 1, wherein in step two:
when the LUA engine layer is switched, clearing the memory Runtime of the current JavaScript engine;
and when the JavaScript engine layer is switched, clearing the Runtime of the LUA engine.
4. The dual-engine system capable of supporting LUA and JavaScript according to claim 1, wherein in the CPP layer, the data structures, method drivers and engine handles of the LUA engine and the JavaScript engine are saved, so that the LUA engine and the JavaScript engine can be conveniently switched, and data is not lost when different engines are switched.
5. A dual engine system supporting LUA and JavaScript in accordance with any of claims 1 to 4, wherein the LUA engine and the JavaScript engine can be concurrently present in a running game APP of Cocos2 d-x.
CN202010538502.5A 2020-06-13 2020-06-13 Double-engine system capable of supporting LUA and JavaScript Pending CN111813445A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010538502.5A CN111813445A (en) 2020-06-13 2020-06-13 Double-engine system capable of supporting LUA and JavaScript

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010538502.5A CN111813445A (en) 2020-06-13 2020-06-13 Double-engine system capable of supporting LUA and JavaScript

Publications (1)

Publication Number Publication Date
CN111813445A true CN111813445A (en) 2020-10-23

Family

ID=72844968

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010538502.5A Pending CN111813445A (en) 2020-06-13 2020-06-13 Double-engine system capable of supporting LUA and JavaScript

Country Status (1)

Country Link
CN (1) CN111813445A (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106325866A (en) * 2016-08-22 2017-01-11 网易(杭州)网络有限公司 Cross-engine calling method and cross-engine calling device

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106325866A (en) * 2016-08-22 2017-01-11 网易(杭州)网络有限公司 Cross-engine calling method and cross-engine calling device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
李锦俊: "cocos2d-x脚本引擎(JavaScript、Lua等等)的大统一(方案概述)", pages 1 - 2, Retrieved from the Internet <URL:http://www.cppblog.com/mybios/archive/2015/11/20/212299.html> *

Similar Documents

Publication Publication Date Title
CN110618876B (en) Linux and Android coexistence and interaction method based on Feiteng platform and shared kernel
CN109731334B (en) State switching method and device, storage medium and electronic device
CN107370804B (en) Software application processing method and device
CN111176629A (en) Application development method and device
CN111330280B (en) Method and device for processing data in game, storage medium and electronic equipment
CN102799444B (en) The method of cross-platform packing program and device
CN111030980A (en) Linux transparent network equipment platform implementation method, device and storage medium
CN107193565B (en) Method for developing native APP (application) across mobile terminals
CN104683438A (en) Compass or GPS (Global Positioning System) dual-mode on-line positioning method
CN103425509A (en) Method and device for installing language package
CN115525282A (en) Method for realizing cross-platform desktop application program and related equipment thereof
CN103678099B (en) A kind of method and device realizing hardware platform and software platform communication
CN111813445A (en) Double-engine system capable of supporting LUA and JavaScript
CN113467769A (en) Three-layer hybrid development system based on HTML5 and development method thereof
CN112905332A (en) Method for realizing English PDF online rapid translation based on LVS load balancing Django architecture
CN111773715B (en) Task execution method, device, equipment and medium
CN115525180A (en) Screen switching method and device, computer readable storage medium and electronic equipment
CN114237684A (en) Component management system, method, device, electronic device and storage medium
CN111880896B (en) Method and device for rapidly restoring container and running state data
CN114296719A (en) Method, system, equipment and storage medium for improving Weex cross-platform compatibility
CN109460280A (en) Run method, the terminal of program
CN113961194A (en) Engineering construction method, system, terminal and medium based on FLUTTER cross-application
CN113609092A (en) Method, system, terminal and storage medium for distributed storage docking of HDFS client
CN104698481A (en) Beidou or GPS dual-mode online positioning system
CN117555645B (en) Data processing method, device, equipment and medium based on multi-terminal application platform

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20201023

RJ01 Rejection of invention patent application after publication