Editing league structures & rules using a hex editor / ArtMoney

Discuss all aspects of editing the data and databases in EHM here. Have a question about the EHM Editor, EHM Assistant, editing the .cfg files, hex editing the .dat or .db files? Want to tweak the EHM exe file to change league rules/structure, start date etc? This is the place!
Forum rules
This is the forum to discuss all aspects of editing the EHM data and tweaking the game.

Have a bug or feature request for the EHM Editor? Post them in the EHM Editor thread. Please start a new thread or post in another thread if you have a question about how to use the EHM Editor.

Given the large number of questions on similar topics, we ask that you start a new thread for a new question unless you can locate a similar question in an existing thread. This will hopefully ensure that similar questions do not get buried in large threads.

Useful links: EHM 1 Assistant (Download) | EHM 1 Editor (Download) | EHM 1 Editor Tutorials | Editing Rules & Structures Guide | Converting EHM 2004 / 2005 DBs to EHM 1 | Converting an EHM 2007 DB to EHM 1 | Extra_config.cfg | Import_config.cfg | Player Roles
User avatar
Lazion
Second Line
Posts: 661
Joined: Tue Oct 23, 2007 5:34 pm
Favourite Team: Flyers

Re: Editing league structures & rules using a hex editor / A

Post by Lazion »

archibalduk wrote:Wow! Nice work! Let me know how it goes. :thup:
Game didn't crash and everything changed back to normal after july game update.

Heres something new.. every league is using own league rules, but these are not playable. I'm definetly going to study league temp files more.
Image
User avatar
archibalduk
TBL Admin Team
Posts: 20373
Joined: Tue Jul 06, 2004 8:44 pm
Custom Rank: Seaside + Fruit Juice Mode
Favourite Team: Guildford (EPL) / Invicta (NIHL)
Location: United Kingdom
Contact:

Re: Editing league structures & rules using a hex editor / A

Post by archibalduk »

Crikey! So you managed to move leagues to the Canadian league?! I'd be interested to hear how to do this at some point.

With regards to the game changing back to normal after the game update, I expect you have to apply whatever fix you have created each time you reload the game (or at least when you reach the January and July updates). This is similar to what we have to do with the Start Date Patch and the League Patch.
User avatar
Lazion
Second Line
Posts: 661
Joined: Tue Oct 23, 2007 5:34 pm
Favourite Team: Flyers

Re: Editing league structures & rules using a hex editor / A

Post by Lazion »

archibalduk wrote:I expect you have to apply whatever fix you have created each time you reload the game (or at least when you reach the January and July updates).
Yes after every July update.

I can give quick guidance to this.

Basicly I just overwrited QMJHL, WHL &OHL.tmp files data with Nor, Swe and edited Aus .tmp files.
You can find these files from ...\user\username\AppData\Roaming\Sports Interactive\EHM 07\temp folder (Vista) after loading and saving game.. you have to keep EHM running so files doesn't disappear. Game generates league files for every selected leagues. It uses league abbrevation and league ID in file names, so NHL is called NHL_0 and Czech is called Cze_11. I opened one and overwrited every data with another league data in HEX-editor (do not save HEX changes at this point otherwise EHM just resets all changes) Then I saved EHM game once again. EHM should give some sort of error.. when you see error message save HEX file and click ok from EHM error box. Quit EHM and load game again.

I haven't looked in League temp files much yet, but I can see that in those files there's stored lot of stats and some league rules. I found out that there's at least league sizes and teams playing in league. If you search for FF 01 0F value from NHL file, these values determine standings screen. You probalby see something like this FF 01 0F 79 01 00 00 01. Here 0F is pointing out teams in conference/league, 79 01 is team ID and 01 is position/ID. I haven't manage to edit these files succesfully yet.. besides replacing tems.
User avatar
Alessandro
Olympic Gold
Posts: 2865
Joined: Sat Aug 27, 2005 1:54 pm
Custom Rank: TBL Rosters Man
Favourite Team: Team Russia
WHL Team: Calgary Flames

Re: Editing league structures & rules using a hex editor / A

Post by Alessandro »

Your workaround works great. I managed to create a 25-team KHL (replacing ECHL) which is what I'm trying to do for years. The problem now is that there is the godamn veteran rules... but it can be edited with some hex editing I guess, like import rules.
User avatar
Alessandro
Olympic Gold
Posts: 2865
Joined: Sat Aug 27, 2005 1:54 pm
Custom Rank: TBL Rosters Man
Favourite Team: Team Russia
WHL Team: Calgary Flames

Re: Editing league structures & rules using a hex editor / A

Post by Alessandro »

archibalduk wrote:
N America: ECHL
008F 5473 = Number of pro games played threshold for veteran players (note this is a 2-byte integer. I.e. the hex number spans 008F 5473 - 5474)
008F 5478 = Max veteran players with more than 260 pro games played dressed. The number of games played threshold can be adjusted via 008F 5473
It ain't that easy. I changed the limit to 2000 pro games yet most of players were veterans anyway.

EDIT: I overwrote KHL and ECHL. The game crashes after 6-7 days of simulation ](*,)
User avatar
Lazion
Second Line
Posts: 661
Joined: Tue Oct 23, 2007 5:34 pm
Favourite Team: Flyers

Re: Editing league structures & rules using a hex editor / A

Post by Lazion »

I took another peek into league temp files.

This is the value set what I have studied lately: (this is from Rsl_9.tmp)
You can find this set quickly by searching FF 01 "league ID" or in some files 01 01 "League ID"
02 00 00 00 00 00 F0 00 D6 07 00 36 00 02 14 00 00 FF FF FF FF FF FF FF FF 16 FF FF 00 00 01 00 02 00 13 00 D6 07 02 01 00 00 00 00 FF FF 01 09 00 00 00 36 00 03 01 02 01 02 01 02 01 02 04 00 00 10 00 02 48 00 00 00 C3 01 00 00 FF FF FF FF FF FF FF FF 00 F9 00 00 00 02 00 00 00 00

There's still plenty to learn, but here's my findings so far..

Bold - This indicates league ID. Changing this will change league name and game rules set. If changing be sure to change all old ID's from fixture files also.. otherwise game will crash.

Blue - These determines how many points teams will earn after game is played in this order:
PW PT POtW POtL PSoW PSoL.. really can't be sure about PT, POtW and POtL I used my smart head to quess those. :nerd:

Red - These only have cosmetic effect, but these determines standings screen gualifying lines. Very first is used rarely it shows how many teams qualifies for next stage. Second indicates how many teams qualifies for playoffs (note that game calculates first two together like 4+4=8). Third is how many teams have to play in playouts and fourth indicates how many teams are getting relegated (again 1+1=2). Relegation lines seems to have some other than cosmetic effect.. my sim just crashed. I need to check this out again.

Green - These shows where team is about to get promoted or relegated (if both leagues are playable?).
For example in Mestis file these values are 01 00 00 00 (SM-Liiga) and 12 00 00 00 (Suomi Division)

Teal - This value clearly have effect in schedules. This is pointing out initial number of games played, but changing this will cause crash or big mess in fixtures. For some leagues (NA and atleast SM-Liiga) this value is for some reason 02 00.

Well there's all for now.. I'm looking for rest values shortly.
User avatar
archibalduk
TBL Admin Team
Posts: 20373
Joined: Tue Jul 06, 2004 8:44 pm
Custom Rank: Seaside + Fruit Juice Mode
Favourite Team: Guildford (EPL) / Invicta (NIHL)
Location: United Kingdom
Contact:

Re: Editing league structures & rules using a hex editor / A

Post by archibalduk »

Wow! Seems you're having more luck with the saved game than I've had with ArtMoney. Keep us posted! :thup:
User avatar
nino33
Mr. Goalie
Posts: 6088
Joined: Sat Aug 07, 2010 3:37 am
Custom Rank: Retro Rosters Specialist
Favourite Team: 1970s hockey

Re: Editing league structures & rules using a hex editor / A

Post by nino33 »

Pretty cool Lazion! 8-)
Hobbit13
Junior League
Posts: 37
Joined: Fri Jul 13, 2007 12:05 pm
Custom Rank: UUDB & Hex Man!

Re: Editing league structures & rules using a hex editor / A

Post by Hobbit13 »

Hey guys, how are you all doing? :D

Nice to see all of you still putting so much effort in ;) Especially you Archi, that's a LOT of utilities you're working on!

The part of my summer holidays, when I've got essentially nothing to do, has started so I may or may not get back in this. It's very tempting seeing the progress you guys have made! I'll probably end up looking at some things but I'll see how far I'll go, I might start today or tomorrow already ;)

Btw noticed you're post about the lineup rules and league sizes for all the leagues, archi, I think I compiled a list like that just before I stopped but I guess I never posted it... Really sorry about that, my bad. Could have saved you a bit of time there... Btw about the lineup rules, the offset that I found in the exe (like under e.g. nhl_rules.cpp or whatever) is the one that links to the specific rules you posted. If I remember correctly, the lineup rules are written in assembly language using some specific command. These commands you can edit, remove and add but I think we're limited to the space given (mostly the leagues have extra space to add a rule though). I'll post more about it once I look into it again. But anyways I'll look into it and possibly try to find some roster rules!
User avatar
archibalduk
TBL Admin Team
Posts: 20373
Joined: Tue Jul 06, 2004 8:44 pm
Custom Rank: Seaside + Fruit Juice Mode
Favourite Team: Guildford (EPL) / Invicta (NIHL)
Location: United Kingdom
Contact:

Re: Editing league structures & rules using a hex editor / A

Post by archibalduk »

Marek! Nice to hear from you! It seemed like you went off to Peru and never came back! :-D

As you have seen, most of my efforts have been in relation to database editing. I have taken a look at the league rules/structure every now and then, but haven't really achieved anything other than posting that list of offsets. However, Alessandro has written a rules patch (thanks to some help from you, I believe) and Lazion has recently posted some very interesting details on his attempts to modify the league structures and schedules.

Anyway, nice to have you back on the forums. Fingers crossed you find some time to tweak EHM some more! :cool:
Hobbit13
Junior League
Posts: 37
Joined: Fri Jul 13, 2007 12:05 pm
Custom Rank: UUDB & Hex Man!

Re: Editing league structures & rules using a hex editor / A

Post by Hobbit13 »

Yeah after coming back from Peru, I went straight to uni and I never really had time there to do anything EHM related...

However I have now found out how to edit roster rules! I haven't tried removing/overwriting them just yet but I have been successful in changing the values! For some weird reason when I went over some of the notes that I took before, I found I had written two commands under a "roster rules" section. I tried finding them for a specific league, changing them and voila it works! It's also regulated in the memory that is loaded by EHM (similarly to lineup rules). I have yet to find if there is a section in the exe that specifies the offset and also how it differs if there are different roster rules in the same country. Also it seems to take effect whenever you start up EHM, so you have to edit the values before you start a new game/load a game.

But anyways first good news already! Btw has any compiled what the roster rules are for like the 11/12 or 12/13 season, by chance?
User avatar
nino33
Mr. Goalie
Posts: 6088
Joined: Sat Aug 07, 2010 3:37 am
Custom Rank: Retro Rosters Specialist
Favourite Team: 1970s hockey

Re: Editing league structures & rules using a hex editor / A

Post by nino33 »

Hobbit13 wrote:Btw has any compiled what the roster rules are for like the 11/12 or 12/13 season, by chance?
FYI There's a 3 page thread started last fall that IIRC includes roster rules for the 11/12 season http://www.ehmtheblueline.com/forums/vi ... =13&t=8277
User avatar
Alessandro
Olympic Gold
Posts: 2865
Joined: Sat Aug 27, 2005 1:54 pm
Custom Rank: TBL Rosters Man
Favourite Team: Team Russia
WHL Team: Calgary Flames

Re: Editing league structures & rules using a hex editor / A

Post by Alessandro »

Hobbit13 wrote:Yeah after coming back from Peru, I went straight to uni and I never really had time there to do anything EHM related...

However I have now found out how to edit roster rules! I haven't tried removing/overwriting them just yet but I have been successful in changing the values! For some weird reason when I went over some of the notes that I took before, I found I had written two commands under a "roster rules" section. I tried finding them for a specific league, changing them and voila it works! It's also regulated in the memory that is loaded by EHM (similarly to lineup rules). I have yet to find if there is a section in the exe that specifies the offset and also how it differs if there are different roster rules in the same country. Also it seems to take effect whenever you start up EHM, so you have to edit the values before you start a new game/load a game.

But anyways first good news already! Btw has any compiled what the roster rules are for like the 11/12 or 12/13 season, by chance?
Welcome back! Please write offsets of the roster rules or anything you found so that I can research myself and forward any info to Archi. Did you try the new version of our league patch? It works like a charm and I already told Archi how to modify the German-related import rules. Come on, I really want to remove this darn import limit in Austria.
Btw, the UUDB now is gone, we moved on to the Manimal project. If you've got some spare time, download the latest roster update and tell us some modifications to do. The DB is still yet to be in the best shape concerning European leagues, even if it has improved a lot since we jumped on board.
Hobbit13
Junior League
Posts: 37
Joined: Fri Jul 13, 2007 12:05 pm
Custom Rank: UUDB & Hex Man!

Re: Editing league structures & rules using a hex editor / A

Post by Hobbit13 »

Here is a table of the different lineup rules that I found (don't think there are any more):
[table][tr][td]Rule[/td][td]Command in ASM Language[/td][td]Command in Hex[/td][td]Example[/td][/tr]
[tr][td]Max number of foreigners[/td][td]MOV BYTE PTR DS:[ESI],__[/td][td]C606 __[/td][td]3 foreigners: C606 03[/td][/tr]
[tr][td]Max number of non EUs:[/td][td]MOV BYTE PTR DS:[ESI+1],__[/td][td]C646 01 __[/td][td]2 non EUs: C646 01 02[/td][/tr]
[tr][td]Max age of domestic players:[/td][td]MOV BYTE PTR DS:[ESI+6],__[/td][td]C646 06 __[/td][td]25 yrs or younger: C646 06 19[/td][/tr]
[tr][td]Min number of above:[/td][td]MOV BYTE PTR DS:[ESI+7],__[/td][td]C646 07__[/td][td]min 4 of above: C646 07 04[/td][/tr]
[tr][td]Max # of players born in year and later:[/td][td]MOV BYTE PTR DS:[ESI+8],__[/td][td]C646 08 __[/td][td]20 years and onwards: C646 0A 14[/td][/tr]
[tr][td]Max of above:[/td][td]MOV BYTE PTR DS:[ESI+9],__[/td][td]C646 09 __[/td][td]4 players: C646 0B 04[/td][/tr]
[tr][td]Max # of players born in year:[/td][td]MOV BYTE PTR DS:[ESI+A],__[/td][td]C646 0A __[/td][td]20 years ago: C646 0A 14[/td][/tr]
[tr][td]Max of above:[/td][td]MOV BYTE PTR DS:[ESI+B],__[/td][td]C646 0B __[/td][td]6 players: C646 0B 06[/td][/tr]
[tr][td]Max veterans (# of games min):[/td][td]MOV WORD PTR DS:[ESI+F],____[/td][td]66:C746 0F ____[/td][td]300 games: 66:C746 0F 2C01[/td][/tr]
[tr][td]Max veterans (# of veterans):[/td][td]MOV BYTE PTR DS:[ESI+11],__[/td][td]C646 11 __[/td][td]7 veterans: C646 11 07[/td][/tr]
[tr][td]Min rookies (# of games max):[/td][td]MOV WORD PTR DS:[ESI+C],____[/td][td]66:C746 0C ____[/td][td]40 games: 66:C746 0C 28[/td][/tr]
[tr][td]Min rookies (# of rookies):[/td][td]MOV BYTE PTR DS:[ESI+E],__[/td][td]C646 0E __[/td][td]3 rookies: C646 0E 03[/td][/tr][/table]

Note: for the ones that use "born in year" the specific year is not given, instead number of years ago from current year.
Hobbit13
Junior League
Posts: 37
Joined: Fri Jul 13, 2007 12:05 pm
Custom Rank: UUDB & Hex Man!

Re: Editing league structures & rules using a hex editor / A

Post by Hobbit13 »

So I've definitely now understood how to edit roster rules! And along with that I have also found out how to edit the number of players dressed. The latter takes effect only when you start a new game/when the game updates in late June. Yay to making progress almost immediately!
User avatar
archibalduk
TBL Admin Team
Posts: 20373
Joined: Tue Jul 06, 2004 8:44 pm
Custom Rank: Seaside + Fruit Juice Mode
Favourite Team: Guildford (EPL) / Invicta (NIHL)
Location: United Kingdom
Contact:

Re: Editing league structures & rules using a hex editor / A

Post by archibalduk »

Wow! It didn't take you long! :D

Will you eventually be looking at league rules and structures, or do you plan just to look at roster rules?
Hobbit13
Junior League
Posts: 37
Joined: Fri Jul 13, 2007 12:05 pm
Custom Rank: UUDB & Hex Man!

Re: Editing league structures & rules using a hex editor / A

Post by Hobbit13 »

archibalduk wrote:Wow! It didn't take you long! :D

Will you eventually be looking at league rules and structures, or do you plan just to look at roster rules?
Well so far it's looking like that league rules (i.e. match rules like fighting misconducts, icing, OT rules, etc.) are configured by one command. So putting in one value sets specific match rules, which would mean the specification of what rules to be linked to that value must be explained somewhere completely different... I still have to test whether what I said is true (since I'm starting to learn Assembly language but I can't say I'm 100% certain of what's happening) but sadly that's what it looks like. I'd have to delve even deeper into the code and I think I first need to understand the code a bit better...
Hobbit13
Junior League
Posts: 37
Joined: Fri Jul 13, 2007 12:05 pm
Custom Rank: UUDB & Hex Man!

Re: Editing league structures & rules using a hex editor / A

Post by Hobbit13 »

So lately I have been looking at schedules and playoffs. I now understand how the schedule is programmed; each part only essentially says the date and if a game is at a different date than the rest of the round, it is explained. However in each of the dates it doesn't actually say how many games are meant to played that day. Therefore I assume that it is programmed what the "default" amount of games there is in each round (so for a 10 team league it would be 5 games). I think once I find this, we should be able to easily expand leagues (well at least ones that aren't split into conferences and divisions) so that all teams are included in the schedule. However so far I haven't found where this could be located and I think it's gonna be pretty hard to find...

For now then I have been looking at playoffs and the first success is changing a round of the Czech Extraliga playoffs from a best of 7 to a best of 5!

Image

I know that the KHL has now a best of 7 (unlike the RSL which had a best of 5), are there any other changes needed? Actually I'll just post this in the "help updating..." thread.

My goal is to be able to change the playoff and relegation formats completely since in the Czech Republic they now have a playoff format similar to the DEL and SM Liiga where the teams placed 7-10 play for the last two playoff spots. However I think the limitation will simply be that there will not be enough space for me to program it in... I'll see though, maybe it's just a matter of learning more assembly language.
User avatar
smokey
Minor League
Posts: 218
Joined: Mon Apr 02, 2012 9:41 pm
Favourite Team: HIFK, Charlestown Chiefs, Flyers

Re: Editing league structures & rules using a hex editor / A

Post by smokey »

Hobbit13 wrote:So lately I have been looking at schedules and playoffs. I now understand how the schedule is programmed; each part only essentially says the date and if a game is at a different date than the rest of the round, it is explained. However in each of the dates it doesn't actually say how many games are meant to played that day. Therefore I assume that it is programmed what the "default" amount of games there is in each round (so for a 10 team league it would be 5 games). I think once I find this, we should be able to easily expand leagues (well at least ones that aren't split into conferences and divisions) so that all teams are included in the schedule. However so far I haven't found where this could be located and I think it's gonna be pretty hard to find...
I came to similar conclusions. There's the total amount of games played per season, and changing this might change games played per round??? Example: WHL ---- 756.18,3,1,109,105..18,3,1,7,6. So 756 is the total amount and 18,3 is the date. The third number seems to be the year, because everything before January is 0, so all of this is just rules for the game to create the schedule each time a new season is set up. There's still a numerological mountain to climb in order to figure out what the two remaining numbers mean. The WHL has 21 teams and only 18 different numbers are used here(100-109 and 0 to 7), so who knows. By comparing this set of data to the data from another league, one might be able to crack this.
User avatar
Lazion
Second Line
Posts: 661
Joined: Tue Oct 23, 2007 5:34 pm
Favourite Team: Flyers

Re: Editing league structures & rules using a hex editor / A

Post by Lazion »

Last two numbers are team ID's.. Not the ones from DB.
Those are kind of rolling numbers which are given to teams by alphabetical order.
Each division is getting own set of numbers. Let's say that there's two divisions in league (A & B) Teams in A div gets number set 1-99 and teams in B div gets 100-199.
And if teams in B div are called as AT and BT the AT's ID is 100 and BT's ID is 101.
User avatar
smokey
Minor League
Posts: 218
Joined: Mon Apr 02, 2012 9:41 pm
Favourite Team: HIFK, Charlestown Chiefs, Flyers

Re: Editing league structures & rules using a hex editor / A

Post by smokey »

Lazion wrote:Last two numbers are team ID's.. Not the ones from DB.
Those are kind of rolling numbers which are given to teams by alphabetical order.
Each division is getting own set of numbers. Let's say that there's two divisions in league (A & B) Teams in A div gets number set 1-99 and teams in B div gets 100-199.
And if teams in B div are called as AT and BT the AT's ID is 100 and BT's ID is 101.
Of course, I was looking at the wrong set of numbers. The game still seems to add a few random games here and there, since the amount of games correlates with the amount of entries per date up to a certain point. On some dates there seems to be a few more games played and these differ from one game to another.
Hobbit13
Junior League
Posts: 37
Joined: Fri Jul 13, 2007 12:05 pm
Custom Rank: UUDB & Hex Man!

Re: Editing league structures & rules using a hex editor / A

Post by Hobbit13 »

So I thought I'd post a little update on my progress lately (haven't really done anything for the past 3 weeks though). The biggest accomplishment has been to expand the EBEL to 12 teams:

Image

I've been able to edit the Austrian schedule so that I didn't have to "borrow" it from another league and have edited to correctly reflect the 12/13 season. However because of the IIHF breaks being slightly different now from 2006 then some of the matches get automatically moved to different dates and this creates a slightly awkward schedule with too many games in December...

I have also found out where to edit roster rules for leagues so now for example for the EBEL we'll be able to increase the foreigner limit.

And lastly, I have started to look at the structure of playoffs and relegation series so in the next superpatch look for the SM Liiga playoffs being changed to a best of 7:

Image


My 3 main goals are now:
To expand the RSL (by preferrably first finding a way to prevent it from contracting from 19 to 18 teams)
To replace Slovenia with Switzerland (I think I now where to look but can't seem to find the part that could change it so still need to keep digging)
To change the relegation system for the Czech Republic (haven't checked it out yet but will hopefully be the easiest out of these tasks)
User avatar
Alessandro
Olympic Gold
Posts: 2865
Joined: Sat Aug 27, 2005 1:54 pm
Custom Rank: TBL Rosters Man
Favourite Team: Team Russia
WHL Team: Calgary Flames

Re: Editing league structures & rules using a hex editor / A

Post by Alessandro »

Way to go, Marek. I can also tell you that the next superpatch will feature other things, like correct import rules for Finland and German leagues :thup:
User avatar
archibalduk
TBL Admin Team
Posts: 20373
Joined: Tue Jul 06, 2004 8:44 pm
Custom Rank: Seaside + Fruit Juice Mode
Favourite Team: Guildford (EPL) / Invicta (NIHL)
Location: United Kingdom
Contact:

Re: Editing league structures & rules using a hex editor / A

Post by archibalduk »

WOW! This is absolutely incredible! Fantastic work! :notworthy: I will do my best to work on a new patch file as soon as I can.

How are you making these changes? Are you using ArtMoney, editing the exe or modifying the saved game data?

What are the limits in relation to league sizes and schedules? Can you setup anything you want? I thought it was only possible to use existing structures and schedules, but it sounds like you have been able to create an entirely new schedule for Austria.

It would be absolutely great in the future to have some sort of tutorial on how you went about doing all of this.
User avatar
nino33
Mr. Goalie
Posts: 6088
Joined: Sat Aug 07, 2010 3:37 am
Custom Rank: Retro Rosters Specialist
Favourite Team: 1970s hockey

Re: Editing league structures & rules using a hex editor / A

Post by nino33 »

archibalduk wrote:WOW! This is absolutely incredible! Fantastic work!
I couldn't agree more! Well done!


The possibility of editing # of teams and schedule...very very exciting!

archibalduk wrote:It would be absolutely great in the future to have some sort of tutorial on how you went about doing all of this.
Again, I couldn't agree more! HaHa



Nice job! =D>
Post Reply