Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
oxseyn
Wanderer


Joined: 26 Nov 2011
Posts: 71
Location: Colorado Springs

PostPosted: Wed Mar 21, 2012 7:22 am   

Speedwalking with Delays
 
Any idea how it might be possible to speedwalk from one location to another that incorporates dynamic behaviors? For example ...

1. Walk to a specific location
2. Check if the ship is available
3. If the ship is not available signal the ship and wait for it to arrive - if the ship has not arrived within 10 seconds, signal the ship again. repeat until the ship arrives.
4. When the ship arrives, enter the ship, and send a command to sail to the destination
5. If we have not arrived at our destination within 10 seconds, send the command to sail to the destination again - repeat until we get there
6. Once we get to our destination, exit the ship and continue speedwalking to the final destination

Is something like this possible? If so, any ideas what the best way to solve this problem would be?
Reply with quote
bothkill
Apprentice


Joined: 13 Mar 2005
Posts: 125
Location: Bucharest

PostPosted: Wed Mar 21, 2012 7:33 am   
 
Looks to me here's the time for Multistate triggers.
Reply with quote
oxseyn
Wanderer


Joined: 26 Nov 2011
Posts: 71
Location: Colorado Springs

PostPosted: Wed Mar 21, 2012 3:59 pm   
 
bothkill wrote:
Looks to me here's the time for Multistate triggers.

Hmm, looks like this might be enough to implement a simple FSM (finite state machine). Anyone ever tried this and had any luck?
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Wed Mar 21, 2012 10:56 pm   
 
Almost any Cmud code with multistate triggers _is_ a finite state machine. For that matter, you don't even need multistate triggers to write a finite state machine in Cmud. A fairly simple set of interacting triggers would suffice. People have written some quite complex Cmud scripts, including entire autonomous bots on some muds that allow them.
Reply with quote
oxseyn
Wanderer


Joined: 26 Nov 2011
Posts: 71
Location: Colorado Springs

PostPosted: Thu Mar 22, 2012 11:31 am   
 
Trying to think about how to approach this ...

Let's go back to the problem above with the ship. Let's say I want to speedwalk across zones and I need to take the ship.
So, would it be possible to bind a script to a particular exit? So let's say I enter the room that links to the ship - if the ship is present (enter ship). The speed walk path knows that the next step is to "enter ship" so CMUD intercepts that command with a "sail" script that saves the target speedwalk destination, then performs a series of steps to ensure we sail correctly using the ship, then resume speedwalking from the current room to the previous destination.

Is that fesable? And an appropriate way to solve this problem with cmud? Is there a better way?
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Thu Mar 22, 2012 1:43 pm   
 
Yes, this would be possible. If you can describe the specific situation in detail, we can help figure out a way to do it. There will probably be half a dozen possible ways.
Reply with quote
oxseyn
Wanderer


Joined: 26 Nov 2011
Posts: 71
Location: Colorado Springs

PostPosted: Tue Apr 10, 2012 7:14 pm   
 
Rahab wrote:
Yes, this would be possible. If you can describe the specific situation in detail, we can help figure out a way to do it. There will probably be half a dozen possible ways.


Sorry, it's been a bit since you asked for the details ... here we go:

The first thing is, I would like the solution to use the standard speedwalking (#walk <dest>) functionality since I hope to nest these inside other scripts in the future (maybe that really doesn't matter, but it seems to me at the moment like it will).
My assumption is that in order for the speedwalking algorithm to find a path from the start to destination location there must be a connected path on the map. This means that there must be standard exits between all rooms (even nonstandard rooms) rather than something like an alias which would update my location on the map from one position to another.

So, step by step, here's what the functionality would look like:

1. I input command #walk <dest> (where destination is a remote location on another continent that I would have to sail to using a ship)
2. Character speedwalks to the ship, which may or may not be present.
3. Character now needs to know if the ship is present. We only care about whether or not the ship is present if we are specifically trying to enter the ship, not if we're passing through the room (this happens a lot).
4. If the ship is present we need to enter the ship, tell the captain to sail to our destination, and wait until we arrive before resuming walking.
5. If the ship is not present we need to signal the ship and wait for it arrive, then enter the ship, tell the captain to sail and wait for it to arrive until resuming walking.
** Note: The ship's can sail to multiple destinations.
6. Once we arrive we should resume speedwalking to the destination.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4691
Location: Pensacola, FL, USA

PostPosted: Tue Apr 10, 2012 7:36 pm   
 
Seems to me that you will need to:

1. give the various dock and destination rooms a short room name. (room properties window, beside the actual room name)
2. use a variable to keep track of which dock your ship is at

with that you will always be able to speedwalk to your boat when you need to- %pathfrom(,@dockname)

3. then i would make an alias to start the boarding, sail setting scenario
4. make a trigger for arrival to disembark and speedwalk to your final destination.
_________________
Discord: Shalimarwildcat
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Tue Apr 10, 2012 8:01 pm   
 
There's a few more details lacking.
a) From any one location, can you get to more than one ship? I don't know how your mud's world is designed, but, assuming it is a set of distinct islands, can there be more than one ship per island? If there is more than one ship per island, it will be more complicated, because we have to set it up such that the mapper can figure out which ship to go to, based on total distance.
b) You say that the ship can sail to multiple destinations. Are any of these destinations on the same island? If so, we will have to set it up so the mapper can figure out which destination to go to, based on total distance.
c) Is it possible for the sailing voyage to be interrupted--the ship stops in the middle, sinks, or something? If so, you will have to account for failed journeys somehow.
d) Is it possible for a ship not to come when you signal for it?
e) Are there actual ocean spaces on the map between islands/continents/whatever? If so, are there different descriptions of these spaces? Can you interact with them in any way (swimming, fishing, etc)? Are there any manually controlled boats which you can steer yourself in arbitrary directions?
e) Is it possible to leave the ship in the middle of the water? If so, I would recommend a completely different solution which would try to track the ship's journey so that the mapper can put you in the right place if you leave the ship somehow.
f) Does the ship itself have room name/description/exits/etc.? If so, does any of that change while you are underway, or when you are in different cities?

I can think of at least three possible types of solutions, but they all depend on different answers to these questions.
Reply with quote
oxseyn
Wanderer


Joined: 26 Nov 2011
Posts: 71
Location: Colorado Springs

PostPosted: Tue Apr 10, 2012 8:21 pm   
 
Rahab wrote:
There's a few more details lacking.

Yar :)

Quote:
a) From any one location, can you get to more than one ship? I don't know how your mud's world is designed, but, assuming it is a set of distinct islands, can there be more than one ship per island? If there is more than one ship per island, it will be more complicated, because we have to set it up such that the mapper can figure out which ship to go to, based on total distance.

There is a set of distinct islands. (Approximately 20 or so)
Each ship services a subset of the total islands.
From any island in it's subset that ship can sail to any other island in its subset.

Advanced complications I haven't considered yet:
Some characters have access to special passages between continents that other characters do not have. This allows some characters to speedwalk between some continents without using the ship system.
Some characters have access to teleport commands that can move them instantly between continents. I currently have these set up as portals, not sure if that will need to change or not.

Quote:
b) You say that the ship can sail to multiple destinations. Are any of these destinations on the same island? If so, we will have to set it up so the mapper can figure out which destination to go to, based on total distance.

These are not on the same island. There is only one "landing" location on each island. However like I stated above, some characters have access to other methods that are much more efficient.

Quote:
c) Is it possible for the sailing voyage to be interrupted--the ship stops in the middle, sinks, or something? If so, you will have to account for failed journeys somehow.

No, this is not possible. The length is slightly variable but the text for departing and arriving is always the same for a specific ship (it differs between ships).

Quote:
d) Is it possible for a ship not to come when you signal for it?

It is possible for a ship not to come when you signal if it is in the middle of sailing somewhere else for someone else.

Quote:
e) Are there actual ocean spaces on the map between islands/continents/whatever? If so, are there different descriptions of these spaces? Can you interact with them in any way (swimming, fishing, etc)? Are there any manually controlled boats which you can steer yourself in arbitrary directions?

No, nothing like this. You enter the ship and issue a command like "ask captain to sail to <destination>" the captain responds with something like "all aboard, we're sailing to <destination>".
The exit "out" (the only exit) is removed from the room. A variable amount of time goes by (like 5-20 seconds depending on where you sailing to/from) then the captain states something like "we have arrived at <destination>" and the exit "out" is added back to the room.

Quote:
e) Is it possible to leave the ship in the middle of the water? If so, I would recommend a completely different solution which would try to track the ship's journey so that the mapper can put you in the right place if you leave the ship somehow.

It is not possible to leave the ship while it is moving.

Quote:
f) Does the ship itself have room name/description/exits/etc.? If so, does any of that change while you are underway, or when you are in different cities?

The room name and description never change, regardless of location or state. When stationary there is a single exit "out" when underway there are no exits.

Quote:
I can think of at least three possible types of solutions, but they all depend on different answers to these questions.

Awesome :)
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Wed Apr 11, 2012 1:36 am   
 
Okay, cool! The first idea I have is pretty much what you were already thinking of. Let us suppose you have a location ThisPlace, from which you can ship to Alpha, Beta, and Gamma.

In ThisPlace, create three exits of type Other--one for each ship destination.
For Alpha, set the exit command to be 'shipto Alpha'; do the same for each exit.
Set the destination room for the Alpha exit to be the landing at Alpha.
Create the alias 'shipto', which does all the work: signal ship, wait for ship, enter ship, ask captain, wait for destination message, exit ship.
Set the movement timeout to be long enough for all of this.

One possible problem is that the timeout would be rather long, causing a problem for other walks that don't need such a long timeout. So, here is an alternative:

For each landing on every island, create a new room which represents the ship at dock. So you would have a room for the ship at ThisPlace, a room for the ship at Alpha, etc.
For each landing, create an exit linking it to the matching ship room.
Set the command for this exit to be 'callship'; the opposite direction should obviously be 'exit ship' or whatever.
Create an alias 'callship' which signals the ship, waits, and enters the ship.
Make sure each ship room gets the room name and description to match.
Set each ship room to automatically Pause walks.
In each ship room, create an exit to the ship room of every possible destination.
Set the exit command between ship rooms to be 'ask captain to sail to <destination>'.
In each ship room, set up triggers matching 'we have arrived at <destination>' to execute #STEP.
Set the movement timeout to be long enough for a ship to arrive after signaling.

With this scenario, here is what would happen:
Walk takes you to ThisPlace.
Walk executes 'callship'.
The callship alias waits for the ship, then moves you to ShipRoomThisPlace.
You pause automatically.
(Hm. Some kind of trigger here needs to execute #STEP, but I'm not sure what it could fire on).
Walk executes 'ask captain to sail to Alpha', which moves you to ShipRoomAlpha.
You pause automatically.
The message ''we have arrived at Alpha' triggers the command #STEP.
Walk executes 'exit ship' and continues the path.

This is at least a start on possible methods.
Reply with quote
oxseyn
Wanderer


Joined: 26 Nov 2011
Posts: 71
Location: Colorado Springs

PostPosted: Wed Apr 11, 2012 2:12 pm   
 
Thanks Rehab. I'm working through your algorithm. Looks good. I'm not sure exactly how the alias/trigger system will work yet, but from what I understand so far, this is how the room layout should look:
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Wed Apr 11, 2012 3:27 pm   
 
That would be one way to do it. It is slightly different from what I described, but is an option I thought of before.

If you do it that way, you would probably have a room trigger in "On ship Docked at South Coast" which catches "all aboard, we're sailing to " and teleports you to "Ship Underway". Then you would put a room trigger in "Ship Underway" which catches "we have arrived at Island A" and teleports you to "On Ship Docked at Island A", then executes #STEP. "Ship Underway" would of course have room triggers for every possible destination. This might make your scripts a bit easier, actually.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Wed Apr 11, 2012 3:33 pm   
 
By the way, if you don't know how to make a room trigger...

In Cmud you can give a class a "key" value. If you use a key of "roomXXXX", that class can contain scripts that are specific to a particular room. Cmud will automatically enable that class when you enter the room, and disable it when you exit. You can also have keys like "zoneXXXX" which can contain scripts that will be active only in particular zones.
Reply with quote
oxseyn
Wanderer


Joined: 26 Nov 2011
Posts: 71
Location: Colorado Springs

PostPosted: Wed Apr 11, 2012 4:28 pm   
 
So I just did some comprehensive documentation of the ship system. I was wrong on a few points. Here it is:
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Wed Apr 11, 2012 8:12 pm   
 
Oh, excellent. We should be able to make fine triggers from that. I don't have time just now, but will look at it some more later.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net