ID:95218
 
Not a bug
User was not properly setting client.perspective.
BYOND Version:467
Operating System:Windows 7 Pro 64-bit
Web Browser:Firefox 3.5.2
Applies to:Dream Seeker
Status: Not a bug

This is not a bug. It may be an incorrect use of syntax or a limitation in the software. For further discussion on the matter, please consult the BYOND Developer forums.
Descriptive Problem Summary:
When assigning client.eye to a turf that is too far from client.mob, the player's view goes black.
It doesn't seem to matter what the z value is, it happens whether the mob and eye are on the same z or not.

Numbered Steps to Reproduce Problem:
1. Create a map and place the starting player's mob in it.
2. Separate the client.eye and client.mob by assigning client.eye to a turf. (I haven't tried assigning client.eye to anything besides a turf.)
3. Move the eye or mob far enough apart from each other, and the screen will go black.

There is a pattern to how far apart they must be before it goes black.
It happens when the horizontal or vertical distance from client.mob to client.eye is greater than 5 + 2 * client.view or when the horizontal and vertical distance are equal to that value. All other values within that square of tiles have no issues.

Code Snippet (if applicable) to Reproduce Problem:
// The following bug occurs in version 467 all the way back to 457
world
view = 5

client
var
blind = FALSE
range
turf/new_eye

New()
. = ..()
eye = mob.loc
new_eye = eye

// depending on who-knows-what, between different compilations,
// one of the following will work to recreate the bug:
if (world.map_format == ISOMETRIC_MAP)
range = view * 2 + 5
#if 0
range = view * 2 + 9
#endif
else if (world.map_format == TOPDOWN_MAP)
range = view + 2

Move(turf/L)
. = ..()
if (.)
var/xdist = abs(L.x - new_eye.x)
var/ydist = abs(L.y - new_eye.y)

//world << "[xdist], [ydist]"

if (!blind &&\
(xdist > range || ydist > range || (ydist == range && xdist == range)))
blind = TRUE
src << "You are now blind."
else if (blind &&\
!(xdist > range || ydist > range || (ydist == range && xdist == range)))
blind = FALSE
src << "You are no longer blind."

Here is a test project that recreates the bug.

Expected Results:
Being able to move the client.eye as far from the client.mob as I want in order to provide whatever view to the player that I desire.

Actual Results:
The view goes black when the mob reaches a certain distance based upon the client.view.

Does the problem occur:
Every time? Or how often? Every time.
In other games? Only tested it with two.
In other user accounts? Not sure.
On other computers? Not sure.

When does the problem NOT occur?
When you don't move the client.eye too far from the client.mob.

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked?
I've tested in version 457, and the bug is still there.

Workarounds:
Set client.perspective to EYE_PERSPECTIVE when client.eye is different than client.mob.
Not a bug, you must set client.perspective to EYE_PERSPECTIVE.
Nadrew wrote:
Not a bug, you must set client.perspective to EYE_PERSPECTIVE.

So, why is it the screen goes black?
That seems to me that it should be unaffected by client.perspective and that this is just a workaround and it's still a bug.
This has always been the intended functionality. client.perspective is what handles how sight is affected by changes to the client's eye.