Search Unity

building games that inherit from a base game?

Discussion in 'General Discussion' started by Mike01923, Nov 25, 2020.

  1. Mike01923

    Mike01923

    Joined:
    Jun 19, 2015
    Posts:
    195
    I'm making a language learning game where I want each game to be built to a stand-alone game for each language (this is a must). The games are exactly the same, except small things like data, different options, saves, ways to track progress, etc. What is the best way to go about this? I'm thinking having a base project that all the languages inherit from, and making sure there's no circular dependencies. Then creating a script that builds all of them at once.

    Is that feasible or will I encounter problems with that method? Any better / simpler ways of going about this?
     
    Last edited: Nov 25, 2020
  2. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,780
    I think you want focus on data driven design.
    Basically, allow as many feature to be modificable and store in one of human readable formats.
    XML, JSon, etc.

    Alternatively, you may want some scripting language on top.
    I.e. lua.
     
  3. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,983
    Just build all your core stuff in one project, and then export it as a .unitypackage and use that to bootstrap the rest.

    Only the language specific assets etc need to live in the seperate projects, everything shared goes in the core one.

    You could probably build them all at once using some sort of unity batch commands
     
    Last edited: Nov 27, 2020
    Ryiah likes this.
  4. Mike01923

    Mike01923

    Joined:
    Jun 19, 2015
    Posts:
    195
    I don't think that would work. Because changing something in the core would not propagate to the others.
     
  5. Vryken

    Vryken

    Joined:
    Jan 23, 2018
    Posts:
    2,106
    In that case, you could instead create a custom package that pulls your core project's files from a Git repository, and then re-import the package any time a change is made.

    This might be a helpful link as well, since I assumed that custom packages would simply have an "update" button like standard packages do, but that's apparently not the case, and updating a custom package is a little different:
    https://forum.unity.com/threads/custom-package-not-updating.696226/
     
  6. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,203
    If you require changes to the core project to automatically propagate to derivative projects then simply use a symlink instead of a package to distribute the core project.

    https://www.howtogeek.com/howto/16226/complete-guide-to-symbolic-links-symlinks-on-windows-or-linux/
    https://www.howtogeek.com/297721/how-to-create-and-use-symbolic-links-aka-symlinks-on-a-mac/

    This approach isn't just limited to your own projects either. With a symlink you can download an asset from the store, extract it into a project, and with a symlink have that asset accessible everywhere while only having to update it in one location.

    Just be aware that this comes with the downside that a change has the potential to break multiple projects, and depending on the time to cost ratio may leave you with no choice but to abandon a project that might have been fine.
     
    Last edited: Dec 1, 2020
    MadeFromPolygons likes this.
  7. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    Why would this be a possibility? Just roll back the changes, and the roll back would similarly propagate to anything linked to it.
     
  8. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,203
    Major breaking changes. While he could maintain multiple copies of the core project to avoid breaking projects that would make it no longer a single core project to develop and his posts left me with the impression that he wanted to avoid that.
     
    Last edited: Dec 2, 2020
    MadeFromPolygons likes this.
  9. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    I would expect to be keeping all sibling projects in lock step.
     
  10. MDADigital

    MDADigital

    Joined:
    Apr 18, 2020
    Posts:
    2,198
    I would put each versions assets and data in a Asset bundle, addressable or similar and at build time pick the one for the current version being built