Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: m!m on September 18, 2018, 08:53:29 am

Title: JSON pilots
Post by: m!m on September 18, 2018, 08:53:29 am
Here is a small notification for the people not following the GitHub commit log (which are probably most users of FSO :nervous:).

The JSON pilot feature has just been merged which converts the previous .plr files from a custom binary format to the standardized JSON format. At the moment, only the main pilot files are stored as JSON but at some point the campaign files will also be converted to JSON.

FSO will automatically convert the binary pilots to JSON on your first launch and will then only use the JSON pilots. That means that the "old" pilots will not be updated anymore so if you switch to an older build you will not see the changes that were made to the pilot with a build which uses JSON pilots.

That is all, have a nice day.
Title: Re: JSON pilots
Post by: Spoon on September 18, 2018, 11:21:52 am
Please educate me on the reasons for this switch to JSON. What does it do, why was it done, what are the pros (or possible cons)? For I am ignorant and would like to know more.
Title: Re: JSON pilots
Post by: Nightmare on September 18, 2018, 11:25:28 am
Does that mean that pilot files spontaneously corrupting is less likely now?
Title: Re: JSON pilots
Post by: X3N0-Life-Form on September 18, 2018, 12:07:33 pm
Well, JSON is just plain text, so if you pilot does get borked, you could theoretically fix it using notepad or something.
Title: Re: JSON pilots
Post by: m!m on September 18, 2018, 12:23:00 pm
The given reasons are the most compelling ones. Since JSON is plain-text it is much easier to inspect (and change) the pilots files in case they got corrupted. There are still some bit-flags in there which make it harder to manipulate them but at least now you don't have to look up the byte-offset of the individual options in the FSO code.
Title: Re: JSON pilots
Post by: Nightmare on September 18, 2018, 12:32:54 pm
Ah, that's pretty neat. I had a lot of trouble with corrupted pilot files; at one point pressing 1 didn't work for me anymore, and another time the game crashed while playing BP and after several restarts my pilot file had grown to over 200MB for some reason.
Title: Re: JSON pilots
Post by: wookieejedi on September 18, 2018, 01:05:02 pm
Great news! I've been looking forward to that merge for a long time!
Title: Re: JSON pilots
Post by: Mr_Maniac on September 18, 2018, 07:30:25 pm
My old pilot files didn't get converted. I had to create a brand new pilot (again). Is there any way to convert the pilot files even after the first start?
Title: Re: JSON pilots
Post by: m!m on September 18, 2018, 07:38:45 pm
I had some issues with the conversion code when using a mod. Try running retail FSO once, that should convert your pilots.
Title: Re: JSON pilots
Post by: mjn.mixael on September 18, 2018, 07:56:30 pm
I had some issues with the conversion code when using a mod. Try running retail FSO once, that should convert your pilots.

That's kind of a non-minor issue. Is there a way we can help get that fixed to make the transition smoother?
Title: Re: JSON pilots
Post by: m!m on September 18, 2018, 07:58:15 pm
I will fix that as soon as possible. I don't plan on leaving it as it is :p
Title: Re: JSON pilots
Post by: m!m on September 18, 2018, 08:55:48 pm
Here is the fix: https://github.com/scp-fs2open/fs2open.github.com/pull/1863
Title: Re: JSON pilots
Post by: Mr_Maniac on September 19, 2018, 10:53:20 am
Great to head @m!m. I'll try as soon as it's merged. Running retail FS2 also didn't convert my "old" pilots.
Title: Re: JSON pilots
Post by: m!m on September 19, 2018, 11:03:05 am
Not the "Retail FS2" executable, I meant FSO without mods :p
Title: Re: JSON pilots
Post by: Colonol Dekker on September 19, 2018, 11:32:38 am
This means I can tweak pilots in codepad or notepad++?


:3
Title: Re: JSON pilots
Post by: Nightmare on September 19, 2018, 12:07:50 pm
It's never been so easy to become a triple ace in a couple moments. :D
Title: Re: JSON pilots
Post by: Mr_Maniac on September 19, 2018, 12:34:19 pm
Not the "Retail FS2" executable, I meant FSO without mods :p

I know  ;)
I started FS2 SCP without mods, with MVP and with my own mod, but the only pilot I saw, was my newly created one. But now I started it without mods again and the pilots were converted... strange.
Title: Re: JSON pilots
Post by: m!m on September 19, 2018, 12:46:40 pm
The fix has been merged so if you are compiling the builds from source you can do a pull and compile the newest version and it should start working in all circumstances.