Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2001:
[Freeciv-Dev] Re: converting bmp to isometric maps: a question
Home

[Freeciv-Dev] Re: converting bmp to isometric maps: a question

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Bart Coppens <coppensbart@xxxxxxxxxxxxxxxxx>, freeciv-dev <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: converting bmp to isometric maps: a question
From: Jason Dorje Short <vze2zq63@xxxxxxxxxxx>
Date: Sun, 04 Nov 2001 12:24:46 -0500
Reply-to: jdorje@xxxxxxxxxxxx

> Bart Coppens wrote:
> 
> Hello,
> I am working on a program written in Delphi (Win32, I hadn't time to
> try out Kylix) that 'converts' a map from a bmp file to a .map
> savegame. This works quite well (not very good, but it works good
> enough for saving me time), but only if the map isn't displayed in
> isometric mode. Because I save the map in a linear mode, the game
> displays the map right in the minimap, but it's rotated 45° in real
> play. Now I didn't find how I can get around this. How should I fill
> the squares at the top? Because I can rotate the file manually, but
> then I create a lot of extra tiles I don't want...
> Bart Coppens

I'm a bit confused as to what you're actually trying to do.


It's easy to convert a flat-rectangle .bmp map to a flat-rectangle .map
savegame.  Everything is straightforward.


To convert a flat-rectangle .bmp map to an iso-rectangle (isometric)
.map savegame would be difficult.  The problem is that if you view
things "flat", then the iso-rectangle has its tiles set up like this:


X X X X X
 X X X X
X X X X X
 X X X X
X X X X X

which is pretty painful to calculate (although possible).  However, the
map is stored [1] in "flat" form:

- - - - - - - - - 
|         #     | 
|       # # #   | 
|     # # # # # | 
|   # # # # #   | 
| # # # # #     | 
|   # # #       | 
|     #         | 
- - - - - - - - - 

Which is the same form the savegame must use.  Now, the arithmetic
necessary for the conversion is pretty ugly, and I'm not going to go
over it here (although if you'd like to see it, I'll send it).  Note
that the tiles in the map won't correspond exactly to pixels, so some
sort of approximation system will be needed.


Similarly, it is possible but difficult to convert an iso-rectangle .bmp
map to a flat-rectangle .map savegame.  Here your .bmp probably looks
like [2]

- - - - - - - - - 
|         # #   | 
|       # # # # | 
|     # # # # # | 
|   # # # # #   | 
| # # # # #     | 
|   # # #       | 
|     #         | 
- - - - - - - - - 


And you want to convert it to a flat-rectangle, something like

# # # # #
# # # # #
# # # # #
# # # # #
# # # # #

Note that this is an inaccurate translation; although it has the same
number of tiles they're not correctly spaced.  You might instead want
something like

# # # # # # # # #
# # # # # # # # #
# # # # # # # # #
# # # # # # # # #
# # # # # # # # #

which is correctly spaced but has more tiles than the original (the new
ones will have to be approximated).  Again the arithmetic is very
complicated.


Finally, it is possible and not too difficult to convert an
iso-rectangle .bmp map to an iso-rectangle .map savegame.  Here your
.bmp hopefully looks like 

- - - - - - - - - 
|         # #   | 
|       # # # # | 
|     # # # # # | 
|   # # # # #   | 
| # # # # #     | 
|   # # #       | 
|     #         | 
- - - - - - - - - 

which is exactly the form you want the .map file (just insert a space or
any other character in place of the unused tiles, and they'll be skipped
over in the general-topologies patch).  If the .bmp takes a different
form (like the parallelogram [2], or in a subtlety different form like


- - - - - - - - - 
|         #     | 
|       # # #   | 
|     # # # # # | 
|   # # # # #   | 
| # # # # #     | 
| # # # #       | 
|   # #         | 
- - - - - - - - - 

then you'll need some more complicated calculations.  Really, this is
probably the conversion you want to be doing - it's just too bad that
FreeCiv doesn't natively support it yet.


[1] This is assuming you're using my general-topologies patch or another
similar system.  Without that, the iso-rectangular map isn't possible in
FreeCiv.

[2] Or, it's possible it looks like
-------------------
|        # # # # #|
|      # # # # #  |
|    # # # # #    |
|  # # # # #      |
|# # # # #        |
-------------------
which makes things harder (IMO).  These two are the exact same map; the
latter form might be used so long as the map wraps in east-west
directions only.


[Prev in Thread] Current Thread [Next in Thread]