Map Storage

The first challenge I encountered when creating a tile-based mobile game was deciding how I would store the various maps upon which various combat scenarios would take place.

What I eventually settled on was an array of integers with each number representing a different type of tile, these arrays were arranged in such a way that the integers were displayed within the xml file in the same layout as the actual map.

This may not have been the best choice for storing the map info but I implemented it anyway as I enjoyed the ease with which I could edit the maps.

A (very small) look at how the map integer arrays are laid out within my code.

3 x 3

As you may have noticed above the integer array has been laid out into three columns of three rows, each of these sections represent enough tiles to fill the combat screen of my app.

When I first tested the combat screen of my app I only created a map big enough to fill the screen before deciding that each map should contain nine such areas in order to give the player the illusion of a bigger world.

The middle section of the map integer array shown above.

I accomplished this by simply making the integer array nine times longer, although looking back I realise it may or may not have been simpler to just have nine separate arrays.

These new larger maps however brought with them a new problem: if the player can move around in an area larger than the screen, how should I go about ensuring that the player is always on the screen?

The middle section of the map integer array shown above when displayed.

6 thoughts on “Map Storage

  1. I enjoy reading through a post that can make people think.
    Also, thank you for allowing for me to comment!

  2. Everything is very open with a precise description of the issues. It was really informative. Your website is useful. Many thanks for sharing! Darell Terrence Virgy

  3. Wow, awesome blog layout! How long have you been blogging for?
    you make blogging look easy. The overall look of your site
    is magnificent, as well as the content!

  4. I enjoy what you guys tend to be up too.
    This kind of clever work and reporting! Keep up the terrific works guys I’ve added you
    guys to my personal blogroll.

    My homepage; US Magazine

  5. I just like the helpful information you provide in your articles.
    I will bookmark your weblog and check once more here regularly.
    I’m fairly certain I’ll be told a lot of new stuff proper here!

    Good luck for the next!

    Here is my web-site: buy weed online, Hubert,

Leave a Reply

%d bloggers like this: