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

iam-ecs-typescript

v1.1.5

Published

使用 TypeScript 实现的一个 ECS 系统。目前用于 Cocos Creator,不过因为没有依赖任何 Cocos Creator 的接口,所以也可以用在任何其他支持 TS/JS 的引擎中。

Downloads

5

Readme

iam-ecs-typescript

使用 TypeScript 实现的一个 ECS 系统。目前用于 Cocos Creator,不过因为没有依赖任何 Cocos Creator 的接口,所以也可以用在任何其他支持 TS/JS 的引擎中。

QQ 群号码: 367237484
COPYRIGHT 2021 ALL RESERVED. (C) liaoyulei, https://github.com/dualface

在线 DEMO 展示: https://liaoyulei.cn/projects/iam-ecs-typescript-demo/

DEMO 源代码: https://github.com/dualface/iam-ecs-typescript-demo

ECS 框架源代码: https://github.com/dualface/iam-ecs-typescript

~

CHANGELOG

  • 版本 1.1.5 打断兼容性的改动: ECSComponent.entityID 改名为 ECSComponent.entityId
  • 2021/03/24: 按照 Google TypeScript Style Guide 更新了代码和注释
  • 2021/03/19: 更新 README 和在线 DEMO
  • 2021/03/18: 更名为 iam-ecs-typescript
  • 2021/03/14: 增加 ECSComponentInterface 接口
  • 2021/03/10: 将 DEMO 迁移到单独的仓库
  • 2021/03/10: 发布为 NPM 包,使用 ecsclass 装饰器简化代码
  • 2021/02/08: 添加 Cocos Creator 3.0 示例项目
  • 2021/01/26: 初始发布

~

目标

ECSEntity-Component-System 的缩写,代表了一种架构模式。

ECS 并没有什么标准的实现。不过总的来讲,ECS 具有这些特点:

  • Entity 代表一个实体,例如游戏中的 NPC、子弹、物品等等。通常每一个 Entity 都有一个唯一 ID。
  • Component 代表构成一个实体的其中一部分,称为组件。例如 NPC 可能由 Movable(可以移动)、Health(具有健康度,也就是血量)、RenderNode(渲染节点)几个组件组成,每个组件只定义特定的一组属性或者状态。
  • System 代表处理某一个领域逻辑的系统。大部分系统都是处理特定的 Component,例如专门处理所有 Movable 组件的系统仅仅处理移动等操作。这样一来大部分 system 通常都只包含相对简单的逻辑。

不过 ECS 也并非万能钥匙。在 UI 交互等场景中,ECS 用起来就比较繁琐了。所以从实践的角度,我主要将 ECS 用于构建游戏世界的玩法实现。而涉及到 UI 交互等场景,仍然采用传统的面向对象架构。

iam-ecs-typescript 这个实现中,我主要追求以下目标:

  • 容易理解的设计
  • 简单明了的 API
  • 无性能损耗

~

DEMO

在线 DEMO 展示: https://liaoyulei.cn/projects/iam-ecs-typescript-demo/

DEMO 源代码: https://github.com/dualface/iam-ecs-typescript-demo

~

ECS API 说明

所有 API 都在 lib/ 目录中,并且有中文注释,文档此处省略。。。

-EOF-