~ Forums of Enroth ~

An Enroth diehard fan community
 
HomeHome  ChatChat  FAQFAQ  SearchSearch  RegisterRegister  Log inLog in  

Share | 
 

 Advanced hex-editing techniques

View previous topic View next topic Go down 
Go to page : 1, 2, 3  Next
AuthorMessage
ComputerPhreak
Pikeman
Pikeman
avatar

Messages : 30
Quality Points : 23
Registration Date : 2016-03-02

PostSubject: Advanced hex-editing techniques   2016-03-02, 14:59

Hi,

I do not know if this is the correct place to post or in the general HoMM2 forum, but it regards mapmaking so I am putting it here.  The below examples are all running on the original, unmodified Heroes 2: Gold Edition executable.

I have been able to create some otherwise "impossible" map locations via hex-editing map structures.  Take a look at a couple of the examples:

An animated smoke puff:


The context menu (right-click) labels it as "Unknown":


When visited, it acts like a hut of the magi:


Here is a floating castle:


(Ignore the flags, they are due to me messing up one of the values in the map structure).  It can only be visited via boat.
Back to top Go down
ComputerPhreak
Pikeman
Pikeman
avatar

Messages : 30
Quality Points : 23
Registration Date : 2016-03-02

PostSubject: Re: Advanced hex-editing techniques   2016-03-02, 15:05

A hero in a boat visiting the floating castle:



I am still learning about the map structures and what they do, but it seems as if it is theoretically possible to make almost any structure act like any other structure, even to make "composite structures" out of slices of different structures, but I have yet to do this. When I have figured it out I will post the info here.

I don't know if people still make maps for the unmodified HoMM2, but if they do, these techniques could enable some cool "new" content and concepts, if used cleverly.
Back to top Go down
GodRage
Webmaster
Webmaster
avatar

Messages : 638
Quality Points : 145
Registration Date : 2009-09-21

PostSubject: Re: Advanced hex-editing techniques   2016-03-02, 15:19

Hahaha I love the floating castle! Very Happy
Did you make a playable map with such tricks? Smile I would like to try one. Razz

Yes I think it's the right place for this topic. Smile

________________________
~Lands of Enroth~
Back to top Go down
http://homm2.free.fr
ComputerPhreak
Pikeman
Pikeman
avatar

Messages : 30
Quality Points : 23
Registration Date : 2016-03-02

PostSubject: Re: Advanced hex-editing techniques   2016-03-02, 15:56

GodRage wrote:
Hahaha I love the floating castle! Very Happy
Did you make a playable map with such tricks? Smile I would like to try one. Razz

Yes I think it's the right place for this topic. Smile

The only maps I have made thusfar are just test maps, but eventually I would like to make one using as many of these tricks as I can to create a full map.
Back to top Go down
Orzie
Master Modder
Master Modder
avatar

Messages : 1607
Quality Points : 675
Registration Date : 2014-12-12
Age : 25
Location : Tomsk, Russia

PostSubject: Re: Advanced hex-editing techniques   2016-03-02, 17:15

Very interesting. It seems that you will be also able to create such tricks as invisible Mercury Mines (just like in Black Forest) and empty wagon mines, just like we had in Charlie Watkins' Ghost Planet. I am very curious what else you can come up with.

Did you check the stability of the map varied by such means? Is the Atlantis city functional and doesn't the game crash upon each turn?

---

Please feel yourself comfortable here. We also have the Introduce Yourself thread if you are not against this kind of stuff Smile

---

I also would recommend to check Project Ironfist, a massive HoMM2 modification which made a lot of things possible, including map scripting.


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

Messages : 30
Quality Points : 23
Registration Date : 2016-03-02

PostSubject: Re: Advanced hex-editing techniques   2016-03-02, 17:43

Orzie wrote:
Very interesting. It seems that you will be also able to create such tricks as invisible Mercury Mines (just like in Black Forest) and empty wagon mines, just like we had in Charlie Watkins' Ghost Planet. I am very curious what else you can come up with.

Did you check the stability of the map varied by such means? Is the Atlantis city functional and doesn't the game crash upon each turn?

---

Please feel yourself comfortable here. We also have the Introduce Yourself thread if you are not against this kind of stuff Smile

---

I also would recommend to check Project Ironfist, a massive HoMM2 modification which made a lot of things possible, including map scripting.


Yes I was inspired by Charlie Watkin's maps, Ghost Planet specifically, but also some tricks he used in Metalluna and Illuminati.

Speaking of which, if you (or anyone else) has played the Retribution map by Timothy Duncan, have you noticed a 'phantom' hero, of the yellow faction I believe, that is not visible during normal play, but is shown during enemy movement, and is able to capture castles in some cases? I didn't know if it was intentional or just an odd one-off bug.

I will have to perform some more testing to see about the stability of such editing; 'Atlantis' is accessible, and you can recruit troops and move them in and out of the garrison, however I did notice a crash when attempting to upgrade the fort to a castle (obviously this can be disabled, though). I don't know if it was because of a mistake I made elsewhere, or if that is going to be the case with any 'floating' castles/towns.
Back to top Go down
Orzie
Master Modder
Master Modder
avatar

Messages : 1607
Quality Points : 675
Registration Date : 2014-12-12
Age : 25
Location : Tomsk, Russia

PostSubject: Re: Advanced hex-editing techniques   2016-03-02, 17:49

I remember something of this kind, yes. Very impressive. Even the Metalluna map was a nice gem in terms of map hacking.
It was very peculiar to find your heroes moving on their own while you push End Turn.

If I recall correctly, hex editing in all cases was performed by Charlie Watkins (Timothy Duncan's maps were in fact a result of a fruitful collaboration with some other community members). Too bad Timothy himself is now overly busy with moderating the chit-chat section of Heroes Community to pay any attention to the HoMM2-HoMM3 developments going on. He is like a legend to me.

Concerning the crash, I suspect it's related to the fort.

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

Messages : 30
Quality Points : 23
Registration Date : 2016-03-02

PostSubject: Re: Advanced hex-editing techniques   2016-03-03, 06:43

I am also working on upscaling the original art assets using pixel-art scaling algorithms such as XBRz.

Original resolution:


Normal 4x upscaling (nearest neighboor):


Using XBRz 4x:



This is still very early stage, I will post another thread about this with more details once I make some more progress.
Back to top Go down
Sir Albe
Vampire
Vampire
avatar

Messages : 531
Quality Points : 321
Registration Date : 2015-07-16
Age : 22
Location : Aalborg, Denmark

PostSubject: Re: Advanced hex-editing techniques   2016-03-03, 08:21

That looks amazing!

Orzie wrote:
Very interesting. It seems that you will be also able to create such tricks as invisible Mercury Mines (just like in Black Forest) and empty wagon mines, just like we had in Charlie Watkins' Ghost Planet. I am very curious what else you can come up with.

Invisible mines? How and where exactly? I never played Black Forest before, but I can't see anything special in the editor.
Back to top Go down
GodRage
Webmaster
Webmaster
avatar

Messages : 638
Quality Points : 145
Registration Date : 2009-09-21

PostSubject: Re: Advanced hex-editing techniques   2016-03-03, 09:27

ComputerPhreak wrote:

OMG, that's awesome! Very Happy

________________________
~Lands of Enroth~
Back to top Go down
http://homm2.free.fr
ComputerPhreak
Pikeman
Pikeman
avatar

Messages : 30
Quality Points : 23
Registration Date : 2016-03-02

PostSubject: Re: Advanced hex-editing techniques   2016-03-03, 10:10

Sir Albe wrote:
That looks amazing!

Orzie wrote:
Very interesting. It seems that you will be also able to create such tricks as invisible Mercury Mines (just like in Black Forest) and empty wagon mines, just like we had in Charlie Watkins' Ghost Planet. I am very curious what else you can come up with.

Invisible mines? How and where exactly? I never played Black Forest before, but I can't see anything special in the editor.

You cannot see them in the editor, only in the game. I've seen them in several maps, 'Ghost Planet', 'Illuminati', 'Abode of Evil', and one of the Agent of Heaven campaign maps that I can't recall the name of.

According to my understanding, it occurs as a result of a bug in the map editor, where using the 'erase' tool in a certain way erases the visible tiles of the object, I guess the alchemist's lab, but leaves some sort of interactable object remaining, which the game sees as a 'mercury mine'. I haven't been able to replicate the bug using the editor, though.
Back to top Go down
ComputerPhreak
Pikeman
Pikeman
avatar

Messages : 30
Quality Points : 23
Registration Date : 2016-03-02

PostSubject: Re: Advanced hex-editing techniques   2016-03-03, 12:19

Here is one more example. The differences aren't too dramatic with this scene but I think have the potential to be with more complex objects.


Back to top Go down
Orzie
Master Modder
Master Modder
avatar

Messages : 1607
Quality Points : 675
Registration Date : 2014-12-12
Age : 25
Location : Tomsk, Russia

PostSubject: Re: Advanced hex-editing techniques   2016-03-03, 20:49

What I actually find funny is that you will be able to place a sign with a custom text, and then replace its sprite with a somewhat new object so that it will be possible to make very atmospheric maps allowing to put custom text upon visiting "houses", etc.

Is the functionality of an object saved right after you replace its sprite with another one?

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

Messages : 30
Quality Points : 23
Registration Date : 2016-03-02

PostSubject: Re: Advanced hex-editing techniques   2016-03-04, 07:48

Orzie wrote:
What I actually find funny is that you will be able to place a sign with a custom text, and then replace its sprite with a somewhat new object so that it will be possible to make very atmospheric maps allowing to put custom text upon visiting "houses", etc.


That is a great idea, actually.  And it (mostly) works:


Only problem is the tooltip says 'Sign', I don't know if that can be changed or not.  Either way it isn't a huge deal.

Orzie wrote:

Is the functionality of an object saved right after you replace its sprite with another one?

I'm not quite sure what you are asking.
I will try to explain how it works to the best of my understanding.  You may already know this but for everyone else's sake I'll try to give some details.  Each map "cell" (every square of the map) has an associated struct (this is from the IronFist source):
Code:

struct mapCell
 {
 __int16 groundIndex;
 [b]char bitfield_1_hasObject_1_isRoad_6_objTileset;
 __int8 objectIndex;[/b]
 unsigned __int16 field_4_1_1_isShadow_1_13_extraInfo;
 char field__1_hasOverlay_1_hasLateOverlay_6_overlayTileset;
 char overlayIndex;
 char displayFlags;
 [b]char objType;[/b]
 __int16 extraIdx;
 int objLink;
 int ovrLink;
 };

Each cell has the object type ('char objType' above) which signifies which type of object it is.  It also has a tileset (the top two bolded fields) which specifies which sprite to draw.  I assume it is done this way since some objects have multiple styles (e.g. the well has at least two different sprites, one with green grass under it and another with yellow-ish grass under it), but are still the same type of object.

By changing the sprite/tileset, objects that look one way and act a different way are possible.
Back to top Go down
Steven Aus
Elf
Elf
avatar

Messages : 108
Quality Points : 38
Registration Date : 2015-07-21
Age : 37

PostSubject: Re: Advanced hex-editing techniques   2016-03-04, 19:34

If it is possible to create custom objects with new names and the functionality of a sign, it might be possible to make a custom sign object with a custom right-click name.
Back to top Go down
Darmani
Master Modder
Master Modder
avatar

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

PostSubject: Re: Advanced hex-editing techniques   2016-03-06, 08:12

Hello ComputerPhreak!

Nice work! I'm pretty interested in what you're doing, and would like to reach out to chat more about possibly working together. I can also explain more of how map cells and map editor objects work (you've got the basics, but the full version is actually somewhat complicated).

Anyway, here's something that should be immediately helpful:

Run the map editor in "Debug mode" by going to the command line and running "EDITOR2W.exe /NWC" . Now, when you use the "?" tool, instead of just being able to edit things like signs and castles, you will be able to edit any object and set all of these fields manually.
Back to top Go down
ComputerPhreak
Pikeman
Pikeman
avatar

Messages : 30
Quality Points : 23
Registration Date : 2016-03-02

PostSubject: Re: Advanced hex-editing techniques   2016-03-06, 08:58

Darmani wrote:
Hello ComputerPhreak!

Nice work! I'm pretty interested in what you're doing, and would like to reach out to chat more about possibly working together. I can also explain more of how map cells and map editor objects work (you've got the basics, but the full version is actually somewhat complicated).

Anyway, here's something that should be immediately helpful:

Run the map editor in "Debug mode" by going to the command line and running "EDITOR2W.exe /NWC" . Now, when you use the "?" tool, instead of just being able to edit things like signs and castles, you will be able to edit any object and set all of these fields manually.

Sure, I'd like to talk and learn more about how things work. I am in #homm2 on irc.freenode.net, I should be available to talk later today.

I tried running the editor with /NWC but it did not do anything for me, I am running the editor version 2.1, included with HoMM2: Gold Edition.
Back to top Go down
ComputerPhreak
Pikeman
Pikeman
avatar

Messages : 30
Quality Points : 23
Registration Date : 2016-03-02

PostSubject: Re: Advanced hex-editing techniques   2016-03-06, 10:36

ComputerPhreak wrote:
Darmani wrote:
Run the map editor in "Debug mode" by going to the command line and running "EDITOR2W.exe /NWC" . Now, when you use the "?" tool, instead of just being able to edit things like signs and castles, you will be able to edit any object and set all of these fields manually.

Sure, I'd like to talk and learn more about how things work.  I am in #homm2 on irc.freenode.net, I should be available to talk later today.

I tried running the editor with /NWC but it did not do anything for me, I am running the editor version 2.1, included with HoMM2: Gold Edition.

I just want to update you and everyone and note that I searched through the strings of my EDITOR2W.exe and did not find "NWC", but I did find "/PUR", and after trying it as an argument it has the effect that you described. I have no idea what it stands for, though.
Back to top Go down
ComputerPhreak
Pikeman
Pikeman
avatar

Messages : 30
Quality Points : 23
Registration Date : 2016-03-02

PostSubject: Re: Advanced hex-editing techniques   2016-03-06, 12:13

Some very odd behavior...
Back to top Go down
GodRage
Webmaster
Webmaster
avatar

Messages : 638
Quality Points : 145
Registration Date : 2009-09-21

PostSubject: Re: Advanced hex-editing techniques   2016-03-08, 05:52

ComputerPhreak wrote:
Original resolution:


4x:

I am very interested in your work! Smile
I would like to used time to time some of your images made in this 4x way on my website ( Lands of Enroth )


I don't know if I can ask you that... but can you make a x2 (and a x4?) of:



________________________
~Lands of Enroth~
Back to top Go down
http://homm2.free.fr
GodRage
Webmaster
Webmaster
avatar

Messages : 638
Quality Points : 145
Registration Date : 2009-09-21

PostSubject: Re: Advanced hex-editing techniques   2016-03-08, 05:53

ComputerPhreak wrote:
Original resolution:


4x:

I am very interested in your work! Smile
I would like to used time to time some of your images made in this 4x way on my website ( Lands of Enroth )


I don't know if I can ask you that... but can you make a x1.5 (and maybe x2 x4?) of:


?
I would be so amazingly happy  <3  ... &lt;3

________________________
~Lands of Enroth~


Last edited by GodRage on 2016-03-08, 06:34; edited 1 time in total
Back to top Go down
http://homm2.free.fr
ComputerPhreak
Pikeman
Pikeman
avatar

Messages : 30
Quality Points : 23
Registration Date : 2016-03-02

PostSubject: Re: Advanced hex-editing techniques   2016-03-08, 06:28

Well to be clear I didn't write the algorithm, or the tool to resize these images.  I'm using the code from here: https://code.google.com/p/2dimagefilter/
and the scaler I used for the previous examples was 'XBRz 4x'.

These algorithms are all designed for pixel-art, and work because said art isn't really photo-realistic.  So for the intro screen, it won't produce a very good result:



Click for full-res: http://i84.servimg.com/u/f84/19/43/11/56/intro_10.jpg

I'm not sure what algorithm would be best for scaling this particular image. You might have to resort to doing things by hand.
Back to top Go down
ComputerPhreak
Pikeman
Pikeman
avatar

Messages : 30
Quality Points : 23
Registration Date : 2016-03-02

PostSubject: Re: Advanced hex-editing techniques   2016-03-08, 06:32

Map objects turn out much better:



Back to top Go down
GodRage
Webmaster
Webmaster
avatar

Messages : 638
Quality Points : 145
Registration Date : 2009-09-21

PostSubject: Re: Advanced hex-editing techniques   2016-03-08, 06:40

Thank you very much ComputerPhreak, I will try myself to see if it can works for my project.

Do you authorize me to use (on my website) the images you made by this way? (when I would use them, I'll thank you in the community page)

________________________
~Lands of Enroth~
Back to top Go down
http://homm2.free.fr
ComputerPhreak
Pikeman
Pikeman
avatar

Messages : 30
Quality Points : 23
Registration Date : 2016-03-02

PostSubject: Re: Advanced hex-editing techniques   2016-03-08, 06:47

GodRage wrote:
Thank you very much ComputerPhreak, I will try myself to see if it can works for my project.  

Do you authorize me to use (on my website) the images you made by this way? (when I would use them, I'll thank you in the community page)

You don't have to thank me or ask for my authorization, I don't own the images as they are I guess copyrighted to Ubisoft or whomever controls New World Computing's assets.

Just to clarify, I don't mind if you use them, but I can't promise anything about the legality of using them, since (from my understanding, at least) they are derived from copyrighted assets.
Back to top Go down
Sponsored content




PostSubject: Re: Advanced hex-editing techniques   

Back to top Go down
 
Advanced hex-editing techniques
View previous topic View next topic Back to top 
Page 1 of 3Go to page : 1, 2, 3  Next
 Similar topics
-
» Template Editing For PHPBB3
» Editing the logo url?
» Suikoden 1&2 PSN PS3 Save editing possible ?
» Twenty-Five Ways To Suppress Truth: The Rules of Disinformation.....
» Code Needs Editing For Floating Chatbox (Javascripting)

Permissions in this forum:You cannot reply to topics in this forum
~ Forums of Enroth ~ :: Mapmaking Guild :: Classic maps: SW & PoL-
Jump to: