Golf With Your Friends

Golf With Your Friends

27 ratings
How to: Fix a broken map
By herbstwerk
Your editor decided to yeet an asset to the moon or two maps over and now you can't shoot on parts of the map or, I've seen this at least once, all the assets are completely black? Here's how you fix it yourself since 2+ years worth of threads with this exact problem aren't enough of a reason for a patch.

Edit: It seems like the bug has been fixed with the last patch / DLC (Bouncy Castle), if only by removing the ability to pick and place duplicate items in the editor. Needless to say fixing a bug by removing a vital tool in the editor is questionable at best, but I'll keep this guild up for people who started building before the patch or want to fix maps that might've been already published with assets outside the map boundaries.
Edit²: Or not... seems like the bug is still around. GG Team17.
Edit³: 2023/08/23 - it is still happening. Just finished cleaning up a map for someone. It's 2+ years now... but hey, as long as people keep buying the DLC, even if it's only half a map, there is no need to fix this.
2
2
   
Award
Favorite
Favorited
Unfavorite
Stuff needed
- A text editor slightly more capable than Notepad. I personally use Notepad++, it's free. All the information mentioned in this guide uses commands (break row and add/remote tabs) used in Notepad++, if you're using another editor you might need to look up what it's using for those functions. An option with similar capabilities for Linux seems to be Notepadqq.

- Some patience and a couple of minutes of time.
What to do
- Navigate to X:\Users\UserName\AppData\LocalLow\Team17 Digital Ltd\Golf With Your Friends\CustomLevels\MapName (This goes for Windows 10, it should be pretty much the same in earlier/later Windows versions. If you're using Linux the path should be ~/.config/unity3d/Team17 Digital Ltd/Golf With Your Friends/CustomLevels - altough I'm not sure if this is correct in all distros. I have no idea about the location in OSX, if you know it please leave a comment and I'll gladly add it here.)

- Make a backup of the file named 'map'. You can skip this if you want but don't blame me if you ♥♥♥♥ up and ruin you map. ;)

- Open the file in your text editor of choice and you'll find something like this. It's a terrible, unreadable, mess. Don't worry, we'll fix that.


- First, go into Settings>Preferences>Language and change the tab length to 18. This will make it easier to spot broken values later. Also deactivate word wrap in the View menu.


- Now go into the Replace menu (Ctrl+H), enter ]}}, in find what and ]}},\n in replace with. Make sure the Search Mode is set to extended. Now hit Replace all, this might take a few seconds depending on the amount of assets placed. This will put everything into its own line and make it a whole lot easier to read. But it's still not perfect.


- While still in the find/replace enter ," in find what, \t ," in replace with, and hit Replace all again. It now should look something like this. Every value lined up, nice and neat.


- Now scroll trough the file until you find pX/Y/Z-values that are either higher/lower than 350/-350 and/or have decimal values with more than 4 digits after the . (e.g. 0.0000001E8). Simply change them to something reasonable or delete the whole line. Just make sure to fix the syntax in case it's the last line, it ends in }}]} not }}, like the rest.

- Sadly the editor doesn't like tabs and won't load the file as it is right now. So when you're sure everything is good, go back into the find/replace dialog and replace \t ," with ," to remove them. It doesn't care about them being in individual lines so there's no need to revert that.

- Now save the file, make sure the encoding hasn't changed to something other than UTF-8, and open it in the GWYF editor. If everything's alright it should load and work as expected. If you're getting an error while loading it most likely due to a syntax error... a missing , is all it needs. Either start over (you made a backup right?) or try to fix it.
Anatomy of a GWYF map file
If you're getting an error when opening the load menu in the editor after editing it's most likely a syntax error in one or more map files. So a missing or additional character like a comma, or a bracket that's not closed, is all that's needed to 'break' a map file.

Here's a simple example with everything laid out nice and tidy:

- The Header. This includes the name, description, ... and opens two brackets "{[".
{levelName":"Name","description":"Description","publishedID":1234567890,"music":0,"skybox":0,"editorObjectData":[

- Any paced asset except the last, all brackets are opened/closed within, always ends with a ','. If that comma is missing you'll get an error.
"sType":0,"pX":1.0,"pY":1.0,"pZ":1.0,"rW":1.0,"rX":0.0,"rY":0.0,"rZ":0.0,"sX":1.0,"sY":1.0,"sZ":1.0,"obName":"6x6_Base_Forest","photonData":{"photonViewID":[]}},

- The last placed asset, as above but without the ',' at the end. Having one here will also net you a 'corrupt data' error.
"sType":0,"pX":2.0,"pY":2.0,"pZ":2.0,"rW":1.0,"rX":0.0,"rY":0.0,"rZ":0.0,"sX":1.0,"sY":1.0,"sZ":1.0,"obName":"6x6_Base_Forest","photonData":{"photonViewID":[]}}

- End of file, here the two brackets from the header are closed... that's all.
]}
FAQ
Q: Why won't the edited map show up in the editor after I'm done?

A: Make sure that the map has no file extension, it most likely saved as a .txt which won't be recognized as a valid map file by the editor. To do this enable "File Name Extensions" in the Windows File Explorer (in Win10, also 7/8/8.1 iirc, no idea about 11), rename the file and remove the extension.


Q: I've published the map ages ago and don't have the map file any more. Can I still fix it?

A: Absolutely. First make sure you're subscribed to your map so a copy will be download to your machine. Then go to your Steam directory folder, navigate into ..\Steam\steamapps\workshop\content\431240\ followed by the publishID (a ten digit number) of your map. If needed you can find the ID by looking at the Steam Workshop URL of your map, the publishID is located at the end (e.g. ../filedetails/?id=0123456789).
14 Comments
Streets 1:12 1 Apr @ 6:09pm 
alles für die gilde
NexGenInsanity 16 May, 2022 @ 3:06pm 
Thanks for the help, even the devs didn't know how to fix a damn map.
Fembob Bulgepants 21 Mar, 2022 @ 1:15pm 
As far as I know the path should be the same on all distros.
herbstwerk  [author] 21 Mar, 2022 @ 8:52am 
Glad you found this and it helped. Do you know if that Linux path is absolute or system/distro agnostic? Tbh, the last time I installed Linux it was SuSe 6.x - so I basically have no clue when it comes to that. If so I'll add that to the the guide so it's easier to find than in the comments where not everyone will be looking for it.
Fembob Bulgepants 20 Mar, 2022 @ 4:32pm 
You are an absolute live saver!

I had two walls that were about 15 million units outside the map (lol) which was making a part of the course unplayable. Followed this tutorial and now it works like a charm.

If anyone else sees this post and is using Linux like me, then:

1. Custom maps are located in ~/.config/unity3d/Team17 Digital Ltd/Golf With Your Friends/CustomLevels

2. A Linux-native text editor that can do what you need for this is notepadqq
Keyo 19 Jan, 2022 @ 6:40am 
Well, this was the single most helpful guide that I've needed.. so awards were absolutely necessary :D
herbstwerk  [author] 19 Jan, 2022 @ 6:25am 
Glad it helped, spending all those points on awards would not have been necessary thought. Well, no refunds. ;)
Keyo 19 Jan, 2022 @ 6:08am 
Thank you so much!
Made something wrong the first try fixing this, but second try on backup worked!

Now back to editing the map :)
nothotsauce 8 Jul, 2021 @ 6:33pm 
Yes, the problem still occurs. I can send a link of the map.
herbstwerk  [author] 8 Jul, 2021 @ 7:15am 
Welp, it certainly sounded like this was the problem. Is the problem still present are saving/reloading the map? If so and if you want, could you contact me on Discord (herbstwerk #7132) and send me the map file? I'd love to have a look at it and see if there's another reason why this happens.