ID:132769
 
My Dev team and I were brainstorming possible capabilities for a project that we are currently working on. With Isometrics how they are would it be possible to add in a client_screen x-ray modification? For example, One of my Icon Artists suggested that we made the Walls of the Icon that we are behind transparent, there are however many flaws with this including the fact that other players will be able to see behind the affected turfs as well.

In an effort to create a situation that we can see behind a specific atom we have concluded the best result would be to somehow include an X-Ray system, a client screen type overlay that will affect the path type specified, setting its alpha transparency to that specified just for that specific client.

xray(pathofatom,num/transparencylevel,num/viewdepth)
//pathofatom = affected atom that well be focused on when using xray
//transparencylevel = the alpha transparency level to set it to
//viewdepth = the amount (in tiles) from caller to effect
The easiest way would be to use images.

EDIT: Or the invisibility/infrared vars.
You can do this now by using client.images to control what users can see. You can also take the simpler approach of setting mob.sight to values like SEE_INFRA or SEE_MOBS.

<edit>Doh, beaten to the point :(
In response to Jeff8500
Jeff8500 wrote:
The easiest way would be to use images.

EDIT: Or the invisibility/infrared vars.

The functionality you're requesting can be accomplished in the above ways. There is no reason to add a built in functionality for this when images can do it just fine.
In response to Jeff8500
Definition of see_infrared var (mob) is Setting this to 1 enables infravision, allowing the mob to see infrared objects in the dark.



See invisible is This is the maximum level of invisibility that the mob can see.


X-Ray is not either of these. What I mean by xraying is this for example. (Ignoring the lines created by transparencies overlapping)
http://img510.imageshack.us/img510/8030/30882457.png
mob
Login()
..()
var/icon/I = new(icon)
I.Blend(rgb(0,0,0,128))
var/image/IM = new(I, src)
IM.layer = TOPDOWN_LAYER
client << IM


You will be able to see a 50% transparent version of your mob through anything.

Though, this isn't perfect, and it will separate from your mob momentarily, sometimes, when moving. Setting pixel_step_size to something other than 0 seems to fix it, though.
In response to Leur
Leur wrote:
Definition of see_infrared var (mob) is Setting this to 1 enables infravision, allowing the mob to see infrared objects in the dark.



See invisible is This is the maximum level of invisibility that the mob can see.


X-Ray is not either of these. What I mean by xraying is this for example. (Ignoring the lines created by transparencies overlapping)

This would also be handled with images, though it will be slightly more resource intensive if you do not handle it properly.

http://www.byond.com/developer/AJX/TreeTransparency

This is an example of how you could handle the situation, though applied to walls and not trees.

A short explanation of what that demo shows you how to do (in a very difficult manner. It isn't commented or documented really)
If no players are behind an object, it is displayed normally.
If a player moves behind an object, it (and all of its parts) are turned transparent, and a dense image is put on top of it. The dense image is shown for everyone expect for people behind the object.

The reason I did it this way instead of just having all possibly-transparent objects have an image is because it dramatically cuts down on your resources for things not in use.

If there could be a built in functionality for this I have to agree it would be nice (programming it yourself can be a bit trying on your resources) but it can still be done.
In response to AJX
AJX, I had the one I was talking to this about join the Tree Demo straight from download, and it is an example of what I mean, However When I walked behind a tree, He could see me and the tree's became transparent to him as well, which is not quite what I meant. This is also a reason why I would love to see an x-ray implemented. So you can change the transparency of an atom for each client, not the entire world.
Instead of using lengthy coding (on the developers end) making projects look ugly and possibly generate lag. why not (over time) have a feature in to simplify this? I understand the BYOND Dev's can't simply snap their fingers and poof it's in, but it would be a helpful feature for viewing everything that is behind a tall turf or object. Which brings up why I cannot use Garthor's Example, not only does it create the virtual icon at a lower state than actual position in ISOMETRIC_MAP format, but if tampered with the virtual icons location will move in different ways, or completely vanish off the face of the map. Plus, we would have to do it for any potential objects that will be created behind the wall in RPGs.
In response to Leur
Leur wrote:
AJX, I had the one I was talking to this about join the Tree Demo straight from download, and it is an example of what I mean, However When I walked behind a tree, He could see me and the tree's became transparent to him as well, which is not quite what I meant.

That is very odd. Are you sure you downloaded the demo that I linked to?

I just tested it myself (as I did when I made it) and when a player goes behind a tree for me it does not show them for anyone who isn't ALSO behind that same tree.

Could you provide a screenshot of this happening please?

Instead of using lengthy coding (on the developers end) making projects look ugly and possibly generate lag. why not (over time) have a feature in to simplify this? I understand the BYOND Dev's can't simply snap their fingers and poof it's in, but it would be a helpful feature for viewing everything that is behind a tall turf or object. Which brings up why I cannot use Garthor's Example, not only does it create the virtual icon at a lower state than actual position in ISOMETRIC_MAP format, but if tampered with the virtual icons location will move in different ways, or completely vanish off the face of the map. Plus, we would have to do it for any potential objects that will be created behind the wall in RPGs.

I never said that I didn't think it'd be a nice feature. In fact, if you read my post, you'd see that I was in favor of the idea. I was simply informing you that it *IS* possible to do, and if you do it right then it wont be TOO bad.

The likelihood of a feature like this becoming hardcoded is probably slim, hence why I am providing you with an example of how you can do it yourself.
In response to Leur
Leur wrote:
Which brings up why I cannot use Garthor's Example, not only does it create the virtual icon at a lower state than actual position in ISOMETRIC_MAP format, but if tampered with the virtual icons location will move in different ways, or completely vanish off the face of the map. Plus, we would have to do it for any potential objects that will be created behind the wall in RPGs.

My example was specifically for showing your own player, which theoretically always maps to the center of the screen on both isometric and top-down views. It does not work for any other objects, unfortunately, because layers won't work with the isometric view (unless placed in the top-down layer, which obviously doesn't work). It therefore also doesn't work if your view is fixed, or attached to anything besides your mob.

The alternative is a bit clunkier, and that is to be creating a ghost object which is some number of tiles to the southeast (down) of an object with a pixel_z to be layered on top of them. Obviously, a bit more involved, but no reason why it couldn't be done algorithmically.
In response to Leur
If you simply want to do that, you would use images. You sounded like you wanted to make walls completely invisible, in which case, both invisibility and infrared could suit your needs; you need to have a bigger imagination.
In response to Jeff8500
Jeff8500 wrote:
If you simply want to do that, you would use images. You sounded like you wanted to make walls completely invisible, in which case, both invisibility and infrared could suit your needs; you need to have a bigger imagination.

Not completely invisible, just enough to see through them to see what is behind them.