Distance-based descriptions
Goto page 1, 2  Next
 
Post new topic   Reply to topic    mudlab.org Forum Index -> Design
View previous topic :: View next topic  
Author Message
KaVir



Joined: 11 May 2005
Posts: 565
Location: Munich

PostPosted: Mon Apr 09, 2007 10:23 pm    Post subject: Distance-based descriptions Reply with quote

Long ago Alayla and I discussed the concept of having multiple descriptions for things based on how far away they are, and I've now come to the point where I could really do with the support for a centaur camp, which is only visible as a camp when up close, but can be spotted from a distance by smoke rising above the treetops.

However while thinking about it's usage for the centaur camp, I've come to realise that perhaps it'll need more flexibility than simply a handful of descriptions based on distance - I think it may require support for the sense of smell as well, which in turn may need to take into account wind strength and direction.

It could also really do with the support for descriptions based on the time of day - thus for the camp you'd be able to see the smoke during the day, while at night you'd smell wood smoke.

For some things there may be the need for more than two descriptions - for example a tower or temple that reveals more detail as you get closer. I was thinking of initially supporting three distances, there'd be:

Short Range, Medium Range and Long Range, each of which has:

Sight: distance (in feet), glow (boolean) messages (dusk, dawn, day, night)
Smell: distance (in feet), wind (boolean) messages

Note that 'glow' indicates whether lighting should be taken into account for the distance (if 'true' then you can see it at the full distance, otherwise at night the distance is reduced depending on whether the sky is clear and you can see the moon). Equally 'wind' indicates whether the wind direction should be taken into account when calculating the distance.

There'd probably need to be combined descriptions, too, for cases where you can both see and smell the smoke. In this case it would first check for both sight and smell, and if you didn't have both it would then check them individually.

One-shot sounds (such as a bell tower) should be handled with a separate system, but for a busy town or an operational mine you might well hear the sounds of people as you approach.

I can't think of many situations in which you'd need taste or touch, but it might be worth having a sixth sense option, which could either be based on psychic abilities or just be a more generic "creepy feeling" message for those who can't see, hear or smell anything.

Despite having a range of senses, though, I'm not sure there'd really be many needed for each location. To keep a more generic solution, I'm therefore thinking of having a vector of 'range descriptions' which contain data a bit like this:

Range: (in feet)
Required Senses: (one or more of: sight, smell, sound, touch, taste, esp)
Glow: (day/night makes no difference)
Wind: (wind direction adjusts the range)
Arrive Message: When you move into range (day, night, dusk, dawn)
Leave Message: When you move out of range (day, night, dusk, dawn)
Description: For when you 'look' (day, night, dusk, dawn)

These would then just be added in order - so you'd have to specify nearer things first, multiple senses before single senses, and so on.

Also note that the arrive/leave/description could be left blank (for no message) or contain "!" (to repeat the previous description) as in most cases you'd reuse the same description.

In the case of the camp there'd perhaps be three such descriptions - a sight/smell combined message which lets you see and smell the smoke from the camp fire, a sight-only message which just shows the smoke and a smell-only message which lets you smell the smoke.

I guess it could also be extended to show the firelight through the trees a little while before the camp comes into view. In theory you might even feel the heat as of the fire you get closer (the generic solution would also support the sense of 'feel') or hear the sound of revelry.

Can anyone think of any reasonable situations this solution wouldn't cover?
Back to top
View user's profile Send private message Visit poster's website
Author Message
ide



Joined: 21 Feb 2006
Posts: 105
Location: Seattle

PostPosted: Mon Apr 09, 2007 11:52 pm    Post subject: Reply with quote

The only thing that jumps out at me immediately are the things you want to show that fall between one-shot and continuous. In other words, periodic things that nevertheless are of limited duration.

For example, a wizard performing rituals atop a mountain -- flashes of light as they cast spells, throw reactive stuff in the cauldron, and so on.

A band of cannibals drumming before a sacrifice.

Giants throwing boulders at each other across a mountain pass.

A roc occasionally screeching, perched in a high eyrie.
Back to top
View user's profile Send private message Send e-mail
Author Message
Vopisk



Joined: 22 Aug 2005
Posts: 99
Location: Golden Valley, Arizona, USA

