1 hour ago, leetNightshade said:
This idea is more for artists and designers, to make things easier on them. And making it harder for them to break something. I don't expect them to have a 3-way merge tool on their computer.
Yeah that's the use case I was aiming for, too
They do have a merge tool on their computer if they have VCS software installed - it will pop up whenever there's a merge conflict.
SVN / Git, P4, etc can all be configured to use custom merge tools instead of the crappy default ones. Artists/designers/etc still need to install the VCS software and the game engine / project before they can work, so it's not too much harder for "the engine" to include it's own diff-tools and scripts to plug them into the VCS software. Some engines like Unity/Unreal/etc already try to integrate with your VCS software anyway -- having config screens in the engine-editor where you select which VCS software you're using, etc... The engine can use that info to attach it's custom diffing tools for it's own file formats. If the engine includes custom diff/merge tools, you can make it automatically resolve file conflicts in a smart way, without requiring a human to hand-select text file changes at all, which completely solves the problem.
As for that original godot example text though, I can still see some merge issues occurring... e.g. say you start with this file:
[ext_resource path="res://icon1.png" type="Texture" id=1]
[node name="icon1" type="Sprite" parent="."]
texture = ExtResource( 1 )
And then two different people simultaneously want to add another icon of their own, and they increment that "id" field when adding their new resource:
Change A. Append this:
+ [ext_resource path="res://icon_foo.png" type="Texture" id=2]
+ [node name="icon_foo" type="Sprite" parent="."]
+ texture = ExtResource( 2 )
Change B. Append this:
+ [ext_resource path="res://icon_bar.png" type="Texture" id=2]
+ [node name="icon_bar" type="Sprite" parent="."]
+ texture = ExtResource( 2 )
When resolving that conflict, you can just choose "Mine, then theirs" to add both blocks to the end of the file, but there's still a problem because both changes have added an external resource with ID #2, and now it's ambiguous which filename each of the node's is referencing
To avoid this issue, don't use simple ID numbers in these files -- use filenames as ID's / GUIDs / etc...
Or another example, someone might change that original file as below (i.e. they've added a single line on the end -- the position attribute).
[ext_resource path="res://icon1.png" type="Texture" id=1]
[node name="icon1" type="Sprite" parent="."]
texture = ExtResource( 1 )
+ position = Vector2( 138, 127 )
While simultaneously another user might change it to add a new node:
[ext_resource path="res://icon1.png" type="Texture" id=1]
[node name="icon1" type="Sprite" parent="."]
texture = ExtResource( 1 )
+ [node name="icon2" type="Sprite" parent="."]
+ texture = ExtResource( 1 )
When resolving that conflict, depending on the order that you apply the two simultaneous additions, you could end up with either of these results:
Theirs then mine:
[ext_resource path="res://icon1.png" type="Texture" id=1]
[node name="icon1" type="Sprite" parent="."]
texture = ExtResource( 1 )
position = Vector2( 138, 127 )
[node name="icon2" type="Sprite" parent="."]
texture = ExtResource( 1 )
Or Mine then theirs:
[ext_resource path="res://icon1.png" type="Texture" id=1]
[node name="icon1" type="Sprite" parent="."]
texture = ExtResource( 1 )
[node name="icon2" type="Sprite" parent="."]
texture = ExtResource( 1 )
position = Vector2( 138, 127 )
To avoid this issue, you could make it so that there are no optional properties. In this example, the problem arose because a node didn't originally have a position attribute at all. If every node always had every property present, this kind of conflict would be much less likely.
Also, in all these examples, the VCS software will just throw it's hands up in the air, complaining that there's a conflict, and will launch an interactive tool for the user to resolve the conflict (picking from the above choices by hand). So artists/designers are still require to read and hand-edit these file formats, which is a bummer
e.g. Above, the first one is probably correct, but you require the artist doing the merge to look at both options in their merge / "resolve conflict" tool and pick the right one.
There is admittedly much less room for them to screw up than with a picky format like JSON, so it is better in that respect! But it doesn't completely solve the problem.