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 > Library of Enlightenment > Thread: On the internals of offered skills when leveling-up a hero.
Thread: On the internals of offered skills when leveling-up a hero. This thread is 17 pages long: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 · «PREV / NEXT»
dimis
dimis


Responsible
Supreme Hero
Digitally signed by FoG
posted April 18, 2010 08:42 PM
Edited by dimis at 21:11, 18 Apr 2010.

Level-Up Offers (Revisited)

Ok, I had to compress all cases in one big algorithm in the FUN paper due to space limitations. For this reason, I am not really sure about the level of readability of the code, so here I will attempt to clear things up by pinpointing the lines of code where the various events take place.

Let's look on the basic mechanism described in Section 3.1. There are 2 major cases that we have to consider:
(A) The hero has at least one free slot.
(B) The hero does not have a free slot.
We examine them in order with their subcases. Case A1 is the longest.


Case A: The hero has at least one free slot.
We have two subcases.
(1) At least one of the secondary skills the hero currently has is not expert.
On the next level-up the secondary skill offer will look like
(Upgrade, Basic)
This case refers to lines 22-32 of the pseudo-code.
Now, we have to distinguish cases based on whether or not there is a Magic School Exception and/or Wisdom Exception. We will consider all cases in turn.
(i) No exception on this level-up. Everything is determined according to the randomized scheme of Section 3.2. Hence, both secondary skills are determined at random; i.e. (Random Upgrade, Random Basic). The assignment follows from lines 26 and 32.
(ii) We have Wisdom Exception, but not a Magic Schools Exception. We distinguish two further subcases.
-- The hero has Wisdom, but not expert. Then the offer should be (Wisdom Upgrade, Random Basic). This happens in lines 23 and 32.
-- The hero does not have Wisdom. The offer should be (Random Upgrade, Basic Wisdom). The assignment follows from lines 26 and 29.
(iii) We have Magic School Exception but not Wisdom Exception. Again we distinguish two further subcases.
-- The hero has at least one Magic School not expert. The offer should be (Random Magic Upgrade, Random Basic). The assignment takes place in lines 25 and 32.
-- All the Magic Schools the hero currently has are expert. The offer should be (Random Upgrade, Random Basic Magic). The assignment takes place in lines 26 and 31.
(iv) Finally, both Wisdom Exception and Magic School Exception coincide on this level-up. We have to distinguish cases further. The model first determines the left slot (the Upgrade here) and then the new (Basic) secondary skill.
-- The hero has Wisdom (but not expert). Then, *usually* the offer will be (Wisdom Upgrade, Random Basic Magic). This takes place in lines 23 and 31. Usually, because the assumption is that there are Magic Schools the hero does not already have and have non-zero weight. If this is not the case (i.e. the hero has taken all the Magic Schools of non-zero weights so far), then clearly there is none to be placed on the right slot. Hence, the offer is (Wisdom Upgrade, Random Basic). This takes place in lines 23 and 32. Note that in this case, Magic Exception will propagate for the next level-up.
-- The hero does not have Wisdom. Again we distinguish cases based on whether or not the hero has at least one Magic School that he can upgrade. If this is the case, then the offer will be (Random Magic Upgrade, Basic Wisdom); lines 25 and 29. If this is not the case, then the offer will be (Random Upgrade, Basic Wisdom); lines 26 and 29. Note again that in this last case Wisdom appears on the right because of the exception and the fact that it has higher priority compared to the Magic School Exception. Again, the Magic School Exception propagates for the next level-up.

(2) All the secondary skills the hero currently has are expert.
On the next level-up the secondary skill offer will look like
(Basic, Basic)
This case refers to lines 5-20 of the pseudo-code.
Again we distinguish cases based on the exceptions.
(i) No Wisdom or Magic School Exception. The offer is (Random Basic, Random Basic); lines 8 and 9 or 19 and 20 depending on whether or not the hero already has Wisdom.
(ii) Wisdom Exception only. The offer is (Basic Wisdom, Random Basic); lines 12 and 15.
(iii) Magic School Exception only. The offer is (Basic Magic, Random Basic); lines 7 and 9 or 18 and 20.
(iv) Both Wisdom and Magic School Exception. Wisdom is treated first, so it will appear on the left slot; i.e. we have (Basic Wisdom, Basic Magic); lines 12 and 14.



Case B: The hero does not have a free slot.
The hero can only upgrade non-expert secondary skills.
(1) The hero has at least two secondary skills not expert.
On the next level-up the offer will look like
(Upgrade, Upgrade)
This case refers to lines 22-26 and 33-36 of the pseudo-code.
Again we distinguish cases based on the exceptions.
(i) No Wisdom or Magic School Exception. The offer is (Random Upgrade, Random Upgrade); lines 26 and 36.
(ii) Wisdom Exception only. The offer is (Wisdom Upgrade, Random Upgrade); lines 23 and 36.
(iii) Magic School Exception only. The offer is (Magic Upgrade, Random Upgrade); lines 25 and 36.
(iv) Both Wisdom and Magic Schools Exception. The offer is (Wisdom Upgrade, Magic Upgrade); lines 23 and 35.

(2) The hero has only one secondary skill not expert.
On the next level-up the offer will look like
(Upgrade) = (Upgrade, NULL)
This case refers to lines 22-26 and 37 of the pseudo-code.
Again we distinguish cases:
(i) No Wisdom or Magic School Exception. The offer is (Upgrade, NULL); lines 26 and 37.
(ii) Wisdom Exception. The offer is (Wisdom Upgrade, NULL); lines 23 and 37.
(iii) Magic School Exception. The offer is (Magic Upgrade, NULL); lines 25 and 37.
-- Note that by definition of this case, there is only one secondary skill not upgraded, and hence Wisdom Exception can not coincide with a Magic School exception.

(3) All 8 slots of the hero are occupied by secondary skills at expert level.
No more secondary skills are offered from now on; line 4.
____________
The empty set

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


Responsible
Supreme Hero
posted May 31, 2010 07:43 AM

Good luck, dimis!
____________

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


Responsible
Supreme Hero
Digitally signed by FoG
posted June 08, 2010 12:32 PM

Thanks man. All went well. May be we can go there together in 3 years from now ?

Anyway, the summer is here, so, sooner or later I will start looking again at the problems in the thread.
____________
The empty set

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


Responsible
Supreme Hero
posted June 08, 2010 01:05 PM

dimis, could you please post here a short report about the event? Thanks.
____________

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


Responsible
Supreme Hero
Digitally signed by FoG
posted July 03, 2010 09:21 PM
Edited by dimis at 21:58, 03 Jul 2010.

FUN 2010

Hey man,

I am sorry I didn't come to this one earlier. After the conference I spent about 10 days in Greece and my days were really full. Then I came back to the US and I had to take care of many obligations that arose in within one month of absence.

Anyway, coming back to the point, almost everything went as planned. My talk was the second one on the second day. The program pretty much summarizes everything.

First day breakfast around 7.30, registration, and then around 9 we started. The lunch and the dinner on that day were in the hotel. By the way, the food was superb every day (and here I mean by far superior to other places where I have been). The funny thing is that I don't think they had pizza in any menu any day (oh, and the island is next to Naples (Napoli) ...), so I guess I made the right decision trying it on my own on night 0. But they had great quality sea food, mozzarella, prosciutto, and all sorts of stuff. The talks ended around 8pm, then we had dinner, and around 9.30-10 I went to my room going through the slides one more time; which by the way were prepared in the last minute, as I don't have a computer with Windows+Heroes+Take Screenshot (by default) in the US. The thing is that macbooks don't have a Print Screen button, so, under Windows you have to change the mapping of some key in order to take screenshots, blah, blah, blah ... and in the last minutes I didn't want to touch anything. So, practically I prepared the slides during the days that I stayed in Greece before I went to Italy.

Anyway, second day. Again, we started around 9 and we finished around 17.30. In between, lunch at the hotel, and at 17.30 we set off to visit the Aragonese Castle initially by bus and later on foot so that we can see part of Ischia in a relaxed pace as well. At the castle it was really nice. Cooler because it had a light wind and it was right next to the sea. We wandered in the castle probably for about an hour, an hour and a half, and a guide could give us all sorts of relevant info about the castle as well as the island and different things we could see in the island from the castle. Then, around 8-8.30 I guess we went to a tavern for dinner, and in between the courses Grossi gave his talk on Olympiads in Informatics that was planned for 3rd's day morning. For a moment I though this would give me the opportunity to go swimming early the next morning, but, we stayed at the tavern for a long time, and I think I reached my room around 1.30-2.00. Bottom line, next day I woke up around 8 and I had already lost my opportunity to go swimming.

This brings us to the third day, when everything started around 10 and finished again on schedule; at around 1pm. I stayed there for the lunch, and then I took off; hydrofoil to Naples, taxi, train to Rome, another train to the airport, airplane, and a little bit after midnight I was back in Athens going out for drinks with friends.


Alright, a few papers that caught my attention.

- Using Cell Phone Keyboards is (NP) Hard, by Peter Boothe.
Peter had some great results on the efficiency of using cell phones by re-arranging characters to different numbers or re-ordering characters in the same number. He had hardness results for T9 and essentially states that we can not do much there. However, for the "old-fahsioned" way of writing text messages, he managed (with a heuristic algorithm) to achieve a 27% increase in the efficiency by reordering letters on the keys, but never moving a letter from one key to another. Plus his presentation was really exciting!

- The Computational Complexity of RaceTrack, by Markus Holzer and Pierre McKenzie.
For me, RaceTrack is kind of a friend from the past when I was still an undergrad reading this; the problem was originally posed by Martin Gardner in Scientific American in 1973 (btw, the other thing that I learnt was that Gardner died this May). So, just by that, I want to go through the paper at some point, and I also want to find one of the references they have in the end by Manuel Blum and Dexter Kozen, On the power of the compass (or, why mazes are easier to search than graphs), FOCS 1978. Anyway, my feeling is that this paper as well as that reference are very interesting.

Alright, this is getting long ...

- Fun with Games (Invited Talk), by Spirakis et al.
The interesting result was that with a single formulation of the Graph Coloring problem, they managed to re-prove all 4 known results for graph coloring bounds; and Spirakis mentioned that he had seen in the past one of them only in some Hungarian books, and we know how good Hungarians are in these things ... Their techniques relied on Game Theory, for which I don't know pretty much anything, but it is so hot these days and apparently close to the things that I do. So, that's another paper, and at some point I have to study Game Theory ...

- Computational Complexity of Two-Dimensional Platform Games, by Michal ForiĊĦek.
Michal proved many meta-theorems that he could apply to many 2D platform games; such as Lemmings and Prince of Persia; e.g. Prince of Persia is PSPACE-complete. My guess is that this one is a very interesting read too. The other funny thing is that apparently I had met Michal in 2004 but neither me nor him did we actually remember anything.

- Do We Need a Stack to Erase a Component in a Binary Image?, by Tetsuo Asano.
This reminded me another ghost from the past, when we were trying with a friend of mine (actually he had to solve the problem) to develop a (good ?) technique for that problem in medical images for cancer.

- Cracking Bank PINs by Playing Mastermind, by Riccardo Focardi and Flaminia L. Luccio.
It does not refer to direct ATM-attacks, but assumes some sort of "insider" in the bank. The other interesting thing are the references on Mastermind that I didn't know of their existence before; e.g. The Computer as Master Mind, by Knuth, in which it is shown that the codebreaker can find the solution to a 4-peg/6-colors mastermind in at most five steps and with expected time 4.478. There are other papers in the references that improve that bound.

Okay, a few more and I conclude ...

- The Urinal Problem, by Evangelos Kranakis and Danny Krizanc.
In other words, what strategy should we follow in order to maximize our privacy-time in the restrooms. And of course we care about the asymptotic behavior of N urinals as N goes to infinity! (j/k) It was interesting to say the least!

- The Complexity of Flood Filling Games, by Arthur et al.
At some point recently I had downloaded Flood-it! for my phone, and I thought it was funny that results about the game were available so fast.

- Christmas Gift Exchange Games, by Arpita Ghosh and Mohammad Mahdian.
lol, just lol.

- O(1)-Time Unsorting by Prefix-Reversals in a Boustrophedon Linked List, by Aaron Williams.
I felt strange when I heard Boustrophedon, because it reminded me of something but I couldn't tell what. Then I realized it was a greek word and it was funny when I was asked to describe its etymology. lol

- UNO Is Hard, Even for a Single Player, by Demaine et al.
The funny thing is that "et al" hides two guys with last names "Uno" who wrote a paper for UNO (game).

- Managing Change in the Era of the iPhone, by Patrick Healy.


Anyway, there is plenty of food for thought and future work. Next FUN is again in 3 years from now, and although since 1998 it has constantly been held in Italy, they are thinking of hosting it on an island in Greece next time. If we submit something there next time, we can go together (you, Ecoris, may be some other guy will show up in the meantime; who knows ?). Apart from the stuff in this thread, there are other problems that I can think of if we do some work. For example, Corribus recently posted a problem in the Maths thread (100 Prisoners and a Light Bulb), which, from what I understand has many open problems for the different variants. There were problems with similar flavor in this FUN too; e.g. A Hat Trick, or The Feline Josephus Problem. Finally, here are some pics they have available online from this FUN.
____________
The empty set

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


Famous Hero
posted March 24, 2015 02:27 AM

So restrictions have been found appart from wisdom and magic school?

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


Adventuring Hero
posted June 21, 2015 11:35 PM

What a great thread this is! Big thanks to all of you for all the valuable insights!

I don't know if anyone still uses the calculators posted here.
I just downloaded the skills executable by dimis from page 14 and ran it.
It works, but when I change the preference files in any way, I get an error message "Invalid skill given on input line 3." (varying number depending on where I copied the skill to)
To reproduce: I just opened the preference file in the text editor, copy-pasted any skill to another location, saved and reran the routine. What am I doing wrong?

Also, anyone knows if there is an updated version with the magic heroes included?
I am also asking because I am interested in applying the calculations to new heroes not included in original game, e.g. for new fan-made towns like Cove from HotA addon.

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


Responsible
Supreme Hero
posted June 22, 2015 02:37 AM

Maybe you use incorrect names for secondary skills? For example, EARTH MAGIC instead of EARTH_MAGIC. I don't know really, it's just a guess.

Btw, you can try LMOracle to calculate those probabilities. Options -> Research Mode, Options -> Policy -> {AL, AR, ALTP, SPOU}. Just put 28 skill names ordered by preference (this time without underlines, e.g. EARTH MAGIC, not EARTH_MAGIC) into altp.txt or spou.txt, and then double-click on any hero's number in the list.

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


Responsible
Supreme Hero
posted June 22, 2015 03:10 PM

With high probability you have encountered the following problem.

Quote:
The different newline conventions often cause text files that have been transferred between systems of different types to be displayed incorrectly. For example, files originating on Unix or Apple Macintosh systems may appear as a single long line on some programs running on Microsoft Windows. Conversely, when viewing a file originating from a Windows computer on a Unix system, the extra CR may be displayed as ^M or <cr> at the end of each line or as a second line break.

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

Tavern Dweller
posted August 15, 2018 06:08 PM

FriendOfGunnar said:
That's just the thing Dimi, after the game has started the secondary skill selection is not random.  At the beginning of every game, HOMM3.exe randomly creates a list of secondary skills (which I suspect is exactly 112 skills long).  HOMM3.exe then uses an algorithm to decide which skill to offer you depending on how whether or not you take an upgrade or a fresh skill.  (in other words HOMM3.exe is kind of jumping back and forth on the list according to a prearranged set of rules).  I'd peek at  the list but like I already said the H3 save files are encrypted (and I believe it's against the CoC here to even suggest ways of cracking it...dunno)


Hi there. I just wan't to ask - is this really true for HoMaM III Complete with that unofficial HD update? I mean there is no way how to change skill via load game when you level up? Thanks for any response!
____________

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

Hero of Order
Part of the furniture
posted August 15, 2018 09:07 PM
Edited by Maurice at 21:08, 15 Aug 2018.

The 112 is misunderstood, if you ask me.

Yes, the total weight across all possible Skills for each Hero is 112, that's true. What the game does, is determine a random number between 1 and 112 and relates that to a specific Skill based on that number and offers it up for skilling up.

The random number generator uses a specific seed number, which is determined at the start of the game. It used that seed to draw numbers from for anything that requires a random number - like skilling up. That seed number is saved with the game, too, which immediately explains why loading and then skilling up again yields the same results.

There's an algorithm that manipulates it, though, as the game forcibly offers the Wisdom skill and any of the four Magic (Earth, Fire, Air, Water) after it hasn't offered those a certain number of levels, depending on Hero class.

I once made an analysis of that algorithm as it is within the game code and posted it here on the forums somewhere. Would need to look for it, haven't got the time right now, though.

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

Tavern Dweller
posted August 15, 2018 10:18 PM
Edited by Targens at 07:59, 16 Aug 2018.

Maurice said:
The 112 is misunderstood, if you ask me.

Yes, the total weight across all possible Skills for each Hero is 112, that's true. What the game does, is determine a random number between 1 and 112 and relates that to a specific Skill based on that number and offers it up for skilling up.

The random number generator uses a specific seed number, which is determined at the start of the game. It used that seed to draw numbers from for anything that requires a random number - like skilling up. That seed number is saved with the game, too, which immediately explains why loading and then skilling up again yields the same results.

There's an algorithm that manipulates it, though, as the game forcibly offers the Wisdom skill and any of the four Magic (Earth, Fire, Air, Water) after it hasn't offered those a certain number of levels, depending on Hero class.

I once made an analysis of that algorithm as it is within the game code and posted it here on the forums somewhere. Would need to look for it, haven't got the time right now, though.


I see, thank you for response! I've probably seen the analysis of that algorithm [url=http://www.cs.virginia.edu/diochnos/research/publications/heroes-fun-10.pdf]here[/url]. Just that there is only described part of it as RndNew(); but not how the RndNew(); is calculated. Anyway - thanks. I just need to live with Navigation or Scholar. I'll probably choose Scholar, because there is no water on my random map .
____________

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

Hero of Order
Part of the furniture
posted August 16, 2018 11:05 AM

Targens said:
I see, thank you for response! I've probably seen the analysis of that algorithm here. Just that there is only described part of it as RndNew(); but not how the RndNew(); is calculated. Anyway - thanks. I just need to live with Navigation or Scholar. I'll probably choose Scholar, because there is no water on my random map .


Had a few minutes to spare at the moment, so I went back into my archive and found this post I made almost 2 years ago. It details specifics as derived from analysing the source code. Note that I didn't detail the RNG; I've taken that one for granted, but basically it uses the seed with which the game was started to draw random numbers from.
____________
The last Reasonable Steward of Good Game Design and a Responsible Hero of HC. - Verriker

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


Responsible
Supreme Hero
Digitally signed by FoG
posted August 23, 2018 04:16 AM
Edited by dimis at 04:19, 23 Aug 2018.

RndNew(), RndUpgrade(), RndNewMagic(), RndUpgradeMagic()

I guess someone is lucky because I hardly ever visit the forum anymore.

Targens said:
...
I've probably seen the analysis of that algorithm here. Just that there is only described part of it as RndNew(); but not how the RndNew(); is calculated.
...


Section 3.2 in the linked paper describes precisely how RndWhatever() works. That is, add up the weights of the skills of interest and then pick a skill s from that set of interesting skills with probability proportional to the weight of each skill s that appears in that particular set.

This is what the paper describes and how the code was written for the relevant programs.

However, if my memory serves me correctly, I think that during the upgrades of skills (perhaps only for upgrades during magic school exceptions, or new magic schools to be offered due to exception?), then all of the relevant skills on that set of interest are treated equally (i.e., weight 1 for each one of them). I think this was found by either Ecoris or Alex -- or by both of them independently and even the ordering by which they are enumerated is known. (It can also be maretti who discovered this, or verified this independently, because he was helping a lot during testing back then; I honestly can not remember atm.) Most likely this information is hidden somewhere earlier in this thread, should you have the patience to read it fully. However, in any case, I remember that the results were not changing dramatically, and how could they (?), as then they would contradict the findings of the paper that you are linking to.

Hope this helps. Do wise level-ups!
____________
The empty set

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


Promising
Supreme Hero
النور
posted August 23, 2018 10:16 AM

maretti said:
I think it works like this:

About new skills that you are offered:

You are offered wisdom at lvl 6 if not earlier. Earlier than lvl 6 the chance of getting wisdom is the same as for other skills (means it depends on the number each heroclass has in wisdom, for example knights 3, barbarians 2). If you do not choose wisdom it will be offered again 6 levels later if not earlier.

You are offered a magic skill at lvl 4 if not earlier. Which of the magic skills you will be offered depends on your numbers in the diffrent magic skills). Earlier than lvl 4 the chance of getting magic is the same as for other skills.
If you do not choose the magic skill offered you will be offered magic again 4 levels later if not earlier.
If you choose the first magic skill offered I dont know when you can be sure to  be offered magic again but I have had games where it was as late as 12-13 levels later.

About improving skills you allready have:

I have heard it mentioned that you have a bigger chance of being offered adv or exp in skills where you have high numbers compared to skills where you have lower numbers but I dont know exactly how it works.


This?
____________
Nothing of value disappears from this world, it will reappear in some shape or form ^^ - Elvin

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

Hero of Order
Part of the furniture
posted August 23, 2018 01:20 PM

Guys, read the post I linked to, in my previous post. For the lazy bums , here it is once more: here. It details the steps the code takes to determine skill-ups. I've derived these steps by examining the source code and moving through the execution steps as it makes its determination.
____________
The last Reasonable Steward of Good Game Design and a Responsible Hero of HC. - Verriker

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


Responsible
Supreme Hero
Digitally signed by FoG
posted August 23, 2018 05:34 PM
Edited by dimis at 17:37, 23 Aug 2018.

AlHazin said:
This?
If you are asking me personally, that's not what I described in the last big paragraph of my previous post.

What you have in bold is the treatment that we have for the weights of skills in normal circumstances and is what I described earlier. (In other words, if there is no magic school exception or wisdom exception, then these special skills are treated as regular skills; see my example in the following paragraph.)

For example, for the set U of unattained skills (some of which can be some magic schools, as well as wisdom), from where you can pick a skill for the right slot (assuming the left one is an upgrade), the probability that __any__ unattained skill s has to appear on the right hand side is:

Pr(skill s) = (weight of unattained skill s) / (sum of weights of unattained skills)

In other words, the probability of seeing the skill s is proportional to the weight that the skill s has -- regardless if s is a magic school skill or wisdom (under the assumptions mentioned earlier; no magic school exception, no wisdom exception, left slot is an upgrade).

Really, this is Section 3.2 in the linked paper above and that is the only equation on display so that there is no confusion. I hope it is clearer now.


Now, for what I meant with the last paragraph in my previous post, please read it carefully and you will see that I am talking about something different.
____________
The empty set

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

Tavern Dweller
posted December 28, 2022 01:53 PM

AlexSpl said:
There are only 255 different skill trees for any hero for PARTICULAR set of allowed skills. A tree number (1 <= N <= 255) is selected in a random way for each hero when a new game is generated or an old one is restarted. Nevertheless, it's possible to change a current skill tree e.g. having visited a Witch's Hut. The new version (3.80) of LMOracle shows a current skill tree number (N).

So, what do you need to know in order to be able to predict which skills will be offered on the next level-up?

The first way.
You can create a database including 156*255 = 39780 different skill trees. Then you may compare your current secondary skill development with skill trees from the database (255 skill trees aren't too many). It's a good way because there is no cheating at all! Though you cannot predict your hero's development from the very beginning because of existence of similar trees.

For example, there is only one skill tree for Crag Hack when he offered Diplomacy at lvl2 (skill tree #112) for the full set of skills. And what? If it happens it's guaranteed your Crag Hack gets Expert Logistics at lvl4: Offense 3, Logistics 1, Logistics 2, Logistics 3 and Expert Tactics at lvl7 provided that all skills are allowed on a map of course.

The big lack of this method is a dependence on a set of the allowed skills.

The second way.
This way supposes you know your hero's skill tree number and also which skills are forbidden on a map. You cannot see a skill tree number unless you use special tools (LMOracle, or WinHex at last ). Also you need the map editor (or something else) to see which skills are restricted on the map from which your game is generated.

I Prologue
Let's assume that all skills are allowed on the map we are playing (at least for a while). Every secondary skill has an internal game number:
0 - Pathfinding
1 - Archery
2 - Logistics
3 - Scouting
4 - Diplomacy
5 - Navigation
6 - Leadership
7 - Wisdom
8 - Mysticism
9 - Luck
10 - Ballisctics
11 - Eagle Eye
12 - Necromancy
13 - Estates
14 - Fire Magic
15 - Air Magic
16 - Water Magic
17 - Earth Magic
18 - Scholar
19 - Tactics
20 - Artillery
21 - Learning
22 - Offense
23 - Armorer
24 - Intellegence
25 - Sorcery
26 - Resistance
27 - First Aid

28 secondary skills in total.
There is an algorithm which allows you to predict skill offer when leveling-up a hero.

II The algorithm. Part I
1. Hero_Level = Hero_Level + 1;
2. Seed = 214013 * Hero_Level + 156823 * N + 154079 (N is a skill tree number);
3. Let's define the procedure _rand that generates randomness:

procedure _rand(ROld: DWORD; var RNew, Q: DWORD);
var R1, R2, R3: DWORD;
begin
 R1 := ROld;
 asm
   mov   eax, R1
   imul  eax, 343FDh
   add   eax, 269EC3h
   mov   R2, eax
   shr   eax, 10h
   and   eax, 7FFFh
   mov   R3, eax
 end;
 RNew := R2;
 Q := R3
end;


_rand(Seed, SEC, PRI);

In other words, SEC = 214013 * Seed + 2531011 (Leave only 4 bytes as a result), PRI = SEC div 65536 (Leave only 15 bits as a result, so PRI cannot exceed 32767).
PRI value is used in calculations to determine which PRIMARY skill will be increased.
SEC value is used for secondary skills prediction.

Now let us roll 100-sided dice!
4. Q = PRI mod 100 + 1.

To be continued...


Hi, do you know if that rule of 255 posible trees is working in HotA? If it is, I have another question, do you know how to read a number of a current tree in saved game? I opened a save (HotA +HDMod) in HxD but is was total mess.
____________

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


Responsible
Supreme Hero
posted January 06, 2023 12:12 PM

Use LMOracle.

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

Tavern Dweller
posted September 02, 2023 09:29 AM
Edited by qq3455307605 at 12:15, 04 Sep 2023.

thanks

Thank you so much to all of the above for the tutorials!
____________

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

Page compiled in 0.1668 seconds