TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

How to Build an Entity Component System Game in JavaScript

28 点作者 enoex1将近 11 年前

4 条评论

albeec13将近 11 年前
Great write-up. I find this system a lot more friendly than previous attempts I&#x27;ve made at game programming, usually involving derived classes of a an Entity class that posses inherited function calls for things like Draw(), Move(), etc.<p>By using data-only entities, it becomes a lot simpler to create Draw and Move classes which take an entity as an object and use the data therein to perform the action described by their class name. This makes it a bit simpler at the &quot;main&quot; code loop, because you don&#x27;t need to pass handles, etc. down to the entities in order to draw using the game engine.
poezn将近 11 年前
Gaah that&#x27;s addictive. I mean, the source and blog post is nice too, but that game...! :)<p>On a more serious note: I&#x27;ve never heard of ECS before, but it seems like it&#x27;s been used in game development for a while. I feel like most data visualization projects these days (especially the ones using D3.js) use some form of ECS, although not necessarily out of deliberation. I wonder if there are best practices from game development that can aide the development of data visualizations
xqunix将近 11 年前
Nice article.<p>I&#x27;ve built a Component-Entity-System library in JavaScript a while back, and the code is quite similar. You can check it out at <a href="https://github.com/qiao/ces.js" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;qiao&#x2F;ces.js</a>
评论 #8134063 未加载
marak830将近 11 年前
Interesting. Working in my (first) game atm in my free time, was just about to refactor the enemy system, so this is a gios time to try something interesting like this!<p>Thanks for the writeup.