#ddnet #teeworlds #snapshot #serialization #format #mod #arrayvec

bin+lib twsnap

Common snapshot format between TwGpu and TwGame

14 releases (6 breaking)

new 0.7.2 Dec 1, 2024
0.7.1 Nov 23, 2024
0.6.3 Nov 17, 2024
0.1.1 Jun 5, 2024

#4 in #teeworlds

Download history 111/week @ 2024-08-11 71/week @ 2024-08-18 129/week @ 2024-08-25 5/week @ 2024-09-01 22/week @ 2024-09-15 27/week @ 2024-09-22 49/week @ 2024-09-29 20/week @ 2024-10-06 23/week @ 2024-10-13 14/week @ 2024-10-20 15/week @ 2024-10-27 427/week @ 2024-11-03 138/week @ 2024-11-10 512/week @ 2024-11-17 133/week @ 2024-11-24

1,212 downloads per month
Used in 7 crates (3 directly)

AGPL-3.0-only

85KB
2.5K SLoC

Snapshot reprentation

Goals:

  • Can be used to render

  • Can be produced by game implementation

  • Can be serialized into DDNet demo

  • Can be deserialized from DDNet demo

  • Can be used as input from game implementation

  • valid utf-8

  • no allocations

  • usability first

Goals, if it doesn't affect the representation, otherwise another snapshot is necessary

  • Can be deserialized from Teehistorian

Non-goals:

  • repr(C) to serialize
  • Implement functions on snap objects like trajectory.
  • no_std
  • Serialization can be played by old DDNet clients or Teeworlds Client
  • resemblance of [i32; k] strings by Teeworlds
  • writing non-DDNet snapshots (other mods)

Architecture:

  • Using fixed to represent uniform scales for all distance related variables: 1 per tile
  • vek for points
  • arrayvec for stack strings/arrays
  • rust enum for protocol enums
  • bitflags
  • bools
  • One snapshot per team

Dependencies

~8MB
~141K SLoC