PostPosted: Wed Apr 11, 2007 3:12 am    Post subject: Reply with quote

You proposed system works (at least in theory) very similar to a system that I myself brainstormed at one time for doing distance-based vision. That being said, I think you've covered most of the bases for what would be required, really, the only thing you need is the three ranges (short, medium and far) with matching descriptions and then a system for showing them of course.

As mentioned before, one-time event or time triggered actions would need to be hooked into a separate system, but this would work for your basic cities, mountains and other landmarks that you want to slowly reveal the presence of over distance.

The commercial mud Age of the Throne uses a very simple version of such a system to show players at range, that is, at a distance you just see someone on the street ahead of you, while as you draw closer (and depending upon your vision score) you can begin to pick out exactly who it is in the distance.

I like the idea to include other periphery senses, such as smell and perhaps feel as well. You might notice an orc den by the smell long before you're ever able to see it and the mage keep might have a spell cast around it that instills fear in the hearts of those who venture too close.

These things seem to me to be mere extensions of the system as it were, you still might want to know the period of day (using your ! syntax if you want the message to be the same no matter what time) but other factors like wind will come into play for things like smell.

A smell system can get much more complex, as perhaps if the wind is blowing strong and at your back you might not be able to smell something until you're right upon it as opposed to several miles away if you have a good wind blowing in your face. But I think that such a system might be a good way of further expanding upon a recent discussion we had about player equipment and where they get it.

While werewolves need to craft their own talismans of powers (from the teeth of their enemies I think it was) perhaps they also rely far more heavily on their sense of smell than that of sight. Other characters might see better at night and be all but blind during the day or vice versa. In these instances it becomes far more important to switch to a more acute sense when one or the other of your senses is impaired by environmental conditions.

The zen warrior might be able to fight as good as anyone, relying on his enhanced sense of sound, feel (esp?) and smell in order to locate and neutralize his opponents. The possibilities are pretty broad.

I made a point about the sense of sound or hearing though, which is one that was somewhat mentioned before but glossed over as a specific sense unto itself, this would be really more akin to the smell sense than the sight sense and would also need to take into account for the wind to determine range.

Anyway, just some rambling thoughts,

Vopisk
Back to top
View user's profile Send private message AIM Address MSN Messenger
Author Message
KaVir



Joined: 11 May 2005
Posts: 565
Location: Munich

PostPosted: Wed Apr 11, 2007 8:09 am    Post subject: Reply with quote

ide wrote:
The only thing that jumps out at me immediately are the things you want to show that fall between one-shot and continuous. In other words, periodic things that nevertheless are of limited duration.


I think these would probably be better handled by the same system as the one-shot messages - I'd likely give such places their own type of 'brain' which is responsible for sending out such information (Creature/Object/Place/etc are all types of Thing, and a Thing can have a controlling Brain).



Vopisk wrote:
I think you've covered most of the bases for what would be required, really, the only thing you need is the three ranges (short, medium and far) with matching descriptions and then a system for showing them of course.


I don't think you need to explicitly store three ranges, as they're already implicitly supported by the open-ended system. If you want to show different information about the tower at 100, 250 and 500 feet, you can just add three different sight descriptions to the vector, one at each range. But this way you could also add more information at 1000, 5000, 10000, etc feet as well, if you wanted to.

Vopisk wrote:
I like the idea to include other periphery senses, such as smell and perhaps feel as well. You might notice an orc den by the smell long before you're ever able to see it and the mage keep might have a spell cast around it that instills fear in the hearts of those who venture too close.


Cool idea, although perhaps emotion should be treated as a separate "sense" in that case - maybe a character in a berserk rage is unable to sense the magical feeling of fear, but they'd still feel the vibrations of the mage's giant worm as it tunnelled below them.

Vopisk wrote:
A smell system can get much more complex, as perhaps if the wind is blowing strong and at your back you might not be able to smell something until you're right upon it as opposed to several miles away if you have a good wind blowing in your face.


I think you could probably handle it reasonable well with a simple "wind strength %", which reduces or increases the range of smell messages depending on whether you're upwind or downwind of the source.

Vopisk wrote:
While werewolves need to craft their own talismans of powers (from the teeth of their enemies I think it was) perhaps they also rely far more heavily on their sense of smell than that of sight. Other characters might see better at night and be all but blind during the day or vice versa. In these instances it becomes far more important to switch to a more acute sense when one or the other of your senses is impaired by environmental conditions.


