homm3tools
homm3tools copied to clipboard
[h3mlib] Conversion: Obstacles missing after conversion
Several objects which is not presented in RoE/HD are dropped during convertion, leaving passable cells on a map which may ruin gameplay for some maps. On attached image an abandoned mine gone after converstion and player now may approach from south, when only west route was originally implied by author.
Code: https://github.com/potmdehex/homm3tools/blob/master/h3m/h3mlib/h3m_conversion/convert.c
Done definition: Missing objects should be replaced by terrain-based landscape objects so obstacles map (red cells) remain intact after conversion,
Note:
@Dergash, thank you for this and your other reported issues, I shall be responding to each one. I'm afraid the answer for this one is quite long so only read it if you are interested and have time.
tl;dr: Conclusion at bottom of post.
Your proposed solution is one way to solve the issue, but there are others too. In this comment I will explain two alternatives:
- Map patches
- Adding support for non-RoE objects to HD Edition
Map patches (current way of solving the problem, chosen mainly due to lack of time): h3mlib has a function, h3m_object_patch(), which merges the objects of a map into another. https://github.com/potmdehex/homm3tools/blob/2554234f7d564cf2209a8b1f4bf013b161132202/h3m/h3mlib/h3mlib.c#L949
This allows the human creation of case-by-case solutions for problems such as the one in your screenshot, or more complex ones that in some way break/change the gameplay of the map.
Example 1:
- A screenshot of And One For All.h3m in its original SoD format, notice the SoD objects in the form of Random Dwellings and Azure Dragons:
- A map patch which contains replacements for the objects that will be dropped during conversion:
- The resulting map after it has been converted and had the patch applied.
h3mconvert and its predecessor h3mtool use this map patch system to fix issues on the standard maps. Again, this approach was largely chosen because of lack of time. In the above example there could instead be code which generates a random dwelling to place for the Random Dwelling objects and replaces the monster with another one (for monsters there already exists a table for doing such conversions which is used to convert creatures in armies of heroes or garrisons: code)
A more complex example is the map patch for Viking We Shall Go. In the original SoD map, there is a Quest Guard guarding Zürich, which wants you to bring 3 artifacts. Since RoE does not have Quest Guards, it is replaced with 3 Border Guards, with the border tents for each placed at the location of the artifacts the Quest Guard in the original asks for. The results look like this, (you can inspect it yourself in more detail to see the tent guards if you want):
The h3mconvert download posted on the releases page does not come with a folder of map patches which h3mtool did. There isn't a great reason for this, it has to do mostly with my attention being turned elsewhere within homm3tools instead of improving h3mconvert which is still in its 0.1 version. You can download the latest h3mtool which comes with the h3mpatches here. This should also work with h3mconvert if the h3mpatches folder is present in its directory
Adding support for non-RoE objects to HD Edition: While some of the problems that arise can be solved in a good way without too much code, others like the Viking We Shall Go (and of course there are even more complex examples) would require a quite sophisticated AI to get it completely right with passability etc (I'm talking about not just replacing with impassable terrain but actually replacing in the way that make the maps most resemble their original).
While such an AI would be a cool thing to work on, one thing to consider is that instead work can be put into modifiyng HD Edition to support the additional objects. The trade off is of course that HDE Mod/<name of mod that adds SOD object support> would have to be installed to play the maps unlike right now where they are playable out of the box in HD Edition after conversion.
One interesting thing to have would be support for some parameters that influence the conversion strategy, i.e you can have it either drop or preserve non-RoE objects during conversion. This would be a good way to make maps for HD Edition that would run with a mod adding support for them, but also be of interest to the Succession Wars mod team, which have been using a branch of h3mlib to get RoE maps that still contain AB/SoD/WoG objects. I have even made a map editor extension for them which apart from features from the HotA editor allows converting SoD maps to RoE directly in the map editor.
Conclusion: The proposed solution would be an improvement to the current h3mlib if it was implemented as a fallback of the current map patch system, but it is also worth considering adding improvements to HD Edition to directly support the non-RoE objects in-game. Also, a way to influence h3mlib's conversion strategy through parameters would be good to have.
after conversion red circles appear instead of monsters,what
@ledeni43, a feature I promise, look how HD the circles are.
I think what you are seeing is h3mconvert putting placeholder monsters instead of AB/SoD monsters which it cannot identify (which is a bug).
The last version of h3mtool does not have this behavior, but simply removes the monsters (which are replaced by other monsters using map patches, see the screenshots in my previous comment in this thread for the example for SoD map And One For All.h3m)
While h3mconvert already converts creatures inside armies and garrisons automatically it does not have functionality to perform automatical conversion of monsters on the map yet (shouldn't be very hard to implement in h3mlib, but many other things being developed right now).
Out of curiosity which is the map in your screenshot?
thanks I will try that latest version,the map is "Four realms"
hey can you tell me where to download a lot of maps to convert,I downloaded 2000 maps but now after conversion an unexpected error shows. The "Four Realms" map now wont even open.thanx in advence
@potmdehex, oh, it seems that I doesn't saw a whole picture :) Can you tell a little more about map patch conception? If I understand correctly, than map patches are drawn by hand. How is that different from directly adapting map to RoE/HD (remove/replace unsupported objects, change logic with tents etc) and then feeding it to the h3mtool?
@ledeni43 conversion for WoG maps is not yet great, but with a few additions such as conversion tables for AB, SoD and WoG monsters it would be greatly improved and your problems would probably go away. Check back in some time.
I don't have a great answer for where to download maps, the starting point is the pre-converted pack of all AB and SoD maps here, then maps4heroes.com has many maps
@Dergash, don't get me wrong, I still think your idea to put impassable terrain is not bad. The map patches are indeed made by hand and the system is not great, it was mainly a way to make the deadline of HD Edition's release on January 29th 2015. It does provide some benefits vs just adapting the maps directly:
- Allows an easy way to place impassable objects on top of each other which the map editor does not allow. This is important, a lot of the solutions that are used in the map patches would not work without this or an alternative to this. For example, if you look at the screenshot of Viking We Shall go above where the Necromancers Boots (one of the artifacts the Quest Guard in the original asks for) are on the west side of the picture, you will see that the tent is placed on top of a mountain there. There is actually no place to place the tent there so otherwise terrain would have to be removed to make room for it. There are other better examples of this too where it is even more important, but this should give an idea.
- The same map patch can be used for the standard and Allies version of the map
- The same map patch can be used for any language of the map (the standard maps have localized strings for things like signs and events)
I believe it would be good to move away from the map patch system if possible, but as I wrote about in my previous comment some things are not easy to automatically convert (just think for a second about automatically converting some of the Seer's Hut Quest types. If you check out the Pandora's Box map patch there are some interesting manual solutions there to replace the Kill Monster quests, where an artifact has been placed behind where those monsters are and the Seer's Hut now looks for that artifact. There are also more complex things than this).
If #16 would be implemented there would be more freedom to make additions like your suggestion of using impassable terrain to cover spots for removed objects, if it would be possible whether or not to use it, and thus it would not in any way be a step backwards from the current map patch system.
Allows an easy way to place impassable objects on top of each other which the map editor does not allow.
Being a mapmaker myself I probably looking at things from that perspective :) I always keep close 'Heroes3 Object Editor by Sergey Rozhenko' whenever I work on map, which solves all my problems with object placement, but I got your point. I'll try to cover crash issues and then help with making things customizable #16.
@Dergash I have added some extra issues. I am currently primarily working behind the scenes with the HotA team (who are not fans of open source, so the code I'm writing for them is like the rest of HotA not publically available anywhere), helping them with their map editor after they reached out to me.
It's a bit hard to predict, but I think I will be done with this as my primary focus within 2-4 weeks after which I will switch focus of the time I have back to homm3tools (I currently intend primarily to get #22, #23 and #20 done)
If you have time, I think your own #15 as well as #19 would be good for you to look at as they are relatively straight-forward while still pretty interesting and rewarding in terms of improvements. But it's 100% up to you, any improvement goes.
Btw, I added you to RE & programming of CONTRIBUTORS.md for your merged contribution of #14