New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Guidance for structuring multiple scenes (like XNA Game State Management :)) #118
Comments
If you are planning to use Win2D for all of your drawing, then I would recommend using a single XAML file containing a CanvasAnimatedControl and arrange for different "scene" switching to be done there. I think that this would cover most game scenarios. ExampleGallery is demonstrating many non-game scenarios with lots of interaction between XAML controls and CanvasControls. This is why it is structured as multiple XAML files. Content can be unloaded simply by dropping all references to them. Most content can also be Disposed() as well to force the underlying GPU resources to be released. The app has full control over this. |
Thanks! Any advice around GC? Does it matter much on desktop? (With XNA on Xbox, much effort seemed to be spent avoiding allocations, forcing GC during loading screens, etc.) |
The CLR has improved a lot since its Xbox 360 incarnation. It's certainly possible to write code where GC will be perf issue, but this isn't usually a big deal. |
Great; thanks for the info :) Closing this, as I think there's enough info here to satisfy the request.. Hope you might consider a small 2D game for a future sample/app building week though! |
I know Win2D isn't aimed purely at games, but it seems to be a reasonable use case (some of the members on
CanvasAnimatedControl
haveGame
in their names!). Something that isn't entirely clear to me at first glance is what the recommended way to break a game into multiple scenes (menus, levels, pause screen etc.) would be and how to navigate between them.Eg:
CanvasAnimatedControl
, but might mean gaining some benefits from navigation structure already available there?XNA had a Game State Management sample which I thought was a great sample! It made it really easy to see how these things can hang together (and encouraged people to split these things up, rather than ending up with a monolithic game class). Having some similar guidance (whether it's a code sample, or just some paragraphs somewhere) for Win2D would be really useful.
Note: I did look at the sample gallery which uses separate XAML files; but there's some text on this page that suggests levels might be loaded within a single control.
@shawnhar A simple 2D game might make a great project for your next dog-fooding week ;O)
The text was updated successfully, but these errors were encountered: