Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Vanilla

Reply
 
Thread Tools Display Modes
Old November 4, 2018, 11:29   #1
wobbly
Veteran
 
Join Date: May 2012
Location: Adelaide, Australia
Posts: 1,659
wobbly is on a distinguished road
Comments on themed level gen part 1 - interesting rooms

You know when I look through vaults.txt I'm seeing a lot of this:

min-depth:0
max-depth:0

but occasionally not. occasionally I see this:

Code:
name:Little eruption
type:Interesting room
rating:0
rows:10
columns:18
min-depth:6
max-depth:35
D:   %%%%%%%%%%%%%%%
D:%%%%*.:..u:.#...:%
D:%:##.u.:.#.uu```.%
D:%#`#:.u:```:`u..:%
D:%`##.#*`````:u#:.%
D:%%````````:`*..::%
D: %u.:`u.*:#.`.:##%
D: %%#.`..#:uu`...#%
D:  %:`:::.#:..:%%%%
D:  %%%%%%%%%%%%%   

name:Little eruption+
type:Interesting room
rating:0
rows:10
columns:18
min-depth:45
max-depth:0
D:   %%%%%%%%%%%%%%%
D:%%%%*.:..U:.#...:%
D:%:##...:.#..U```.%
D:%#`#:.U:```:`U..:%
D:%`##.#*`````:.#:.%
D:%%````````:`*.U::%
D: %U.:`U.*:#.`.:##%
D: %%#.`..#:U.`U..#%
D:  %:`:::.#:..:%%%%
D:  %%%%%%%%%%%%%
I'm sure people who are playing a lot recognize these 2 along with the rough level at which they appear. These have a slightly different aesthetic to a lot of the other V rooms & appear within specific level ranges. It is my feeling that this is an under-utilized trick for adding variety into the dungeon.
wobbly is offline   Reply With Quote
Old November 4, 2018, 11:37   #2
wobbly
Veteran
 
Join Date: May 2012
Location: Adelaide, Australia
Posts: 1,659
wobbly is on a distinguished road
Comments on themed level gen part 2 - multiple runs of monster placement

Following is part of the level gen code in coffee-band. The actual numbers are not necessarily good yet, I'm just presenting the idea. For those familiar with the code you can probably see that a chunk of it is just a copy of the Moria-level gen.

First it does a normal run placing monster. Then it does a 2nd run placing monsters to theme. In the following it uses the "Tolkienizer" which is set in (pits.txt). Finally it does a 3rd run placing to a 2nd theme, in this case the moria-themed level set.

Code:
/* Pick a base number of monsters */
    i = z_info->level_monster_min + randint1(8 + k);

	/* Remove all monster restrictions. */
	mon_restrict(NULL, c->depth, true);

    /* Put some monsters in the dungeon */
    for (; i > 0; i--)
		pick_and_place_distant_monster(c, p, 0, true, c->depth);

    /* Extras - MC */
	mon_restrict("Tolkienizer", c->depth, true);

     /* Pick a base number of monsters */
   	  i = MIN(((c->depth / 5) + 3), ((z_info->level_monster_min) - (player->state.skills[SKILL_STEALTH] / 3)));

    /* Put some monsters in the dungeon */
    for (; i > 0; i--)
		pick_and_place_distant_monster(c, p, 0, true, c->depth);

	/* Remove our restrictions. */
	(void) mon_restrict(NULL, c->depth, false);

/* Extras - MC */
	mon_restrict("Moria dwellers", c->depth, true);

     /* Pick a base number of monsters */
   i = (c->depth / 5) + 2;

    /* Put some monsters in the dungeon */
    for (; i > 0; i--)
		pick_and_place_distant_monster(c, p, 0, true, c->depth);

	/* Remove our restrictions. */
	(void) mon_restrict(NULL, c->depth, false);
wobbly is offline   Reply With Quote
Old November 8, 2018, 06:46   #3
wobbly
Veteran
 
Join Date: May 2012
Location: Adelaide, Australia
Posts: 1,659
wobbly is on a distinguished road
So I'm not sure if anyone is interested in this stuff but perhaps I'll prattle a bit while I'm playing around, just in case.

It would seem that in interesting rooms for monster placement I can do:

Some no. - random monster by depth
c - monster_restrict(centipede)

but not:
some symbol - monster_restrict(pitname)

This seems a loss? I can see a centipede nest which could be a creepy crawler nest for instance.

Item-wise I think(have to double check):
? - scroll works (maybe)
" - amulet doesn't

This is ruining a gag in my own variant where cpb quest rewards are floor items. For instance there's a bow in Ap room but the parser treats it as an empty square.

So there's stuff here that just works & some stuff here that might be nice to have working.
wobbly is offline   Reply With Quote
Old November 8, 2018, 12:28   #4
Nick
Vanilla maintainer
 
Nick's Avatar
 
Join Date: Apr 2007
Location: Canberra, Australia
Age: 53
Posts: 7,188
Donated: $60
Nick is on a distinguished road
Most of the credit for this goes to Leon Marrick and Bahman Rabii, the Oangband creators.

Quote:
Originally Posted by wobbly View Post
It would seem that in interesting rooms for monster placement I can do:

Some no. - random monster by depth
c - monster_restrict(centipede)

but not:
some symbol - monster_restrict(pitname)

This seems a loss? I can see a centipede nest which could be a creepy crawler nest for instance.

Item-wise I think(have to double check):
? - scroll works (maybe)
" - amulet doesn't

This is ruining a gag in my own variant where cpb quest rewards are floor items. For instance there's a bow in Ap room but the parser treats it as an empty square.

So there's stuff here that just works & some stuff here that might be nice to have working.
If you look at the top of vault.txt there's a key for what you can use.
__________________
One for the Dark Lord on his dark throne
In the Land of Mordor where the Shadows lie.
Nick is offline   Reply With Quote
Old November 8, 2018, 13:31   #5
wobbly
Veteran
 
Join Date: May 2012
Location: Adelaide, Australia
Posts: 1,659
wobbly is on a distinguished road
True & it's quite useful. However if I wasn't on my phone I'd be a smart arse & quote you back at yourself. "code documentation is not up to date". Take a look at little eruption in the 1st post. Is lava in the key? What about 'u'. It's obvious that there are undocumented symbols that work. Which do & don't are unclear without looking at code underneath.

Go down to room_template. This also has a key. Template rooms are 1,2 & 3 in dungeon_profile.txt. I can't work out from the key how they are differentiated.

For reference I'm not complaining. It's a matter of if there are things that work not in the key and someone says "there's a key", I'm going to say "key's incomplete".
wobbly is offline   Reply With Quote
Old November 8, 2018, 17:13   #6
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 4,971
Donated: $40
Pete Mack is on a distinguished road
Q: in what file is the vault.txt parser/assembler defined?
Pete Mack is offline   Reply With Quote
Old November 8, 2018, 21:15   #7
Nick
Vanilla maintainer
 
Nick's Avatar
 
Join Date: Apr 2007
Location: Canberra, Australia
Age: 53
Posts: 7,188
Donated: $60
Nick is on a distinguished road
Quote:
Originally Posted by wobbly View Post
True & it's quite useful. However if I wasn't on my phone I'd be a smart arse & quote you back at yourself. "code documentation is not up to date".
Just as well you're on your phone, then

Quote:
Originally Posted by wobbly View Post
Take a look at little eruption in the 1st post. Is lava in the key? What about 'u'. It's obvious that there are undocumented symbols that work. Which do & don't are unclear without looking at code underneath.
Yes, correct - '`' is lava, and monsters (aside from mimics) can be placed using their glyph from monster_base.txt.

Note that with monsters and specific objects, placement may fail if there's nothing of appropriate depth.

Quote:
Originally Posted by wobbly View Post
Go down to room_template. This also has a key. Template rooms are 1,2 & 3 in dungeon_profile.txt. I can't work out from the key how they are differentiated.
Yeah, IIRC Nomad suggested at one point having different types of template room, so we put facility for three in there, but currently they're all type 1.

Quote:
Originally Posted by Pete Mack View Post
Q: in what file is the vault.txt parser/assembler defined?
generate.c has the file parsing, but more informative is gen-room.c (build_room_template() and build_vault()) which turn the strings into actual vault contents.
__________________
One for the Dark Lord on his dark throne
In the Land of Mordor where the Shadows lie.
Nick is offline   Reply With Quote
Old November 8, 2018, 21:30   #8
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 4,971
Donated: $40
Pete Mack is on a distinguished road
On the vault generation code, it looks like the amulet code is already there and is identical to the ring code, so I don't see why they won't get generated. BTW: here is another ugly if else stack, with the action taken identical except for a couple constants (the letter and the ovject type.) Just sayin'.
Pete Mack is offline   Reply With Quote
Old November 8, 2018, 21:59   #9
wobbly
Veteran
 
Join Date: May 2012
Location: Adelaide, Australia
Posts: 1,659
wobbly is on a distinguished road
Thanks to the both of you.

It looks like amulets are 1 in 4 chance, though I might just be misinterpreting that, I'll look at closer later. There's also stuff in that room that can pickup items, so there's a bunch of things that could of caused it not to be there.

The bow it seems can't be called directly. It's | (weapon) then 1 in 4 chance of bow. & I guess I now know , does food rather then mushroom patches.

Re: Ugly long if/thens - quite possibly, though from my perspective it's easier to read then a more compact format.
wobbly is offline   Reply With Quote
Old November 8, 2018, 22:30   #10
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 4,971
Donated: $40
Pete Mack is on a distinguished road
In a more compact format, there would nust be an zero-terminated array of the objects and associated symbol that are valid. Then a bit of special purpose code for weapon/bow creation. It is standard object-oriented technique in non-OO languages, and it is a lot easier to read. Monster if-else statements are a pain to read. Array initialization is a lot easier to read quickly, and then you don't actually need to read the code at all to see what is happening.
Pete Mack 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
How does level gen work? wobbly Vanilla 26 July 22, 2018 11:07
Level feelings, or "a not much interesting thread" fph Vanilla 6 September 25, 2011 21:45
Feature idea: themed staircases Derakon Vanilla 16 August 9, 2010 18:12
[Feature Request] Themed descriptive terms JamesDoyle Vanilla 7 January 27, 2008 00:01
a couple interesting comments about my current game will_asher AAR 4 June 8, 2007 18:22


All times are GMT +1. The time now is 06:28.


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