APP, small program open source small game engine, support 2D, 3D game development

APP, small program open source small game engine, support 2D, 3D game development

2022-10-10 0 1,589
Resource Number 44987 Last Updated 2025-02-24
¥ 0HKD Upgrade VIP
Download Now Matters needing attention
Can't download? Please contact customer service to submit a link error!
Value-added Service: Installation Guide Environment Configuration Secondary Development Template Modification Source Code Installation

This issue recommends a small game engine that supports 2D and 3D game and application development – LayaAir.

 APP, small program open source small game engine, support 2D, 3D game development插图

Support WebGL 1.0 and 2.0 adaptive. Support ActionScript3, TypeScript, JavaScript three development languages, suitable for 2D, 3D product development. Performance comparable to native APP, once developed HTML5, APP(Android and iOS), small games (wechat small games, QQ small games, Baidu small games, Alipay small games, BiliBili small games, Bytedance small games, millet fast games, OPPO small games, vivo small games, Huawei fast games, etc.) released at the same time on various platforms.

Features

The LayaAir engine mainly includes two core parts: engine library and LayaAir IDE.

LayaAir2.0 engine library function

    • The LayaAir2.0 engine not only maintains the original functionality of 1.0, such as: Sprites, vector graphics, text, rich text, bitmap fonts, animation, bones, audio and video, filters, events, loading, easing, time, network, UI system, physical system, TiledMap, prtocol and other apis;
    • Also adds a built-in box2D physics engine, componentization support, and more than 150 3D features, such as: The main new official materials include PBRStandardMaterial, PBRSpecularMaterial and UnlitMaterial.
    • Texture, add a variety of texture parameter configurations (mipmap, format, wrapModeU, wrapModeV, filterMode, anisoLevel), add texture upload pixel interface, GPU texture compression.
    • In terms of animation, new crossFade function of Animator animation fusion is added, multi-layer mixing of animation is added, animation update mechanism is adjusted to real-time interpolation, which greatly reduces memory and animation fluency performance, and multi-material attribute animation

is added.

  • Support the development of 2D and 3D product development, support the simultaneous release of Web (browser, webView), Native APP (IOS, Android), small games (wechat, hand Q, Baidu, Toutiao, Tiktok, Xiaomi, OPPO, vivo, Huawei), and other versions.

APP, small program open source small game engine, support 2D, 3D game development插图1

APP, small program open source small game engine, support 2D, 3D game development插图2

LayaAir2.0 IDE features

LayaAir2.0 IDE mainly includes project management, code development editor, visual editor, third-party toolchain support tools and so on. The main features include:

  • Code development
  • UI and scene editor
  • Scene management (new in 2.0)
  • Particle editor
  • Animation editor
  • Physical editor (new in 2.0)
  • Component support (new in 2.0)
  • 3D support (new in 2.0)
  • Supported by LayaCloud project (2.0 new)
  • Script extension
  • Default
  • APP package
  • JS obfuscation and compression
  • third-party toolchain conversion tools (Unity3D, TiledMap, Spine, Keel…)

Laya2.0 IDE is compatible with LayaAir 1.x version, in 2d projects, you can upgrade the original project to 2.0 engine without too much change (backup is recommended before upgrading)

Laya2.0 IDE adopts the way of mounting component scripts and scene management to develop, edit scene and page components in the ide, and add scripts to make the project development more conducive to the collaborative work of program, art and planning. Easier to get started and more friendly to develop.

APP, small program open source small game engine, support 2D, 3D game development插图3

APP, small program open source small game engine, support 2D, 3D game development插图4

Development language

Since the LayaAir engine supports ActionScript3 (AS3), TypeScript (TS), JavaScript (JS) three languages, which language is better to use? It’s often confusing for people who are new to engines. Here is a brief introduction.

About JS language

It should be noted that although JS language is easier to get started, but as a weakly typed language, the difficulty of development and debugging, as well as the management of large projects and multi-person collaboration, are not as good as TS and AS3, which can detect the type and syntax in the IDE language. When the code is more and more, JS once accidentally written wrong, IDE will not have any hint, only in the running time will find the problem, often developers in order to check a small mistake, spend a lot of time cost. So while JS language development is supported, it is not recommended to adopt the language for medium or large projects.

About TS language

TS language is the official recommended development language for LayaAir engine, and it is also the language used by LayaAir engine source code since engine 2.2. In the official 2.0 engine video teaching, only TS language will be used for teaching.

About AS language

AS language is LayaAir 2.2 version of the engine source language before the AS3 language was once the dominant page game era, but since Adobe officially announced the abandonment of Flash, also represents the language will also enter the unmaintained situation. Those new language features are naturally difficult to support, and there is no doubt that continuing to use the language will be a drag on the engine. AS a result, the source language of the LayaAir engine has been changed, but the 2.X version of the engine and the AS language version will remain compatible and maintained. However, support for the language will definitely be dropped in future 3.x releases. Developers are advised not to use AS when creating new projects.

Code example

APP, small program open source small game engine, support 2D, 3D game development插图5

Scene loading

ActionScript

package LayaAir3D_Scene3D {
	import common.CameraMoveScript;
	import laya.d3.core.Camera;
	import laya.d3.core.scene.Scene3D;
	import laya.d3.math.Vector3;
	import laya.d3.math.Vector4;
	import laya.display.Stage;
	import laya.utils.Handler;
	import laya.utils.Stat;
	
	public class SceneLoad1 {
		public function SceneLoad1() {
			//Initializing the engine
			Laya3D.init(0, 0);
			Stat.show();
			Laya.stage.scaleMode = Stage.SCALE_FULL;
			Laya.stage.screenMode = Stage.SCREEN_NONE;
			//Loading the scene
			Scene3D.load("res/threeDimen/scene/LayaScene_dudeScene/Conventional/dudeScene.ls", Handler.create(this, function(scene:Scene3D):void {
				Laya.stage.addChild(scene) as Scene3D;
				
				//Get the camera in the scene
				var camera:Camera = scene.getChildByName("Camera") as Camera;
				//Moving the camera position
				camera.transform.position = new Vector3(0, 0.81, -1.85);
				//Rotate the camera Angle
				camera.transform.rotate(new Vector3(0, 0, 0), true, false);
				//Set the camera field of view (Angle)
				camera.fieldOfView = 60;
				//Set the background color
				camera.clearColor = new Vector4(0, 0, 0.6, 1);
				//Add the camera movement control script
				camera.addComponent(CameraMoveScript);
				
				//Set the ambient color of the light
				//scene.ambientColor = new Vector3(2.5, 0, 0);
			}));
		}
	}
}

JavaScript

class SceneLoad1{
	constructor(){
		Laya3D.init(0, 0);
        Laya.Stat.show();
        Laya.stage.scaleMode = Laya.Stage.SCALE_FULL;
        Laya.stage.screenMode = Laya.Stage.SCREEN_NONE;
        Laya.Scene3D.load("res/threeDimen/scene/LayaScene_dudeScene/Conventional/dudeScene.ls", Laya.Handler.create(this, this.sceneLoadFinished));
	}
	sceneLoadFinished(scene){
		Laya.stage.addChild(scene);
        let camera = scene.getChildByName("Camera");
        camera.addComponent(CameraMoveScript);
	}
}

//Activate the launch class
new SceneLoad1();

TypeScript

import CameraMoveScript from "./common/CameraMoveScript"
class SceneLoad1 {
    constructor() {
        Laya3D.init(0, 0);
        Laya.Stat.show();
        Laya.stage.scaleMode = Laya.Stage.SCALE_FULL;
        Laya.stage.screenMode = Laya.Stage.SCREEN_NONE;
        
        Laya.Scene3D.load("res/threeDimen/scene/LayaScene_dudeScene/Conventional/dudeScene.ls", Laya.Handler.create(null, function(scene:Laya.Scene3D):void {
            Laya.stage.addChild(scene) as Laya.Scene3D;
            var camera:Laya.Camera = scene.getChildByName("Camera") as Laya.Camera;
            camera.addComponent(CameraMoveScript);
        }));
    }
}
new SceneLoad1;

Engine Example

