31. Juli 2011

Necessary Boat Enhancements

Previously, upon zoning with a boat the passengers relative location on the boat would be calculated server side - so that on the next zonin the passenger could be put near the location the boat was. This was not very accurate and there were two problems associated with this method. The first one is that passengers could fall into water upon zoning right next to the boat, because the server side coordinates and the client side coordinates do not match perfectly (due different time intervals on position updates). The next issue was, that boats have to wait after zoning in for the passengers to zone too. But what would happen when the player disconnected or the boat already moved? They would also fall into the water.

Also you shouldnt camp while on the boat because it would put you at the exact same spot in the ocean you logged out.

Now i knew it was possible to retrieve the correct relative position of the client on the boat somehow - because if you remember - when you camped/zoned on the boat - the exact same spot where you zoned would be memorized somehow.

After tinkering a bit and searching for some unknown values in the playerprofile it dawned on me - that the position is already in the normal x,y,z coordinate fields. However while on a boat - these values are no longer absolute for the zone, but relative to the boat. That means if we save these values and sent them to the client upon zoning in - he would calculate where the boat is and put us on the correct spot.

For this to work we also needed to signal the client that the player was previously on the boat - i already figured this out last year, but there was still the issue when the boat was not in the zone the client tries to login to, that the client would sent a request to ask where the boat currently is. So i had to extend the logic to ask the worldserver in what zone the requested boat is, then sent the correct opcode (i call it boat locate answer, which is also the same when you tell the client the boat you are on is now zoning) so that the client will try to zone into the new zone.

So to sumarize, the boats are now more fail proof - you should generally be put at the exact spot on the boat (on or within the boat doesn't matter) when you zone or camp/login again - it is not possible anymore to fall into water - even if for some reason we cannot find the boat in any zone, you will be teleported to the zones safe coordinates (these are mostly the boat footbridges in each zone). Also you can simply logout in one zone when you are on the boat, and when the boat is in another zone on login, you will be automatically transfered to that zone (so roleplay wise, you slept on the boat all the times =).

Now i can go back to the easier task and finishing the boat routes for the Kunark boats.

Keine Kommentare:

Kommentar veröffentlichen