Agreed, and this is something I'd really like to expand on for general descriptions as well. In most muds you literally see nothing when blind - I think it'd be nice for certain characters to be able to function just as well when blind, to the point of 'look' showing information based on your other senses rather than just "It's too dark to see."
Back to top
View user's profile Send private message Visit poster's website
Author Message
Kjartan



Joined: 13 May 2005
Posts: 110

PostPosted: Wed Apr 11, 2007 12:26 pm    Post subject: Reply with quote

KaVir wrote:
Vopisk wrote:
A smell system can get much more complex, as perhaps if the wind is blowing strong and at your back you might not be able to smell something until you're right upon it as opposed to several miles away if you have a good wind blowing in your face.


I think you could probably handle it reasonable well with a simple "wind strength %", which reduces or increases the range of smell messages depending on whether you're upwind or downwind of the source.


Sound, too. Because there's necessarily a wind shear as you move away from the ground, sound headed upwind gets deflected into the ground after a certain distance, while headed downwind it gets deflected upwards. See http://www.wsdot.wa.gov/Research/Reports/000/033.1.htm, for example.
Back to top
View user's profile Send private message Visit poster's website
Author Message
KaVir



Joined: 11 May 2005
Posts: 565
Location: Munich

PostPosted: Wed Apr 11, 2007 2:14 pm    Post subject: Reply with quote

Kjartan wrote:
Sound, too. Because there's necessarily a wind shear as you move away from the ground, sound headed upwind gets deflected into the ground after a certain distance, while headed downwind it gets deflected upwards.


Good point, I hadn't considered that - although arguably there should be an overall "sound pollution" of which wind is only one factor. Other factors might include rain or nearby noises (eg if you're standing in a noisy town centre, you might not hear the distance sound of mine workers).

Although come to think of it, the same argument could be made for smell as well. Tracking someone by scent through a sewer or during heavy rain is going to be pretty hard, even for the most gifted of werewolves.

Could these all be handled through the combination of two generic factors though, I wonder? Weather (rain, snow, wind, etc) and Local (sound/smell/etc polution in the current area)? Light and dark could possibly be extensions of the same system, too.

Thus light rain might give a minor sound penalty and a medium smell penalty, while heavy rain could give a medium sound penalty and a major smell penalty, and a thunderstorm would give a major sound penalty and an extreme smell penalty. Equally, a rushing river might give a minor sound penalty, a sewer might give an extreme smell penalty, and so on.

You'd then just combine the two to calculate the overall penalty for each sense, which would then apply as modifiers to the PCs personal senses (adjusted based on injuries and such).
Back to top
View user's profile Send private message Visit poster's website
Author Message
Vopisk



Joined: 22 Aug 2005
Posts: 99
Location: Golden Valley, Arizona, USA

PostPosted: Wed Apr 11, 2007 2:25 pm    Post subject: Reply with quote

KaVir wrote:

Vopisk wrote:
While werewolves need to craft their own talismans of powers (from the teeth of their enemies I think it was) perhaps they also rely far more heavily on their sense of smell than that of sight. Other characters might see better at night and be all but blind during the day or vice versa. In these instances it becomes far more important to switch to a more acute sense when one or the other of your senses is impaired by environmental conditions.


Agreed, and this is something I'd really like to expand on for general descriptions as well. In most muds you literally see nothing when blind - I think it'd be nice for certain characters to be able to function just as well when blind, to the point of 'look' showing information based on your other senses rather than just "It's too dark to see."


It would probably be a tricky feat to accomplish I just want to say. The quick, dirty and arguably worst solution would be to simply use the same room description and pretext everything with "You sense... smell... hear... etc...". However, that would be horrifically tacky. Smile

It's hard to describe in text what you "hear" when you're talking about ambient sounds, and certainly feelings are pretty murky water to wade through. However, I think it could be done with a good bit of ambiguity. You might only sense presences in the room at the exclusion of objects or exits and have to "feel" your way around to find them. Smells would probably be the same all around, as either you smell the sickly, pungent aroma of cow dung that seems to be coming from the corner of the room or you don't.

