Author Topic: Mining  (Read 3275 times)

Prolix

  • Guest
Re: Mining
« Reply #15 on: February 23, 2009, 07:15:18 pm »
One thing about mining that seems odd to me is that the distance you have to move to defeat the 'you can't mine twice' message does not seem to be consistent. I wonder if there is some kind of grid where this location is in this box and that one is over there. This would mean that if , say, you were on the left side of the box you would have to move further to the right to get to the next viable spot than you would to the left. Is there such a grid system or something else?

Zontick

  • Hydlaa Resident
  • *
  • Posts: 53
    • View Profile
Re: Mining
« Reply #16 on: February 24, 2009, 04:09:00 am »
First off - really happy with this discussion for a variety of reasons. Thank you.

One thing about mining that seems odd to me is that the distance you have to move to defeat the 'you can't mine twice' message does not seem to be consistent. I wonder if there is some kind of grid where this location is in this box and that one is over there. This would mean that if , say, you were on the left side of the box you would have to move further to the right to get to the next viable spot than you would to the left. Is there such a grid system or something else?

I've noted a similar inconsistency. I'm wondering if the terrain has something to do with this; if distance is calculated in 3 dimensions (why wouldn't it be?) this could account for the differential I have noticed.


khoridor

  • Hydlaa Citizen
  • *
  • Posts: 352
    • View Profile
Re: Mining
« Reply #17 on: February 24, 2009, 08:35:09 am »
It has always looked like a grid system to me.
Take one of the gems pools for example: I'd say it's 3x3.

Vornne

  • Testers
  • Hydlaa Resident
  • *
  • Posts: 189
    • View Profile
Re: Mining
« Reply #18 on: February 25, 2009, 01:20:24 am »
The inconsistency is probably because the server doesn't keep track of your exact position, all the time; only every time the client sends an update message - and the server checks that the position has changed, in WorkManager::SameProductionPosition:
Code: [Select]
actor->GetPosition(pos, sector);
return ((startPos - pos).SquaredNorm() < 1);
csVector3::SquaredNorm:
Code: [Select]
return x * x + y * y + z * z;
In other words, if the sum of the squared distances moved in each dimension is greater than or equal to one unit, you can mine :)

Prolix

  • Guest
Re: Mining
« Reply #19 on: February 25, 2009, 02:02:28 am »
What kind of operator is the dot in that first snippet? is it a decimal point? It looks like it is overloaded, a function call as well as a decimal point but what comes before it isn't a declared object so how do you define a method of an object that has no constructor? And why is the sector being passed to actor->GetPosition when it is being ignored? I suppose GetPosition actually checks that the sector is identical before breaking or something.

Very confusing. :(

Lanarel

  • Testers
  • Hydlaa Notable
  • *
  • Posts: 782
    • View Profile
Re: Mining
« Reply #20 on: February 26, 2009, 11:20:57 pm »
What kind of operator is the dot in that first snippet? is it a decimal point?
startPos and pos are of class csVector3, which has an overloaded - operator, so that (startPos - pos) is a csVector3 too. And the .SquaredNorm() just calls a member function for the resulting vector just as pos.SquaredNorm() would.



Prolix

  • Guest
Re: Mining
« Reply #21 on: February 27, 2009, 12:13:22 am »
Ah good, I wasn't too far off. So theoretically if I had a 1 unit box I could stand on I could dig in the same place repeatedly by stepping on and off it.

It seems that the z direction isn't or wasn't always included in the proximity calculation because you could mine coal on the ramp and down below under the temple, although I suppose the ore-field might not be flat. The big rocks in the gold fields are similar.