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%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-spec generate (map_map:type()) -> {list(any())}.
generate (Map) ->
   {
      [
         {<<"msg">>, <<"set_map">>},
         {<<"w">>, map_map:get_width(Map)},
         {<<"h">>, map_map:get_height(Map)},
         {
            <<"t">>,
            array:sparse_to_list(map_map:get_tile_class_ids(Map))
         }
      ]
   }.