I for one would definitely enjoy seeing a mud that used other senses to overcome the hurdle you mentioned of "blindness" where your character quite literally becomes useless. There's also the "Daredevil" version of blindness that might be neat for things like elves or others whom may have some manner of "infravision", although this too must require the details to be lost at least in very large part.

Kjartan has a point about hearing being affected in the same manner as smell, but I wonder exactly how much realism is too much, it's easy enough to make the "travel" of a "sense object" be parabolic, but it all depends on the delivery method you choose to use. Other items yet again will rebound sound (echoes through caverns) while still others will deaden sound (trees and wood and such).

For the purposes of a mud, measuring wind as a percentage as you mentioned and decreasing or increasing range appropriately would probably be suitable.

Heh, I just had the thought of designing a game where an alternate sense mechanism acted something like being able to see the "harmonics" of the world, a la The Matrix, but enough tangents, that's all I have for now, good ideas all around.

Vopisk
Back to top
View user's profile Send private message AIM Address MSN Messenger
Author Message
Kjartan



Joined: 13 May 2005
Posts: 110

PostPosted: Wed Apr 11, 2007 2:51 pm    Post subject: Reply with quote

Vopisk wrote:
Kjartan has a point about hearing being affected in the same manner as smell, but I wonder exactly how much realism is too much, it's easy enough to make the "travel" of a "sense object" be parabolic, but it all depends on the delivery method you choose to use. Other items yet again will rebound sound (echoes through caverns) while still others will deaden sound (trees and wood and such).


Well, you've got a computer, might as well use it. If you're already coding a wind/smell interaction then it's minimal extra work to do sound.

It's actually a real effect, I have noticed it when shouting - it's not just that the sound gets dampened, if someone is far enough upwind - not even all that far if the wind is blowing hard - they absolutely cannot hear you no matter how loud you shout, but if you climb up a tree and shout then they can hear you just fine.
Back to top
View user's profile Send private message Visit poster's website
Author Message
Kjartan



Joined: 13 May 2005
Posts: 110

PostPosted: Wed Apr 11, 2007 2:56 pm    Post subject: Reply with quote

And here's something else that is only vaguely relevant but I always thought was really cool: if you are small (e.g. a snail) then you can actually use smell to get a decent 3D sense. This works for two reasons: first, there is usually fairly turbulent air close to a surface (not REALLY close, then you get into a laminar boundary layer, but at snail-height from the ground all of the twigs and leaves and other obstructions create some turbulence) so you are constantly getting bursts of wind from all directions. Second, when a chunk of smell molecules breaks off of a smell-emitter, it is tightly grouped - things don't drop one smell molecule at once, they drop a cluster - but as it moves through the air it diffuses, you can tell how far away the smell-emitter is by looking at how much the burst of smell you get has diffused.

That means that you can tell distance and direction to any smell-emitters in your immediate vicinity. Allegedly snails use this to find food.
Back to top
View user's profile Send private message Visit poster's website
Author Message
shasarak



Joined: 29 Jun 2005
Posts: 134
Location: Emily's Shop

PostPosted: Fri Apr 13, 2007 7:08 pm    Post subject: Reply with quote

This is connected to stuff that's already mentioned, but I think you need some sort of occlusion processing.

Examples:

a) A statue standing in the middle of a grassy plain can be seen from much farther away than the same statue standing in the middle of a forest. The sort of calculations you can do with this tie rather neatly into other things like hiding and camouflage skills - how close would you have to be to the ranger hiding in the hedgerow before you spot him?

b) You might be able to see a horse and rider from some distance away if they standing on the top of a hill. The same horse and rider might be invisible if they are at the bottom of a valley, even though the valley is closer than the hill. But you'd see them once you reach the lip of the valley. The same rider on the far side of the hill is invisible.

c) Whether you can see or hear something going on inside a house will be influenced by whether or not the door is open, and whether or not the doorway is directly between the observer and the thing in question. There's also actions like looking through windows and listening at doors to consider: how much more audible do sounds inside the room become if you have your ear pressed against the door? Or if you're using a stethoscope?


Some other thoughts:

- It might be interesting to experiment with other senses (or variation on senses) besides sight, vision and hearing. For example, a cat would be able to see quite clearly by dim moonlight, even starlight, while a human would be effectively blind; but both human and cat would be blind in total darkness. A hawk can see things as if they were only a third of the distance they actually are (compared to a human). There's also the possibility of telescopes.

Someone with passive infravision (eyes sensitive to heat) would be able to make out warm-blooded creatures in total darkness as if they were glowing, and might even spot fires or torches on the far side of thin stone walls; but the same person might not be able to detect a cold-blooded snake on a cavern floor. Someone with active infravision (i.e. their eyes actually emit infra-red light, like a radar system) would be able to spot cold-blood snakes quite easily, but the disadvantage would be that someone with passive infravision would be able to spot them coming from a mile off because their eyes would be glowing like a lighthouse.

There might be some mileage in playing around with colour vision, or the lack of it; would magically induced colour blindness have any significant ill-effects? Does infravision include colour?

What about detection using ultrasound? That provides information about position and shape, but not about colour or texture. It works in total darkness. It could be detected by creatures that can hear into the ultrasonic. A giant bat would probably be almost impervious to invisibility or blindness spells, but would be completely immobilised by a deafness spell. (The effect of invisibility on a creature that hunts by scent would also be interesting: it would hamper it, but not as much as a sight-based creature).


- How do you handle the sound of miscellaneous events happening in a place that is out of sight? For example, a combat message "Shasarak slams his shortsword into KaVir's armoured back" would have to be rendered completely differently if you're listening to the fight from the next room. You've no idea who the participants are, or that the weapon is a shortsword: "From the north, you hear the thud of metal against leather".
Back to top
View user's profile Send private message
Author Message
Vopisk



Joined: 22 Aug 2005
Posts: 99
Location: Golden Valley, Arizona, USA

PostPosted: Fri Apr 13, 2007 10:34 pm    Post subject: Reply with quote

You make some really good points here Shasarak, some of this I worked on when I was brainstorming my own system and others I had not yet considered. My thought was to use a sort of depth-first search for vision ("sight feelers" I called them). Then, based upon a height factor of objects in question (trees, statues, etc...) what you would "see" would be based off of what is in front of other things and shorter or taller similarly.

Consequently this is where the three "ranges" of vision would come into play, because one must take into account that as you get further from the viewer, smaller objects become harder if not impossible to spot while larger objects (such as rings compared to mountains) are visible from great distances.

This works for vision, but I think in the case of olfactory and auditory senses instead of querying for "events" you would instead need to broadcast them and let anyone who's, for lack of a better term, listening pick them up. What you might do is broadcast both smells and sounds with a rating (decibels for audibles), then based upon your character's hearing or smelling ability, you would receive different amounts and levels of detail regarding these items, so for example, dogs would hear far more than humans and at greater distances.

If you take into consideration a dynamic description system, such as God Wars II implements then it would be pretty easy to strip out things such as color for "color blind" players, but in a static description system this might be more difficult.

Of course, in connection with the above, active infravision or sonar (sonic hearing) abilities would require their own "feeler" system that would allow them to "ping" for objects, items and creatures in their surroundings. Much as with vision, the distance and granularity of these systems would be dependent upon a skill or statistic rating and also perhaps what the surroundings are made of (stone might stop sonic hearing dead in its tracks while things like wood or thinner materials might allow a character to "hear beyond" ). Much like you suggested with active infravision being able to detect fires and the like on the other side of thin, inanimate objects.

-Vopisk
Back to top
View user's profile Send private message AIM Address MSN Messenger
Author Message
Vopisk



Joined: 22 Aug 2005
Posts: 99
Location: Golden Valley, Arizona, USA

PostPosted: Fri Apr 13, 2007 10:40 pm    Post subject: Reply with quote

shasarak wrote:

- How do you handle the sound of miscellaneous events happening in a place that is out of sight? For example, a combat message "Shasarak slams his shortsword into KaVir's armoured back" would have to be rendered completely differently if you're listening to the fight from the next room. You've no idea who the participants are, or that the weapon is a shortsword: "From the north, you hear the thud of metal against leather".


I think that the difference here would be how strings are generated for the different auditory systems, because you left out one. So the aforementioned shortsword strike would generate the given descriptions:

Shasarak slams his shortsword into KaVir's armoured back. -- Vision
You hear the thud of metal against leather coming from the <direction> -- Hearing
The smell of fresh blood wafts in from the <direction> -- Smell

These would then travel outwards from the epicenter of the event based upon their individual characteristics and be received by players up to whatever distance away. With things like vision, if we're going off a coordinate-based system, as would be suggestible as prudent if going through the task of designing such a system, perhaps only the specifics of the shortsword strike are picked up by those in the nearby proximity while as you get farther away you merely notice that two combatants are engaged in mortal battle some X distance ahead, eventually fading to a point where vision drops off and you may be left clueless if none of your other senses are receptive to that range.

-Vopisk
Back to top
View user's profile Send private message AIM Address MSN Messenger
Author Message
shasarak



Joined: 29 Jun 2005
Posts: 134
Location: Emily's Shop

PostPosted: Sat Apr 14, 2007 12:48 pm    Post subject: Reply with quote

Vopisk wrote:
Much like you suggested with active infravision being able to detect fires and the like on the other side of thin, inanimate objects.

Passive infravision would be best for that. Smile

Active infravision would give you a detailed scan of the surface of the wall on your side. Passive would detect a warmer patch of wall just opposite where the torch bracket is on the other side of it. It's like difference between shining a toch at a curtain and seeing a faint glow coming through through the fabric from the far side: a torch on your side actually makes it harder to see what's coming through.

Vopisk wrote:
Shasarak slams his shortsword into KaVir's armoured back. -- Vision
You hear the thud of metal against leather coming from the <direction> -- Hearing

The point I'm trying to make is that, with the statements phrased in that way, no one player should ever see both of those messages: they might see either one, but not both together. Players who have a direct line-of-sight to the battle and can see what is going on only need to be given the visual message. Players who do not have direct line of sight but are within earshot should only get the audio message.

You could rephrase messages in such a way that it does make sense to receive both:

"Shasarak lurches drunkenly and falls".
"There is a loud clatter of steel armour against rock."

but having to phrase every visual message in such a way that it contains no audio information (and vice versa) is likely to cramp your style a little. It might be better to concentrate on what information you're trying to convey, and how much of that information the player character actually has access to. If you're out of the room you hear a loud crash but you don't know what's caused it. If you're inside the room you can see what's caused it.

Thus, there's an "inside the room" message and an "outside the room" message, but the inside one contains both visual and audio information, while the outside one contains audio only.

Vopisk wrote:
My thought was to use a sort of depth-first search for vision ("sight feelers" I called them). Then, based upon a height factor of objects in question (trees, statues, etc...) what you would "see" would be based off of what is in front of other things and shorter or taller similarly.

Consequently this is where the three "ranges" of vision would come into play, because one must take into account that as you get further from the viewer, smaller objects become harder if not impossible to spot while larger objects (such as rings compared to mountains) are visible from great distances.

This works for vision, but I think in the case of olfactory and auditory senses instead of querying for "events" you would instead need to broadcast them and let anyone who's, for lack of a better term, listening pick them up. What you might do is broadcast both smells and sounds with a rating (decibels for audibles), then based upon your character's hearing or smelling ability, you would receive different amounts and levels of detail regarding these items, so for example, dogs would hear far more than humans and at greater distances.

The process for visual information in the open air would often be much the same as it is for sound or scent; an object or an event has a "visibility" that diminishes with distance. How fast visibility diminishes with distance depends on the terrain: fast if you're in a forest or thre's fog/rain/snow, slow if you're in the middle of a flat plain in daylight. (You also need to kep the passive/active thing in mind: a bonfire is more visible at night rather than less). The effective visibility-drop-off with distance would also be influenced on how keen the vision of the observer is.

Much the same calculation applies to noise or smell: sounds have a volume to begin with, and the volume drops off with distance. It effectively drops off faster if there is significant noise pollution (or slower over water at night); it drops off more slowly for a keen-eared observer. Scent propagation, again, is the same: the intensity of the signal diminishes with distance (although wind is more of a factor there).

In an indoor (or subterranean) evironment you could process line-of-sight by using "portals" - a technique borrowed from early video games (circa 1997). You regard each separate "room" or area as an entirely separate space. As a first pass you can see anything within the same space you are occupying - but typically not anything that is inside an object in that space, as the interior of each container is its own self-contained space. (You make an exception for transparent containers, of course).

To handle visibility between rooms you use "portals" - a defined widow between one space and another. Thus, you can only see things within tye space you currentlyoccupy, or within the area that you can see on the other side of portals that connect to your space and that are within your field of view. (It's not too difficult to calculate the volume of the neighbouring space visible through the portal - think of looking through an open window into a room). By making the portals dynamic you can have dynamic visibility calculations: an open door creates a vision portal, while closing the door removes it. Blowing a hole in a wall between neighbouring underground tunnels creates a permanent vision portal between the two spaces (not to mention an actuial exit).

This doesn't work so well out-of-doors, but you could process large objects (e.g. houses, hills) as "negative portals" i.e. excluding from visibility regions of the same space you're in. You can also automatically exclude anything beyond a particular distance. And you could divide "out of doors" up into "zones", and assume that nothing in any one zone is visible inside another.

I've often wondered if using a relational database as a backing store for your objects would help with this. If every object in the game has 3D cartesian coordinates, could you easily query every object in the game to see which ones are in the approriate room/zone and, of those, which are contained within the region that you can see things? Would a relational DB (assuming the correct indexing and maybe a custom view) allow you to do this fast enough to be practical? Or would you have to do things using a "tree" structure?
Back to top
View user's profile Send private message
Author Message
nihraguk



Joined: 16 Apr 2007
Posts: 4

PostPosted: Tue Apr 17, 2007 5:21 pm    Post subject: Reply with quote

Quote:
I've often wondered if using a relational database as a backing store for your objects would help with this. If every object in the game has 3D cartesian coordinates, could you easily query every object in the game to see which ones are in the approriate room/zone and, of those, which are contained within the region that you can see things?


I've been experimenting with using a relational database (PostgreSQL) for simple line of sight/visibility computations for the objects/characters in the MUD I'm working on. Basically each player has an entry in a table with two columns: one describes a circle that represents the player's 360deg line of sight, the other describes a circle that represents the player's visibility. So if you're the Loch Ness Monster you would have a really large circle under the visibility column, and if you were short-sighted you would have a small circle under the line of sight column.

Both PostgreSQL and MySQL have Overlaps()/Intersects() functions that you can use in a query to SELECT all other objects whose visibility circle overlaps/intersects with a particular player's line of sight circle. Whilst what you're describing sounds more complicated than what I've just described, I think it would be possible to use the geometric functions that these relational databases provide to simplify the task somewhat.

One caveat though is that MySQL doesn't technically support Circles as a column type; I had to use octagons instead. Part of the many reasons why I switched to Postgres instead.

As for speed... this is the area I'm currently struggling with. To be fair, I haven't tried to optimize anything with indices or anything, and the VPS I'm hosting the MUD on is one of the cheaper ranges, with less RAM than my 3 year old laptop. So right now, taking a step NSE or W takes about 5 seconds of RL time to process; though the MUD does a lot more than just check for visiblity/line of sight intersections... it also checks to see if it needs to generate a room on the fly, checks to see if monsters are generated in that room and the surrounding 8 rooms, checks to see if monsters' line of sight/visiblity intersect with the player, etc.
Back to top
View user's profile Send private message MSN Messenger
Author Message
quixadhal



Joined: 17 Sep 2007
Posts: 8

PostPosted: Tue Oct 09, 2007 5:59 pm    Post subject: Reply with quote

Ages ago, I pondered exactly this idea. Back then, CPU time was the primary limiting factor, with RAM being a close second.

My idea was to give everything of importance a visibility radius, which was based on a combination of factors including size, brightness, etc. A mountain is very large and tall, and can be seen from a very long ways away if your LOS isn't obstructed. A person holding a torch is pretty small, but if it's night and their torch is lit, you can see the glow from quite a long ways away too.

Similar radii could be done for each sense. Each living object would then have a perception radius for each sense. If your perception radius overlapped the visibility radius of an object, you might be able to see it... for all the objects which fall within that set, run an LOS check on them to see if they're actually detected.

Sound and smell would also work the same way, although the LOS algorithm would be slightly different since different things obstruct those senses. Taste and touch can probably be left to things directly near the player, unless you're playing FerretMUD or MoleMUD. Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    mudlab.org Forum Index -> Design All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
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

Powered by phpBB © 2001, 2002 phpBB Group
BBTech Template by © 2003-04 MDesign