Closed ferrous26 closed 10 years ago
That is, about 8.5 kB per train.
The other option is to have some sort of scaling factor for a base speed associated with each track node. However, we would need to do some more measurements to see if the same multiplier will work for each speed level.
If only it could work with each train, it would be a definite winner.
The answer is "no, 43kB is not worth it.".
Since we know that train velocities have a linear relationship we can exploit that to only store the slop and offset for the line. This reduces the storage requirement to 2 words. To handle live feedback we have a slope and offset for each track type, and also a delta offset that we build up using feedback. Still linearly bound in size if we should choose to have one function for each track node, but the constants are much smaller:
144 track nodes
3 words per node
-----------------------
432 words
1728 bytes
Still a big deal and we should avoid it, but an order of magnitude less storage required.
14 speed levels, 5-7 trains, 155 track pieces
That is 43kB of velocity data. Is it worth it?