Additional Tower/Pylon Placement Helper

Started by Grabz, December 29, 2018, 03:33:29 PM

Previous topic - Next topic

Grabz

I've been watching K75's stream today and as I watched him place pylons, I got an idea. Images below taken and edited from his stream.

When you place towers or pylons, you usually want to place them as far apart as possible to maximize efficiency. For example, when placing a long range connector like a pylon, this means that you often have to look for that "sweet spot" position that is right on the edge, as far away as possible from the nearest pylon but close enough to connect. What if we could have a way to simplify the process of finding that edge?



The red color is a part of the circumference around the connection radius from the nearest placed pylon (the pylon in bottom left of the screenshot), and the distance from the cursor to the ghost of the pylon we are placing.

When placing a pylon, if you hold a key (say, Shift), if the cell under your mouse is too far away from any other pylon to connect to, the ghost of the pylon we're placing will "snap" to the furthest connectable position from the nearest pylon. This way we don't have to be precise about placing the pylon, we can just hold a key and look for a suitable position around the circumference of the connection radius.

Second image for reference, if we moved our mouse slightly down:



This could make placement a lot easier, especially in combination with another key that could let us snap units to 90 degree angles. Holding both these keys would allow K75 to build his starter collector fields in no time, and holding just this key would make it trivial to place efficient pylon connections.

Thank you for reading! Let me know what you think.
For quicker response, reply to me directly at Grabz#4707 on Discord. Find me on the KC server: https://discord.gg/knucklecracker

knucracker

Let's explore "furthest connectable position from the nearest pylon" in detail...

This is the algorithm I took from what you wrote:

1 The nearest pylon would be the pylon nearest to the current mouse position (3d linear distance).

2 The pylon ghost (the pylon to build) would appear on an imaginary line that goes from the nearest pylon through the mouse position. The ghost's distance from the nearest pylon would be the max connection range.

3 The pylon ghost would NOT take into consideration build legality.  So the ghost would appear red if over some other unit or irregular terrain.

4 The mouse position might be inside or outside the maximum build radius.  Often it might be inside the maximum build radius since that might be required in order to select the 'nearest pylon' to build outward from.

Observations and thoughts:
This sounds like it would work, but the complexity is in selecting the "nearest pylon" (not computationally, but for the player).  Moving the mouse too far out or around could cause the algorithm to select a different pylon.  You could imagine every existing pylon would show a circle around itself whenever you entered pylon build mode.  As you move the mouse around (with the special key held down), the pylon build ghost would snap to one of those circles.  The circle it would snap to would be the pylon nearest the mouse.

So to precisely control where to snap, you have to move the mouse closer to the pylon you want to build from.  The closer you get to the source pylon the more sensitive the direction of the outward casting ray, or line, becomes. 

For pylons the irritating cases are probably minimized and the utility is enough to warrant it.  For towers, I'm not sure without actually trying it.  They are often crowded around each other.

Placement for a pylon or tower is often constrained not just by legality of placement, but by ability to connect.  Terrain can get in the way.  This is less often the case for pylons and fairly common for towers.  So the solution to "where to build on the line outward from the nearest existing pylon", might not always be at max radius.  It might need to be somewhere shy of that to maintain connectivity (like on the wall that would occlude the connection if the pylon were placed at max distance).

I guess a totally different algorithm might be:
A: Press a magic key while in build pylon mode.  Select the nearest existing pylon to the mouse pointer at the moment the magic key is pressed.
B: Calculate and show all possible build locations on the map for at max distance (maintaining connectivity and legality of build). Show these markers on the map until the magic key is release, or the mouse is clicked to build the pylon.

That said;
The method for selecting the 'nearest pylon' in "A" just above, could also be the method used in step "1" in the algorithm above.  The build location for the pylon in the first algorithm could be the same as in the A/B algorithm, just constrained to looking in an arc of some reasonably constrained angle around the line from the 'nearest pylon' to the mouse pointer.


Grabz

#2
That's on point, and these are some great observations!

Quote from: knucracker on December 29, 2018, 06:45:48 PM
This sounds like it would work, but the complexity is in selecting the "nearest pylon" (not computationally, but for the player).  Moving the mouse too far out or around could cause the algorithm to select a different pylon.  You could imagine every existing pylon would show a circle around itself whenever you entered pylon build mode.  As you move the mouse around (with the special key held down), the pylon build ghost would snap to one of those circles.  The circle it would snap to would be the pylon nearest the mouse.
I gave this some thought, and at first I figured you're totally right - it would be really inconvenient to have your ghost suddenly snap to a different pylon. You mentioned a circle... that made me think of a filled area. You probably have thought of the same, or a very similar thing already, but I figured I'd make an illustration on a flat surface:


The black points are pylons, and the red circles are marked cells which are "too close" to the pylon, i.e. the new pylon can still be placed further away. The rest of the image are a few outlines. The image assumes that the pylons and the red areas are what you would see in game.

The purple areas are example places where, having your cursor on them, it should be pretty obvious for the user to know which pylon they are snapping to. They should be able to tell from the pylon that is closest.

However, if you're trying to place things efficiently, and you're given this full readout of pylon areas, you'll likely want to stick to the areas that aren't marked red with your cursor. I outlined two points of interest where you might place your cursor trying to efficiently fit a new pylon. The green lines are the distance from the cursor to the closest edge of the surrounding circles. If my theory is correct, in this setup the player should immediately be able to tell which side the ghost will snap on based on how close the cursor is to the chosen circle, thus the chosen pylon. In both cases the ghost should snap to the pylon up top, as the green lines are the shortest.

A screenshot example:


The upper right pylon was added in for the sake of example. In this case the ghost would snap to the edge of the bottom circle because you can visibly see it's closer.

I originally did not think this could need a visualization at all... but you're right that it would definitely need a visualization of some sort. Lines could work as well, maybe with additional highlights placed only around the nearest pylons, so you can determine distance between them without having to focus on any of the other pylons. For example: find the closest pylon to cursor, write down the distance between the pylon and the cursor, and highlight this pylon. If this distance were "x", highlight each other pylon if its distance to the cursor is between "x" and "x + 5". This way the player only has to focus on the nearest pylons.
For quicker response, reply to me directly at Grabz#4707 on Discord. Find me on the KC server: https://discord.gg/knucklecracker