Miskatonic-Investigative-Society / CoC7-FoundryVTT

An unofficial implementation of the Call of Cthulhu 7th Edition game system for Foundry Virtual Tabletop
https://discord.gg/foundryvtt
GNU General Public License v3.0
118 stars 98 forks source link

[Feature] Implement diagonal distance #148

Closed lozalojo closed 3 years ago

lozalojo commented 4 years ago

I'd suggest, if it is possible, to implement the diagonal distance measurement; currently there is no diagonal movement restrictions:

Vass1979 commented 4 years ago

Please make it optional if implemented!

lozalojo commented 4 years ago

HavlockV told me in the discord channel that this behavior happens only for movement, CoC system measures diagonal distances correctly, independently of what the ruler says.

So if you set grid to OFF and grid px to 50, the ruler shows the exact distance in all directions, using the 50 px/5 feet (10px/feet) base. It is a workaround that works great. Also if you use hexagonal grid, it works also with minor bias.

HavlockV commented 4 years ago

I had a look at it. The 'correct' way to measure distance is to use the build in API xxxGrid.measureDistances where xxx can be Base (gridless), Square and Hexagonal (even, odd ...) I didn't know that... So I used my own grid measuring function which is the classic hypotenuse(pixel)/gridSize(pixel) * gridDistance(unit) of the ACTIVE scene. So as it is implemented right now, whatever type of grid you choose, distance will always be calculated using the above formula (which correspond to the gridless : BaseGrid.measureDistances) The option you see on different modules override this measureDistances method for a certain type of grid ( Square in the case of DND5) and propose different calculation methods. I can implement it but it will have no effect (other than what you see using the tool) as I'm not using that to calculate distances. A quick word on the measure distance tool. It indeed uses the xxxGrid.measureDistances method, which will be altered by the settings you use (Euclidean (rounded), Alternating or Equidistant) and the type of grid. Holding Shift (you actually need to start measuring, then press shift, then move) while measuring will give you the actual Euclidean distance rounded to 2 decimal. That's the one CoC system uses. I could switch to the classic way of grid measurement then letting the user decide of their method of distance calculation depending on the type of grid they are using (using a grid-less grid will give you the actual calculation, a square the Equidistant etc...) I'll leave this open as a reminder.

Vass1979 commented 4 years ago

Not sure if this is relevant to the range topic, but take a look at this. My character is shooting the Fire Vampire from 10 yards away, with a firearm that has a range of 15 yards as you can see on the picture. Yet still the range is displayed as long instead of normal. Feels like a bug to me, but wanted your opinion. Keep in mind that the fire vampire covers a 2x2 space.

rangebug

HavlockV commented 4 years ago

It is completely relevant to the range topic. You're using a square grid so the measurement tool uses the equidistant method to calculate a distance. This is the default method of distance calc for a square grid. All the squares around your token are a 5 yards away (even the diagonals one), 10 yards for the second 'around' square, 15 for the third etc...

As you can see the system tells you that your distance is 10 Y but, you're measuring 2 diagonals and a diagonal is actually 7.07 in a 5 unit grid. (7.07 being 1.4142*5, 1.4142 being the square root of 2). So it should tell you 14.14 yards. You can have this by holding shift AFTER you start measuring ( you may need to move a little bit to trigger an update) I'm using the actual distance, center to center, which in you case is actually 2.5 diagonals so 17.7 yards. The square grid doesn't use half diagonals. Your fire vampire (nice art BTW) being 2x2 I'm not sure how this will be calculated by the default measurement, as you can land only on a square center in a square grid. I would recommend using a grid-less grid for the time being, then you will have the actual value used by the system center to center. This is until I switch to the 'normal' way of calculating distance, bound by the type of grid you're using. It may also needs an option to set the measurement from center to center of from closest square...

HavlockV commented 4 years ago

Also be aware that your grid unit is of 5 yards per square, making your fire vampire 10x10 yards, 9x9 meters.

Vass1979 commented 4 years ago

OK, so I changed my scene to gridless, grid units is 5 yards. When I shoot at the fire vampire it is still long distance. When I shoot at creature example short distance. When the monster is more than 1x1 size, where is the "hit box" located?

bug2

HavlockV commented 4 years ago

Yes, it's normal, the system uses center to center to calculate the distance, in your case that should be around 17.5 yards. That's an option that I can add later, switching from center to center to center to first 'square' hit.

Vass1979 commented 4 years ago

Center to first square hit sounds like the correct rule if I'm honest. The creature does occupy that square, so makes sense :) Thanks Havlock!

HavlockV commented 4 years ago

No prob. I thing so little making so much difference came from the fact that your grid unit is too big. Usually a 'commercial' grid is 5 feet per square. If you look at the right side of the picture the book roughly is half a Square, making it (with a 5 yards per square unit) a 2.5 yard (2.2 meters) wide book. Your character occupying 1 square make them 5x5 yards, 4.5 meters. As a rule of thumb, and that's actually what European editors use usually for distance in CoC, 1 yard = 1 meter.

lozalojo commented 4 years ago

I agree with HavlockV, if you set the grid to 5yrds, then the movement is 1 square and a half per turn, more or less, it is too big, imho, why did you switched from standard 5ft ruling?

This affects the size of your tokens, your character and creatures should be 3 times lower than they actually are, and so, then there shouldnt be that differences between the "center of the token" and the reach of the creature.

Vass1979 commented 4 years ago

I switched it just for testing purposes. For my Cthulhu games I have each square be 2 yards. That way a character with a movement of 8 can move 4 squares.