Saving locked files w/o checking out (Perforce)

We are using the Perforce integration in FMOD Studio, and as we do with the rest of the game, we have many FMOD files set to exclusive checkout. This includes events, so that people don’t accidentally work on the same event at once. We noticed today that exclusive checkout is not working in FMOD, causing situations where someone can easily lose their work.

Here’s the situation:

User A makes changes to an event and saves their work.

  • P4V checks out the event automatically
  • A checkbox appears near it in the FMOD event browser
  • A grayed out checkbox appears next the event on User B’s computer

All of this is as it should be. But there’s more to it:

User B does work on the same event, not realizing that it is already checked out by User A. User B saves the project and closes FMOD. Later they reopen it and do more work on the event.

  • FMOD saves the changes to the event when it is closed
  • Those changes are still there when FMOD is reopened
  • The event does not appear in User B’s pending changelists
  • The checkbox in the FMOD event browser stays grayed out

Aside from the checkbox in the FMOD browser, all of that behavior should not be possible. If you save an event, Perforce should check it out automatically if it can. And if it cannot be checked out, FMOD should not be able to save it because that file should be set to read only.

Here’s where it’s really bad:

User A checks in their changes, and User B gets latest. The file on User B’s computer gets overwritten with the version of the file that User A just submitted. User B gets no warnings because they do not have it checked out, so as far as Perforce is concerned, the file is identical to the previous depot version. This means that User B loses all their work, and it cannot be recovered either because it was never in the version control system to begin with.

This is a problem that can be pretty devastating, particularly because it fails silently. When you’re working on more than one event, and you check yours in at a different time than the other person, you have no reason to think your changes weren’t submitted, especially when submitting a changelist full of files only named with their GUIDs. You don’t even get to resolve the differences like you’re supposed to have to, you just don’t have that file in the changelist at all.

FMOD shouldn’t be able to save that event when you save the project. You should be notified that you can’t save a read only file as soon as you try to save it. Actually, FMOD is supposed to check the file out when you make your first change, so you should be notified then when it fails to check the file out.

Is this a bug? Is there something about setting up exclusive checkout that we may have missed? This has caused problems for us already, but fortunately nothing too serious. I’m hoping to find out what the limitations are of our current workflow before something really bad does happen.

Hi,

Thank you for bringing this to our attention. Could I please grab your FMOD version?

Testing 2.03.14 I was not able to reproduce the issue. How is project B being closed?

Attempting to pull the changes into Project B triggered

Are you using the P4 app at all or is everything done through the P4 integration?

It is possible to manually lock files from the Source Control context menu:

That may be what you are looking for?

I am using 2.03.14 as well as you can see here. I have never seen that Conflict Resolution window before ever. That’s what we should be seeing to keep our work from getting silently overwritten.

As for how project B gets closed, I’m not certain, but I would imagine just Alt+F4, clicking the upper right X button, or right clicking in the taskbar and selecting “Close” from the context menu. Is there a difference between those? I do know that we tested manually saving the project before closing it and I don’t think it made any difference.

Regarding my workflow (quotes are just for organization)…

I do the following operations in the P4V app as part of my regular workflow:

  • Move files between changelists
  • Submit files/changelists to the depot
  • Revert files when I need to discard changes
  • Confirm that files have been checked out automatically (pressing Refresh after saving changes in FMOD Studio, then looking in my default changelist)
  • Get latest revisions of files submitted by others

Sometimes I also do these operations in P4V as well:

  • Diff files between workspace and depot
  • Reconcile offline changes
  • Resolve conflicts
  • Overwrite workspace files with their depot version (‘Get latest…’ using ‘Force Operation’)

I rely on the FMOD integration to:

  • Check files out
  • Mark new files for add
  • Mark old files for delete
  • Mark/create files for delete/add when renaming
  • Visually tell me if a file is checked out by me or someone else

These operations can’t really be done in P4V because the filenames are just the GUIDs there, so I have no way of knowing which one to do it with.

After comparing those lists, you’ll probably notice that the only things I use the FMOD integration for are the things that it does automatically and that you can’t do in P4V if you are only seeing the GUID filenames.

