fraggle
Registered just to make one post
Posts: 9210
Registered: 1299 
Maes said:
So what gives? Is the "zero linedef" header really necessary in checks, or do some blockmaps actually carry an information payload there?
It's possible that some blockmap builders already assume that a leading "0" is redundant, so just start using the first entry to include real lines. The redundant header is just like having linedef #0 in every block.
Back to business: I started experimenting with my ideas. The output below is from my test script trying every (16, 16) block alignment and counting the number of intersections between lines and the block grid at that alignment.
You can see that a +(64, 64) offset is a very good choice (4788 intersections) while a +(80, 112) offset would be a very bad one (5738 intersections).
The level I'm testing with has 8129 linedefs, so you can assume that each line has to appear in at least one block, and each time there's an intersection it appears in another block. As a (very rough) estimate, that's (8129 + 4788) * 2 = 25834 bytes for the best case and (8129 + 5738) * 2 = 27734 bytes for the worst. That saves a couple of KB (about 7%), which isn't much  I was hoping for more. The effectiveness of this technique probably depends very much on the level geometry.
code: 8129 linedefs
0, 0: 4881 intersections
0, 16: 5269 intersections
0, 32: 5042 intersections
0, 48: 5284 intersections
0, 64: 4861 intersections
0, 80: 5270 intersections
0, 96: 5047 intersections
0, 112: 5297 intersections
16, 0: 5241 intersections
16, 16: 5629 intersections
16, 32: 5402 intersections
16, 48: 5644 intersections
16, 64: 5221 intersections
16, 80: 5630 intersections
16, 96: 5407 intersections
16, 112: 5657 intersections
32, 0: 4967 intersections
32, 16: 5355 intersections
32, 32: 5128 intersections
32, 48: 5370 intersections
32, 64: 4947 intersections
32, 80: 5356 intersections
32, 96: 5133 intersections
32, 112: 5383 intersections
48, 0: 5215 intersections
48, 16: 5603 intersections
48, 32: 5376 intersections
48, 48: 5618 intersections
48, 64: 5195 intersections
48, 80: 5604 intersections
48, 96: 5381 intersections
48, 112: 5631 intersections
64, 0: 4808 intersections
64, 16: 5196 intersections
64, 32: 4969 intersections
64, 48: 5211 intersections
64, 64: 4788 intersections
64, 80: 5197 intersections
64, 96: 4974 intersections
64, 112: 5224 intersections
80, 0: 5322 intersections
80, 16: 5710 intersections
80, 32: 5483 intersections
80, 48: 5725 intersections
80, 64: 5302 intersections
80, 80: 5711 intersections
80, 96: 5488 intersections
80, 112: 5738 intersections
96, 0: 5060 intersections
96, 16: 5448 intersections
96, 32: 5221 intersections
96, 48: 5463 intersections
96, 64: 5040 intersections
96, 80: 5449 intersections
96, 96: 5226 intersections
96, 112: 5476 intersections
112, 0: 5320 intersections
112, 16: 5708 intersections
112, 32: 5481 intersections
112, 48: 5723 intersections
112, 64: 5300 intersections
112, 80: 5709 intersections
112, 96: 5486 intersections
112, 112: 5736 intersections
