Top Mud Sites Forum

Top Mud Sites Forum (http://www.topmudsites.com/forums/index.php)
-   MUD Coding (http://www.topmudsites.com/forums/forumdisplay.php?f=9)
-   -   Implementing Virtual rooms/areas (http://www.topmudsites.com/forums/showthread.php?t=449)

snowfruit 06-10-2002 11:39 AM

I know there is code out there to create virtual areas. that is you define the size and shape and seupply all the descriptions and such, but the code virtually creates the rooms so that they dont all have to be created seperately.
Does anyone know where i could find the code for this? Its for an amylaar LP mud btw

Cougar Khan 06-10-2002 01:53 PM

Snowfruit,

Why on Earth would you want to create a "virtual area?"

It is possible to do in LP and I have some examples I could send you - but I've never had anything but problems from them.

In the end it is easier to code up the rooms and just drop them into your directory.

Good luck and if you still want the code send me an IM where I can send some samples to you.

-C...

Eddy 06-10-2002 04:21 PM

This won't answer you question, but I felt an urge to reply anyway.

Your question makes me shiver almost as much as when I read some mud ad recently where they claimed to have 1,000,000 rooms. When you code a quality area the time it will take to create the actual files is marginal compared to them it takes to write it's content. Virtual rooms end up (in my experience) either as mazes or as hack 'n slash forests where every room is identical to the last.
"Well says the coder: It is a forest, what else do I need besides trees?"

Neither of those 2 results appeal to me as a coder and they are a huge turnoff for almost all players. Any 20 room area that was coded with care and detail will beat a 1000 room virtual area.

Perhaps I'm wrong in my assumption where you want to use it for. If so provide some details as to what you are trying to accomplish with it and I'm sure I can give you some ideas how to realise it (with or more likely without) the use of virtual rooms.

Greetings,
Eddy

snowfruit 06-10-2002 06:24 PM


Eddy 06-10-2002 07:57 PM


thelenian 06-10-2002 10:02 PM

Virtual area generators like the one being described are good for generating large tracks of uninteresting wilderness for RPI MUDs. While the ship hack described by Eddy will give the minimal illusion of travel needed for SoD on an average MUD, RPI MUDs need to think of the next step... What happens if someone throws you overboard? How far can you/your eq sink? At this point having a virtual room daemon starts to look mighty appealing.

Kastagaar 06-11-2002 03:14 AM

So, because it can be done badly, it must always be done badly?

Kas.

snowfruit 06-11-2002 06:43 AM


Eddy 06-11-2002 07:19 AM


Cougar Khan 06-11-2002 10:23 AM

On the MUD - I work on, we've gone to great lengths to try and remove many of the virtual areas in play. One they looked bad and two - they broke and players got stuck.

One of the situations we came up with was the ability to have a ship that moved in "real time" (or something less then instant.)

The ship is 8 rooms large - aft rooms, port rooms, starboard....
plus we have a room for water, where the player could "jump" off.  If the player jumped off, it is possible for the ship to leave them, and the player is stranded in the water until another ship came by. The ship is controled by slaves rowing, if you kill the slaves - the ship stops to row.

Here are my examples of making this work. In this first file - is the ship speed controller.

[code] /* Coded by Zor 05/98 */

#include <shadow.h>

#define SLAVEROOM               SHIP"slaveroom"

int query_speed();
int change_speed();

int howfast;

int change_speed(){
       object *inv;
       int count;
       int slavecount;
   object slave_room;

   slave_room = find_object_or_load(SLAVEROOM);
   if(!objectp(slave_room)) {
       howfast = 13;
       return howfast;
   }

   inv = all_inventory(slave_room);

   slavecount = 0;
   count = 0;
   while(count<sizeof(inv)) {
       if((int)inv[count]->query_is_slave() == 1) slavecount+=1;
   count++;
       }
      howfast=slavecount;
      howfast += 15;
      if(howfast == 0)  howfast = 6;
      if(howfast > 24)  howfast = 40;
       return howfast;
}

int query_speed() { return howfast; }

[/quote]

Here is the actual ship controller:

[code] /* Coded by Zor 12/98 */

#include <shadow.h>
#include "speed_m.h"

#define WATER       SHIP"water"
#define S_AFT        SHIP"star_aft"
#define P_AFT        SHIP"port_aft"
#define S_FORE      SHIP"star_fore"
#define P_FORE      SHIP"port_fore"
#define S_DECK      SHIP"star_deck"
#define P_DECK      SHIP"port_deck"
#define CABIN        SHIP"cabin"
#define SLAVEROOM   SHIP"slaveroom"

#define ATHENS1      SPATH"pier"
#define CRETE1        CRETE"pier"
#define FOOTPAD1    FOOTPAD"pier"
#define DANIEROS1   DANIEROS"Danae_pier1"
#define ATHENSCITY ATHENS"port3"

#define AT_DOCK     30
#define DISTANCE    40

inherit TREASURE;

void arrive();
void tell_ship(string);

string *ports, *port_paths;
int count, num_ports, from, distance_gone,speed;

void create() {
   ports = ({
   "South Port",
   "Crete",
   "Footpad Isle",
   "Danieros",
   "Athens City"
 });
   port_paths = ({
   ATHENS1,
   CRETE1,
   FOOTPAD1,
   DANIEROS1,
   ATHENSCITY,
 });
   ;;create();
   set_id("ship");
   set_alias("galley");
   set_alt_name("slave_galley");
   set_short("Slave Galley");
   set_long(
@DESC
The vessel before you is a large slave galley which has been known to ferry adventurers from island to island. Be warned however, although the captain does not ask for payment, money often goes missing from this ship's passengers.
DESC
   );
   count = 0;
   num_ports = sizeof(ports);
   from = count - 1;
   if(from < 0)
       from = num_ports - 1;
   this_object()->move_me(WATER);
   call_out("water", 20, 0);
}

int get(){
   return 0;
}

void init() {
   ;;init();
   add_action("board", "enter");
   add_action("board", "board");
}

int board(string str) {

   if(str != "ship" && str != "vessel" && str != "slave galley")
       return 0;
   if( random(10) > 3) {
       write("Someone on the boarding plank brushes up against
you\n");
       this_player()->add_money(-(random(70)));
   }
   write("You board the Slave Galley!\n");
   tell_room(environment(TO),sprintf("%s boards the slave galley.\n",
       NAME),this_player());
   tell_room(P_DECK,sprintf("%s boards the slave galley.\n",NAME));
   this_player()->move_me(P_DECK);
   this_player()->command("look brief");
   return 1;
}

void water(int distance_gone) {
   if(distance_gone < DISTANCE){
       speed=change_speed();
       distance_gone+=speed;
       if(speed>12) tell_ship(sprintf("The slaves are whipped and
beaten as they row to %s.\n",ports[count]));
       if(speed<13 && speed>2)tell_ship(sprintf("With effort the
slaves row to %s.\n",ports[count]));
       if(speed==2)tell_ship(sprintf("The currents carry the ship
towards %s.\n",ports[count]));
       remove_call_out("water");
       call_out("water", 20, distance_gone);
   }
   else {
       remove_call_out("water");
       distance_gone=0;
       arrive();
   }
}

void arrive() {
   tell_room(port_paths[count],sprintf(
       "A Slave Galley arrives from %s.\n", ports[from]));
   tell_room(WATER, "The slaves forced efforts carry the galley over
the horizon.\n");
   tell_ship(sprintf("The slave galley arrives at
%s.\n",ports[count]));
   TO->move_me(port_paths[count]);
   count++;
   if(count > num_ports - 1)
       count = 0;
   from = count - 1;
   if(from < 0) from = num_ports - 1;
   call_out("sail", AT_DOCK);
}


void sail() {
   remove_call_out("sail");
   tell_room(environment(TO), sprintf(
       "A whip cracks and the slaves begin rowing for
%s.\n",ports[count]));
   tell_room(WATER,sprintf(
       "A slave galley pulls in from %s.\n",ports[count]));
   tell_ship(sprintf("The slave galley continues on to
%s.\n",ports[count]));
   this_object()->move_me(WATER);
   call_out("water", 20,0);
}

void tell_ship(string mesg) {
   tell_room(S_FORE, mesg);
   tell_room(P_FORE, mesg);
   tell_room(S_DECK, mesg);
   tell_room(P_DECK, mesg);
   tell_room(S_AFT, mesg);
   tell_room(P_AFT, mesg);
   tell_room(CABIN, mesg);
   tell_room(SLAVEROOM, mesg);
}

int clean_up(){
   return 1;
}


string query_location() {
   return ports[count];
[/quote]


Good luck - and this is just one of the examples we have. Many of the other ones have been a bit tweaked. Let me know if we can help out with anything else.

-C...

P.S. I need to thank the Admin and Zor of for letting me show this code.


All times are GMT -4. The time now is 04:50 PM.

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright Top Mud Sites.com 2022