Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Development

Reply
 
Thread Tools Display Modes
Old August 24, 2010, 12:39   #1
Hajo
Adept
 
Hajo's Avatar
 
Join Date: Aug 2010
Posts: 142
Hajo is on a distinguished road
Limiting out of depth monsters

I want to limit out of depth monsters, particularly on the early dungeon levels.

I'm not quite sure if I found the right place, and also not quite sure if my new formula will work as intended. So I want to ask here. I'm Using the Angband 2.9.3 codebase, I hope a few of you will still remember that.

In the file monster2.c there is a procedure get_mon_num() which calculates a monster number appropriate for the given depth. It has a block:
Code:
		/* Occasional "nasty" monster */
		if (rand_int(NASTY_MON) == 0)
		{
			/* Pick a level bonus */
			int d = level / 4 + 2;

			/* Boost the level */
			level += ((d < 5) ? d : 5);
		}
I have changed this to:

Code:
		/* Occasional "nasty" monster */
		if (rand_int(NASTY_MON) == 0)
		{
			/* Pick a level bonus */
			int d = level / 5;

			/* Boost the level */
			level += ((d < 5) ? d : 5);
		}
The new code should not generate out of depth monsters for the first 5 levels if I understood right. Also have a more shallow curve for generating OOD monsters later. Do you think this will work as intended?
__________________
I have a project problem? I have no project problem. I start a project, I work on it, it fails. No problem
Hajo is offline   Reply With Quote
Old August 24, 2010, 13:02   #2
Sirridan
Knight
 
Sirridan's Avatar
 
Join Date: May 2009
Posts: 560
Sirridan is on a distinguished road
At level 5 it should generate a one level ood monster, or a level 6.
Sirridan is offline   Reply With Quote
Old August 24, 2010, 13:07   #3
Hajo
Adept
 
Hajo's Avatar
 
Join Date: Aug 2010
Posts: 142
Hajo is on a distinguished road
Right. I started counting at 0, but that is town.

Right now I wonder if I can diff&patch my changes to Angband 2.9.3 into Angband 3.1.2v2 ... the overall code structure looks similar but I guess a lot of things have changed in between.
__________________
I have a project problem? I have no project problem. I start a project, I work on it, it fails. No problem
Hajo is offline   Reply With Quote
Old August 24, 2010, 14:43   #4
RogerN
Swordsman
 
RogerN's Avatar
 
Join Date: Jul 2008
Posts: 308
RogerN is on a distinguished road
Note that the last line of code ensures that no monsters are ever generated more than 5 levels OOD (I don't think this applies to vaults, though). This means that the formula has no effect after level 25 using your formula (and it has no effect after level 12 using the original formula).
RogerN is offline   Reply With Quote
Old August 24, 2010, 18:30   #5
Hajo
Adept
 
Hajo's Avatar
 
Join Date: Aug 2010
Posts: 142
Hajo is on a distinguished road
I'm not sure if I follow. The

level += ((d < 5) ? d : 5);

limits the level "boost" to at most 5 levels of the nasty monsters. But there can still be 5 level OOD monsters generated after 12 (or 25) levels?
__________________
I have a project problem? I have no project problem. I start a project, I work on it, it fails. No problem
Hajo is offline   Reply With Quote
Old August 24, 2010, 19:58   #6
Sirridan
Knight
 
Sirridan's Avatar
 
Join Date: May 2009
Posts: 560
Sirridan is on a distinguished road
Quote:
Originally Posted by Hajo View Post
I'm not sure if I follow. The

level += ((d < 5) ? d : 5);

limits the level "boost" to at most 5 levels of the nasty monsters. But there can still be 5 level OOD monsters generated after 12 (or 25) levels?
No, at 12 you can have a max ood of 2. That line can be rewritten like this, if you find the ternary operator (?) confusing.

Code:
if(d < 5)
    level += d;
else
    level += 5;
EDIT:

To be more precise, the level / 5 means that the max ood is one fifth the level, so a level 12 generates up to a 2 OOD monster, where level 25 generates a 5 ood. At level 60, level/5 is 12, but the line of code at the end limits it to 5.
Sirridan is offline   Reply With Quote
Old August 24, 2010, 21:03   #7
ekolis
Knight
 
ekolis's Avatar
 
Join Date: Apr 2007
Location: Cincinnati, OH, USA
Age: 36
Posts: 911
ekolis is on a distinguished road
Send a message via AIM to ekolis Send a message via MSN to ekolis Send a message via Yahoo to ekolis
Why not use MIN to be really clear?

level += MIN(d, 5);
__________________
You read the scroll labeled NOBIMUS UPSCOTI...
You are surrounded by a stasis field!
The tengu tries to teleport, but fails!
ekolis is offline   Reply With Quote
Old August 24, 2010, 21:31   #8
Hajo
Adept
 
Hajo's Avatar
 
Join Date: Aug 2010
Posts: 142
Hajo is on a distinguished road
Quote:
Originally Posted by Sirridan View Post
To be more precise, the level / 5 means that the max ood is one fifth the level, so a level 12 generates up to a 2 OOD monster, where level 25 generates a 5 ood. At level 60, level/5 is 12, but the line of code at the end limits it to 5.
Yes. That is quite what I wanted it to do. Sorry if my writing was not clear enough.
__________________
I have a project problem? I have no project problem. I start a project, I work on it, it fails. No problem
Hajo is offline   Reply With Quote
Old August 25, 2010, 06:59   #9
zaimoni
Knight
 
zaimoni's Avatar
 
Join Date: Apr 2007
Posts: 590
zaimoni is on a distinguished road
Quote:
Originally Posted by RogerN View Post
Note that the last line of code ensures that no monsters are ever generated more than 5 levels OOD (I don't think this applies to vaults, though). This means that the formula has no effect after level 25 using your formula (and it has no effect after level 12 using the original formula).
Actually, there are two level-boosting blocks to be modified; the maximum OOD level boost is the same at DL25 and lower [10].
__________________
Zaiband: end the "I shouldn't have survived that" experience. V3.0.6 fork on Hg.
Zaiband 3.0.10 ETA Mar. 7 2011 (Yes, schedule slipped. Latest testing indicates not enough assert() calls to allow release.)
Z.C++: pre-alpha C/C++ compiler system (usable preprocessor). Also on Hg. Z.C++ 0.0.10 ETA December 31 2011
zaimoni is offline   Reply With Quote
Old August 25, 2010, 11:42   #10
Hajo
Adept
 
Hajo's Avatar
 
Join Date: Aug 2010
Posts: 142
Hajo is on a distinguished road
In the original code there were two of such blocks directly behind each other, so the level boost could happen twice. Is this what you mean? Or is there a different location in the source that must be adapted too?
__________________
I have a project problem? I have no project problem. I start a project, I work on it, it fails. No problem
Hajo is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Native depth visual spoiler fph Vanilla 9 August 4, 2010 19:34
Max depth of artifacts r1886 Psi Development 5 January 13, 2010 20:49
Object recall depth bug in r1886 Psi Development 1 January 12, 2010 16:41
Delurks with depth and rChaos question richdunlop AAR 7 May 12, 2008 09:37
Recommended Depth Levels for my Char Level steeg1234321 Vanilla 10 March 15, 2008 09:08


All times are GMT +1. The time now is 10:47.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.