[Tutorial] Adding more tiles to game window - Updated 7/6/2018

Animera

* * * * *
Joined
Dec 9, 2008
Messages
2,238
Best answers
1
Likes
381
Location
In-game
I did all the code changes using Tfs 1.3 source, but when i try compile it display those errors:

'AddByte': is not a member of 'NetworkMessage' theforgottenserver c:\users\forgottenserver\src\protocolgame.cpp 2518

View attachment 33069

My protocolgame.cpp
/** * The Forgotten Server - a free and open-source MMORPG server emulator * - Pastebin.com

I appreciate some help, thank you.
Try addByte instead of AddByte
I remember somewhere used to be a error with capital letter... if you copy/paste it..
check the original files how it's written :)
 
Joined
Oct 3, 2018
Messages
34
Best answers
0
Likes
5
Try addByte instead of AddByte
I remember somewhere used to be a error with capital letter... if you copy/paste it..
check the original files how it's written :)
I changed all AddByte to addByte and it worked, thank you Animera :)
 
Joined
Oct 3, 2018
Messages
34
Best answers
0
Likes
5
I used clean tfs 1.3 build and clean otclient latest source, to test this tutorial to add more tiles to game window.

I was testing the fps performance with many monsters on screen with and without zoom, and i got those errors on otclient console and a huge fps drop;

ERROR: no thing at pos:31 70 7, stackpos:1
at:
[C++]: [email protected]@@[email protected]@@@[email protected]@[email protected]@@@[email protected]@Z
ERROR: no creature found to move
at:
[C++]: [email protected]@@[email protected]@@@[email protected]@@Z
ERROR: no thing at pos:30 70 7, stackpos:1
at:
[C++]: [email protected]@@[email protected]@@@[email protected]@[email protected]@@@[email protected]@Z
ERROR: no creature found to move
at:
[C++]: [email protected]@@[email protected]@@@[email protected]@@Z
ERROR: no creature found to move
at:
[C++]: [email protected]@@[email protected]@@@[email protected]@@Z
ERROR: no creature found to move
at:
[C++]: [email protected]@@[email protected]@@@[email protected]@@Z
ERROR: no creature found to move
at:
[C++]: [email protected]@@[email protected]@@@[email protected]@@Z
ERROR: no thing at pos:30 70 7, stackpos:1
at:
[C++]: [email protected]@@[email protected]@@@[email protected]@[email protected]@@@[email protected]@Z
ERROR: no creature found to move
at:
[C++]: [email protected]@@[email protected]@@@[email protected]@@Z
ERROR: no creature found to move
at:
[C++]: [email protected]@@[email protected]@@@[email protected]@@Z
ERROR: no thing at pos:30 70 7, stackpos:1
at:
[C++]: [email protected]@@[email protected]@@@[email protected]@[email protected]@@@[email protected]@Z
ERROR: no creature found to move
at:
[C++]: [email protected]@@[email protected]@@@[email protected]@@Z
ERROR: no thing at pos:30 69 7, stackpos:1
at:
[C++]: [email protected]@@[email protected]@@@[email protected]@[email protected]@@@[email protected]@Z
ERROR: no creature found to move
at:
[C++]: [email protected]@@[email protected]@@@[email protected]@@Z
ERROR: no thing at pos:31 70 7, stackpos:1
at:
[C++]: [email protected]@@[email protected]@@@[email protected]@[email protected]@@@[email protected]@Z
ERROR: no creature found to move


On tfs console display no errors, do someone else got it?
 

BigMc0

New Member
Joined
Sep 14, 2018
Messages
14
Best answers
0
Likes
1
my bad its only happens on vievmode 0 changed mode to 1 and it works fine thanks
 

namco

Alienbutserious
Joined
Sep 5, 2010
Messages
112
Best answers
2
Likes
28
@Flatlander
I followed the tutorial to 100% on the main post, with exception of the TFS 0.3.6 stuffs because I use TFS 1.0 and my sources didn't have the functions for those anyway.
But other than that, I did everything exactly as it said.. (I even doubled the const.h value)

And it works prefect with default values..
but as soon as I increase how many tiles the screen should contain, it buggs out as hell..

This is my screen using default values:

src/client/map.cpp
C++:
void Map::resetAwareRange()
{
    AwareRange range;
    range.left = 8; //Change this to = maxClientViewportX
    range.top = 6; //Change this to = maxClientViewportY
    range.bottom = range.top+1;
    range.right = range.left+1;
    setAwareRange(range);
}
And here's my screen adding extra tiles:

src/client/map.cpp
C++:
void Map::resetAwareRange()
{
    AwareRange range;
    range.left = 9; //Change this to = maxClientViewportX
    range.top = 7; //Change this to = maxClientViewportY
    range.bottom = range.top+1;
    range.right = range.left+1;
    setAwareRange(range);
}
As you can see, it bugs out real good..
But pay attention, and you see that my screen doesn't go bigger at all, it stay same amount of tiles on width and height
(even when I resize the window).
So even if I did change it to be 9x7 in the sources, the client doesn't add the extra rows.

And this is very odd to me, I double checked with previous guys having similar issues, there entire game window buggs out..
But as they buggs out, they can still see the new size of the tiles anyway.. and I can't...

Anyone having any idea what's causing this?
Does/Did OTClient had any other places there you needed to change how many rows of tiles there should be?
Same here!
It only works with the default values (8 and 6)

Untitled.png
 

Peonso

Godly Member
Joined
Jan 14, 2008
Messages
1,448
Best answers
22
Likes
922
Solution:


//Creature.CPP

Change this:
Code:
bool Creature::canSee(const Position& myPos, const Position& pos, int32_t viewRangeX, int32_t viewRangeY)
{
   if (myPos.z <= 7) {
       //we are on ground level or above (7 -> 0)
       //view is from 7 -> 0
       if (pos.z > 7) {
           return false;
       }
   } else if (myPos.z >= 8) {
       //we are underground (8 -> 15)
       //view is +/- 2 from the floor we stand on
       if (Position::getDistanceZ(myPos, pos) > 2) {
           return false;
       }
   }

   const int_fast32_t offsetz = myPos.getZ() - pos.getZ();
   return (pos.getX() >= myPos.getX() - viewRangeX + offsetz) && (pos.getX() <= myPos.getX() + viewRangeX + offsetz)
       && (pos.getY() >= myPos.getY() - viewRangeY + offsetz) && (pos.getY() <= myPos.getY() + viewRangeY + offsetz);
}
To this:
Code:
bool Creature::canSee(const Position& myPos, const Position& pos, int32_t viewRangeX, int32_t viewRangeY)
{
   if (myPos.z <= 7) {
       //we are on ground level or above (7 -> 0)
       //view is from 7 -> 0
       if (pos.z > 7) {
           return false;
       }
   } else if (myPos.z >= 8) {
       //we are underground (8 -> 15)
       //view is +/- 2 from the floor we stand on
       if (Position::getDistanceZ(myPos, pos) > 2) {
           return false;
       }
   }

   const int_fast32_t offsetz = myPos.getZ() - pos.getZ();
   return (pos.getX() >= myPos.getX() - Map::maxViewportX + offsetz) && (pos.getX() <= myPos.getX() + Map::maxViewportX + offsetz)
       && (pos.getY() >= myPos.getY() - Map::maxViewportY + offsetz) && (pos.getY() <= myPos.getY() + Map::maxViewportY + offsetz);
}
That's all folks! [Tested it and worked properly on TFS 1.3, Cannot guarantee anything for other distro's]


Animera
It would be better to actually change otland/forgottenserver (https://github.com/otland/forgottenserver/blob/bcb86eac0655c58b8dc9a35c652f8953a0edd033/src/monster.cpp#L83)

from
C:
return Creature::canSee(getPosition(), pos, 9, 9);
to
Code:
return Creature::canSee(getPosition(), pos, Map::maxViewportX, Map::maxViewportY);
so you don't conflict with otland/forgottenserver (https://github.com/otland/forgottenserver/blob/bcb86eac0655c58b8dc9a35c652f8953a0edd033/src/npc.cpp#L235)
 

BahamutxD

Jack of all trades, master of none
Joined
Jun 8, 2009
Messages
464
Best answers
10
Likes
130
Location
Spain
Recently gave this tutorial another shot (had it working in the past).

Using latest TFS+OTClient clean sources, maxClientViewportX 16 and maxClientViewportY 10 I was getting errors/issues. From black screens, desync when moving floors underground, skills -1, on OTC console [C++]: [email protected] and others...

I only managed to trigger those errors on one place of the map (not saying it only triggers there just couldn't find another place) This map has a big room full of items/monters/teleports (basically a test room I have with everything ingame for testing) Going there would make OTC console pop errors (sometimes it would desync/glitch) Logging out there and coming back on would show a black screen.

Using normal view (both with Tibia client and OTC) would work just fine but as soon as I extended the view bugs start again.

Tryed changing NETWORKMESSAGE_MAXSIZE to all kind of different values, did and redid the tutorial with clean sources/data folder/modules etc... several times, tested it on a different (clean) map to discard map bugs...


Found out that changing maxClientViewportY to 9 fixed it (x16, y9). Tryed to change to 8 but bugs started again. So I was wondering if maxClientViewportX/Y need to keep some ratio? Maybe this is the answer to some users having problems with this tutorial?
 
Top