Hi all. I am playing around with an idea I have for room conveyors. A Conveyor is a room that pushes all of the players in it out to a predetermined location at a predetermined interval. I have used mob SPECIAL's for this in the past, but when a friend suggested a ski hill (with Ogres operating the chair lift), I realized I would need something more complicated. I have everything coded and working but there are one or two things I would like to tweak. The way I coded the delay was to have a "delay" variable as part of the room_data structure. My function update_conveyors() is called once per second, and I iterate through all the rooms looking for conveyors. I have enough memory/CPU speed that this is not a performance hit, but I may improve that eventually anyway. I use the following test for each room to see if players should be conveyed to the next room: if (pulse % (room->delay * PASSES_PER_SEC)) continue; /* Skip this room for now */ This creates the problem that if the room that the char is conveyed to is also a conveyor operating on the same interval, and if that room happens to have a higher rnum, the player is immediately conveyed beyond the next room, and all the way up the mountain (in the case of my chair lift). So, I added a flag to char_data that I can set in that scenario and test for on subsequent iterations. This led me to think about the intervals themselves. If all my rooms in a single line use the same interval, there is a consistent delay from room to room. But if rooms use different intervals, the amount of time a player spends in a given room can vary due to the nature of the above test. If for example, room 1 uses an 8 second delay, and room 2 uses a 16 second delay, the delay in room 2 is actually either 8 or 16, not just 16. A possible workaround would be to add a counter to char_data that gets incremented each second and reset in char_to_room(). This counter would be used in place of the pulse. That works fine for ski slopes, but not so good for chair lifts, which should swing around at regular intervals regardless of when players happen to walk in. I have not included the code, since this message is already fairly long and the code is quite extensive. Anyone interested can e-mail me directly and I will send it to you. Does anyone have any comments/suggestions on any of this? I am currently leaning toward having two different kinds of conveyors, but I would prefer to keep the code generic if I can pull it off. Mike -- +---------------------------------------------------------------+ | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html | | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html | +---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/05/01 PST