Help with understanding turns

The Cathedral of Attnam > Trouble Shooting and Bugs

#1 Jul 19, 10:48 am Hide


Hi, I'm new here and this is my first attempt to solve something by changing/looking at the code.

My problem was that I had too much trouble raising some stats - I just made it to Oree level with 11 agility and 17 dex and just couldn't dodge enough critical strikes from the knights. I wanted to see the code and figure out what was I doing wrong so I could finally get more jumpy in the future runs.

I edited ivan sc to print out changes in experience, and what I found out is that every turn of moving I get the normal ammount of agility, and then lose just a little bit because I'm burdened or satiated... except I was gaining exp once per turn and losing it 10 times!. Then I traced the problem back a bit and figured out that my character actually exists around 10 times each turn(this varies a bit). This is the edit I did on char.cpp:989:
void character::Be()
  if (IsPlayer()) ADD_MESSAGE("Ping!"); is unchanged
Ping! would print at least 10 times every time I moved. This is a problem because every time the character happens, it loses a bit of experience which is at the end of the game so high that just being burdened, without any other modifiers, makes you lose AGI when moving.
Is this a bug, or is it intended to happen this way? I guess this is the way characters attack multiple times in one turn, but it don't match the agility gain.
#2 Jul 19, 12:25 pm Hide


Hmm - I don't have an answer (perhaps one of our resident devs knows something?) but I suspect this has something to do with the way time is handled. However, just a glancing thought on this makes me think that this could result in "snowballing" agility training. If it takes several turns to move, and each turn costs you training points, then it's in your best interest to minimize the number of turns it takes to move - that is, to increase your agility. So having high agility results in having higher agility.

Other tangentially related comments - R'u'nning will generate more agility training than walking, and obviously you should avoid being burdened when trying to train agility. Additionally, each character is created with certain aptitudes which modify how quickly they gain training points in each attribute - a quick character will train agility and dexterity faster, but may (for example) train arm/leg strength more slowly. Also, I suspect but have no evidence that evading attacks generates agility training, so being in combat is good for your AGI. Although this also leads back to the problem I mentioned earlier, where high stats lead to higher stats.
#3 Jul 19, 2:30 pm Hide


You are right about snowballing but that's not really the problem if agility loss is tied to agility gain, so they happen at the same time. This way the worst thing could be that you are leveling faster than monsters around you.

Dodging trains agility. And perception too!
(I scaled exp. to show only progress towards next level which would happen at 1000 exp. in that attribute). If I understand the code right, I scaled experience down 25 times from how original game sees it. Agility is tied to limbs, so the message pops up once for each limb trained. Message log gets clogged very quickly so I only use this for debugging, but if you want(and trust me not to send a virus to you) you can download my build(.exe) here:
I removed the pings, you can't see anything from the ammount of them.
I also removed hungry, satiated, and burdened attribute loss so if you want to see the bad thing happening go for more extreme states.
#4 Jul 19, 2:36 pm Hide


Also, running in the wild at the beginning of the game gives you an enormous boost to agility, from now on I'm just gonna buy all the bananas from new attnam and do this at the start of every run. You can easily get to 15 AGI.
#5 Jul 20, 1:42 am Hide


The game has ticks where it runs Be() for all entities. A creature can act on any tick where it has 1000+ Action Points, and with 10 DEX/AGI, that's every 10th tick. So there are 10 sub-turns per turn at the start of the game, but as your stat get higher, you will be able to act more often.

Getting negative experience for hunger/encumbrance is intended and balances out the gains from movement, combat etc. Unless you are constantly Strained and Overfed, you will slowly train AGI; if you want to train it faster, you have to be unencumbered and run around. But as Ischaldirh mentioned, each character gets a modifier that changes the amount of experience needed to level a stat, so some characters will slowly loose AGI if they are burdened, while others will get it quite fast anyway.

No snowballing happens, increased gains of exp are balanced out by diminishing returns at higher stats.

Yup, you can train AGI fast by running in wilderness. Not sure if that is completely intended, but it works.
#6 Jul 20, 4:07 am Hide


Thanks for the reply. It seems that I understood propertly how character::Be() works, it's just that it seems to happen way more often later in the game, like 40 times every turn, which ruins agility. I will just continue studying the code until I figure out what is going on, because after rescuing the Aslona kiddo I am now actually losing agility rapidly even if just burdened, and gaining almost none while unburdened. My char is at 16 AGI. Aren't characters supposed to be able to go above 25 AGI even without ommel supplements?
#7 Jul 20, 5:00 am Hide


Vladivarius wrote
I am now actually losing agility rapidly even if just burdened, and gaining almost none while unburdened. My char is at 16 AGI. Aren't characters supposed to be able to go above 25 AGI even without ommel supplements?

Don't you have leprosy, or some other deletrious status effect? Leprosy would make you loose stat exp quite fast.

Yeah, you should be able to train past 20, especially when eg. running and unencumbered.
#8 Jul 20, 9:19 am Hide


No, I cleared myself of all negative effects. I have played the game for long enough that I know almost all the stuff you can find out on the wiki and by yourself, I don't think I'm doing anything wrong in the game. Besides, I have definitely narrowed the problem down to Hunger() being called a lot of times every turn, and the part where the game checks for burdened/hungry state.
#9 Jul 24, 12:01 pm Hide


Ah I figured out what is going on. Walking doesn't improve AGI beyond 17, and running doesn't improve it beyond 22. On the other hand the attribute drain will be there the whole time. Should I write an explanation of how experience system works, for others to see? And where should I post it.
#10 Jul 25, 1:52 am Hide


Sure, that would be great. You could add it on the wiki, there may already be some stub of an article about experience?
#11 Jul 25, 1:10 pm Hide


Here you go
#12 Jul 25, 1:28 pm Hide


IMO a rebalance is required here, and I have many different suggestions ranging from minor fixes to complete overhaul. I will write them down for the community later but for now I believe that burdened state should at least take into consideration a small AGI gain from walking rather than completely ignoring it after 17AGI and just draining it. There should be a way to finish the game without using artificial limbs, and I was under the impression that it would be possible when I get better at playing the game.
#13 Jul 25, 1:55 pm Hide


There definitely were wins with natural limbs, you just never reach the insane stats of artificial limbs. I don't think the player was ever intended to be able to train their stats much higher than cca 30ish.
#14 Jul 25, 6:00 pm Hide


red_kangaroo wrote
There definitely were wins with natural limbs

Can confirm. My first (and so far only) win was with natural limbs. I can't find the original post, but it involved twin maces and lots of starvation.

Natural limb victories are absolutely possible. Tough, but possible.
#15 Jul 27, 8:50 am Hide


I got a high priest victory with natural limbs in .50. killed petrus first then went for oree.
#16 Jul 31, 3:43 am Hide


Vladivarius wrote

This documentation is exceptionally well written, with concise explanations and clear examples.

Three areas of the game that are in real need of good explanations are:
1) the combat system
2) the weapons system
3) the danger system

If you can write the documentation for these, you will be rewarded with