The Castle Doctrine Forums

Discuss the massively-multiplayer home defense game.

You are not logged in.

#1 2013-09-08 06:35:57

Hippasus
Member
Registered: 2013-09-03
Posts: 32

Pet sight bug

I was fiddling with a simple (unoriginal) design for a one-time robbable house when I came across this odd behaviour. This is a functional arrangement, but by removing a single wall tile (as in this) the cat's vision is obscured to the point that the house is broken.

It is likely a consequence of the new pet sight rules concerning diagonal gaps. Obviously this is a bug. Not a very exciting one though...

Offline

#2 2013-09-09 14:46:20

jasonrohrer
Administrator
Registered: 2013-04-01
Posts: 1,235

Re: Pet sight bug

Yeah, this strange behavior is actually a consequence of the way the game fixes "diagonal gaps".

To deal with the "diagonal gap" issue, when a corner looks like this:

0000
0X00
00X0
0000

I "patch" one of the empty spots near the gap.  The two spots are A and B like this:


0000
0XA0
0BX0
0000

I look for which of A or B is farthest from the robber, and I call this the "back side" of the gap. I fill it in with a full square of "vision blocking," as if a wall was there.

In your case, because of where the robber is standing, B is actually "farther" from the robber, so it gets filled in, as if there was a wall there.  This blocks the cat's view of the robber.

Now, if you actually place a wall at A like this:

0000
0XX0
0BX0
0000

The "diagonal gap patching" code doesn't touch that corner, because there's no gap there, so B is not filled in.

I'm not sure that it's worth fixing.... it would further complicate that part of the code, and I'm sure there would still be some other case that wasn't perfect.

Offline

#3 2013-09-10 08:51:14

joshwithguitar
Member
Registered: 2013-07-28
Posts: 538

Re: Pet sight bug

It doesn't seem like it would be too complicated to fix this one. For any diagonal there will be regions from which you could never see through it:
eg. Given the following diagonal:

000000
000000
00X000
000X00
000000
000000

if the player is in any of the regions marked below with an A there is no point in patching the gap:

AAABBB
AAABBB
AAXBBB
CCCXAA
CCCAAA
CCCAAA

Whilst if you are in the B region you should patch on the C side, and if in the C region patch on the B side. To figure out which region you are in for any given diagonal seems fairly simple and you could scrap the code for figuring out which is closer. I also don't see how this could create cases in which it gets it wrong.

Offline

#4 2013-09-12 07:04:20

jasonrohrer
Administrator
Registered: 2013-04-01
Posts: 1,235

Re: Pet sight bug

Yes!  You're right about this.  Great thinking here.  Will do in v19.

Offline

#5 2013-10-14 10:28:44

jasonrohrer
Administrator
Registered: 2013-04-01
Posts: 1,235

Re: Pet sight bug

This has been fixed in v19.

Offline

#6 2013-11-14 14:49:13

iceman
Member
Registered: 2013-11-09
Posts: 687
Website

Re: Pet sight bug

With a diagonal gap, are you supposed to be able to see through it?  Say, if I'm in area C, and little Timmy's in area B (in the above examples), should he see me and start to run?


Fortress Theory Mod - New objects, tools, and paintings!

I keep dying of a natural cause - Stupidity
The biggest thing that Castle Doctrine has taught me is that the price of your house is proportional to the stupidity of the mistake that kills you.

Offline

#7 2013-11-14 15:46:36

jasonrohrer
Administrator
Registered: 2013-04-01
Posts: 1,235

Re: Pet sight bug

No, he should not.

You can sometimes see him there, though, lurking in the shadows, because of the soft edge on the black visibility fog.

Offline

#8 2013-11-14 18:20:08

iceman
Member
Registered: 2013-11-09
Posts: 687
Website

Re: Pet sight bug

Ok, I had a case where my son wasn't seeing me correctly (or seeing me incorrectly).

If you have a diagonal wall, and a family member is on the corner of the walls, then they'll see you through the wall.

   X
   X
  WX
XXXA
    A
     A

If a family member is at W, and you step into A(basically, a diagonal perpindicular to the wall diagonal), they'll see you and start moving.


Fortress Theory Mod - New objects, tools, and paintings!

I keep dying of a natural cause - Stupidity
The biggest thing that Castle Doctrine has taught me is that the price of your house is proportional to the stupidity of the mistake that kills you.

Offline

#9 2013-11-15 18:50:43

jasonrohrer
Administrator
Registered: 2013-04-01
Posts: 1,235

Re: Pet sight bug

Ah, yes, you're right!  It happens with dogs to.... hmm...

Well, that's obviously a bug.  I'll move this back onto the other list.

Offline

#10 2014-01-22 08:44:31

remouk
Member
Registered: 2014-01-22
Posts: 3

Re: Pet sight bug

Not sure if this is the same bug, but there is a problem with dogs' vision/behavior. In this particular case:

EF0S4iV.png

The dog doesn't see me. If I go down he doesn't follow. If I go up once, he moves forward and kills me. So I guess it's a bug, isn't it?

Offline

#11 2014-01-22 09:00:04

jasonrohrer
Administrator
Registered: 2013-04-01
Posts: 1,235

Re: Pet sight bug

Mouse over the pit...

Dogs hate the smell of other, non-human animal corpses.

Offline

#12 2014-01-22 09:29:52

remouk
Member
Registered: 2014-01-22
Posts: 3

Re: Pet sight bug

Oh ok, didn't know that (and TBH I don't see the point but that's just me big_smile).

So there's no way to go past this dog without a gun, am I right?

Offline

#13 2014-01-22 10:33:07

gyuri
Member
Registered: 2013-07-09
Posts: 232

Re: Pet sight bug

Now you see the point.

Offline

#14 2014-01-22 11:32:17

iceman
Member
Registered: 2013-11-09
Posts: 687
Website

Re: Pet sight bug

gyuri wrote:

Now you see the point.

I think he means the point of why dogs won't move near dead animals.

The reason is because, due to the way the game is designed, dogs can't step on the same tile as another "Mobile" (Animals, panic button, and shotgun).  That means that if you're standing on a dog corpse, you're perfectly safe from dogs.

Now, if the dogs DIDN'T stay away from dog corpses (like they do now), hallways of dogs would be trivial to pass.  You'd simply shoot the first one, stay behind the corpse until the rest of the dogs lined up on the other side.  Then, step on the corpse, and the dogs will be right beside you in clubbing range, but since you're on a corpse, they can't kill you.

The way it is now, since they'll only step beside a corpse if YOU are there, you can't step on a corpse and club dogs safely.

gyuri wrote:

So there's no way to go past this dog without a gun, am I right?

Correct

Last edited by iceman (2014-01-22 11:33:30)


Fortress Theory Mod - New objects, tools, and paintings!

I keep dying of a natural cause - Stupidity
The biggest thing that Castle Doctrine has taught me is that the price of your house is proportional to the stupidity of the mistake that kills you.

Offline

#15 2014-01-23 05:23:14

remouk
Member
Registered: 2014-01-22
Posts: 3

Re: Pet sight bug

Thanks for the answers iceman, it's always better to know how it works exactly!

Offline

Board footer

Powered by FluxBB 1.5.8