distance function generation from level data, first pass