~ 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
» fheroes2 General Announcements
How autoborder/autofixer works... Icon_minitimeby sirDranik 2024-03-17, 23:35

» Photo Gallery
How autoborder/autofixer works... Icon_minitimeby Sir Albe 2024-03-07, 06:57

» Heroes Orchestra's 5th Birthday concerts with Paul Romero
How autoborder/autofixer works... Icon_minitimeby Sir Albe 2024-03-07, 06:55

» Polskie powitanie
How autoborder/autofixer works... Icon_minitimeby rrravyn 2024-03-05, 04:02

» Heroes II localisation: how to make no-CD patch.
How autoborder/autofixer works... Icon_minitimeby kiku 2024-02-19, 02:43

» WARNING - The dreaded moment is here: Heroes 6 servers shutting down
How autoborder/autofixer works... Icon_minitimeby Blake01 2024-02-17, 15:25

» Forum Admins Feed
How autoborder/autofixer works... Icon_minitimeby GodRage 2024-02-15, 22:10

Poll
Global announcements should be:
Everlasting, 1 for each project.
How autoborder/autofixer works... Redbar110%How autoborder/autofixer works... Redbar12
 0% [ 0 ]
Temporary, when there is something new to announce.
How autoborder/autofixer works... Redbar11100%How autoborder/autofixer works... Redbar12
 100% [ 6 ]
Holalala... No idea where the Ultimate artifact is.
How autoborder/autofixer works... Redbar110%How autoborder/autofixer works... 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

 

 How autoborder/autofixer works...

Go down 
3 posters
AuthorMessage
number128
Gargoyle
Gargoyle
number128


Messages : 17
Quality Points : 10
Registration Date : 2017-04-29

How autoborder/autofixer works... Empty
PostSubject: How autoborder/autofixer works...   How autoborder/autofixer works... Icon_minitime2017-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:
How autoborder/autofixer works... 1502787786

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:

https://github.com/nullptr128/openheroes2/blob/master/src/Editor/Utils/AutoBorder/AutoBorder.ts

Example patterns for water can be found here:
https://github.com/nullptr128/openheroes2/blob/master/src/Editor/Utils/AutoBorder/WaterBorders.ts

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

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:
How autoborder/autofixer works... 1502788640

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
Unknown_Hero
Mage
Mage
Unknown_Hero


Messages : 778
Quality Points : 78
Registration Date : 2015-09-06

How autoborder/autofixer works... Empty
PostSubject: Re: How autoborder/autofixer works...   How autoborder/autofixer works... Icon_minitime2017-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
Unknown_Hero
Mage
Mage
Unknown_Hero


Messages : 778
Quality Points : 78
Registration Date : 2015-09-06

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

@number128

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
Darmani
Master Modder
Master Modder
Darmani


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

How autoborder/autofixer works... Empty
PostSubject: Re: How autoborder/autofixer works...   How autoborder/autofixer works... Icon_minitime2017-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





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

Back to top Go down
 
How autoborder/autofixer works...
Back to top 
Page 1 of 1
 Similar topics
-
» Heroes III: The Succession Wars v0.8.1 Beta

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