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