游戏框架架构-查看组件还是MVC? [英] Game framework architecture - view components or MVC?

查看:120
本文介绍了游戏框架架构-查看组件还是MVC?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为我的游戏构建一个非常轻便的可重用框架,而不是每次启动游戏都从头开始.我有一个组件驱动的体系结构-例如实体由Position组件,Health组件和Ai组件等组成.

I'm trying to build a very light re-usable framework for my games, rather than starting from scratch each time I start a game. I have a component driven architecture - e.g. Entity composes a Position component and a Health component and Ai component etc.

我的主要问题是,我的模型是否构成视图组件以允许该模型包含多个视图,或者是否在模型不了解其视图的情况下使用更真实的MVC,并且它们由外部管理.

My big question is whether my model composes view components to allow for more than one view of the model, or whether to use a truer MVC where the model does not know about its views, and they are managed externally.

我已经尝试了这两种方法,但是如果有人知道每种方法的优缺点,并且这是行业标准,那真是太好了.

I have tried both methods but if anyone knows the pros and cons of each approach and which is the industry standard, it would be great to know.

推荐答案

取决于您的听众,游戏开发者(包括我自己)并不十分习惯MVC模型,尽管大多数人都知道,但保持干净并非易事因为开发人员伤亡(没有任何严重的技术原因)而裁员.因此,从经验来看,我已经看到许多游戏框架是从MVC开始的,但是只有一对能够维护它直到结束.我的理论是,MVC对于小型一次性游戏(通常有几个开发人员)增加了太多的复杂性,却没有什么好处,并且很难将大多数游戏对象真正干净地分隔为大型/复杂游戏的这些层.而且由于游戏有发布日期,因此它们多次牺牲代码的清晰度和可重复性来提高性能和快速的即席解决方案(如果需要续集(如果有的话)将重写它们).

depends on your audience, game devs, myself included aren't very used to the MVC model, although most know it, it's not as easy to keep it clean cut, because of development casualties (not any serious technical reasons). So from experience, I've seen dozens of game frameworks start as MVC, but only a pair were able to maintain it until the end. My theory is MVC adds too much complexity and little benefits for small throwaway games (with normally a few devs), and it's to hard to keep really cleanly separate most game objects into these layers for large/complex games. And since games have a release date, they many times sacrifice code clarity and reusability for performance and quick adhoc solutions (that will get rewritten if necessarry in the sequel (if there is one)).

但是,有了上面的警告,最好将目标对准高处,因为如果成功,它就会更好:);如果失败,则从优至劣.因此,您可能应该尝试使用MVC,但不要担心它是否会失败,专业游戏开发人员都多次失败了:)

However, with the caveat above, it's better to aim high, because if you succeed it's better :) and if you fail, well to bad. So you should probably try the MVC, but don't worry if it fails, profesional game devs have all failed at the task many times :)

这篇关于游戏框架架构-查看组件还是MVC?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