# Devlog #3: Basic Skill Range

Today I wanted to talk about "skill range".

What is range?

Range is basically an upper and/or lower bound of some sort of scale. In our grid system, we are interested in the "distance" between two objects. "Skill range" is therefore "how far" or "how close" an object must be in order to be "within range".

How to Measure Distance?

There are various ways to measure distance. But to make things simple, we'll be using "number of tiles between two objects". Basically count the number rows and number of columns between them.

For example, if you have one unit standing beside another unit, that is considered to be "one tile distance": they are one column apart.

If the two units are standing a bit further apart like this, we say they are "two tiles apart", because they are two columns away from each other.

If they were standing diagonally like this, we would say they are two tiles apart. I mean, if you use the euclidean distance you get something between 1 and 2, and that's PROBABLY more accurate? But in our grid system, each tile is is the smallest unit of measure. There's no such thing as half a tile, so we basically have to choose whether to treat it as one tile apart or two tiles apart.

For now we'll just say it's two tiles, because they are "one row apart" + "one column apart".

Anyways so with the definitions out of the way, we can focus on the actual implemention of skill range.

Range Highlight

It would be useful to start by visualizing what our range is. In addition to "selection highlight" and "AoE highlight", I added a new type of highlight called "range highlight" which basically highlights the range of your selected skill. This is probably good enough for most purposes, because the player only really needs to know which tiles are "selectable"

So for example in the following screenshot, I've selected the 'Move" command which has a range of 2. So all of the tiles that are within a distance of 2 tiles are highlighted in blue, and the yellow square the tile the tile that our grid selector is currently at.

Valid Tiles

Whether a tile is selectable is generally determined by the "scope" of the skill. For example, whether it's an empty tile or not, whether it's within range or not, whether it can be walked on or not.

Currently I haven't implemented scope yet, so I'll just assume a tile must be "within range" in order to be valid. Maybe there are situations where you allow for a target to be selected "out of range"? Like maybe you wanted to "examine" a target to look at its stats, but you don't want this to be an actual action.

It might be useful to say "within range" is a default scope, but you can override it by saying "ignore range" or something. Not sure at this point.

Minimum Range

Another thing that might be useful is the ability to define a "min range". Basically, if a target is too close, you can't hit it. This might be used for ranged weapons like bows where you require a certain amount of distance between the target. Here's an example of how a skill with max range of 4 and min range of 2 looks

Everything is a Skill

I'd like to emphasize the idea that everything is a skill in my system. Whether it's movement or attacking or summoning chickens, they are all set up as skills in the database.

This means that all of them automatically have skill ranges, and you can customize how you want individual skills to function.

Perhaps you have one unit on horseback that can move up to 6 spaces per turn, and another unit on foot that can only move 4 spaces. You can set this up easily by creating one move skill with 4 range, and a second move skill with 6 range. Then you just assign the move skill to the appropriate units and now you can have different movement ranges.

Thoughts?

Let me know what you think of the range system, how it could be used, or how it could be improved.