Development Partial interlocking source control

I had this idea and wondered if it already existed.

Instead of writing the same code over and over in each project, I like to create a library of commonly used things and place them in my project when needed. However if I find a bug in one and I fix it, it only fixes it in the current project I imported it into. I was wondering if there would be an easy way to synchronise a set of objects/scripts/sprites across multiple projects so everything stays up to date?
 

FoxyOfJungle

Kazan Games
Technically, no. But you can maybe create a .bat file (if it's Windows) that copy the files to the designated folder automatically, so, you would only need to double click on the file for each modification.
 

rui.r6o

Member
The way I do it is:

I have a project where I just keep all of the things I share among my projects. All of those assets are under a Modules group in the IDE, and I basically don't touch those resources in my actual game project, if I need to configure them I configure them in a different group (I try to make all of my code configurable by macros exactly because of this, I can just create a game config with a different set of values for the macros and I don't need to change the actual assets at all).

If I ever need a new module or to fix a bug in my current modules I do it in the module-specific project, then I re-export all the assets under the Modules group as a local package. In my actual game project I then just delete the Modules group and re-import it from the local package created before. Voila, everything is now in the latest version.

Pro-tip: make each module have a specific group under the Modules group, for example a Modules/string.ext group structure for the string.ext module. That way if you know you only need to update one module you can just delete and reimport that one. It also means you can selective choose which modules to include in a specific game project.

Note that this is still a manual process, but like @FoxyOfJungle said it can be easily automated with some batch scripts. One thing I still want to do in the future is to have associated metadata to each of the module (version, dependencies, etc) so that I can build a proper (simplistic) dependency management tool for importing and updating them. Ideally I'd even integrate this with the IDE itself, but for that YoYo needs to finally support user plugins for the IDE, which probably won't happen for quite a while still.
 

kburkhart84

Firehammer Games
I don't know about older versions of GMS, and this may not apply even to pre 2.3...but currently, all GML assets are stored inside the project folder, in a specific subfolder, with each script asset having a subfolder. Note that it doesn't actually matter where in the asset/resource tree the script appears(this is handled elsewhere). So if you want to update some GML code, you in theory could just copy the files(*.gml) over into their proper folders(assuming they are already part of the project of course), and it should load in the modified versions and use them. This is not documented or official, but considering how git friendly the project files are these days, this method should just work.

It will still be up to you to write a batch file if you want to automatically copy the files around, but at least it is something that can be done outside of the IDE so there is that. You would have to be on the newer version that stores the project like that though, unless the older version stores it the same way, and I'm not sure if they do or not since the resource tree used to be different.
 

Roldy

Member
What you really want (and are describing) are externals or sub-repos. Git unfortunately does not have good support for externals but there are extensions. Worse however is the GMS2 files structure does not accommodate project independent externals. This is mainly due to the .yy meta files being side by side with the data files. CVS, SVN and Git externals don't play nice with that. So it can be a pain. This is the same for Unity and it sucks. But you can work around it.

But the basic idea is you have a project repo, and that repo links to another repo for your project independent library that has no project specific dependencies. Multiple projects can link to the same external code base and share it. That is what I mean by externals or sub-repo.
 
Last edited:

Yal

šŸ§ *penguin noises*
GMC Elder
Worse however is the GMS2 files structure does not accommodate project independent externals. This is mainly due to the .yy meta files being side by side with the data files.
The good thing is, for script files in particular, you don't really need the YY files (there's basically no metadata). When I reuse scripts, I just open the old project's script files in a text editor*, copy the text from there, and then paste it into the GM editor for a newly created script. So far nothing weird has happened.


*so I don't need to close the current project just to open ONE FILE :V
 
Top