GC在游戏编程方面的经验 [英] Experiences with GC in game programming

查看:86
本文介绍了GC在游戏编程方面的经验的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在这里有谁在游戏或自行演示中有GC经验?是否

GC暂停游戏是否明显?如果是的话,是否可以预先分配

几乎所有内容,以便GC只需要每隔> 5分钟运行一次,这将是可接受的。

非常欢迎任何建议或经验或建议!


-

cody


[免费软件,游戏和幽默]
www.deutronium.de.vu || www.deutronium.tk

解决方案

只要有内存,你就有很多选择。我倾向于尽可能多地使用

对象

汇总,而不是创建新对象并让他们

去。

清理任何池化对象都存在一些问题,但是如果你自己创建一个带有一些接口的通用池管理器,那么它可以很好地工作





调用

确保物品被清理干净并准备送回去。


Terrarium运行相当一些时间,在某些情况下很多天。到目前为止,

只有

真正的GC问题,我们已经在这个项目进入框架之前发布了



Terrarium没有任何明显的滞后,除非生物过去,没有

由于

GC介意你,我们不断有生物分配

我们的控制之外的新对象。


如果你有一个特定的用例,那可能会好于

一般来说

钓鱼以获取信息。注意,你总是会有gen0集合

射击。


-

贾斯汀罗杰斯

DigiTec Web Consultants,LLC。

博客: http:// weblogs.asp.net/justin_rogers


" cody" < PL ********** @ gmx.de>在留言中写道

news:ed *************** @ tk2msftngp13.phx.gbl ...

这里有谁是谁有游戏或自行演示的GC经验吗? GC暂停游戏是否明显?如果是的话,是否可以预先分配几乎所有的东西,这样GC每隔> 5分钟就需要运行一次,这是可以接受的。
非常欢迎任何建议或经验或提示!

-

[免费软件,游戏和幽默]
www.deutronium.de.vu || www.deutronium.tk



只要有内存,你就有很多选择。我倾向于尽可能多地使用

对象

汇总,而不是创建新对象并让他们

去。

清理任何池化对象都存在一些问题,但是如果你自己创建一个带有一些接口的通用池管理器,那么它可以很好地工作





调用

确保物品被清理干净并准备送回去。


Terrarium运行相当一些时间,在某些情况下很多天。到目前为止,

只有

真正的GC问题,我们已经在这个项目进入框架之前发布了



Terrarium没有任何明显的滞后,除非生物过去,没有

由于

GC介意你,我们不断有生物分配

我们的控制之外的新对象。


如果你有一个特定的用例,那可能会好于

一般来说

钓鱼以获取信息。注意,你总是会有gen0集合

射击。


-

贾斯汀罗杰斯

DigiTec Web Consultants,LLC。

博客: http:// weblogs.asp.net/justin_rogers


" cody" < PL ********** @ gmx.de>在留言中写道

news:ed *************** @ tk2msftngp13.phx.gbl ...

这里有谁是谁有游戏或自行演示的GC经验吗? GC暂停游戏是否明显?如果是的话,是否可以预先分配几乎所有的东西,这样GC每隔> 5分钟就需要运行一次,这是可以接受的。
非常欢迎任何建议或经验或提示!

-

[免费软件,游戏和幽默]
www.deutronium.de.vu || www.deutronium.tk



如果您考虑到它,当然可以创建一个渲染循环

,它使用从上到下的近零分配,代价是一些

额外内存。你当然可以创建一个只使用GC0

而且从不使用更昂贵的GC1 / 2并且如果你经常使用它们的那个

你*会*注意。我已经完成了这个并且效果非常好......我不会说b $ b说我正在构建的是任何想象力的UT 2003质量,

但是它确实做了很多纹理/几何变化并且没有抖动。

实际上我也有多个视频在玩,我目前甚至没有制作

使用VMR但我仍然没有任何令人讨厌的停顿。


我也很痛苦永远不会发出多余的渲染状态变化。我不知道是否值得我付出努力将其降到零,但是我会猜测每一点都有帮助。


根据你想做的事情,MDX似乎对很多应用程序都足够好了

恕我直言。


Christian

" cody" < PL ********** @ gmx.de>在留言中写道

news:ed *************** @ tk2msftngp13.phx.gbl ...

这里有谁是谁有游戏或自行演示的GC经验吗?
GC暂停游戏是否明显?如果是的话,是否可以预先分配几乎所有的东西,这样GC每隔> 5分钟就需要运行一次,这是可以接受的。
非常欢迎任何建议或经验或提示!

