Page 1 of 3

Combat Ranges

Posted: Sat Dec 12, 2015 1:16 pm
by John Adams
This topic is about how far away you stand from an NPC before you can effectively hit it. By default, we used a 250.0f value, but zippyzee changed it to 400.0f because 250 seemed too close (remember, scale in VG is very tiny). What I am working on today is adjusting the melee range for mobs who are not a 1.0 size.

Example, if an NPC is 10.0 size above normal size, you'd still need to be right underneath it to hit it. With the current code I am testing, I'm getting much more dynamic results based on NPC "size". See the attached video for an example. Before adding my new code, I would have to stand between his legs to not be "too far away". Now, as I approach, I get a more realistic attack range.

http://vgoemulator.net/images/too_far_away.mp4

BUT! The question is, strictly swinging melee weapons, is there any other facet of the game that needs to be considered when determining range for MELEE attacking?

Thanks in advance

Re: Combat Ranges

Posted: Sat Dec 12, 2015 1:45 pm
by Jakkal
5 meters (feet? They never say what the number is) is max melee range. Though max melee range wasn't determined by the center of the model. I think it was actually based somehow on model hitbox.

I don't know how the game calculated it out, but it might have something to do with the bounding box of the mob. As per my spider (Arachnidon Sunshine) example from the IRC chat, you could be 20m away from your tank and be able to hit the mob in the back with melee attacks.

Re: Combat Ranges

Posted: Sat Dec 12, 2015 2:47 pm
by John Adams
Right, in the example of a huge spider, previous to todays code changes I literally had to crawl under the belly of the beast to not be "Too Far Away". If your screen shot shows you 20m from the Tank, who is 5m on the opposite side, it's definitely not about center of mass.

With Jak's help, something that is starting to make sense is the way Sigil coordinates in a chunk line up with "meters". Might have been obvious to others, but from what I see it's about 1 meter per 100 x,y,z, but not exactly. I have a debug spitting out as I approach my target and clearly it's not perfect round numbers math.

I'm pushing test code to Targ now for a try, which considers x,y,z and the devs will try attacking multiple size NPCs before we send it to New Telon for player input. Keep the feedback coming though, as this is a work-in-progress.

Re: Combat Ranges

Posted: Sun Dec 13, 2015 5:09 pm
by Galladicus
How are creature hitboxes defined. Is each creature's hitbox manually defined? Also, is the hitbox generated as a sphere? Im brainstorming out of my ass of course, but if their is a hitbox property for a creature, could a universal melee ranged not be calculated as just X + 5, where X is the radius of the sphere drawn by the hitbox?

Sorry if this is not helpful at all. I wish i knew the first thing about how this game is put together. As far as i know, it operates on Ksaravi souls and faerie dust

Re: Combat Ranges

Posted: Sun Dec 13, 2015 7:05 pm
by Amnath
Five is max melee range, this is used in many encounters to attack from outside various mob effects, or to establish distance between party members to stop contagions.

On some mobs, particularly such as large spiders, this always looked like it was calculated from a hit box that was a little too small.

Of all things you'd want to be more complicated, I am not aware of anything that affected the basic 5 is the range. Encounters are going to be triggered by ranged shots or aggro radius, chances are a mob will close in to 2-3--but then it will not move if you back off to 5. All it will do is turn if you stay in range. Or, in the case of a non-aggressive mob, melee should not be able to hit outside of 5. Of course, one step doesn't always equal one distance unit.

Probably also related to character hitbox instead of center of mass.

Re: Combat Ranges

Posted: Sun Dec 13, 2015 7:49 pm
by Apaelias
Would that affect mob AoE type abilities? If Jakkal's rogue is attacking a giant mob in the back that has a Point blank 10 Range AoE can she now just stand outside of it? Wouldn't that drastically alter a lot of encounters? Or am I not understanding correctly?

Re: Combat Ranges

