I’ll try to more fully explain some of the individual pieces, since a fully realized example would be too much to cover in this comment box.
You can quantize your vector locations using the FVector::GridSnap(…) function. Just provide it a float value to tell it what size you want each grid square to be. (For example, 100 units, a.k.a. 1 meter.) This will enable you to easily convert any standard 3D location into one that respects your grid.
To highlight a square on the ground, you have several options, but one easy approach is to use a Decal actor, pointed straight down, with a material that creates a square border/shape of your liking.
To get this grid-highlighting decal actor to snap to the grid under the cursor, you can use a line trace to determine the 3D point where the cursor is “touching” the ground, then GridSnap() this location to quantize it, and finally move the decal actor to this quantized location.
If you’re performing the trace in a subclass of APlayerController, you can take advantage of the very convenient GetHitResultUnderCursor(…) function. For example:
FHitResult Hit;
GetHitResultUnderCursor(ECollisionChannel::ECC_Visibility, false, Hit);
if (Hit.bBlockingHit)
{
// The projected 3D location is stored in Hit.Location, which we can
// quantize using FVector::GridSnap() and a grid size of 100 units
FVector QuantizedCursorLocation = Hit.Location.GridSnap(100.f);
...
}
As for constraining player character movement to the grid, for starters, just try feeding the pathfinding system with grid-snapped locations. This, combined with the cursor highlight, should begin to sell the effect you’re looking for.
There’s much more that can be done, but that should get things started. I hope this makes sense, and sheds more light on the subject!