~ Forums of Enroth ~

An Enroth diehard fan community
 
HomeHome  ChatChat  FAQFAQ  SearchSearch  RegisterRegister  Log inLog in  
Latest topics
» H3SW: General Graphics discussion
by robizeratul Yesterday at 11:45

» Ragoon's Graphics For HoMM3SW
by robizeratul Yesterday at 11:40

» Creature Quest – The New Adventure from JVC (feat some old NWC members)
by Galaad 2017-10-13, 20:34

» Modding Questions
by GodRage 2017-10-12, 18:32

» Introduce yourself
by Orzie 2017-10-12, 17:10

» [Ironfist ver 1.3.0] Sorrow's End map - Sprites of creatures missing on the adventure map
by Kristo 2017-10-12, 15:13

» [EN, RU][Offline] HoMM1 Main Tourney 2017-2 (Общий Турнир)
by Orzie 2017-10-11, 18:14

Poll
"Wait" in HoMM2?
Yes
80%
 80% [ 45 ]
No
20%
 20% [ 11 ]
Total Votes : 56
Most Viewed Topics
H3SW: General Graphics discussion
Ragoon's Graphics For HoMM3SW
H3SW General Discussion
H3SW: Dwelling Development
H3SW Map List: Work in progress
Dervish Faction General Concept
Enrothian Fan Art
H3SW Recruitment Point - Enroth Needs You!
Серия книг "Земли Меча и Магии"
Commanders?

Share | 
 

 Image-to-map conversion

View previous topic View next topic Go down 
AuthorMessage
Metalhead33
Peasant
Peasant
avatar

Messages : 4
Quality Points : 0
Registration Date : 2016-06-12
Age : 25
Location : Budapest, Hungary

PostSubject: Image-to-map conversion   2016-06-12, 05:10

Hello everyone!

Currently, I am in charge of a project that would convert images to maps for H4:
https://github.com/Metalhead33/Homm4-img2map

Why? Because I have an image of a map, and I am too lazy to make a map based off it by hand, so I'll convert the pixels of the image to terrain types.

Currently, my program isn't functional, and it's for Homm4, BUT... Homm3 uses the same format: map compressed into .gzip.
So, if there is a demand, I can expand my project to work for both Homm3 and Homm4.

I have this image. I will clean it up, pick a specific part of it, and then I'll be able to convert it into a H4 map.
Back to top Go down
http://ways-of-darkness.sonck.nl/User:Metalhead33
Orzie
Master Modder
Master Modder
avatar

Messages : 1544
Quality Points : 643
Registration Date : 2014-12-12
Age : 25
Location : Tomsk, Russia

PostSubject: Re: Image-to-map conversion   2016-06-12, 05:12

Nice! Would love to see such tool working for Heroes 1-3 too.

________________________
In case someone cares for my music:
Mylinks_profile_page
Back to top Go down
Metalhead33
Peasant
Peasant
avatar

Messages : 4
Quality Points : 0
Registration Date : 2016-06-12
Age : 25
Location : Budapest, Hungary

PostSubject: Re: Image-to-map conversion   2016-06-12, 05:14

Orzie wrote:
Nice! Would love to see such tool working for Heroes 1-3 too.

Once I manage to get my converter to work, I will do some research on H1-3 map formats, and get to working on it Smile
Be warned though, my tool will only generate terrain types - the map will be devoid of any objects on it. That will have to be put on it by the player.
Back to top Go down
http://ways-of-darkness.sonck.nl/User:Metalhead33
Orzie
Master Modder
Master Modder
avatar

Messages : 1544
Quality Points : 643
Registration Date : 2014-12-12
Age : 25
Location : Tomsk, Russia

PostSubject: Re: Image-to-map conversion   2016-06-12, 05:15

That's how it must be done. Still, the mapmaker must remember that impassable terrain squares are colored with a darker version of a terrain color on the map.

________________________
In case someone cares for my music:
Mylinks_profile_page
Back to top Go down
Thorjac
Gargoyle
Gargoyle
avatar

Messages : 12
Quality Points : 5
Registration Date : 2015-09-10

PostSubject: Re: Image-to-map conversion   2016-06-12, 08:56

This is already possible for Heroes III through the WoG editor.
Back to top Go down
BoseDrache
Nomad
Nomad
avatar

Messages : 55
Quality Points : 44
Registration Date : 2015-08-01

PostSubject: Re: Image-to-map conversion   2016-06-12, 11:46

I have 144x144 image to H3 map conversion program.
Have written it myself, it creates 144x144 landscape and 144x144 obstacle images, so one should draw a map manually.
Back to top Go down
Metalhead33
Peasant
Peasant
avatar

Messages : 4
Quality Points : 0
Registration Date : 2016-06-12
Age : 25
Location : Budapest, Hungary

PostSubject: Re: Image-to-map conversion   2016-06-12, 22:51

BoseDrache wrote:
I have 144x144 image to H3 map conversion program.
Have written it myself, it creates 144x144 landscape and 144x144 obstacle images, so one should draw a map manually.

Is that so? May I take a look at the source code please? *cute face*
Back to top Go down
http://ways-of-darkness.sonck.nl/User:Metalhead33
BoseDrache
Nomad
Nomad
avatar

Messages : 55
Quality Points : 44
Registration Date : 2015-08-01

PostSubject: Re: Image-to-map conversion   2016-06-13, 23:20

Since that was long time ago, I don't even understand all the features I've implemented there.
It was a GameMaker program...
I can retell the idea.
I. Rough (but correct) conversion
1. You divide your picture into 2x2 squares.
2. For every square you try all the landscape types. Then for all 4 pixels in a square you choose if it should be clear or have obstacle - minimum of these 2 values:
(r-r_cl)^2+(g-g_cl)^2+(b-b_cl)^2
(r-r_ob)^2+(g-g_ob)^2+(b-b_ob)^2
3. Summarizing 4 minimal values of 4 pixels you minimize it again across the landscape types and then attach a landscape type with minimal sum to a square.

Rough conversion gives you a correct, but lower than possible resolution pseudographics.

II. Auxiliary conversion (incorrect in terms of Editor)
1. For every pixel (independently) you try all possible combinations of landscape types and obstacle/free settings. Attach a combination with minimal sum (as above) to a pixel.

III. Through a number of iterations you remove incorrect places such as alone cells or thin (1-cell) bands from (II) using (I) as an origin.

How it works.
(Origin image - just a random cat from net)

(Results - landscape map, obstacles map and preview)
Back to top Go down
Metalhead33
Peasant
Peasant
avatar

Messages : 4
Quality Points : 0
Registration Date : 2016-06-12
Age : 25
Location : Budapest, Hungary

PostSubject: Re: Image-to-map conversion   2016-06-19, 09:05

Even more good news!
Together with a friend of mine, we have started working on the map converter even more than before.
And I have already managed to get a few maps converted.

Here is the proof:
mediafire.com download/3w722k5450u2r6c/H4converted_maps.7z
Back to top Go down
http://ways-of-darkness.sonck.nl/User:Metalhead33
Darmani
Master Modder
Master Modder
avatar

Messages : 175
Quality Points : 32
Registration Date : 2014-12-27

PostSubject: Re: Image-to-map conversion   2016-06-19, 14:55

Nice!

Let me know if you want help on the H2 map format. Smile
Back to top Go down
Pitsu
Pikeman
Pikeman
avatar

Messages : 39
Quality Points : 28
Registration Date : 2015-08-02

PostSubject: Re: Image-to-map conversion   2016-06-19, 21:00

BoseDrache wrote:

(r-r_cl)^2+(g-g_cl)^2+(b-b_cl)^2
(r-r_ob)^2+(g-g_ob)^2+(b-b_ob)^2

Although the conversion is not exactly to grayscale, the number of colors in H3 is limited. Thus have you also tried with the relative corrections for human eye perciption?
like: 0.3*(r-r_cl)^2+ 0.59*(g-g_cl)^2+0.11*(b-b_cl)^2
maybe it has no effect, and if it has, then only in certain cases, but it may be something to think about when doing palette reductions
Back to top Go down
BoseDrache
Nomad
Nomad
avatar

Messages : 55
Quality Points : 44
Registration Date : 2015-08-01

PostSubject: Re: Image-to-map conversion   2016-06-20, 02:50

Pitsu wrote:
Thus have you also tried with the relative corrections for human eye perciption?  
like: 0.3*(r-r_cl)^2+ 0.59*(g-g_cl)^2+0.11*(b-b_cl)^2
I've tried it today. The result is in general worse than for equal coefficients.
Same cat:
Back to top Go down
Baronus
Pikeman
Pikeman
avatar

Messages : 48
Quality Points : 1
Registration Date : 2016-06-12

PostSubject: Re: Image-to-map conversion   2016-06-21, 09:53

I found imagemagic for HIII but it generate only landscape. If it is possible good thing will be generating full playable map. Very good idea.
Back to top Go down
 
Image-to-map conversion
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» Putting an image in your post
» Adding a Background Image to Posts
» Issue with forum background image and custom image display
» Hover text on image
» Image that link to a page

Permissions in this forum:You cannot reply to topics in this forum
~ Forums of Enroth ~ :: Modding Guild :: General Modding-
Jump to: