Heroes of Might and Magic Community
visiting hero! Register | Today's Posts | Games | Search! | FAQ/Rules | AvatarList | MemberList | Profile


Age of Heroes Headlines:  
5 Oct 2016: Heroes VII development comes to an end.. - read more
6 Aug 2016: Troubled Heroes VII Expansion Release - read more
26 Apr 2016: Heroes VII XPack - Trial by Fire - Coming out in June! - read more
17 Apr 2016: Global Alternative Creatures MOD for H7 after 1.8 Patch! - read more
7 Mar 2016: Romero launches a Piano Sonata Album Kickstarter! - read more
19 Feb 2016: Heroes 5.5 RC6, Heroes VII patch 1.7 are out! - read more
13 Jan 2016: Horn of the Abyss 1.4 Available for Download! - read more
17 Dec 2015: Heroes 5.5 update, 1.6 out for H7 - read more
23 Nov 2015: H7 1.4 & 1.5 patches Released - read more
31 Oct 2015: First H7 patches are out, End of DoC development - read more
5 Oct 2016: Heroes VII development comes to an end.. - read more
[X] Remove Ads
LOGIN:     Username:     Password:         [ Register ]
HOMM1: info forum | HOMM2: info forum | HOMM3: info mods forum | HOMM4: info CTG forum | HOMM5: info mods forum | MMH6: wiki forum | MMH7: wiki forum
Heroes Community > Heroes 5 - Modders Workshop > Thread: [NCF project] Adding creatures in ToE!
Thread: [NCF project] Adding creatures in ToE! This thread is 19 pages long: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 · NEXT»
sfidanza
sfidanza


Promising
Supreme Hero
posted December 31, 2007 12:53 AM bonus applied.
Edited by VokialBG at 09:15, 22 Jul 2008.

[NCF project] Adding creatures in ToE - 1.0 released!

Post edited for the framework release (1.0). The original text is below.
Edit2: some infos moved to the NCF project page

The New Creatures Framework is now officially released, with the first ever additional creatures pack - Nelgirith's Creatures Pack:

--> Go to the NCF project page (in english)
The page also contains the brand new Mapmaker Pack, that will allow you to use the new creatures in the map editor.

--> Nelgirith Creatures Pack (5.20Mb)

The creatures pack adds 9 new creatures. In addition, most of the new creatures are tied with existing neutral creatures as upgrades or downgrades:
- Suzaku -> Thunderbird | Phoenix
- Black Knight -> Apocalypse Knight | Death Knight
- Wolf -> Winterwolf  | Worg

--------------------------------------

List of reserved slots (the list is now maintained on the project page)

--------------------------------------

=== Original post ===
I know more and more of you are wondering how it can be done, so I finally took the time to make it happen. You will now be able to add new creatures in ToE, instead of always reusing the same CREATURE_SNOW_APE slot.

First, the files, then I'll give some explanations for those interested in the technical details. The framework is available there:
(edit: link obsolete)
(obsolete paragraphs removed)

Unlocking the .exe is only one technical issue. To be really interesting, there are still two problems we have to solve:
- different mods with new creatures should be compatible
- a mod should not need to supply a specific .exe, there should be a shared framework on which to build

The answer to those is obviously to build a framework, for which all modders will be able to build their new creatures mods. The framework unlocks a number of slots, right now 180 to 299, and each slot get reserved for a specific creature. There are already a number of existing new creatures (Plague Treant, Magma Elemental, Efreet, Crystal Dragon, new Wolves...) and others are under construction (Azure Dragon, Sharpshooter, ...). Basically, they will reserve slots up to around 210. I'll maintain a list of course.

When a new creature is ready, it just has to be registered, get a slot, update 2 files, and voilà, it's framework-compliant: anyone with the framework installed can get it and use it. No need to switch mods around or anything.

Let's take an example: I just made a mighty Squirrel, and the next free slot is 246. So here what I have to do:
- rename the base creature file to "/GameMechanics/Creature/Creatures/Neutrals/Creature_246.xdb"
- the creature id is CREATURE_246 (update it in the AdvMapMonsterShared file)
- its numeric id for scripts/console is 246

That's all.
Of course, 300 is not the limit: it can be pushed anytime, and again, this is still in beta. The final version will have an installer, will come with a pack of new creatures mods (you can suggest yours if it's ready), and may have more slots if needed. And the framework can be updated later as well to add slots.

Now, time for some technical details!
The framework .exe (H5_Game.NCF.exe) is based on the european edition 3.0 (ToE) executable. The creatures list length has been updated from 180 (B4 00 00 00) to 300 (2C 01 00 00) at two offsets:
1. offset 6C0A50
2. offset 6A91F1

These are the only two changes.

As you can see, the creatures list length is stored in a 4 bytes integer, in little endian (reversed order):
180 is B4 in hexadecimal, which gives "B4 00 00 00"
300 is 012C in hexadecimal, which gives "2C 01 00 00"
500 is 01F4 in hexadecimal, which gives "F4 01 00 00"
10000 is 2710 in hexadecimal, which gives "10 27 00 00"

Pushing the limit in the .exe is not enough of course. If the index files do not provide a creature in an existing slot, the game will not start, and instead tell something like "Empty pointer to creature #300". That's why the framework also has a mod, with the types.xml and Creatures.xdb files inside.
Then, the Creatures.xdb list points each slot to an actual creature file, like Creature_246.xdb, which allows to plug in a creature on this file without editing the indexes. In the framework mod, it means that these files have to exist, or the game will stop onother DB error, like: "Creature 300 has no visual or it's missed.".

Credits:
The Thunderbird mod is based on work by Szeridan from Drachenwald.
The .exe editing is very similar to the HoF .exe editing by crazypill.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Gnoll_Mage
Gnoll_Mage


Responsible
Supreme Hero
posted December 31, 2007 01:23 AM
Edited by Gnoll_Mage at 01:24, 31 Dec 2007.



Amazing idea, let's hope it pans out as intended!

But how on earth did you know which bit to change of that massive file! From my pov it seems rather impressive (also very interesting)...
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
kmp123
kmp123


Hired Hero
posted December 31, 2007 01:54 AM

holy Asha !!! you did veryyy gooooooood work !!!!!

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Sunjah
Sunjah


Hired Hero
posted December 31, 2007 03:49 AM

Would all of those 120 extra creatures be neutrals, or could they be added to towns?
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Daystar
Daystar


Honorable
Legendary Hero
Back from the Dead
posted December 31, 2007 03:52 AM

Its all in the programing, I guess.  Hey, I wonder if this means it will be possible to have multiple creatures per level in one town?
____________
How exactly is luck a skill?

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Wulfstan8182
Wulfstan8182


Famous Hero
, eh?
posted December 31, 2007 04:53 AM
Edited by Wulfstan8182 at 04:55, 31 Dec 2007.

by posting this thread sfidanza sure brought the world of H5 modding to a whole new level. a whole bunch of new stuff i think is coming right up from our fellow modders.
EDIT: does this mean that we will be able to ADD new factions instead of REPLACING existing ones? cause if we can ADD NEW creatures than why can't we do it with towns? this stuff is great!
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Nelgirith
Nelgirith


Promising
Supreme Hero
posted December 31, 2007 09:36 AM

Quote:
Would all of those 120 extra creatures be neutrals, or could they be added to towns?

We can add neutral creatures linked to existing factions. For example, I'm making a neutral ballista, but linked to Haven. This means, the unit will have the haven "trail" on the map adventure and you can mix it with a Haven army without morale penalty.
But so far we can't add new units directly to a town.

Quote:
I wonder if this means it will be possible to have multiple creatures per level in one town?

Not in the H4 way, if that's what you mean. We can create new level 1 through 7 linked to each castle, but we can't put them in the castle without replacing the existing ones.

Quote:
does this mean that we will be able to ADD new factions instead of REPLACING existing ones? cause if we can ADD NEW creatures than why can't we do it with towns? this stuff is great!

No. Adding (without replacement) a new faction is currently impossible. But I tend to think that factions are hard-coded in the exe as the number of creatures and that with A LOT of researches, it should be possible to change that too.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
alcibiades
alcibiades


Honorable
Undefeatable Hero
of Gold Dragons
posted December 31, 2007 10:15 AM

This is ... interesting. You should make this a sticky.

On a slightly off-topic but still related note - since when did we become able to modify the .exe file - or did I misunderstand something? And which other new doors does this potentially open?
____________
What will happen now?

 Send Instant Message | Send E-Mail | View Profile | PP | Quote Reply | Link
magnomagus
magnomagus


Admirable
Legendary Hero
modding wizard
posted December 31, 2007 10:30 AM
Edited by magnomagus at 11:04, 31 Dec 2007.

Quote:
No. Adding (without replacement) a new faction is currently impossible. But I tend to think that factions are hard-coded in the exe as the number of creatures and that with A LOT of researches, it should be possible to change that too.


It may not be possible to add new factions, but it should be possible for mapmakers to create some sort of 'villages' on a map that is a collection interdependent creature dwellings. (maybe supported with a gold mine and an outpost to guard it). I saw a nice creature dwelling mod on drachenwald.

[Edit] Developing this idea further...

Maybe it is also possible to place a dwelling next to a town with a level 8 creature or commander-unit in it. Then the mapmaker must make a script that 'unlocks' the dwelling after the town is fully build.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Nelgirith
Nelgirith


Promising
Supreme Hero
posted December 31, 2007 10:35 AM

Quote:
It may not be possible to add new factions, but it should be possible for mapmakers to create some sort of 'villages' on a map that is a collection interdependent creature dwellings. (maybe supported with a gold mine and an outpost to guard it). I saw a nice creature dwelling mod on drachenwald.



Yes I've updated and translated that mod for the french community but I just can't be assed to make the english pdf atm. There are too many explanations to make it work correctly.

My updated mod contains dwellings for all Hof neutrals + Apocalypse Knight + Thunderbird.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Kronos1000
Kronos1000


Promising
Supreme Hero
Fryslân Boppe
posted December 31, 2007 11:13 AM

Wow this is great, though what do I need to do now with the 23 new Creatures that I have almost ready? My only problem was I still needed to edit the exe which failed me Now what should I do should I make my Creatures compatible with this frameworks? If yes do you mind if I use the ID's 180 to 202?
____________
Hwær cwom mearg? Hwær cwom mago?
Hwær cwom maþþumgyfa? - 'The Wanderer'

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Lesij
Lesij


Famous Hero
posted December 31, 2007 11:24 AM

Father sky is thankfull
Now we are able to spam the game with egzotic creatures from modders' imagination
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Nelgirith
Nelgirith


Promising
Supreme Hero
posted December 31, 2007 11:26 AM

1. For each creature, you make a /MapObjects/Neutral/yourcreature.xdb, inside you link models and animset as usually and at the end you put :
<Creature>CREATURE_181</Creature> or whatever number you want between 181 and 298 (since 299 is the UD Cyclops)

2. Add the link to your creatures in the appropriate /MapObjects/_(AdvMapSharedGroup)/Monsters/Level#.xdb and Any.xdb

3. Put the stats of your creatures in the /GameMechanics/Creature/Creatures/Neutrals/Creature_181.xdb (or whatever number you picked)


To manually put a creature on a map you need :
- to have the framework.h5u in the USerMODs (or it will crash the map editor)
- to have a .pak file with your creature files

Then, put any creature and in the shared value put : /MapObjects/Neutral/yourcreature.xdb

The creature will appear as a peasant with a Creature value at CREATURE_UNKNOWN

Launch the game, your new creature is where you placed it.


PS : If you create 30 new creatures, they'll look like peasants in the map editor but will work correctly in the map editor.


About your question, I'd suggest you make your own pack for your mod. Just in case some people might not like all of your creatures (nobody's perfect ^^).

PS : Oh btw, don't rename your old .exe or the game won't work ^^

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
sfidanza
sfidanza


Promising
Supreme Hero
posted December 31, 2007 02:37 PM
Edited by sfidanza at 14:39, 31 Dec 2007.

Sorry, big post again...

@Kronos1000: would you mind having reserved slots starting at 250? Say 250-272?
As for Nelgirith comment, I think it's better to plan for compatibility. ToK package can be deactivated. ToK new creatures can also be released separately by themselves, using those same IDs, which will allow a total control. However, since ToK is such a huge project, you might want to package it with its own .exe like DM to get a more personalized feel, and release everything in an installer. You still have time for this anyway, and I can offer support if you'd like.

@Nelgirith: 299 for the UD Cyclops was only a test. He can be brought back earlier in the list. Not that it changes much of course.

---------------------------

About adding new factions (or anything else): we can add heroes easily, and now creatures, because they are completely defined in a mod (xdb, dds, txt). There is no byte code needed to determine some behavior.
On the contrary, a skill, specialization or creature ability requires code to work. It cannot be defined by xdb only. A damaging spell can, but no other spell. A stats-changing artifact can, but no other artifact. A common building can, but a special building (there are 4 or 5 per faction) needs its behavior code.

All in all, some things can be added (damaging spells, stats-changing artifacts). For these, maybe the quantity is locked as well right now, but if it is we will unlock it.
But other just can't be defined in pure mod-form. A new racial skill for example. And this rules out adding a completely new faction in a near future.
However, a "new" faction can be added in a map on a per-town basis, which amounts as having more than 8 factions on that map. This is used in the DM map or in ToK, as far as I know.

---------------------------

