~ Forums of Enroth ~

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

» I'm looking for one really crazy map to H2
by Orzie Yesterday at 03:23

» MasterMind Heroes: The Succesion Wars (wip title)
by Orzie Yesterday at 03:20

» Introduce yourself
by Orzie Yesterday at 02:48

» Ragoon's Graphics For HoMM3SW
by GodRage 2018-06-23, 21:44

» Minecraft: HoMMII Texture pack!
by GodRage 2018-06-23, 21:41

» H3SW General Discussion
by qlczas_PL 2018-06-13, 17:39

"Wait" in HoMM2?
 80% [ 55 ]
 20% [ 14 ]
Total Votes : 69
Most Viewed Topics
H3SW: General Graphics discussion
Ragoon's Graphics For HoMM3SW
H3SW General Discussion
H3SW: Dwelling Development
H3SW Map List: Work in progress
Enrothian Fan Art
Dervish Faction General Concept
H3SW Recruitment Point - Enroth Needs You!
Heroes of Might and Magic 3: The Succession Wars - General info & Announcements

Share | 

 How autoborder/autofixer works...

Go down 

Messages : 1
Quality Points : 0
Registration Date : 2017-04-29

PostSubject: How autoborder/autofixer works...   2017-08-15, 21:21

Hello! I need programming help with Heroes2 autoborder.

I'd want to ask if someone knows the rules for creating map borders in Heroes2 editor? I'll introduce briefly the problem:

Heroes 2 has several borders that connects different terrains, like in this screenshot:

The rules for connecting terrain are quite complicated but I have managed to implement it 100% correctly (though its not the most optimal way...). I've used a pattern matcher approach that scans all changed tiles and is looking for certain patterns to place borders. The implementation looks like this:


Example patterns for water can be found here:

And this works perfectly. There are no case where border will be placed wrong, as you can see:

However, in Heroes 2 there are some combinations, where its IMPOSSIBLE to generate border using these tiles, simplest example would be a 1x1 grass tile on ocean. Original Heroes2 editor can strip those situations, fixing tiles behind the scenes to make sure it can be borderized correctly. Original H2 editor does this perfectly 100% of time, and I am struggling for few days now to create such alghoritm.

Perhaps some of you guys played with that problem? How should this be addressed? I've tried to make pattern-based fixing but it looks like there are endless combinations of "wrong" borders. I've also tried to figure out some rules, while some of them are quite good (like a rule "any specific tile must be part of 2x2 tile block of same terrain" that fixes like 90% of bad tiles), but I believe that I am approaching problem in totally wrong way.

Here are some examples of invalid combinations that are impossible to borderize using h2 tileset:

If you want to play around with this, you can run the project:

1. Node.JS 6+ is required
2. git clone https://github.com/nullptr128/openheroes2
3. Move to cloned dir in console
4. npm install
5. npm run editor-dev

However this is not required as this is not really Heroes 2 specific problem, many tile-based games have there problems.
Back to top Go down

Messages : 347
Quality Points : 44
Registration Date : 2015-09-06

PostSubject: Re: How autoborder/autofixer works...   2017-08-15, 23:31

Wow, a new Heroes 2 project, "OpenHeroes2". Great news. Very Happy
Welcome to the party.

Maybe Darmani should be able to help you, but you may have to wait a little before he goes through here.
Back to top Go down

Messages : 347
Quality Points : 44
Registration Date : 2015-09-06

PostSubject: Re: How autoborder/autofixer works...   2017-08-23, 23:34


Maybe you should try to contact him by private message.

There is also an email address to join him in the last post of this thread.

Good luck. Smile
Back to top Go down
Master Modder
Master Modder

Messages : 184
Quality Points : 36
Registration Date : 2014-12-27

PostSubject: Re: How autoborder/autofixer works...   2017-08-29, 18:44

You're right; it is very complicated.

You can trawl through the editor code: https://raw.githubusercontent.com/jkoppel/project-ironfist/master/src/raw_decompiled/EDITOR2W.c

I don't remember where exactly the logic for this is. You can look through everything that modifies gpMap.tiles .
Back to top Go down
Sponsored content

PostSubject: Re: How autoborder/autofixer works...   

Back to top Go down
How autoborder/autofixer works...
Back to top 
Page 1 of 1
 Similar topics
» The Works of V.C. Andrews
» The Works of George R.R. Martin
» The Works of the Brontës
» The Works of L.M. Montgomery
» Complex Works of Hojyo Takashi.. [Many Diagram and CP]

Permissions in this forum:You cannot reply to topics in this forum
~ Forums of Enroth ~ :: General Board :: HoMM2 Discussion-
Jump to: