在游戏开发中,是否存在迭代 SoA 集合中所有相同类型数组的设计模式?

问题描述

我有 N 个数组结构:

PlayerTable: ids,velocities,positions,animations,healths ...
EnemyTable: ids,AIs ...
BulletTables: ids,ranges ...
... other N-3 soas

我有 M 个程序来更新这些数组结构:

applyVelocities: [read] velocities,[write] positions
updateAnimations: [write] animations
drawEntities: [read] animations,[read] positions
... other M-3 procedures

是否有一种设计模式可以迭代 SoA 集合中所有相同类型的数组?

我可以考虑编写一个模板函数,并为具有这些属性的每个数组结构调用它。是这样吗?这通常可以很好地扩展吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...