@Alcibiades: about .exe editing, some people know more than I do since I mostly look at the file only with an hexadecimal editor, not a disassembler, and this comes with limitations. However, between this here, the modified DM .exe and the discussion about campaigns repackaging, you have a good idea of what I can do so far:
- change paths of special folders or files (UserMODs/, savegame folder, autoexec.cfg, ...)
- change the icon, the splash screen
- change a limit on a list length (for the creatures, but I don't think this would be useful for other things - see above).
- and a few debug stuff to get more info from the console.

On .exe editing specifically, knowledgeable people I know are crazypill, evil-good and alexrom66.

A related topic is the editor improvement (involving binary files editing), and in this area, the reference is of course Neckie. In particular, it will be possible to make the new creatures appear in the editor creatures list. I guess at some point in a near future, we'll release guidelines and base files so that any modder can provide the map editor addon to his creature mod.


 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Kronos1000
Kronos1000


Promising
Supreme Hero
Fryslân Boppe
posted December 31, 2007 04:12 PM

Quote:
@Kronos1000: would you mind having reserved slots starting at 250? Say 250-272?
As for Nelgirith comment, I think it's better to plan for compatibility. ToK package can be deactivated. ToK new creatures can also be released separately by themselves, using those same IDs, which will allow a total control. However, since ToK is such a huge project, you might want to package it with its own .exe like DM to get a more personalized feel, and release everything in an installer. You still have time for this anyway, and I can offer support if you'd like.


Yeah I was planning to release it this way my only problem was the exe editing, for some reason I failed unlike in the HoF exe where I succeeded I also wanted to add 1 Artifact, so could you help me out on this one? I can make the Install Wizard myself.
____________
Hwær cwom mearg? Hwær cwom mago?
Hwær cwom maþþumgyfa? - 'The Wanderer'

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Gnoll_Mage
Gnoll_Mage


Responsible
Supreme Hero
posted December 31, 2007 07:21 PM

Quote:

On .exe editing specifically, knowledgeable people I know are crazypill, evil-good and alexrom66.



Would some clever person please please please explain how you know which bits to edit in the exe file, to get the desired effects?

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Wulfstan8182
Wulfstan8182


Famous Hero
, eh?
posted December 31, 2007 08:08 PM

i have a question, from which link do we download the first one or the second one? and about new factions, we found out the script of the creatures, so hey, we can find out the script for the town.
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
kmp123
kmp123


Hired Hero
posted January 01, 2008 03:58 AM

yeah i really want a new town for H5 , especially Conflux

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Wulfstan8182
Wulfstan8182


Famous Hero
, eh?
posted January 01, 2008 07:55 AM
Edited by Wulfstan8182 at 07:56, 01 Jan 2008.

Nah, Conflux would suck. This one, now that's what I'm talking about!
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
sfidanza
sfidanza


Promising
Supreme Hero
posted January 01, 2008 11:57 AM

@Wulfstan8182: read the post. The first link is the framework. The second is the test package with 2 demo mods and a test map.

@Gnoll_Mage: I don't know how crazypill found out the first time for the HoF exe, and I mostly looked for about the same bits in ToE. I can explain briefly what you have to look at, but not really why.

First, there are a number of tables which lengths are specified. Look inside data.pak/types.xml for <dbid>: those are the entry points mostly for the tables GameMechanics/RefTables/. Each has a different lengths, and they are of two types: lengths lower than 128 are stored in a signed short (1 byte - for values between -127 and 128), while lengths higher than 128 use a long integer (4 bytes).

Lengths seem to be specified at two places in the .exe, but let's focus on the first one. 1-byte values are given in a block like
"FF 6A xx 8D 44" (where xx is the value)
and 4-bytes values are given in a block like:
"FF 68 xx xx xx xx 8D 44" (where xx xx xx xx is the value in little endian)
As I explained in the first post, "little endian" means the bytes are reversed: 300 is 012C in hexadecimal, and is written "2C 01 00 00" in the exe.

If you looked in types.xml for <dbid>, you have noticed that there are 29 such tables. Now, the "8D 44" suffix in the exe is actually part of a longer block:
"8D 44 24 24 50 8D 4C 24 1C 51 68"
and if you look for it in H5_Game.exe, you'll see that it also appears 29 times. Now that you know how to recognize 1-byte and 4-bytes values, you can match each occurrence to its table.

Of course, that's only half the story. At the second place where the length are specified, all of them are written with 4 bytes, and appear in blocks like:
"B8 xx xx xx xx C3 CC CC"
There might be multiple hits of those. For example, "B8 B4 00 00 00 C3 CC CC" appears 2 times. But the one we're looking should be in an area with other such blocks around for other lengths.

These explanations certainly do not explain the why, only a part of the how. But understanding the why is even more technical, and requires using a disassembler, which is illegal in various countries.

Now, some of you here like to barely read a technical post, obviously do not make the effort of understanding what it means, but believe that it solves everything. It does not.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Jump To: « Prev Thread . . . Next Thread » This thread is 19 pages long: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 · NEXT»
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.0991 seconds