Resetting the automap?

Error message

Deprecated function: implode(): Passing glue string after array is deprecated. Swap the parameters in drupal_get_feeds() (line 394 of /var/www/pied-piper.ermarian.net/includes/common.inc).

Pages

AuthorTopic: Resetting the automap?
Law Bringer
Member # 2984
Profile Homepage #25
There's a function in the editor that puts walls around an enclosed space, right? Perhaps one might adapt that somehow...

--------------------
EncyclopaediaArchivesMembersRSS [Topic / Forum] • BlogPolarisNaNoWriMo
Look on my works, ye mighty, and despair.
I have a love of woodwind instruments.
Posts: 8752 | Registered: Wednesday, May 14 2003 07:00
...b10010b...
Member # 869
Profile Homepage #26
Not every editor function has a corresponding script call. :P

--------------------
The Empire Always Loses: This Time For Sure!
Posts: 9973 | Registered: Saturday, March 30 2002 08:00
Shock Trooper
Member # 4557
Profile #27
I looked at the Angband code and all the dungeon creation code seems to be in generate.c. The code is basically straight C, the functions are in an ascending order of importance (meaning the very last function generates a random level) and its very well commented, so it shouldn't be too hard to extract a generic algorithm for each function.

EDIT: The code is in generate.c, not dungeon.c.

[ Saturday, November 19, 2005 12:26: Message edited by: KernelKnowledge12 ]
Posts: 264 | Registered: Wednesday, June 16 2004 07:00
Law Bringer
Member # 2984
Profile Homepage #28
quote:
Originally written by Thuryl:

Not every editor function has a corresponding script call. :P
No, but the editor is open-source, and assuming that Jeff somehow coded an algorithm that sets these walls, it might be possible to use the same algorithm to set the walls in the game.

--------------------
EncyclopaediaArchivesMembersRSS [Topic / Forum] • BlogPolarisNaNoWriMo
Look on my works, ye mighty, and despair.
I have a love of woodwind instruments.
Posts: 8752 | Registered: Wednesday, May 14 2003 07:00
Off With Their Heads
Member # 4045
Profile Homepage #29
It would probably be easier just to write the algorithm yourself. I mean, seriously.

--------------------
Arancaytar: Every time you ask people to compare TM and Kel, you endanger the poor, fluffy kittens.
Smoo: Get ready to face the walls!
Ephesos: In conclusion, yarr.

Kelandon's Pink and Pretty Page!!: the authorized location for all things by me
The Archive of all released BoE scenarios ever
Posts: 7968 | Registered: Saturday, February 28 2004 08:00
...b10010b...
Member # 869
Profile Homepage #30
I predict that the 64000-command limit is almost certainly going to be a problem if you try anything too fancy. You might have to make each level of the cave fairly small.

--------------------
The Empire Always Loses: This Time For Sure!
Posts: 9973 | Registered: Saturday, March 30 2002 08:00
Law Bringer
Member # 2984
Profile Homepage #31
With infinite variety for the cave design, a small cave would not be a problem. Even the 48*48 (that's the minimum for BoA, right? There were smaller ones in BoE, though) square would be big enough for a few rooms and tunnels, and a couple of monsters placed strategically. Add to that a bit of fancy stuff to randomly generate monsters - this could be called while the player explores, which should move it out of the initial thread of commands - and the level is done...

Of course, it sounds way easier than it would be. Still, after November is out I might fiddle around a little with the editor and try out some of these concepts.

--------------------
EncyclopaediaArchivesMembersRSS [Topic / Forum] • BlogPolarisNaNoWriMo
Look on my works, ye mighty, and despair.
I have a love of woodwind instruments.
Posts: 8752 | Registered: Wednesday, May 14 2003 07:00
Master
Member # 5977
Profile Homepage #32
Isn't it much easier to just designing maybe 50 small towns, and link them to certain stuff done flags? Then, while the player walks around in the tunnel, the player gets messages, saying "you hear stone grinding on stone and slight vabrations make you blah blah blah......." When this messages gets triggered, a certain town has been moved into another place, or a wall was shifted. This way you would get a huge number of possibilities and things to change. The only problem is maybe that in the end the player will get tottaly frustrated by the constant moving and changing of the tunnel.... I could actually easily make a story arounf this now that i think of it. This would make a nice scenario: "the tunnel of shifting rooms," or something like that. Good one, aran!

[ Sunday, November 20, 2005 00:07: Message edited by: Thralni, emperor of Riverrod ]

--------------------
Play and rate my scenarios:

Where the rivers meet
View my upcoming scenario: The Nephil Search: Escape.

Give us your drek!
Posts: 3029 | Registered: Saturday, June 18 2005 07:00
Law Bringer
Member # 2984
Profile Homepage #33
The idea is to have the levels change both ways - going up, and going down, the level is regenerated anew every time. Even after reloading from a saved game, the levels would be generated differently.

--------------------
EncyclopaediaArchivesMembersRSS [Topic / Forum] • BlogPolarisNaNoWriMo
Look on my works, ye mighty, and despair.
I have a love of woodwind instruments.
Posts: 8752 | Registered: Wednesday, May 14 2003 07:00
Apprentice
Member # 5044
Profile #34
Here's my code for putting walls round stuff:

x = 3;
y = 3;

while (x < 60){
while (y < 40){

if (get_floor(x , y) == 71) {

if (get_floor(x , y - 1) != 71) {set_terrain(x,y,2);} // North
if (get_floor(x - 1 , y) != 71) {set_terrain(x,y,3);} // West
if (get_floor(x , y + 1) != 71) {set_terrain(x,y,4);} // South
if (get_floor(x + 1 , y) != 71) {set_terrain(x,y,5);} // East

if ((get_floor(x , y - 1) != 71) && (get_floor(x - 1 , y) != 71)) {set_terrain(x,y,6);} // North and West
if ((get_floor(x , y + 1) != 71) && (get_floor(x - 1 , y) != 71)) {set_terrain(x,y,7);} // West and South
if ((get_floor(x , y + 1) != 71) && (get_floor(x + 1 , y) != 71)) {set_terrain(x,y,8);} // South and East
if ((get_floor(x , y - 1) != 71) && (get_floor(x + 1 , y) != 71)) {set_terrain(x,y,9);} // East and North
}

y = y + 1;
}
y = 3;
x = x + 1;
}
It only works if each pit square is in groups of at least two. This is because the walls are being put on the pit square and squares can't have walls on more than two sides (a downside of the engine if you ask me, hint, hint, cough, cough).

The command limit is an issue. I break my code into three separate bits: the random room creation is done in init_state; the walls are added by a special node; and the terrain is frilled up by another special node.
Posts: 30 | Registered: Sunday, October 3 2004 07:00
Law Bringer
Member # 2984
Profile Homepage #35
I haven't had a chance to try it, and won't for the next few days, but that looks awesome! :)

