~ Forums of Enroth ~
Would you like to react to this message? Create an account in a few clicks or log in to continue.

~ Forums of Enroth ~

The Enroth diehard fan community
 
HomeHome  Latest imagesLatest images  SearchSearch  RegisterRegister  Log inLog in  
Latest topics
» Songs of Conquest
Image-to-map conversion Icon_minitimeby Blake01 2024-04-07, 15:14

» ...to XP run...
Image-to-map conversion Icon_minitimeby CATMAN 2024-03-30, 03:16

» WARNING - The dreaded moment is here: Heroes 6 servers shutting down
Image-to-map conversion Icon_minitimeby Blake01 2024-03-29, 23:04

» Songs of Silence (HoMM like game)
Image-to-map conversion Icon_minitimeby Blake01 2024-03-27, 16:52

» Heroes Orchestra's 5th Birthday concerts with Paul Romero
Image-to-map conversion Icon_minitimeby rrravyn 2024-03-23, 22:45

» fheroes2 General Announcements
Image-to-map conversion Icon_minitimeby sirDranik 2024-03-17, 23:35

» Photo Gallery
Image-to-map conversion Icon_minitimeby Sir Albe 2024-03-07, 06:57

Poll
Global announcements should be:
Everlasting, 1 for each project.
Image-to-map conversion Redbar110%Image-to-map conversion Redbar12
 0% [ 0 ]
Temporary, when there is something new to announce.
Image-to-map conversion Redbar11100%Image-to-map conversion Redbar12
 100% [ 6 ]
Holalala... No idea where the Ultimate artifact is.
Image-to-map conversion Redbar110%Image-to-map conversion Redbar12
 0% [ 0 ]
Total Votes : 6
Most Viewed Topics
H3SW: General Graphics discussion
Ragoon's Graphics For HoMM3SW
Introduce yourself
H3SW General Discussion
H3SW Map List: Work in progress
H3SW: Dwelling Development
Forum Admins Feed
The Floody Land
Enrothian Fan Art
Heroes III: The Succession Wars v0.8.1 Beta

 

 Image-to-map conversion

Go down 
+3
Thorjac
Orzie
Metalhead33
7 posters
AuthorMessage
Metalhead33
Peasant
Peasant
Metalhead33


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

Image-to-map conversion Empty
PostSubject: Image-to-map conversion   Image-to-map conversion Icon_minitime2016-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
Orzie


Messages : 2163
Quality Points : 843
Registration Date : 2014-12-12
Age : 32
Location : Turkey

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

Nice! Would love to see such tool working for Heroes 1-3 too.
Back to top Go down
Metalhead33
Peasant
Peasant
Metalhead33


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

Image-to-map conversion Empty
PostSubject: Re: Image-to-map conversion   Image-to-map conversion Icon_minitime2016-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
Orzie


Messages : 2163
Quality Points : 843
Registration Date : 2014-12-12
Age : 32
Location : Turkey

Image-to-map conversion Empty
PostSubject: Re: Image-to-map conversion   Image-to-map conversion Icon_minitime2016-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.
Back to top Go down
Thorjac
Gargoyle
Gargoyle
Thorjac


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

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

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


Messages : 64
Quality Points : 49
Registration Date : 2015-08-01

Image-to-map conversion Empty
PostSubject: Re: Image-to-map conversion   Image-to-map conversion Icon_minitime2016-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
Metalhead33


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

Image-to-map conversion Empty
PostSubject: Re: Image-to-map conversion   Image-to-map conversion Icon_minitime2016-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
BoseDrache


Messages : 64
Quality Points : 49
Registration Date : 2015-08-01

Image-to-map conversion Empty
PostSubject: Re: Image-to-map conversion   Image-to-map conversion Icon_minitime2016-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)
Image-to-map conversion Prog1
(Results - landscape map, obstacles map and preview)
Image-to-map conversion Prog2
Back to top Go down
Metalhead33
Peasant
Peasant
Metalhead33


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

Image-to-map conversion Empty
PostSubject: Re: Image-to-map conversion   Image-to-map conversion Icon_minitime2016-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:
http://www.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
Darmani


Messages : 288
Quality Points : 47
Registration Date : 2014-12-27

Image-to-map conversion Empty
PostSubject: Re: Image-to-map conversion   Image-to-map conversion Icon_minitime2016-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
Pitsu


Messages : 45
Quality Points : 32
Registration Date : 2015-08-02

Image-to-map conversion Empty
PostSubject: Re: Image-to-map conversion   Image-to-map conversion Icon_minitime2016-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
BoseDrache


Messages : 64
Quality Points : 49
Registration Date : 2015-08-01

Image-to-map conversion Empty
PostSubject: Re: Image-to-map conversion   Image-to-map conversion Icon_minitime2016-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:
Image-to-map conversion Cat3
Back to top Go down
Baronus
Nomad
Nomad
Baronus


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

Image-to-map conversion Empty
PostSubject: Re: Image-to-map conversion   Image-to-map conversion Icon_minitime2016-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
Sponsored content





Image-to-map conversion Empty
PostSubject: Re: Image-to-map conversion   Image-to-map conversion Icon_minitime

Back to top Go down
 
Image-to-map conversion
Back to top 
Page 1 of 1
 Similar topics
-
» HoMM Similar Games & HoMM Total Conversion Mods List
» How to do an image for H2:ironfist/H3:SW?
» [Heroes 2 Bugs] Invisible Mirror Image troop
» [Heroes 2 Bugs] Bug Mass Dispel Mirror Image

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