Refactored tilemap support, and added Entity encoding.