Running several games based on the same code

This is more of a code design than a game design question, but I didn’t know where else to post it. Please feel free to move it somewhere if you see the need.

I posted a question in the State of Fortune thread, but a wise man pointed out that people don’t look at the thread for generic questions, and therefore this thread is created.

What is the best way forward (from a time/code point of view as well as maintainability) when one has two versions of the same game running, where a lot of the code is shared, but many functions are different?

Should one:
Make a copy of the current projects (client and server) and build on top of that?

  • Positive: Easy to separate the projects, the jar for the sandbox will download quicker as it doesn’t contain the game content
  • Negative: If one fixes something generic one will need to change both versions. Big refactorings needs to be done to both versions separately. Will need a launcher client where you can choose which version to start up

Extend the current classes where necessary and make a game version of them, only overwriting where necessary?

  • Positive: Cleaner code
  • Negative: I don’t know if my programming skills are good enough to keep it organized :slight_smile:

Split the game code completely away from the engine code and let the game know where it can inject code?

  • Positive: Cleanest code
  • Negative: I really don’t know if my programming skills are good enough to keep it organized :slight_smile: A lot of work to keep the game code separate

Add cases to the code based upon which game version one is playing?

  • Positive: Quick win
  • Negative: Messy code

Something obvious that I didn’t think of? :slight_smile:

Mike