Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm currently making a PC game in XNA. It's actually a collection of mini-games (there's 3 mini-games at the moment) however I plan to make and add more, in downloadable 'packs'.

My question is, what's the best way to achieve this?

Currently my thoughts are:

  • Create a 'game' interface
  • Build games to this interface but create them as .dlls
  • Have the main .exe file scan a directory and load in the .dlls at runtime.

I've not messed around with the idea much, but I know there are applications at-least that use this plug-in approach (Notepad++ seems to), but I'm not sure of any games that do (although I'm sure they must exist). However it seems that this is a problem that has been solved previously, so I'm wondering if there's any form of established best-practice.

share|improve this question

2 Answers 2

On windows, you can you can just open an assembly (dll) and import types and execute methods. See the Assembly Class documentation.

On the Xbox 360 you do not have access to System.Reflection. Here you should rely on the XBLA store API. I'm not sure how much of this functionality is available to XBLIG applications.

share|improve this answer
    
Yeah, I know I can just load the .dlls (since it's a PC game) however I'm wondering if this is the best way of doing it, or if this is going against some established best practice –  Pyroka Oct 29 '10 at 15:26
    
+1 This is the standard way of loading plugins. Look up plugin architecture; FYI, this is a very good solution. –  ashes999 May 24 '12 at 3:00

Since you're building a game for Windows, you can access the full framework as @Ranieri stated. Your architecture sounds solid; however, you might want to check into MEF, the Managed Extensibility Framework. It might make that workflow you outline more streamlined. I haven't used it myself, but I've read good things about it.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.