Author Topic: Key of a level: How to map replays/trophies to levels  (Read 79 times)

0 Members and 1 Guest are viewing this topic.

Offline Simon

  • Administrator
  • Posts: 2384
    • View Profile
    • Lix
Key of a level: How to map replays/trophies to levels
« on: May 29, 2018, 03:24:59 am »
Lix 0.9.17 has:
  • A level is identified by its full filename (path within levels/ plus the file's basename).
  • Identical level files in different directories are considered different levels for replay-to-level matching and for trophies (checkmarks).
  • Within larger sets of levels, it's popular to have ranks, i.e., one directory per 30-ish levels of that larger set.
Problems of 0.9.17:
  • When a level moves between ranks (e.g., we reorder levels in lemforum), that level's replays will point to nonexistant file and that level's trophies are lost.
  • The level is the unit of culture. The rank or the pack are arbitrary distribution methods and should not count towards level identity.
  • Consider two levels the same when they have the same basename (= the tail of the full filename that is independent of directories) and the levels have identical level titles and authors.
  • This treats the level directory as an associative array (a.k.a. dictionary) where a key is level title plus author plus basename (filename independent of directory). A value is then a level (the data in the file, not the file itself).
  • Store trophies (checkmarks) by key (basename, level title, author) and let replays point to keys instead of to full filenames.
  • Given a level file, it is trivial to determine its key. For each level, it remains fast to retrieve trophies.
  • To match replays back to levels, accept a dent in performance: When you have a key (filename without directory, level title, author), e.g., because a replay points to that key, you must first list the entire tree and then open all listed files with matching basename (usually 1 match but might be a couple more) to compare title and author.
  • To get the performance back, cache the key-to-full-filename resolution. While Lix is running, slowly index all files in the tree in the background. This would also make the search feature faster on Windows (slow harddisks, Windows itself, and Windows's virus scans nuke the search's performance).
  • When do you consider two levels the same for trophies (checkmarks) and replay-to-level-mapping? When only decoration changes, the level should probably still count the same. How about renaming the level file? How about moving the file or changing the level title? How about changing the skillset or number of lix?
  • Should the basename be part of the key? Or should the key consist only of level title and author? Should it consist of other things?
  • Or continue to map replays/trophies to levels by full filename alone, accepting above problems of 0.9.17?
  • For a selected level, I'd like to list all replays that point to this level. How should I implement that? Either I'll have to index the entire replay directory on demand (awfully slow), index the replay tree slowly in the background (feels weird for replays, but maybe okay), or require that replays for a level be put in a certain directory structure (but Nepster complained about Lix's replay directory structure, he wanted to sort replays by level position first, only then by solved/manual/proofs/...).
  • Can we require that a replay's basename should start with the basename of the level? That makes it much nicer to find replays for a given level file.
Older topic: Musings on level culture, 2017-07.

-- Simon
« Last Edit: May 29, 2018, 05:24:39 am by Simon »