-

[免费软件,游戏和幽默]
www.deutronium.de.vu || www.deutronium.tk



Is here anybody who has experience with GC in games or selfrunning demos? Is
the GC pausing the game noticeable? If yes, is it possible to preallocate
almost everything so that GC only needs to run every >5minutes, that would
be acceptable.
Any suggestions or experiences or tips are very welcome!

--
cody

[Freeware, Games and Humor]
www.deutronium.de.vu || www.deutronium.tk

解决方案

As long as the memory is there you have quite a few options. I tend to use
object
pooling as much as possible, rather than creating new objects and letting them
go.
There are some issues with clean-up of any pooled objects, but it works fairly
well
if you create yourself a generic pool manager with some interfaces that get
called to
make sure objects are cleaned up and prepared to be sent back out.

The Terrarium runs for quite some time, many days in some cases. So far the
only
true GC issue we''ve had with this project got into the framework before it
released.
The Terrarium doesn''t have any noticeable lag, unless creatures go over, none
due to
GC mind you, and we constantly have creatures allocating new objects outside of
our control.

If you have a specific use case in mind, that would probably be better than
generically
fishing for information. Note, you are always going to have gen0 collections
firing.

--
Justin Rogers
DigiTec Web Consultants, LLC.
Blog: http://weblogs.asp.net/justin_rogers

"cody" <pl*************************@gmx.de> wrote in message
news:ed***************@tk2msftngp13.phx.gbl...

Is here anybody who has experience with GC in games or selfrunning demos? Is
the GC pausing the game noticeable? If yes, is it possible to preallocate
almost everything so that GC only needs to run every >5minutes, that would
be acceptable.
Any suggestions or experiences or tips are very welcome!

--
cody

[Freeware, Games and Humor]
www.deutronium.de.vu || www.deutronium.tk



As long as the memory is there you have quite a few options. I tend to use
object
pooling as much as possible, rather than creating new objects and letting them
go.
There are some issues with clean-up of any pooled objects, but it works fairly
well
if you create yourself a generic pool manager with some interfaces that get
called to
make sure objects are cleaned up and prepared to be sent back out.

The Terrarium runs for quite some time, many days in some cases. So far the
only
true GC issue we''ve had with this project got into the framework before it
released.
The Terrarium doesn''t have any noticeable lag, unless creatures go over, none
due to
GC mind you, and we constantly have creatures allocating new objects outside of
our control.

If you have a specific use case in mind, that would probably be better than
generically
fishing for information. Note, you are always going to have gen0 collections
firing.

--
Justin Rogers
DigiTec Web Consultants, LLC.
Blog: http://weblogs.asp.net/justin_rogers

"cody" <pl*************************@gmx.de> wrote in message
news:ed***************@tk2msftngp13.phx.gbl...

Is here anybody who has experience with GC in games or selfrunning demos? Is
the GC pausing the game noticeable? If yes, is it possible to preallocate
almost everything so that GC only needs to run every >5minutes, that would
be acceptable.
Any suggestions or experiences or tips are very welcome!

--
cody

[Freeware, Games and Humor]
www.deutronium.de.vu || www.deutronium.tk



If you put your mind to it it is certainly possible to create a render loop
that uses close zero allocations from top to bottom at the cost of some
extra memory. You can certainly create one that only makes use of only GC0
and never does GC1/2 which are much more expensive and if you do those a lot
you *will* notice. I have done this and it works pretty well... I wouldn''t
say what I am building is UT 2003 quality by any stretch of the imagination,
but it does do a lot of texture/geometry changes and doesn''t jitter a bit.
In fact I also have multiple videos playing and am currently not even making
use of the VMR but I still don''t have any nasty pauses.

I also go to great pains never to issue redundant render state changes. I
don''t know if it is worth the effort I put in to get it down to zero but I
guess every little helps.

Depending on what you want to do, MDX seems good enough for a lot of apps
IMHO.

Christian
"cody" <pl*************************@gmx.de> wrote in message
news:ed***************@tk2msftngp13.phx.gbl...

Is here anybody who has experience with GC in games or selfrunning demos? Is the GC pausing the game noticeable? If yes, is it possible to preallocate
almost everything so that GC only needs to run every >5minutes, that would
be acceptable.
Any suggestions or experiences or tips are very welcome!

--
cody

[Freeware, Games and Humor]
www.deutronium.de.vu || www.deutronium.tk



这篇关于GC在游戏编程方面的经验的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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