## When using a grid for combat, do corners grant cover?

We are using a grid for combat. In the diagram below, the grey areas are walls.

If A attacked B, would B have any cover from A?

## How to measure on a grid the area of a sphere area spell or effect centered on a creature?

Per the Wild Magic sorcerer’s Wild Magic Surge table (PHB, p. 104)

07-08: You cast fireball as a 3rd-level spell centered on yourself.

There’s other questionable area spells in that list (grease is a 10 foot square, so your square and which three?), but I’ll focus on spheres like fireball (PHB p. 241):

(…) Each creature in a 20-foot-radius sphere centered on the point must (…)

My problem is, the sources I found so far – including the other answers to similar questions here – talk about measuring spheres from grid square intersections, whereas this clearly talks about it being centered on the unlucky Wild Magic sorcerer. Plus, since it’s a wild magic effect, it doesn’t exactly have a caster that can pick a point of origin. Is there an accepted way to measure an effect like this?

## Grid Puzzle Split Algorithm

What could be the best approach to divide an $$N\times N$$ grid into $$N$$ groups having $$N$$ tiles each? Is there a well-known algorithm to create a random puzzle of this type? I could not find a direct answer on the net. Max grid size will be 10×10. Below is an example for 5×5 grid.

# Setup

Here’s the setup: I have an $$N$$ x $$N$$ grid of tiles, and a list of $$M$$ agents that need to move across the grid. Each agent has its own start tile $$S(a)$$, end tile $$E(a)$$, and an exact number of steps $$D(a)$$ it must make. Each step consists of a one-tile move horizontally, vertically, or staying in place. For each agent, $$D(a)$$ is usually much larger than the Manhattan distance between $$S(a)$$ and $$E(a)$$, so the path the agent takes is not necessarily a straight line from $$S(a)$$ to $$E(a)$$. Furthermore, the sum of all $$D(a)$$ is expected to be much larger than $$N$$ x $$N$$, so every tile will be used at least once. Agent paths are allowed to intersect with other paths and with themselves, and the number of agents on a tile at any given time doesn’t matter.

# The Problem

I would like to find paths for each agent that begin at $$S(a)$$, end at $$E(a)$$, and are exactly $$D(a)$$ steps long, with the goal of minimizing the maximum number of times any given tile is used. More formally, given an agent path $$P_0 \ldots P_n$$, let $$C(P, t)$$ be the number of times tile $$t$$ appears in $$P$$, and let $$A(t)$$ be the sum of $$C(P, t)$$ over all agent paths. I would like to find agent paths that minimize the maximum $$A(t)$$ over all tiles $$t$$.

My intuition tells me that this problem is almost certainly NP hard, so I’m looking for some kind of approximation or heuristic.

# First Attempt

My first stab at solving this was to find each path sequentially. For each agent, I create a 3-dimensional $$N$$ x $$N$$ x $$D(a)$$ search space, then use A* search to find the min-cost path from $$[S(a), 0]$$ to $$[E(a), D(a)]$$. The cost of each node in the search is the number of times that tile has been used by previous paths. Then, once the path is found, I add to the cost of each tile used, and proceed to the next agent. Of course, this leads to the problem that while the last agent path will be pretty good, the first agent path will be essentially random because the grid is yet totally unused. So, I just loop this process a few times; once the last path is computed and the tile costs updated, I loop back to the first path, subtract from the grid the costs that agent contributed, then recompute that path and add the new costs in. After 3 or 4 loops, I converge on a pretty reasonable solution.

But I’m hoping there’s a better idea out there. Any ideas or references to similar problems that I could read up on would be very welcome.

## How do we determine circular AoE areas on grid?

I dont know how to explain it, but i have a question about spells areas, imagine a spell has a 10´radius circle area, wich one work better?

Im confused because the lower option its not 10´foot radius its, 12,5´foot radius, taking an extra square of area.

Thank you

## When using the wall of fire spell, what shape is a ringed wall on a grid?

I was looking at wall of fire and realized I wasn’t sure how to represent the ringed version when on a grid. The spell states (emphasis mine):

You create a wall of fire on a solid surface within range. You can make the wall up to 60 feet long, 20 feet high, and 1 foot thick, or a ringed wall up to 20 feet in diameter, 20 feet high, and 1 foot thick […]

So assuming we maximize the diameter to 20 feet and use the following rule from the Dungeon Master’s Guide (DMG: page 251) we get the following images with the second showing the outer squares, where the ring actually is:

Choose an intersection of squares or hexes as the point of origin of an area of effect, then follow its rules as normal. If an area of effect is circular and covers at least half a square, it affects that square.

However, this image seems incorrect; one could simply leave the ring by moving diagonally, avoiding taking damage entirely. Have I made a mistake in my drawings or is this just a case that the rule happens to not work well with?

## How do I map a 15′ cone to a 1″ grid?

I’ve been playing 5e for a while now, and mercifully this hasn’t come up yet, but it’s definitely on it’s way.

When a caster casts burning hands, how is that properly mapped onto a standard 1″ battle mat? The easy response is a 3×3 square, and that’s the method I’ve told myself I’m going to use. But is there a better template?

The 3×3 grid works great if the caster casts on a corner, it matches the description of a cone perfectly (each square is 5′, 10, 15′ away for the purposes of grid math). However, when a caster casts the spell in a cardinal direction (N/S/W/E), that math breaks down. now a second or even third square is adjacent with a 3×3 square and the spell description has fall apart.

What are the appropriate grid shapes for a 15′ cone?

## Managing pre-placed objects in a grid based game

i am building a city management 3D game, however the terrain is completely flat. I am planning to use a grid for placing roads and walls and buildings.

It then makes sense to use the grid to detect where you can build instead of colliders.

My question is, how do I get the pre-existing objects like trees, rocks etc on my grid so that I can’t place buildings on top of them? Or is there a better way?

## Get row in Grid to evenly divide?

I’m having an issue making the second row in this grid space out evenly:

Grid[{{Slider[ImageSize -> 300], SpanFromLeft, SpanFromLeft}, {"l",     "c", "r"}},   Alignment -> {{2, 1} -> Left, {2, 2} -> Center, {2, 3} -> Right},   Frame -> All, Spacings -> Automatic] 

## How to maximize the number of filled grid squares in a partially filled grid with Tetris shapes

So here’s the problem:

-You are given a partially filled grid of size mxn (represented by a matrix of 1s and 0s where a 1 signifies that grid square is occupied by a block and a 0 signifies that grid square is empty)

-You must minimize the number of empty grid squares by filling this grid with Tetris shapes which are each composed of exactly 4 blocks (a block is 1×1)

What is an algorithm that can consistently do this given any mxn partially-filled grid?