【转】Fast Entity Component System
http://entity-systems.wikidot.com/fast-entity-component-system
Summary
- Create a generic System class which stores Components as a Vector array, allows access to them, and processes its data when called.
- Create an Entity Manager that re-uses expired entity id's, if possible, and facilitates the clean removal an entity by removing it from all systems.
- Components are classes. Ideally, component classes do not have external methods, but that doesn't mean they aren't allowed.
- The Entity is represented by an integer, not its own class.
- The Entity's integer value is equal to the index of its data in any given system's object array. This allows "fast" access to its data. The biggest tradeoff is a potential for null values between "active" indices, bloating the object array.
- A simple version can be seen in action at Open Processing.
Perhaps add the word "Index" into the name somewhere? Perhaps "Fast Entity-Indexed Component System" ?
I think it would help underlne the key innovative step in this approach — tmachine
Implementation
Concepts
- Entity: An integer.
- Entity Manager: A singleton class.
- Component: A class with data.
- System: A generic class with methods and an object array.
- Component System: A singleton class that extends System using a specific Component class.
Duties
- Entity: A handle shared by all systems. It has no idea what components it has.
- Entity Manager: Prevents duplicate IDs from being handed out.
Recycles IDs that have been removed from all component systems. Handles
the removal of an entity from all component systems. - Component: Holds data of a specific type. If things get dirty (as
rapid game development often does), it can have methods for other
systems to work with that data, such as a vector class that can return
its magnitude. - System: (This is a generic class, and never used directly) Manage an
array of Components of a specified class, using the value of Entity as
an index. Has methods to add, update, get, remove, and process that
data. - Component System: Extends System with the Component's class. Almost always overrides the Process function.
Expansion
Out of the box, it is only possible to process (or try to process)
every object, in every system, each frame. But the framework also allows
a system to process individual entities. This could lead to a "group"
class that manages its own list of entity ID's, preventing wasted cycles
on "blank" entries in systems. It would still use the Entity Manager to
create and destroy entities.
Source Code for FECS Framework
Java
http://www.openprocessing.org/visuals/?visualID=18023 - Note that this requires Processing. It can easily be ported to pure Java, however.
【转】Fast Entity Component System的更多相关文章
- Unity下一轮最大的变革-Entity Component System & C# Jobs System
ECS+jobs实现的酷炫效果 新一代Entity Component System(ECS)将会彻底改变Unity的底层概念(GameObject-Component 系统)和现有工作方式.Mono ...
- github 排名前100的项目
dotnet/roslyn The .NET Compiler Platform ("Roslyn") provides open-source C# and Visual Bas ...
- Game Development Patterns and Best Practices (John P. Doran / Matt Casanova 著)
https://github.com/PacktPublishing/Game-Development-Patterns-and-Best-Practices https://github.com/m ...
- 剖析虚幻渲染体系(14)- 延展篇:现代渲染引擎演变史Part 1(萌芽期)
目录 14.1 本篇概述 14.1.1 游戏引擎简介 14.1.2 游戏引擎模块 14.1.3 游戏引擎列表 14.1.3.1 Unreal Engine 14.1.3.2 Unity 14.1.3. ...
- 我所理解的Cocos2d-x
我所理解的Cocos2d-x(完全基于Cocos2d-x3.0,深度剖析计算机图形学,OpenGL ES及游戏引擎架构,全面提升游戏开发相关知识) 秦春林 著 ISBN 978-7-121-246 ...
- Cocos2d-x 3.0 事件系统【转】
事件系统,是一个软件的核心组成部分.从小处讲它是应用程序内部各模块交互的设计模式,从大处讲,它是软件架构的组成模块.在现代软件开发中,操作系统通常通过一些预定义的事件,告知应用程序发生的一些事情如用户 ...
- Unity ECS 视频笔记
视频摘要 本文视频资料:使用Entity Component System开发<快乐的Minecraft>游戏 使用Unity2018及以上版本才有ECS功能. 本文是看视频的一些摘要. ...
- A-Frame WebVR开发新手教程
WebVR和WebGL应用程序接口使得我们已经能够在浏览器上创建虚拟现实(VR)体验.但从project化的角度而言,开发社区还须要很多其它方便强大的开发库来简化编程.Mozilla的 A-Frame ...
- 如何实现最佳的跨平台游戏体验?Unity成亮解密实时渲染
7月31日,2018云创大会游戏论坛在杭州国际博览中心103B圆满举行.本场游戏论坛聚焦探讨了可能对游戏行业发展有重大推动的新技术.新实践,如AR.区块链.安全.大数据等. Unity大中华区技术经理 ...
随机推荐
- C++的vector学习abc
开始学习和使用vector了,用到之后再去学似乎神迹的感觉啊,就像跑一下就能给个糖吃哈哈 百度上的六种初始化的方法就不再说了,那些方法都很对. 如果没有值初始化,系统会自行初始化,目前我遇到的是用脚标 ...
- 使用HttpClient访问被保护资源
下面的Android应用需要向指定页面发送请求,但该页面并不是一个简单的页面,只有当用户已经登录,而且登录用户的用户名是crazyit.org时才可访问该页面.如果使用HTTPURLConnectio ...
- Operating System Concepts 项目:生产者-消费者问题 线程
一. 实验目的 实现一个c程序,该程序能模拟解决有限缓冲问题,其中消费者和生产者产生和消耗随机数 二.实验内容 缓冲区 元数据类型为buffer_item,大小为1000的数组,按环形队列处理 生产者 ...
- LA 4119 - Always an integer
https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_probl ...
- python交互模式下cp65001异常
unknown encoding: cp65001异常 python安装后进入命令行交互模式,输入任何代码都报unknown encoding: cp65001异常 需要将编码(UTF-8)修改为 简 ...
- 【Noip2012】解题报告【字符】【贪心】【高精度】【倍增】【set】
目录:1:vigenere密码[字符]2:国王游戏[贪心][高精度]3:开车旅行[倍增][set] 题目: VJ P1778 vigenere密码 Accepted 标签:NOIP提高组2012 ...
- 关于BIOS的一点东西
关于BIOS的一点东西 编辑删除转载2016-05-20 00:36:36 去把BIOS的每个单词意思都有道一遍就都明白了,BOOT是更改 启动顺序的(台式机一直按del键就会进入BIOS界面,用上下 ...
- 纯JS文本在线HTML编辑器KindEditor
KindEditor(http://www.kindsoft.net)是一款比较专业,主流,好用的在线HTML编辑器. 它除了可以将文本进行编辑.将Word中的内容复制进来外,本身还可以拖动缩放(右下 ...
- 获取hadoop的源码和通过eclipse关联hadoop的源码
一.获取hadoop的源码 首先通过官网下载hadoop-2.5.2-src.tar.gz的软件包,下载好之后解压发现出现了一些错误,无法解压缩, 因此有部分源码我们无法解压 ,因此在这里我讲述一下如 ...
- PHP里10个鲜为人知但却非常有用的函数
levenshtein() 你有没有经历过需要知道两个单词有多大的不同的时候,这个函数就是来帮你解决这个问题的.它能比较出两个字符串的不同程度. 用法: <?php $str1 = " ...