• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Changing view distance

Ancores

Active Member
Joined
Jan 17, 2010
Messages
538
Reaction score
28
Hello, I'm trying to change the view distance so I can see like 20x20 tiles instead of 15x11.

I'm using OTClient and it's possible to zoom in/out with it, but obviously I need to change some code in the TFS source aswell to draw all tiles, but I'm not sure what I need to change.

I found this:
Code:
static const int32_t maxViewportX = 11; //min value: maxClientViewportX + 1
static const int32_t maxViewportY = 11; //min value: maxClientViewportY + 1
static const int32_t maxClientViewportX = 8;
static const int32_t maxClientViewportY = 6;
in map.h

But changing those values didn't make any difference.
 
Check game_interface module
 
I've seen that file already but I need the server to send more tiles to the client to be able to update them.

Without doing something with the server it looks like this:
84816d7188eab00c833d083b884d4131.png
 
Last edited:
Changed all of these:
Code:
GetFloorDescription(msg, oldPos.x - 8, oldPos.y - 6, 4, 18, 14, 4, skip);

to:
Code:
GetFloorDescription(msg, oldPos.x - 15, oldPos.y - 15, 4, 18, 14, 4, skip);

also tried:
Code:
GetFloorDescription(msg, oldPos.x - 15, oldPos.y - 15, 4, 32, 32, 4, skip);

That didn't make any difference at all, so I also changed all of the GetMapDescription() functions but that just screwed the whole map up.
 
Same here, tried everything on TFS 0.3.6PL1, the only thing i've got is my map bugged :(
 
I might be wrong about this but I think it's to do with the clients cache. For example, when I login to the game while the client is zoomed out.

2qknx5k.png


This shows

However, after exploring a bit

This shows

2yknuyt.png


If you log out and login again all the tiles you have previously walked on are no longer visible. Excluding the 18 by 14 that are originally drawn.

This would be really interesting to figure out a solution for.. :)
 
Also, if the tiles outside the original area would change in any way, they wouldn't change on the client unless the tiles are in the original area.

It's obvious that something needs to be changed in the server source, otherwise you could use this client on real tibia servers and see everyone/everything on the map.
 
Yes, that makes sense.. there are alot of things in the server source that seem to reference it - like the things you have mentioned before, but changing them doesn't seem to change the original area. Guess it's back to looking through the source code. :p
 
sendWalkCreature in protocolgame.cpp deletes the previous row and creates the next row, you will need to basically make a bigger box for it to create.
Right now for example, walking east it will delete the column 9 tiles West, and create a column 9 tiles to the east.

So basically things you need to change:
  • When logging in, it needs to draw the entire screen (currently it does x=9 and y=7 I believe, it actually draws 1 extra tile south and east since you can see farther south and east)
  • When walking, it needs to update the edges of the screen. (Currently it does x=9 and y=7, you will have to update this, also remember south and east have an extra row/column)
  • Also all "get spectators" functions, that update players on events that happen on screen will have to be extended, this might be done automatically when you update the next bullet:
  • The following will need to be changed, as it helps monsters, and spectators work correctly (maxViewport should be at least 2 bigger than your client's view, this is how far monsters can see, as well as other things)
    PHP:
    static const int32_t maxViewportX = 11; //min value: maxClientViewportX + 1 static const int32_t maxViewportY = 11; //min value: maxClientViewportY + 1 static const int32_t maxClientViewportX = 8; static const int32_t maxClientViewportY = 6;
  • Most things you will need to change is in protocolgame.cpp
Let me know how this goes!
 
Hi Flatlander,

Thanks for taking time to respond :)

In my version (2.014) the function is "sendMoveCreature" (I think!) Which is here

Code:
void ProtocolGame::sendMoveCreature(const Creature* creature, const Tile* newTile, const Position& newPos,
   uint32_t newStackPos, const Tile* oldTile, const Position& oldPos, uint32_t oldStackPos, bool teleport)


I've tried changing this part

Code:
      if(newPos.z > oldPos.z)
         MoveDownCreature(msg, creature, newPos, oldPos, oldStackPos);
       else if(newPos.z < oldPos.z)
         MoveUpCreature(msg, creature, newPos, oldPos, oldStackPos);

       if(oldPos.y > newPos.y) // north, for old x
       {
         msg->AddByte(0x65);
         GetMapDescription(oldPos.x - 8, newPos.y - 6, newPos.z, 18, 1, msg);
       }
       else if(oldPos.y < newPos.y) // south, for old x
       {
         msg->AddByte(0x67);
         GetMapDescription(oldPos.x - 8, newPos.y + 7, newPos.z, 18, 1, msg);
       }

       if(oldPos.x < newPos.x) // east, [with new y]
       {
         msg->AddByte(0x66);
         GetMapDescription(newPos.x + 9, newPos.y - 6, newPos.z, 1, 14, msg);
       }
       else if(oldPos.x > newPos.x) // west, [with new y]
       {
         msg->AddByte(0x68);
         GetMapDescription(newPos.x - 8, newPos.y - 6, newPos.z, 1, 14, msg);
       }

As far as I can understand (Forgive me if I'm mistaken - I'm just starting out) the last part, 18,1 and 1,14 refers to the height and width of the map. I've tried to change all the values in here with undesired results - I can make the client draw less than 18 and 14, any more than 18 and 14 just causes me to jump around the map.
 
I've seen that file already but I need the server to send more tiles to the client to be able to update them.

Without doing something with the server it looks like this:
84816d7188eab00c833d083b884d4131.png

Hi!
What in map.cpp of OTClient code did u edit to get that?

I have the part of the server ok (it loads more tiles that they are shown) but I can't see them because the client still shows the range of default tiles.

I tried to change the void Map::resetAwareRange() range values according to the TFS map.h viewport values but either I got the same or the tiles mess up :(

EDIT: Maybe it has something to do with module gameinterface? I'm trying with it but still no changes

EDIT 2 [SOLVED]: Yes, it had to do something with gameinterface. There is a function that allows to zoom in or out in the game, now I can see the tiles the server sends to client.

Thanks!
 
Last edited:
Back
Top