Version control, GIT, collaborative coding best practices or tips?

P

patrikgrinsvall

Guest
Hi!

We are three persons working on the same game, all of us are working as developers as our normal day-time jobs are having game development as hobbies. Normally in modern application development, the version control system is often GIT and process goes something like this:
  1. Pull latest master
  2. `git checkout -b features/your-new-feature`
  3. <code>
  4. <review/demo>
  5. `git checkout master && git merge features/your-new-feature`
  6. <goto 1>
When working with GM, however, the merge process is often very difficult. I think this boils down to the GM-metadata files, especially files in the view folder are changed just by opening a project and these files are referencing UUIDs. This makes it very difficult to know what is going on and how the merge should look like since you cannot easily see in an editor what object is where.
If you are only two persons and one is working on master and the other one is working in separate branches this is the easiest. If you however are two or three or more persons working on different branches and there are alot of changes to the metadata files, it becomes more or less impossible to merge, and most often you manually need to merge using copy+paste with game maker.

Of course, I understand the need for the yy metadata-files or project files but I'm looking for tips and tricks on how to improve the VCS process.
I didn't find any thread on the forum covering this yet, surely more teams are having the same issue?

We have tried using the built-in version control system of GM but that often ends up breaking the project and you need to revert to last working commit, we therefore use the command line and then resolve the conflicts in the .yy files using an external editor.

  • Any .gitignore rules that make life easier?
  • Any settings in GM?
  • Any other tips and tricks for using git with gm, anything in the process we should change?

Thanks!
 

Attachments

FInking

Member
Hello there, i think u must try CI CD and CD methodology and it can helps u and ur's frinds to resolve some difficulties too.
 

chamaeleon

Member
@patrikgrinsvall If you can manage to hang on, GMS 2.3+ promises to improve the situation out of the box quite a bit by changing project file contents a bit and getting rid of some unnecessary files that caused troubles in the past due to their existence implying changes in another file that often caused conflicts.
 
P

patrikgrinsvall

Guest
Hello there, i think u must try CI CD and CD methodology and it can helps u and ur's frinds to resolve some difficulties too.
Hi! No, I'm sorry continuous integration or delivery will not help in this case at all.

If you can manage to hang on, GMS 2.3+ promises to improve the situation out of the box quite a bit by changing project file contents a bit and getting rid of some unnecessary files that caused troubles in the past due to their existence implying changes in another file that often caused conflicts.
Yea, this seems like the best solution. It is in beta now so lets hope it will be released soon. :) Thnks!
 

Selek

Member
I hope you don't mind if I follow-up with a newbish question. I'm working on my own, just trying to learn; I've made a couple little games just by following tutorials. Now I'm trying to make a Tetris clone on my own, without peeking at other code. But version control is a puzzle to me. Right now my version of version control is...commenting out code when I replace it. Or running the game every 10 seconds to see whether I just broke it, lol. I suppose there's "File/Save As," but that creates an entire new project, which seems like overkill for my needs. Any advice on this? Thanks in advance. :)
 

Roldy

Member
Any advice on this?
But version control is a puzzle to me.
Fix that. SVN or git are easy to use. Take the hour or so and research one of them. The time invested will be paid back near infinitely in future saved time.

Right now my version of version control is...commenting out code when I replace it. Or running the game every 10 seconds to see whether I just broke it, lol.
Nothing really wrong with either one of those when you are working. Compile times can eventually make running frequently a pain. But it is always sad when you code for 45 minutes straight and then things don't work. And two hours later you figure out it was something you wrote in the first five minutes. Testing often is good.

If you find yourself having to code a bunch before something can be tested, then that is a good sign you havn't broken the problem down small enough to do in smaller steps.

Learn SVN or git. It will help you in the long run.

SVN is easier to use and grasp IMO. However, you will need to setup a server, it can run locally but you need it. git on the other hand doesn't need a server and the repository can be local. However, git is slightly more complicated, and almost everything you can do in SVN takes one or two extra steps with git. But ultimately git is more useful, and I imagine that will only be more true as time progresses.
 
Last edited:

Nidoking

Member
Make a change? Commit.
Test thoroughly and verify that everything works well? Tag it.
Want to play with something that might really mess with stuff, while preserving the old state of the game in case you need to go back? Make a branch.
Source control is indispensable for any serious project.
 

Selek

