title: Store a matrix of elements that might be similar
body: <p>I am making a small app in Ruby On Rails that let's you create RPG game maps like this:</p>
  
  <p><a href="https://i.stack.imgur.com/GD6tu.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GD6tu.jpg" alt="enter image description here"></a></p>
  
  <p>To the question, "How should I save this data?", my first thought would be to create a Model <code>Tile</code> and a Model <code>Map</code>, which <code>has_many :tiles</code>. Probably giving an x and y parameter to <code>Tile</code>, to know where to locate them into the map.</p>
  
  <p>But then again, I look at the map, and I see there are plenty of tiles that are exactly the same. For instance, the "grass tiles", which are repeated over and over in about 40% of the map.</p>
  
  <p>So I was wondering. Is there any smarter way to save this information that may save me space?</p>