8f964fef166b463592ffac920ae594bfnoop.image_

Environmental reflection

APP, small program open source small game engine, support 2D, 3D game development插图7

Light mapping

APP, small program open source small game engine, support 2D, 3D game development插图8

Directional light

e5ba3afc1aff4124933753b42b9e99b5noop.image_

Mesh loading

APP, small program open source small game engine, support 2D, 3D game development插图10

Base collider

a82592389a894f989d3d03e84eadd65anoop.image_

Refraction of glass

APP, small program open source small game engine, support 2D, 3D game development插图12

Model Example

—END—

Open source License:
https://gitee.com/layabox/LayaAir/blob/master/LICENSE.md

资源下载此资源为免费资源立即下载
Telegram:@John_Software

Disclaimer: This article is published by a third party and represents the views of the author only and has nothing to do with this website. This site does not make any guarantee or commitment to the authenticity, completeness and timeliness of this article and all or part of its content, please readers for reference only, and please verify the relevant content. The publication or republication of articles by this website for the purpose of conveying more information does not mean that it endorses its views or confirms its description, nor does it mean that this website is responsible for its authenticity.

Ictcoder Free Source Code APP, small program open source small game engine, support 2D, 3D game development https://ictcoder.com/app%e3%80%81-open-source-mini-game-engine-for-mini-programs-supporting-2d-and-3d-game-development/

Share free open-source source code

Q&A
  • 1. Automatic: After making an online payment, click the (Download) link to download the source code; 2. Manual: Contact the seller or the official to check if the template is consistent. Then, place an order and make payment online. The seller ships the goods, and both parties inspect and confirm that there are no issues. ICTcoder will then settle the payment for the seller. Note: Please ensure to place your order and make payment through ICTcoder. If you do not place your order and make payment through ICTcoder, and the seller sends fake source code or encounters any issues, ICTcoder will not assist in resolving them, nor can we guarantee your funds!
View details
  • 1. Default transaction cycle for source code: The seller manually ships the goods within 1-3 days. The amount paid by the user will be held in escrow by ICTcoder until 7 days after the transaction is completed and both parties confirm that there are no issues. ICTcoder will then settle with the seller. In case of any disputes, ICTcoder will have staff to assist in handling until the dispute is resolved or a refund is made! If the buyer places an order and makes payment not through ICTcoder, any issues and disputes have nothing to do with ICTcoder, and ICTcoder will not be responsible for any liabilities!
View details
  • 1. ICTcoder will permanently archive the transaction process between both parties and snapshots of the traded goods to ensure the authenticity, validity, and security of the transaction! 2. ICTcoder cannot guarantee services such as "permanent package updates" and "permanent technical support" after the merchant's commitment. Buyers are advised to identify these services on their own. If necessary, they can contact ICTcoder for assistance; 3. When both website demonstration and image demonstration exist in the source code, and the text descriptions of the website and images are inconsistent, the text description of the image shall prevail as the basis for dispute resolution (excluding special statements or agreements); 4. If there is no statement such as "no legal basis for refund" or similar content, any indication on the product that "once sold, no refunds will be supported" or other similar declarations shall be deemed invalid; 5. Before the buyer places an order and makes payment, the transaction details agreed upon by both parties via WhatsApp or email can also serve as the basis for dispute resolution (in case of any inconsistency between the agreement and the description of the conflict, the agreement shall prevail); 6. Since chat records and email records can serve as the basis for dispute resolution, both parties should only communicate with each other through the contact information left on the system when contacting each other, in order to prevent the other party from denying their own commitments. 7. Although the probability of disputes is low, it is essential to retain important information such as chat records, text messages, and email records, in case a dispute arises, so that ICTcoder can intervene quickly.
View details
  • 1. As a third-party intermediary platform, ICTcoder solely protects transaction security and the rights and interests of both buyers and sellers based on the transaction contract (product description, agreed content before the transaction); 2. For online trading projects not on the ICTcoder platform, any consequences are unrelated to this platform; regardless of the reason why the seller requests an offline transaction, please contact the administrator to report.
View details

Related Source code

ICTcoder Customer Service

24-hour online professional services