Search Unity

2 Games - 1 Project

Discussion in 'General Discussion' started by fishbrainz, Oct 13, 2017.

  1. fishbrainz

    fishbrainz

    Joined:
    Nov 27, 2013
    Posts:
    12
    Hello!

    I would like to ask some insight on how to approach a problem i have at my workplace.

    We have this game released, but we want to release another, similar, game. The 2nd game would have the same lobby scene but a few different game mechanics in the game scene. Bottom line, about 90% of the 2nd game would be the same as the first game, i would have to go into much more detail to explain granular differences, but i find it pointless.

    So with that said, seeing these projects are so similar, i find it pointless to make another project for the 2nd game. I would like to avoid that mostly because if bugs are found in the common code or features are to be added to one game, then the 2nd game would have to have them too, so fixing a bug one place would fix it for the other as well.

    My question is, how do i approach this? I wanted to work with Asset Bundles but they dont support scripts so easily. I know i can setup some editor scripts with some defined symbols to separate runtime code, but can i separate the code at compile time too? Say GameMechanics_game1.cs to be integrated in the game1.apk and GameMechanics_game2.cs in game2.apk. I know scripts dont weight much, but i would like to keep the code separate even so, game1.apk should not have game2.apk specific code and vice-versa.

    Any ideea is welcome!

    Thanks!
     
  2. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,569
    You put everything under version control, and place common code into its own repository. Then include common code into both projects using something like git submodules. Meaning you'll have 3 respositories: ProjectA, ProjectB and CommonCode where CommonCode will be referenced in both ProjectA and ProjectB.

    YOu can indeed have multiple games in a single project, however, it'll create a mess because you'll need two distinct sets of scenes for export. I wouldn't do it this way.
     
    theANMATOR2b, Kiwasi, Ryiah and 2 others like this.
  3. verybinary

    verybinary

    Joined:
    Sep 23, 2015
    Posts:
    373
    What about copying the project folder of your existing game, changing the name of the pasted folder, deleting everything you don't need, and editing everything that's left?
     
  4. wccrawford

    wccrawford

    Joined:
    Sep 30, 2011
    Posts:
    2,039
    Came here to say almost exactly this. I'd like to emphasize the pain you'll go through if you try to swap back and forth between 2 sets of scenes in the same project every time you do a bugfix. It's going to be *horrible*.

    In addition, separating out the common code / assets can help clean it up and make it easier to maintain, especially if you end up with more projects using the same stuff.
     
    Kiwasi likes this.
  5. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,569
    Do you love living dangerously and making your own life more difficult?

    This will make a big mess, and two versions will quickly go out of sync. Meaning you'll be copying changes and bugfixes back and forth between them, forgetting some modifications and introducing bugs in the process. This is not a sustainable solution.
     
    Kiwasi and EternalAmbiguity like this.
  6. verybinary

    verybinary

    Joined:
    Sep 23, 2015
    Posts:
    373
    In my experience, two projects using the same framework is never the case for long. If both projects use the same "anything important", one will always be held back to cater to the other, until they branch out and you fork while your well into the project. I'd rather complicate everything while the pieces are still small and giving my two cents.