Posted: Sun Dec 13, 2015 8:11 pm
by Jakkal
No, we're talking about how the client calculates distance, how far you can stand from the mob to it and be within range. Mobs have their own abilities and could have AOE ranges of like 25-100

Re: Combat Ranges

Posted: Sun Dec 13, 2015 8:31 pm
by Apaelias
So for instance in the video John posted he was able to actually hit the mob at what looked like 16m. Is this going to affect spells as well? What I am thinking is if a mob has a 10m AoE that melee is supposed to joust won't this kinda just negate that AoE or joust tactic? Or would the mobs AoE ability be beefed up to account for his new size?

Say John is tanking a giant mob at its face and Jakkal is standing at a "20m" behind it backstabbing would my casting range now be based on it's size as well? So I could essentially stand another 20m behind Jakkal and hit the Giant Mob at 40m?

Re: Combat Ranges

Posted: Sun Dec 13, 2015 8:57 pm
by Jakkal
No, we're trying to make it just like it was in game. John's been having some trouble figuring out how the client works out the distance. It's wonky for some reason. But we want it to work like it used to.

Re: Combat Ranges

Posted: Mon Dec 14, 2015 7:34 am
by John Adams
Yes, in short, the problem is that our server does not yet match the client as far as Distance checks; so the bigger the NPC, the less accurate our server-side distance checks are. In my video, you saw me hitting the NPC at 16 (meters?) which of course is inaccurate.

The client does some crazy math I have yet to understand

Code: Select all

	//__asm
	//{
	//	movss	xmm1,[Y]
	//	rsqrtss xmm0,xmm1			// 1/sqrt estimate (12 bits)
	//	
	//	// Newton-Raphson iteration (X1 = 0.5*X0*(3-(Y*X0)*X0))
	//	movss	xmm3,[fThree]
	//	movss	xmm2,xmm0
	//	mulss	xmm0,xmm1			// Y*X0
	//	mulss	xmm0,xmm2			// Y*X0*X0
	//	mulss	xmm2,[fOneHalf]		// 0.5*X0
	//	subss	xmm3,xmm0			// 3-Y*X0*X0
	//	mulss	xmm3,xmm2			// 0.5*X0*(3-Y*X0*X0)

	//	movss	xmm4,[fZero]
	//	cmpss	xmm4,xmm1,4			// not equal

	//	mulss	xmm3,xmm1			// sqrt(y) = y * 1/sqrt(y)

	//	andps	xmm3,xmm4			// set result to zero if input is zero

	//	movss	[temp],xmm3
	//}
though zippy (or someone) came up with a close approximation

Code: Select all

inline float appSqrt( float Y ){
	//Closest port I could come up with...again not real familiar with asm
	if (Y == 0.0f)
		return 0.0f;
	float XO = 1 / sqrtf(Y);
	return (0.5f*XO*(3.0f-(Y*XO)*XO))*Y;
}
Problem is, this equation does not take into account the "size" of the mob, which is what I was working on trying to add - as a distance offset - to the current distance calc code.

The problem that stumped me was that the Sunshine spider is an 8.0 drawscale (8x it's normal model size) and has a 2,000 range as far as chunk coords go, from it's center of mass (reticule). While the Giant in my video is am 8.5 drawscale, but has only a 750 range. So, the VGClient is doing different math for these two different size NPCs and that is what we need to figure out.

Or, all players will need to be huddled around the spinning circle under the NPCs feet. And that's no fun. And inaccurate.


fwiw, when an NPC is 1.00 size, or within 0.5 of the base size of the model, things work brilliantly. It's when things start getting bigger (or even a lot smaller, 0.1 size for example) that we start seeing a lack of accuracy. This is why humanoid/gataro podlings seem to have no issue; we're hard-coding a 400.0 range check.


Edit: Something just occurred to me as I was talking with a developer at work; I wonder if "model height" is what's changing the hit box for the client? The spider is short and squat, far as it's base model goes. The giant is tall and narrow. Something to consider, though I do not know how we could control that.