Daniel Tang

I was reading Eli's post on basic game engine structure, and he talks about declaring objects that represent different game screens. Each screen is supposed to be responsible for their own GameComponentCollection, but GameComponentCollection is a sealed class with an internal constructor. I realize that it wouldn't be terribly hard to duplicate the class (and by realize, I mean think), but I was wondering what the justification behind locking down the class. I did a search for "GameComponentCollection" and saw a post from Mitch saying, "Nested game components is not something we explicitly support through the XNA Framework at this time. We'll take a look at adding support in a future version." It seems like it's explicitly not supported, though. So, can I get some reasoning on the lockdown :)


Re: XNA Framework GameComponentCollection instances

Eli Tayrien - MSFT

Sorry about that! Made a mistake in my blog post - youre exactly right that GameComponentCollection can't be used like I suggested in my blog. I posted an update today.

About the lockdown I can't speak for Mitch, but my guess would be because we may want to change how it works in the future. If we do end up supporting nested game components in the future, we may have to change the constructor, which would be a breaking change if it were public.

PS - thanks for reading





Re: XNA Framework GameComponentCollection instances

Daniel Tang

Eli Tayrien - MSFT wrote:
Sorry about that! Made a mistake in my blog post - youre exactly right that GameComponentCollection can't be used like I suggested in my blog. I posted an update today.

About the lockdown I can't speak for Mitch, but my guess would be because we may want to change how it works in the future. If we do end up supporting nested game components in the future, we may have to change the constructor, which would be a breaking change if it were public.

PS - thanks for reading

Not entirely sure why it's a breaking change (it's 3am and I took night-time medicine a few hours ago, or I just don't get it anyway), but it seems like that's the reasoning after all. I saw the same reasoning submitted as user feedback on the Connect website after I posted, but I left the thread open anyway.

And thanks for posting! Your posts have been very insightful.