Issue information

Issue ID
#3452
Status
Fixed
Severity
Medium
Started
Hercules Elf Bot
Jul 31, 2009 19:42
Last Post
Hercules Elf Bot
May 18, 2012 11:45
Confirmation
Yes (3)
No (0)

Hercules Elf Bot - Jul 31, 2009 19:42

Originally posted by [b]theultramage[/b]
http://www.eathena.ws/board/index.php?autocom=bugtracker&showbug=3452


[rev=13944]: "Range for players' attacks and skills should always check for a circular area."
This change was based on a random baseless side-note ([bug=3339]) by Playtester:
[quote name='Playtester']I'm not sure how it is interpreted by eA or if we have already implemented that the range for monsters is square while for players it's circular.[/quote]

Now where the heck did this come from? Aegis never uses circles anywhere, we proved that a few thousand revisions ago when eA was changed to not use circular distance checks. The abovementioned commit is a game-breaking regression wtf and should be removed.

(will be done as part of the charmerge mergeback)

This post has been edited by Brian on Apr 5, 2012 8:00

Hercules Elf Bot - Apr 5, 2012 8:07

Originally posted by [b]Brian[/b]
(the rest of the replies from the original bug report)

[quote name='Inkfish']he always bases on Doddler and so does he this time.

according to him, Aegis did use square for all distance check at the first time and then changed to use circular distance check to prevent some exploits(he didn't explain what).[/quote]

[quote name='theultramage']It is not circular for attacks or skills on episode 11.3 aegis. If it was changed (and I did not read about it in the ragnarok news section), then it has to be something fairly recent. I think it's fake though.[/quote]

[quote name='Inkfish']Simple test conducted on cRO(EP13.1) shows range for player is denfinitely NOT square.

Player A and B

A1 A2 A3 A4 A5 A6 A7 A8 A9
o
o
o
o
o
o
o
o
o
o
o
o
o
B1
B2

B can attack A without moving when A is on cell A1 and B is on cell B1
B will have to move half a cell before starting to attack when A is on cell A1 and B is on cell B2
B can attack A without moving when A is on cell A2 and B is on cell B1
B can attack A without moving when A is on cell A3 and B is on cell B1
B can attack A without moving when A is on cell A4 and B is on cell B1
B can attack A without moving when A is on cell A5 and B is on cell B1
B can attack A without moving when A is on cell A6 and B is on cell B1
B can attack A without moving when A is on cell A7 and B is on cell B1
B can attack A without moving when A is on cell A8 and B is on cell B1
B will have to move half a cell before starting to attack when A is on cell A9 and B is on cell B1

(well, by move half a cell, i just wanted to describe the appearance and to say that the max range has been reached.)[/quote]

[quote name='theultramage']Hm, this is a problem then.

[attachment=1365:bugtracker_reply-144308-1249129146.png]

It indeed is a circle (a rather imprecise parody of a circle, but whatever).
So now come the questions: does this apply to everything, or just client-controlled skill usage? What was that about mobs using square? Was that tested?[/quote]

This post has been edited by Brian on Apr 5, 2012 8:09

Hercules Elf Bot - Apr 5, 2012 12:46

Originally posted by [b]Rytech[/b]
I found this hard to believe, but after doing a test based on the test results in the pic I learned that this circle thing has to be real. Without it a physical range exploit is possible. Take a look at the pic I made from the test results.

In the pic you see I made a full circle using his data and then marked some white lines across it to mark each 45 degrees angle and also help with the white circle measurement. The white circle shows the green area which is castable on without moving is physically equal all around in distance (talking about in actural measured distance, not cell distance). Then I finally placed some numbers to mark cell ranges to show how far your really casting when targeting straight up or down, straight left or right, and at a direct 45 degrees angle.

Whats interesting here is while it looks normal to cast + or - 10 cells X or Y on the grid, you can clearly see how much further you can physically cast when targeting 10 cells with X and Y combined. 3 cells of physical distance. This extra distance is likely part of the exploit and also the reason Gravity switched the casting range to a circle. Imagine using that extra distance in some way like....like in WoE for example, or to kill MVP's more easily.

Now what if we combined this with ground AoE's? Most AoE's are known to follow the square shape layout which will cause the corners to physically stretch out more. So lets imagine a 9x9 AoE magic skill with a 9 cell range. Casted up, down, or all the way to the side, your AoE will be placed 9 cells away from you and the sides of the AoE will stretch out 4 cells all around. So you can hit something 13 cells away.

But what if we casted that same skill at a 45 degree angle at something thats standing on that line of cells? You can already cast physically further like that, but that AoE will also have its corners physically stretching out further then the sides of the AoE. So thats even a greater reach.

I dont know if its a illusion im seeing here honestly, but the pic is clearly speaking to me on whats going on. If the cast range thing is true, then keep it or have a config to enable/disable it. As for AoE's the day I see Land Protector change into a circle shape AoE is the day ill learn if they made AoE's follow circle forums.

Hope I explained this in a understandable way.

This post has been edited by Rytech on Apr 5, 2012 12:59

Hercules Elf Bot - Apr 6, 2012 7:56

Originally posted by [b]Angezerus[/b]
I can confirm that on rA mobs use sqare range, and players have somewhat of a bugged sqare circle. The first is a bit annoying because you can easilly walk into the corner of the monster's range even if it is far away, but you can't hit it from the same distance on a diagonal position. The second problem is with player attacks and skills. It seems that it's mixed up a bit because it's not really smooth, as you can see in my similar post:
[url="http://rathena.org/board/tracker/issue-5502-position-bug/"]http://rathena.org/board/tracker/issue-5502-position-bug/[/url]

When casting or attacking from outside of range, the player moves closer, but the movement is a bit buggy, and sometimes you cant attack from the position you moved onto, or when you cast a skill from outside, you move closer, but the skill interrupts and there is no cast. It looks like if it is using a larger area for position check, than attack range check, and when it moves to the calculated pos, you skill can't attack sometimes.

Please do something about this. It's very annoying, both the monster and the player version of the bug.

This post has been edited by Angezerus on Apr 6, 2012 7:56

Hercules Elf Bot - Apr 26, 2012 8:26

Originally posted by [b]Angezerus[/b]
/panic

Hercules Elf Bot - Apr 30, 2012 12:55

Originally posted by [b]Angezerus[/b]
I have noticed some odd thing. Skills that's area is "full screen" uses a curcular area as well. This way they don't affect the whole screen. So based on this, everything has to be either circular, or sqare, because this mixed state is only a source of problems.

This includes: view range (currently sqare), attack range (currently circular), monster attack range (currently square), cast range (currently circular), monster cast range (currently sqare).

And movement is still bugged when attacking from outside of range.

Hercules Elf Bot - May 2, 2012 3:48

Originally posted by [b]Ind[/b]
I reproduced this on an official server, however I noticed our calculation is wrong somewhere, as i was testing vs a geographer in both rathena and official server I noticed when attacking from diagonal rathena makes the player move much closer than official server does, as I'm not a good math person I don't think I'm able to find out whats the actual formula.

Hercules Elf Bot - May 2, 2012 3:49

Originally posted by [b]Ind[/b]
[hr]
this is the broken part:
[CODE]
{ // Range for players' attacks and skills should always have a circular check. [Inkfish]
int dx = src->x - bl->x, dy = src->y - bl->y;
if( !check_distance(dx*dx + dy*dy, 0, range*range+(dx&&dy?1:0)) )
return false;
}
[/CODE]
i'm not sure what can be broken there however.

Hercules Elf Bot - May 2, 2012 8:45

Originally posted by [b]Angezerus[/b]
[quote name='Ind' timestamp='1335930590' post='8838']
[hr]this is the broken part:
[CODE]{ // Range for players' attacks and skills should always have a circular check. [Inkfish]
int dx = src->x - bl->x, dy = src->y - bl->y;
if( !check_distance(dx*dx + dy*dy, 0, range*range+(dx&&dy?1:0)) )
return false;
}[/CODE]
i'm not sure what can be broken there however.
[/quote]

I checked this function:
[CODE]
int check_distance(int dx, int dy, int distance)
{
#ifdef CIRCULAR_AREA
//In this case, we just do a square comparison. Add 1 tile grace for diagonal range checks.
return (dx*dx + dy*dy <= distance*distance + (dx&&dy?1:0));
#else
if (dx < 0) dx = -dx;
if (dy < 0) dy = -dy;
return ((dx<dy?dy:dx) <= distance);
#endif
}
[/CODE]

It seems a little bit odd to me that this:
[CODE]
!check_distance(dx*dx + dy*dy, 0, range*range+(dx&&dy?1:0))
[/CODE]
always gives 0 as the second argument to the function. Why is that? Isn't something mixed up there? The other parameters seems to be wrong for me as well.

It seems to me that someone made this function for distance check, but forgot to remove the old calculation and replace it with the parameters in the code when you call it.

I believe this is how it should look like:
[CODE]
{ // Range for players' attacks and skills should always have a circular check. [Inkfish]
int dx = src->x - bl->x, dy = src->y - bl->y;
if( !check_distance(dx, dy, range) )
return false;
}
[/CODE]

This post has been edited by Angezerus on May 2, 2012 8:54

Hercules Elf Bot - May 3, 2012 0:37

Originally posted by [b]Ind[/b]
Angezerus thank you very much. I compared the distance official servers move in a diagonal vs geographer and in rathena with your modified version of the range and it matches perfectly. I'll apply to the svn and credit you.

Hercules Elf Bot - May 3, 2012 0:38

Originally posted by [b]Ind[/b]
Fixed in [rev=16054]