You’ll also probably notice that I don’t use anything in the Perforce submenu in the context menu when right clicking on events. This is because almost all of the options in that submenu are things I’ve never seen in Perforce before, except for the one I feel like I will never want to use anyway. I have never seen the words “Sync” or “Lock” used in P4V for any operations I do regularly, as is also the case for “Identify local changes…” I suspect that Sync might mean Get Latest, and Lock might mean setting a checked out file to exclusive checkout, but terminology is very specific and important in software, so I never wanted to find out the hard way when I could instead just use P4V. I’ve seen “Merge” and “Revert” in Perforce before, but I would never want to merge and do other operations at the same time; and I use revert all the time, but I would never want to revert the entire project rather than only a specific file. I imagine “Identify local changes…” is probably similar to “Reconcile offline work” and “Commit” sounds like it’s similar to “Submit” but they must be different in at least some way if the words being used are not the same. Consequently there is nothing in that menu that I would ever want to do, so I do all of my version control operations in the P4V app except what FMOD needs to do automatically.

Is it possible that those are the Git terms for the equivalent operations or something? I’ve actually never used Git, so maybe those words make more sense to most people, but it’s very confusing to me.

We have all the files in the FMOD project set to exclusive checkout in Perforce. No one should be able to save any changes to a file that someone has checked out already; FMOD should give you an error saying that the file is read only and cannot be saved. I don’t know why this is happening, and I have confirmed in P4V that they are set to exclusive checkout. Does “Lock” do something different than that? I thought exclusive checkout is the Perforce feature that is for doing that. If that is what lock is, how do we configure it to automatically lock anything that we check out as soon as it’s checked out? I don’t want to have to do that manually, mostly because I will definitely not remember to do it every time.

Thank you for your help. Sorry for the delayed response.

Thank you for the detailed post. We have documentation outlining the behavior of the options here: FMOD Studio | Using Source Control.

To get the most out of the P4 integration it is best to try and do all operations in Studio.

“Sync Latest & Merge Project… This gets the latest version of the project from your source control repository.”

Lock: Lock an opened file against other users submitting changes to the file. ( p4 lock )

This is missing from the docs and I have made a task to add it. It is possible to revert changes for specific events via the commit window:

Please let me know if there are any operations we are missing or functions we can make more clear and I can make tasks to address them.

Thank you for the detailed post. We have documentation outlining the behavior of the options here: FMOD Studio | Using Source Control.

Oh, thank you so much, I have no idea how I hadn’t found that before. Still, it seems like some basic operations I’m used to relying on are missing, and more importantly, it seems like FMOD is ignoring some important Perforce features (more below).


To get the most out of the P4 integration it is best to try and do all operations in Studio.

I would love to, but too many features/operations are missing or implemented in ways that I don’t prefer. That said, I do very much prefer to see the files I’m working with in a human readable form, so that’s a very strong motivator for changing my workflow…


“Sync Latest & Merge Project… This gets the latest version of the project from your source control repository.”

I’ve never used this because getting latest is no different in P4V, and merging isn’t something I usually want to do at the same time, or really at all. Merging to me means two people probably did conflicting work and someone’s work needs to be discarded. The exception to that is code, but resolving those conflicts is a task in itself a lot of the time that I never want to have to do. However, I did not realize that the FMOD integration is made to merge with a tool for it that makes that task as easy and simple as it should be. (Once again, this is the first time I saw that document for some reason. I had seen a much smaller page about setting up version control and didn’t realize there was another one that was actually comprehensive, so thank you again - I had stopped searching because I thought I had already found what was there.)

But despite learning all the new information in the correct documentation, the fact remains that I don’t ever want to have to merge at all. As useful as it is, it is still the case (as your documentation says) that there are plenty of cases where there are conflicts that can only be merged by someone’s work being discarded. I don’t personally prefer being able to merge over the ability to prevent that from happening entirely. Which brings us to the next point…


Lock: Lock an opened file against other users submitting changes to the file. ( p4 lock )

As you and the Perforce documentation say, lock prevents other people from submitting the file. This means that lock does not prevent anyone from working on the file in a way that might conflict with what the person who locked the file will submit. It seems like the point of lock working this way is specifically to allow other people to continue working on a file in a way that won’t cause problems for the person who locked it when they submit. But I don’t see why that would change anything about other people being able to do conflicting work on that file before it is submitted by the person who locked it. Because of this, it is more flexible, but it doesn’t solve the problems that exclusive checkout exists to solve, which is to prevent anyone from doing any work that might have to be discarded, which is a problem we’ve been having regularly.

