When moving diagonally, require one of the cardinal direction spaces to be open

This is a problem, and it’s only going to become more of a problem in the future.

Physics for diagonals is weird. When you turn a car, suddenly you can walk through the walls. If I create a multi-tile snake creature You’ll be able to outright walk through parts of it as if they weren’t there - diagonals, unlike cardinals, don’t actually logically “connect”.

I think that while everything else about diagonals should stay the same, the player should “move” through one of the cardinal squares on their way to that diagonal location - if both cardinals are blocked, they can’t move in that direction. If both cardinals are traps, they will hit one of them (but the logic will always assume the player moves through the square without a trap if it’s available).

If you go with this, you’ll need to correct the layout issue with buildings, especially labs and houses, where doors sometimes appear in corners of rooms. This fix would make such doorways inaccessible.

Would save some consternation the first time you try to sleep in a car near a swamp.

Also needs to block attacks and line of sight in general.

If you tried to move diagonally between two creatures, would that result in you melee-attacking one of them at random?

Urgh, that’s a good point. While you shouldn’t be able to walk through a worm, it means 4 zombies could effectively completely block you in… Hrngg…

This kind of thing makes sense if diagonal movement is actually a series of two cardinal moves (manhattan movement), we treat diagonal movement as actual diagonal movement, so if two squares are connected diagonally, they’re connected. This is clear if you visualize the tiles as square-packed circles https://en.wikipedia.org/wiki/File:Square_tiling_circle_packing.png which makes it obvious that there are gaps that can be navigated. Effectively, diagonal movement being “blocked” is a visual artifact. This is the sort of thing that makes people use hex grids.

If you want the snake to block movement, restrict the snake to cardinal movement, it’s going to look really bad with gaps in it anyway, even if they’re rendered “apparent” by a change to navigation. This would prevent it from going through diagonal gaps itself, and the severity of that depends on the environment it spawns in.

Alternately, special-case the problem cases, vehicles and snakes, to use this rule, which now that I think of it is probably the most natural solution. The triggers would be “if adjacent to a snake*” or “if stepping onto a vehicle tile”.

*Could be replaced with any multitile monster as needed, or even be a special property of some kind of monster that’s good at blocking movement.

Will this effect tires? Because I’m getting tired of having zombies come through tires.

Or even more generally, be a property of the “tile” that can be called, and will return a “connected to” value for multitile creatures, fields (this was a serious problem when designing the sludge crawler), vehicles, or even diagonal walls.

Alternately, like you said, I could just hack around multitile continues events by allowing them to only occur in cardinal directions. One way this could be achieved without (for example) limiting such creatures from moving diagonally, would be to have a “half” segment of some sort, that only appears when moving diagonally and only appears when there’s an open space for it to appear in. This solution isn’t the best for vehicles, admittedly, but it is something that could work with some tweaks. Let me demonstrate what I mean:
[tt]
3 unit long snake in a 5x5 field.

…o…
…o…
…o…

Snake moves 1 unit northeast - “half segement” is created"
Snake appears 4 tiles long, but it /works/. Only three of these segements are ‘real’, but one is created to ‘link’ two of the segments and will be discarded when it is no longer needed.
…o.
…oo.
…o…

Snake moves 1 unit east - “half segement” is maintained, preventing movement through the gap.
…oo
…oo.


Re-centered, with a wall with a diagonal gap placed to the east. (now 4x6)
…|
.oo…|
oo…|.
…|.

Snake moves a square to the east - since there’s no longer a diagonal translation between it’s body parts, the “half segment” is dropped.
…|
.ooo.|
…|.
…|.

Snake moves a square to the east
…|
…ooo|
…|.
…|.

Snake moves a square to the southeast
The half-step segement goes to place itself in the square to the sw, between the two segements, but since that square is already blocked it does now. It then tries to place the half-step segment to the east instead, but since that is also blocked, it just places nothing. If either of those become unblocked, we could have it pop in a snake segment.
…|
…oo|
…|o
…|.

Here’s an example of a snake turning a u-turn corner in a hallway:


|…| |.oo…| |.ooo.| |…oo.| |…|
|.o|…| |.o|…| |.o|o.| |…|o.| |…|o.|
|.o|…| |.o|…| |…|…| |…|o.| |…|o.|
|.o|…| |…|…| |…|…| |…|…| |…|o.|
[/tt]

The general concept crossed my mind, but I didn’t immediately see how to make it work, for snakes at least that’s a better solution I think, maybe for vehicles too, especially if… we don’t draw them!

Here’s a 90-degree set of rotations for a car, I’m not sure that it’s the exact set of rotations the game uses, but the principle is the same. The second row has ‘’ characters inserted to show where extra blocking tiles would be inserted. The key here is we don’t draw the ‘’ characters I’ve added, they’re only used for collisions.

  Before    After
   o--o      o--o
   |""|      |""|
   +##+      +##+
   +##+      +##+
   |HH|      |HH|
   o++o      o++o

  o--o       o--o\
   |""|      \|""|
   +##+       +##+
   +##+       +##+
   |HH|       |HH|\
    o++o      \o++o

 o--o        o--o\
  |""|       \|""|
  +##+        +##+\
   +##+       \+##+
   |HH|        |HH|\
    o++o       \o++o

  o--o       o--o\
   |""|      \|""|\
    +##+      \+##+\
     +##+      \+##+\
      |HH|      \|HH|\
       o++o      \o++o

 o           o\
 |-          |-\
 |"+         |"+\
 o"#+        o"#+\
  -##-       \-##-\
   +#=o       \+#=o
    +=+        \+=+
     -+         \-+
      o          \o

 o           o\
 |-+         |-+\
 |"#+-       |"#+-\
 o"##=o      o"##=o
  -+#=+      \-+#=+
    +-+        \+-+
      o          \o

 o           o\
 |-++-       |-++-\
 |"##=o      |"##=o
 o"##=+      o"##=+
  -++-+      \-++-+
      o          \o

  o-++-o     o-++-o
  |"##=+     |"##=+
  |"##=+     |"##=+
  o-++-o     o-++-o

As you can see, any time a row is shifted relative to its neighbor, it gets a blocking tile added. An open question is where collisions and damage get applied, I’d guess they get applied to the adjacent part on the same row of the vehicle, but it might go to the adjacent column instead, hard to say. I’m not sure that this will fill up gaps in non-rectangular vehicles, and I need to see how cleanly this will implement. The main blocker is barely squeaking past monsters/vehicles/terrain, this would keep this from happening sometimes, which really isn’t unreasonable, but it’s a CHANGE, so have to be careful about it.

Now I’m curious about using diagonal characters for boards…

  Before    After
   o--o      o--o
   |""|      |""|
   +##+      +##+
   +##+      +##+
   |HH|      |HH|
   o++o      o++o

  o--o       o--o
   |""|       \""\
   +##+       +##+
   +##+       +##+
   |HH|       \HH\
    o++o       o++o

 o--o        o--o
  |""|        \""\
  +##+        +##+
   +##+        +##+
   |HH|        \HH\
    o++o        o++o

  o--o       o--o
   |""|       \""\
    +##+       +##+
     +##+       +##+
      |HH|       \HH\
       o++o       o++o

 o           o
 |-          |\
 |"+         |"+
 o"#+        o"#+
  -##-        \##\
   +#=o        +#=o
    +=+         +=+
     -+          \+
      o           o

 o           o
 |-+         |\+
 |"#+-       |"#+\
 o"##=o      o"##=o
  -+#=+       \+#=+
    +-+         +\+
      o           o

 o           o
 |-++-       |\++\
 |"##=o      |"##=o
 o"##=+      o"##=+
  -++-+       \++\+
      o           o

  o-++-o     o-++-o
  |"##=+     |"##=+
  |"##=+     |"##=+
  o-++-o     o-++-o

Hmm, they’re a clear win with the middle two, I wonder if we can use them just there, it looks like it would be a fairly localized change…

We could also not-draw them in ascii mode but allow “overlap” into those tiles in graphics mode - it’s a way to make the cars look better while also communicating what tiles the cars are currently blocking. I imagine snakes/tentacles/my various desired multi-tile monsters will display differently in graphics mode as well.