npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

xert

v1.2.3

Published

A lightweight ECS framework based on three.js

Downloads

16

Readme

Xert

一个基于Three.js的轻量级ECS框架,仅有5个API。 A lightweight ECS(Entity Component System) framework based on three.js, there are only 5 APIs.

暴龙

Xert 提倡组合优于继承、外观行为分离、不重复造轮子。

Xert 对 ECS 的理解:
Entity:游戏中的所有对象,需要自定义,包含外观和行为;
Component:构成游戏对象的组件,不需要自定义、由 Three.js 提供,可借助 ES6 语言特性实现,如getter/setter;
System:游戏需要借助的外部功能,如渲染、UI、声音、控制等,可自定义或由浏览器、HTML、三方类库等提供;

使用 Xert 只需要关注 3 类对象:

  1. Plugin: 包含钩子代码,负责将外部系统功能注入游戏,使用function函数;

  2. Entity: 包含只运行一次的代码,负责定义游戏对象的加载、层级结构等,使用对象字面量;

  3. Script: 包含每帧都运行的代码,负责控制游戏逻辑和对象行为,使用箭头函数;

API

1. const game = new Xert()

创建 Xert 实例。

2. game.reg(manager)

向 game 实例中注册插件,插件是系统的钩子,系统包括HTML UI、Audio、Input、Loading等。 使用 function 声明插件函数。

3. game.add(light)

向 game 实例中添加 3D 实体,对应 ECS 中的 E。 使用对象字面量声明实体。

4. game.use(control)

调用游戏逻辑控制实体行为。 使用箭头函数声明行为。

5. game.start()

开始游戏。

安装 Install

npm install xert 

示例 Examples

import * as THREE from 'three'
import {GLTFLoader} from 'gltfloader'
import {Xert, Minimap, NavMeshGenerator} from 'xert'

const game = new Xert()
game.reg(manager)
game.reg(input)

game.add(light)
game.add(world)
game.add(car)

game.use(control)

game.start()

License

MIT © Li zhigang