Member
OK, I've made progress on this! I worked through the github tutorial and made my github account. I then read through GMS's documentation about its git plugin, and I created an online repository using my new github account. I was then able to enable source control on my current project -- coding a Tetris clone without peeking at other people's code. :) (It's going pretty well; I've sorta got it working, and I've learned a lot more than I would by watching someone else code it, since I've had to solve all the problems on my own.) The source control was nifty: the little red and green marks make clear what's been changed, the commit process is sensible, and the version history (with my comments) is great to have. But I have two minor questions:

1. First, I don't see my new repository on my github account, even though I used the same credentials when establishing my GMS authentication. Should I expect to see the repository on github.com?

2. Second, my project file is honestly quite tiny; maybe 200kb or so, heh. My sprites are 2K in size. So doing a File/Save As doesn't take a lot of disk space, though it does clutter up my hard disk with subfolders. In this sort of situation, is it still preferable to use version control? I noticed that when I did a File/Save As, the new project did not have version control enabled. I guess I'll enable it and maybe stop doing more file/save-as's? Old habits from writing and photoshop die hard. :)
 
Last edited:

Roldy

Member
1. First, I don't see my new repository on my github account, even though I used the same credentials when establishing my GMS authentication. Should I expect to see the repository on github.com?
Possibly you will see your repo on github if you made one.

However, be aware that github is not required. Unlike SVN, git is distributed and it needs no centralized server. The repository in your project folder is all that you need (back it up regularly). However, github is very handy. If for nothing else it can act as a back up for you.

Now with git you must understand the difference between a commit and a push. When you commit you are making version changes on your local repository. If you push then you will push those to a remote repository (like github).

So if you have only been committing then you don't need github.

2. Second, my project file is honestly quite tiny; maybe 200kb or so, heh. My sprites are 2K in size. So doing a File/Save As doesn't take a lot of disk space, though it does clutter up my hard disk with subfolders. In this sort of situation, is it still preferable to use version control? I noticed that when I did a File/Save As, the new project did not have version control enabled. I guess I'll enable it and maybe stop doing more file/save-as's? Old habits from writing and photoshop die hard. :)
Version control isn't really about saving space. It is about keeping track of changes. Even when working solo this is invaluable. When working with a couple other people it is near required. If working with several or more people then you should consider it being required.

There is nothing wrong with your method of saving whole copies of your project as a versioning system. However, why not let the VCS do the same thing for you, while also keeping notes about each version along with delta so you can diff. It might not seem that big of a deal now, but wait until your project gets bigger, or you have to look at changes farther back. Or the real killer you take a break for a month and when you come back you have to remember what you where doing. Having a history to look at is very handy.

Now neither git, nor SVN are very good at versioning binary files (sprites, audio files etc..) However unless you start versioning large binaries you don't have to worry about it. But know that they both have extensions for binary files. For git if you want to learn about it look into git LFS (large file storage). Otherwise people will go with a totally different package for binaries like Perforce, Alienbrain etc...
 
Last edited:

Selek

Member
Thanks very much for that helpful reply. Yes, I've been doing only commits, no pushes, but maybe I'll experiment with a push to see what happens. I'm working alone now, but if I ever do something collaborative, it would be nice to have a better understanding of push and pull.

In the meantime, I tried importing my project into my online github repository, and it worked a treat! I kind of like this option because it's cloud-based backup. I'm lazy about backing stuff up from my hard disk.

I didn't realize versioning binary files was an issue. I had just thought I'd version my sprites in Photoshop if I create them there, using my old-school save-as technique, lol. Although so far I've found GMS2's included sprite editor to be a surprisingly good tool for pixel art.
 

Selek

Member
So version control is working fine for me, but I still have trouble seeing my commits on github.com. For my latest project, I made the repository on github, then imported it, and I was able to see my first commit on the website. But since then, when I commit changes inside GMS2 using the source control menu, I don't see any corresponding update on github. I'd like that extra assurance of cloud-based version control. Am I doing something wrong?
 

chamaeleon

Member
So version control is working fine for me, but I still have trouble seeing my commits on github.com. For my latest project, I made the repository on github, then imported it, and I was able to see my first commit on the website. But since then, when I commit changes inside GMS2 using the source control menu, I don't see any corresponding update on github. I'd like that extra assurance of cloud-based version control. Am I doing something wrong?
Did you push the changes?
 

samspade

Member
So version control is working fine for me, but I still have trouble seeing my commits on github.com. For my latest project, I made the repository on github, then imported it, and I was able to see my first commit on the website. But since then, when I commit changes inside GMS2 using the source control menu, I don't see any corresponding update on github. I'd like that extra assurance of cloud-based version control. Am I doing something wrong?
Are you pushing your changes to github?
 
Top