2
\$\begingroup\$

I'm developing a modular game in Unity 5.6. Each module has very little overlap in assets with the others. I'm concerned about having a bloated repository after a few months of development, and since I'm using Bitbucket (a free account) I'm limited in my repo size, but not in my number of repos. So instead of having one huge folder for my game I'm considering having a launcher project and scene that loads builds from a folder in /Assets. Each module would be its own project, and I would just drop its build into the launcher's folder.

My question is, is this a reasonable approach to building a highly modular game? Hopefully I'll be continuing development for quite a while, and I want to make sure the project is as lightweight and extendable as possible. Or am I overthinking this, and should I just use one big repo?

\$\endgroup\$
  • 1
    \$\begingroup\$ It sounds very awkward - I think it would end up being far more awkward than you'd anticipate. As modular as they are, you'll still end up with some often-used core code that is shared between all projects, and you don't want to create a synchronisation nightmare. If you must host your version control online, I'd consider paying a little to a provider (or hosting your own GitLab server on DigitalOcean for $5/mo.) for version control. Then seperate your modules with scenes, folders and namespaces. \$\endgroup\$ – Steve Harding Jun 8 '17 at 23:45
  • \$\begingroup\$ I'd concur with Steve Harding that this sounds like a very cumbersome way to work, but there's no fundamental barrier preventing you from doing it. As a result I think this question likely falls into a matter of opinion, of whether saving a bit of money on repo space is worth the complications it introduces into your project (not least of which being that your finished game will contain a complete copy of the Unity runtime for each and every module, bloating the total download size) \$\endgroup\$ – DMGregory Jun 9 '17 at 22:30
  • \$\begingroup\$ It's a very bad idea to complicate things for the sake of Bitbucket unless it's absolutely essential. Just use a different git host. Personally, I use Gitlab. Servers are a bit slower than github or bitbucket but of the 3 it's the only one that allows free, unlimited public and private repos. Most of the time you will work from your local repo anyway so the server latency is not a big deal if ur solo or small team. As to modular design in Unity, I'd go with plugins, like Dan mentioned. If x-plat though, you need to build a plugin for each. Could get messy if you have very many. \$\endgroup\$ – Fuzzy Logic Jun 10 '17 at 0:42
  • \$\begingroup\$ Overthinking it. Use GitLab. \$\endgroup\$ – MichaelHouse Jun 13 '17 at 17:45
1
\$\begingroup\$

This is not an uncommon pattern when it comes to procedural games, who load assets as they are needed (which in their cases might be never). Under this system you'd load your assets in chunks via Unity's Resource Loader, which allows unity assets to be loaded via a runtime command. This can hurt performance, but can help you manage packages of assets separately .

Other Techniques to consider:

1) Consider leaving all unmodified third party assets outside of source control and simply maintain a text file listing what they are. This means not having to spend repo space on assets already being maintained by the asset store and avoids issues if you accidentally provide a third party asset publicly.

2) Consider using the more advanced AssetBundle system which allows you to load assets as packages. Then each project could just maintain it's own package.

3) There are several books on Unity Game Optimization that cover, amongst other things, file size and identifying unneeded assets. I hesitate to make a direct recommendation, but I have a book from PacktPub that helped me address several asset size issues.

|improve this answer|||||
\$\endgroup\$
0
\$\begingroup\$

I haven't experimented with this yet, but you can write plugins for Unity.

Doc/Manual link: https://docs.unity3d.com/Manual/PluginsForDesktop.html

Video tutorial: https://unity3d.com/learn/tutorials/topics/scripting/writing-plugins

In regards to an architecture, look into Dependency injection and Events/Event Managers. Aside from that I can't say I've seen any specific implementation of this.

|improve this answer|||||
\$\endgroup\$

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