And according to you and the FMOD documentation, locking needs to be done manually every time you use it. I will absolutely not remember to manually lock a file every time I intend to use that feature, and I don’t assume I am the only one who would have that problem. Even if I did remember every time, exclusive checkout is a property that applies to the file itself, making it essentially automatic. Lock prevents you from using an operation in Perforce. Exclusive checkout prevents you from doing an operation on the file entirely, regardless of what program you use to do it. It is more restrictive than lock. You shouldn’t be able to save that file at all in any program because Perforce changes it to read only.

Here is a video showing exactly what should not be possible in FMOD, and confirming that Perforce is handling that file correctly:

In this video I:

  • Show that FMOD sees that the event is checked out by someone else
  • Make a change to the file
  • Save the project (and consequently the file)
  • Copy the event GUID and move to P4V
  • Select the event in the depot tree by searching for the GUID
  • Confirm that that specific event is checked out by someone else - both Perforce and FMOD correctly see this information
  • Attempt to check out the file in P4V
  • Get an error from Perforce telling me that I cannot check out the file because it is checked out by someone else

In order to save a file in the first place, it needs to be checked out. This usually happens automatically and silently, but if a file can’t be checked out, it shouldn’t be able to be saved at all. And FMOD knows it can’t check the file out, so why is it not giving me an error when I try to save it? This is much worse than having to merge conflicts, because you don’t even know you’re in conflict until you have to merge, which often means losing more work that you should have had to stop doing the first time you tried to save.

So ultimately, exclusive checkout is supposed to be a more robust way of preventing file conflicts than lock, but it doesn’t work with FMOD, meaning it has the biggest possible potential consequences in terms of file conflicts and work that needs to be thrown out.


This is missing from the docs and I have made a task to add it. It is possible to revert changes for specific events via the commit window

Ok I can’t fault myself for missing this one. I would never have thought to look in the commit window to find where to revert something. Reading the docs would have been the only way I could have possibly figured that out while still using P4V to submit my work.


Thank you so much for this reply. A lot of things make a lot more sense to me now, particularly after seeing that there was actually a properly comprehensive page of documentation that I thought didn’t exist for whatever reason.

However, regardless of the much better understanding I now have of the Perforce integration, I still think the exclusive checkout is a significantly non-trivial issue, but I completely acknowledge that that is only my opinion and maybe our team is the only one that uses Perforce and FMOD together in this way.

Unfortunately though, despite seeing that the integration is much better than I thought, and even after seeing that you can indeed actually use Perforce with FMOD and actually see the event names, I am still without question going to use P4V instead of the integration (but it’s great to know it’s easy to merge if I have to). It’s oversights like exclusive checkout not working that make me not willing to trust a third party integration. I also don’t use the Unity integration either for the most part for similar reasons - it doesn’t always behave consistently the way I expect it to, and it causes issues because of it. I only ever want to rely on tools that always work as expected, because there are plenty of times when a small issue can be more than catastrophic. When things are going normally, if someone loses their work on a couple of events, I can go write a forum post and get answers like this to keep it from happening again. But when you have less than zero time to get things finished for a publisher milestone or console certification deadline, something that small could become a devastating setback that disproportionately affects many other things that you could never have anticipated. As frustrating as Perforce can be sometimes, I know that the operations I always have to use will work. I only trust third party integrations for tasks I have used them over and over for without issues, and once I know I can trust it, I still need to prefer the workflow. I will definitely keep the FMOD integration in mind for some things a lot of the time, but I just don’t feel like I should make it part of my default workflow. Although now I have good reason to believe that merging could be an exception to this, and I will definitely try that soon.

Once again, thank you for your help. I definitely have a very different and much better understanding of the integration than I did before, but it still feels to me like it isn’t the best option a lot of the time.

Thank you for the information and detail.

A task to better support exclusive checkout is in our backlog and I have added your interest. Hopefully we get the integration to a state where you feel confident in relying on it completely.