quote:
It only works if each pit square is in groups of at least two.
One square pits shouldn't be an issue really - after all, they really don't occur that often in everyday town designs, and when they do, they rarely need to be walled in.

Many thanks for that code!

--------------------
EncyclopaediaArchivesMembersRSS [Topic / Forum] • BlogPolarisNaNoWriMo
Look on my works, ye mighty, and despair.
I have a love of woodwind instruments.
Posts: 8752 | Registered: Wednesday, May 14 2003 07:00
Apprentice
Member # 5044
Profile #36
Oops! I forgot to mention that I use pit for all squares on the map that the player is not meant to go on (this way they look black on the automap). I then use this code to put the walls on the pit squares, giving walled in caves. This leaves the cave squares free to be frilled up (with stalactites, nests, bones, thermonuclear weapons and any other terrain types relevant to the town).

The pit squares MUST be in groups of at least two in each dimension or else putting walls on the doesn't work. This is kind of hard to explain, but I think you'd realise if you had a go.

I'm excited to see your random room generation, as my random maker isn't that sophisticated.

EDIT: You could easily change the code to look for blackness rather than pit, I just use it as this is the way by random maker works.

[ Monday, November 21, 2005 00:20: Message edited by: demipomme ]
Posts: 30 | Registered: Sunday, October 3 2004 07:00
Law Bringer
Member # 2984
Profile Homepage #37
Yes, I'd figured as much. To have a wall around it, you need this kind of square as the smallest unit:

....
.BB.
.BB.
....

(B=blackness)
What does the script do when it finds a smaller pit? Wall it improperly, return an error, or just leave it alone?

--------------------
EncyclopaediaArchivesMembersRSS [Topic / Forum] • BlogPolarisNaNoWriMo
Look on my works, ye mighty, and despair.
I have a love of woodwind instruments.
Posts: 8752 | Registered: Wednesday, May 14 2003 07:00
Infiltrator
Member # 3040
Profile #38
Does anyone know if arithmetic operations are included in the limit? If not, then I came up with a different algorithm based on demipomme's that might be more efficient:

// Assumes that the only regular floor is 1, and everything to be surrounded with walls is 0
set_flag(100,0,0); // None: No terrain
set_flag(100,1,3); // West
set_flag(100,2,4); // South
set_flag(100,3,7); // South & West
set_flag(100,4,5); // East
set_flag(100,5,0); // East & West: No terrain
set_flag(100,6,8); // East & South
set_flag(100,7,0); // East, South, West: No terrain
set_flag(100,8,2); // North
set_flag(100,9,6); // North & West
set_flag(100,10,0); // North & South: No terrain
set_flag(100,11,0); // North, South, West: No terrain
set_flag(100,12,9); // North & East
set_flag(100,13,0); // North, East, West: No terrrain
set_flag(100,14,0); // North, East, South: No terrain
set_flag(100,15,0); // North, East, South, West: No terrain

x = 3;

while (x < 60) {
y = 3;
while (y < 40) {
if (get_floor(x, y) == 0) {

i = 8*get_floor(x , y - 1) + 4*get_floor(x + 1 , y) + 2*get_floor(x , y + 1) + get_floor(x - 1 , y);

set_terrain(x, y, get_flag(100, i));
}
y = y + 1;
}
x = x + 1;
}
I haven't tested it extensively, so I don't know how many operations it uses, but if anyone wants to give it a try and let me know how it compares, I'd appreciate it.

[ Monday, November 21, 2005 08:36: Message edited by: wz. arsenic... ]

--------------------
5.0.1.0.0.0.0.1.0...
Posts: 508 | Registered: Thursday, May 29 2003 07:00

Pages