Help us shape the future of Go! Take the 2026 Go Developer Survey

a2kit

module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 25, 2026 License: MIT

README

a2kit

Passive AION 2 protocol decoder. No injection. No Npcap/WinPcap required.

Performance (on real game data, Apple Silicon)

  • Decoding: 500 MB/s, 60 ns a frame
  • Allocations: 1 per ~500 frames
  • CPU: ~6 µs per second of play
  • Latency after a lost packet: 51 ms median

Logs

dump -pcap fight.pcap -log fight.jsonl writes an a2log/v0.1 file, which contains a header line, then one JSON line per frame with its raw payload.

var (
	hdr a2log.Header
	dec = json.NewDecoder(file)
)

if err := dec.Decode(&hdr); err != nil {
	return err
}
for dec.More() {
	var line a2log.Frame
	if err := dec.Decode(&line); err != nil {
		return err // a line that is not an a2log frame
	}
	switch e, err := game.Parse(line.Wire(hdr.T0)); {
	case errors.Is(err, game.ErrUnread): // an opcode game does not read yet
	case err != nil: // bytes off the layout, many after a game patch
	default:
		if hit, ok := e.(game.Hit); ok {
			fmt.Println(hit.Actor, hit.Target, hit.Skill, hit.Damage)
		}
	}
}

game/opcode.go lists every opcode met and which ones are read. dump -events prints the same events as JSON lines

Work in progress.

Directories

Path Synopsis
Package a2log is the fight log that dump -log writes: a Header line, then one Frame a line, each a JSON object.
Package a2log is the fight log that dump -log writes: a Header line, then one Frame a line, each a JSON object.
Package capture reads TCP segments from pcap and pcapng files, and from a live device.
Package capture reads TCP segments from pcap and pcapng files, and from a live device.
cmd
dump command
Dump prints a line for each game frame it finds
Dump prints a line for each game frame it finds
Package game reads the meaning of AION 2 frames, like hits, casts, spawns, deaths, positions and the clocks.
Package game reads the meaning of AION 2 frames, like hits, casts, spawns, deaths, positions and the clocks.
internal
genfixtures command
Genfixtures writes the synthesized test fixtures: TCP payload streams for package wire, and a pcap for package capture, each with the frames it holds.
Genfixtures writes the synthesized test fixtures: TCP payload streams for package wire, and a pcap for package capture, each with the frames it holds.
opdiff command
Opdiff helps name opcodes.
Opdiff helps name opcodes.
score command
Score measures the decoder on synthesized captures whose frames are known: how many of them it finds, and how many it makes up.
Score measures the decoder on synthesized captures whose frames are known: how many of them it finds, and how many it makes up.
timeline command
Timeline writes game frames as a Chrome trace, to open in ui.perfetto.dev
Timeline writes game frames as a Chrome trace, to open in ui.perfetto.dev
Package wire turns TCP segments into AION 2 game frames.
Package wire turns TCP segments into AION 2 game frames.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL