Caeden117 / ChroMapper

GitHub repository for ChroMapper, the Unity-based map editor for Beat Saber.
https://cm.topc.at/dl
GNU General Public License v2.0
295 stars 86 forks source link

Support for v4 format #512

Open DanTheMan827 opened 4 months ago

DanTheMan827 commented 4 months ago

1.35 added a v4 difficulty format, picture below is a screenshot from AssetStudioGUI of one of the new DLC files image

The files are still json, but now with a .beatmap extension, and the asset files also gzip compress them.

XAce1337manX commented 4 months ago

v4 has actually been in the game since 1.34.5. It's on the radar but it will take time as it substantially changes serialization format which has a bunch of challenges.

DanTheMan827 commented 4 months ago

Maybe this'll be helpful, maybe not... but I've figured out this much based on comparing the new beatmap with the old difficulty file.

V4 > V3
  beatmap
    colorNotes
      b > b
      i = index for colorNotesData
      colorNotesData[i ?? 0].x > x
      colorNotesData[i ?? 0].y > y
      colorNotesData[i ?? 0].c > c
      colorNotesData[i ?? 0].d > d
      colorNotesData[i ?? 0].a > a

    bombNotes
      b > b
      i = index for bombNotesData
      bombNotesData[i ?? 0].x > x
      bombNotesData[i ?? 0].y > y

    obstacles
      b > b
      i = index for obstaclesData
      obstaclesData[i ?? 0].x > x
      obstaclesData[i ?? 0].y > y
      obstaclesData[i ?? 0].d > d
      obstaclesData[i ?? 0].w > w
      obstaclesData[i ?? 0].h > h

    chains > burstSliders
      hb > b
      tb > tb
      i = index for colorNotesData
      colorNotesData[i ?? 0].x > x
      colorNotesData[i ?? 0].y > y
      colorNotesData[i ?? 0].c > c
      colorNotesData[i ?? 0].d > d
      ci = index for chainsData
      chainsData[ci ?? 0].tx > tx
      chainsData[ci ?? 0].ty > ty
      chainsData[ci ?? 0].c > sc
      chainsData[ci ?? 0].s > s

    arcs > sliders
      hb > b
      tb > tb
      hi = index for colorNotesData
      ti = index for colorNotesData
      ai = index for arcsData
      colorNotesData[hi ?? 0].c > c
      colorNotesData[hi ?? 0].x > x
      colorNotesData[hi ?? 0].y > y
      colorNotesData[hi ?? 0].d > d
      colorNotesData[ti ?? 0].x > tx
      colorNotesData[ti ?? 0].y > ty
      colorNotesData[ti ?? 0].d > tc
      arcsData[ai ?? 0].tm > tmu
      arcsData[ai ?? 0].m > mu
      arcsData[ai ?? 0].a > m

I haven't done the lightshow yet, but I don't even know if converting v4 to v3 would even work?

Caeden117 commented 4 months ago

v4 contains the same information as v3, but has additional compression on top for shared object states.

For ChroMapper, the implementation I'm thinking about is to decompress a v4 list of indices and data back into a full complete list of objects, so v4 maps can be manipulated using the same systems we already have in place for v2 and v3. At save time, ChroMapper will re-compress objects back into the indices and data lists. This decompression/compression process will be invisible to the mapper and to the rest of ChroMapper's codebase, so systems like Node Editor can still function as expected and not have to be entirely rewritten.

that being said, considering official editor still does not save in the v4 format just yet, i don't think implementation is of utmost priority, but it is something we'll want to look into

EDIT: Should want to mention that changes involving the v4 Info.dat file will need more substantial changes to the Song Edit screen, and how CM loads lightshowss alongside maps. There's still quite a lot of work and refactors to be done to support the v4 format, but I think my solution outlined above will cut out a lot more work involving the Editor itself.