8/20/2014 - WTF Windows

Your chance to hear me complain

8/20/2014 - WTF Windows

PostPosted by Railboy » Wed Aug 20, 2014 11:03 pm

It seems like every day I'm fighting with some obscure limitation with the engine or the OS instead of polishing the gameplay or implementing more quest stuff. Really frustrating.

Today I crashed into an absurd limit: the 259 max character limit for file paths in Windows. A exceptionally deep part of my WIGroup hierarchy produced a 160+ character path, which when combined with the path of the project resulted in 263 characters. So the file wouldn't save, resulting in lost progress and disappearing items.

dev.jpg

I briefly considered truncating the offending group names so the items would save. But there's no arbitrary limit on WIGroup hierarchy depth so that would only be a temporary solution. *sigh* better squash this permanently.

I know for a fact that NTFS file system supports file paths with up to 32,000 characters. So I looked into libraries that circumvented the ridiculous limit that the Windows API forces on you. At that moment I didn't care that this solution would be Windows-specific - I just wanted the problem gone so I could move forward. But it was a moot point anyway - all of the libraries available required tools that aren't included in the .NET 2.0 subset that Unity forces me to use. Oh well, whatever. Guess I'll roll up my sleeves and implement a cross-platform solution. Maybe Unity's half-assed 2.0 subset actually saved me some trouble down the road.

Soooo I ended up implementing a string compression system that takes these uber-long paths and converts them to a guaranteed-to-be-unique 64-bit integer, which is then converted to hexadecimal for a (semi) readable directory name (eg Root.World.C-2-3-14.WI.AG becomes 9BDB8EA3B81D90AE). Thankfully because I'm not an idiot I funnel every request to save and load through two primary functions, both of which are abstracted to hell before any in-game object touches them. So I was able to make this change relatively painlessly. This setup kind of cramps modding in my opinion (since you could actually browse the hierarchy as it existed in game before, where now you have to jot down IDs to find stuff) but whatever. Gotta do what you gotta do.

Just so we're clear here: My goal was to save a file to disk.

Save a file.

To disk.

Save. A. File. To. Disk. For fuck's sake. Could today have been any less productive? I doubt it. Thanks, Windows!
Language is to the mind more than light is to the eye.
User avatar
Railboy
Developer
Developer
 
Posts: 1845
Joined: Mon Jul 15, 2013 10:46 pm
Location: Seattle, WA

Re: 8/20/2014 - WTF Windows

PostPosted by Vance » Wed Aug 20, 2014 11:38 pm

Form identification is not really a bad idea, as it can help you track down and organize integers later down the road.
Awesome that you could circumvent the damn limitation that Win has.
Instagram
YouTube
Twitter
User avatar
Vance
Dungeon Crawler
 
Posts: 124
Joined: Thu Jul 18, 2013 5:59 am
Location: United States

Re: 8/20/2014 - WTF Windows

PostPosted by SignpostMarv » Thu Aug 21, 2014 7:57 am

Does this technique not play nice in Unity? http://stackoverflow.com/questions/3415 ... ame-prefix
User avatar
SignpostMarv
Alchemist
Alchemist
 
Posts: 307
Joined: Thu Jul 18, 2013 2:28 pm

Re: 8/20/2014 - WTF Windows

PostPosted by Railboy » Thu Aug 21, 2014 4:38 pm

SignpostMarv wrote:Does this technique not play nice in Unity? http://stackoverflow.com/questions/3415 ... ame-prefix


I was getting System.Runtime.COMExceptions so I lumped it in with the 'non-cross-platform solutions I won't bother trying to debug.'
Language is to the mind more than light is to the eye.
User avatar
Railboy
Developer
Developer
 
Posts: 1845
Joined: Mon Jul 15, 2013 10:46 pm
Location: Seattle, WA

Re: 8/20/2014 - WTF Windows

PostPosted by light487 » Fri Aug 22, 2014 5:49 am

Maybe you could still create a virtual directory of all the objects/items for modders to search through and pair the entries up with the HEX representations etc?
light487
Spyglass Polisher
 
Posts: 41
Joined: Fri Jul 26, 2013 12:04 am

Re: 8/20/2014 - WTF Windows

PostPosted by hundlar » Fri Aug 22, 2014 11:02 am

Yay! Another argument for Windows' technical inferiority!
When in doubt, use bruteforce. — Ken Thompson
User avatar
hundlar
Novice
Novice
 
Posts: 5
Joined: Thu Aug 07, 2014 10:48 am
Location: Reykjavík, Iceland

Re: 8/20/2014 - WTF Windows

PostPosted by SignpostMarv » Sat Aug 30, 2014 3:59 pm

Presently running into this issue with
Code: Select all
git clean -fxd
with ridiculously nested npm dependencies o_O
User avatar
SignpostMarv
Alchemist
Alchemist
 
Posts: 307
Joined: Thu Jul 18, 2013 2:28 pm


Return to Dev Logs

Who is online

Users browsing this forum: No registered users and 1 guest

cron