Getting my game logic away from XNA

Started by
2 comments, last by tharealjohn 10 years, 6 months ago

What are the advantages/disadvantages of completely modularizing my game model code into its own DLL, and creating an XNA Game Component to, essentially, function as an adapter between XNA and the game model? All I want XNA to do is draw stuff and capture user input.

  • One advantage I like is the ability to unit test the game model itself.
  • I also like that it keeps solution files better organized (that's one thing that has driven me MAD with the books I have on XNA game development; there is little to no organization of the solution files...)
  • I like the clean separation of responsibilities, and the portability it affords the actual game logic (it could later be hooked up to Unity, SFML, etc.)

I am aware that it takes more effort, having to develop an interface for the game model; am I overly in love with separation of concerns?

Advertisement

Sounds similar to other design patterns like MVVM, MVC, MVP, etc.

In my experience it, the big disadvantages are mainly the complexity it adds to a project. It has its time and place, and for simple things is probably not worth it. I think you have already grasped the main advantages - you can decouple the pieces and change/update/upgrade them independently.

jmillerdev.com

Follow me @jmillerdev

The question in this case is, How much portability is it really buying you?

If you're writing in XNA, your game model is most likely C#, which is still going to lock you into Windows...

The ability to swap Frameworks is interesting, but I doubt it would really be worth it, esp since again, if you write the game model in C#, swap to a frame work that is cross platform your game model is still locking you into windows...


If you're writing in XNA, your game model is most likely C#, which is still going to lock you into Windows

That is not 100% true. This and this.

jmillerdev.com

Follow me @jmillerdev

This topic is closed to new replies.

Advertisement