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

Animera

* * * * *
Joined
Dec 9, 2008
Messages
2,313
Best answers
1
Reaction score
435
Location
ANIMERA.ONLINE
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 :)
 

Cesrarr

Member
Joined
Oct 3, 2018
Messages
34
Best answers
0
Reaction score
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 :)
 

Cesrarr

Member
Joined
Oct 3, 2018
Messages
34
Best answers
0
Reaction score
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]@ABV?$shared_object_[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?
 

esnio12

Well-Known Member
Joined
Oct 2, 2010
Messages
46
Best answers
0
Reaction score
11
Anyone have a good tutorial how i can compile OTC ?
 

BigMc0

New Member
Joined
Sep 14, 2018
Messages
14
Best answers
0
Reaction score
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
128
Best answers
2
Reaction score
33
@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,516
Best answers
24
Reaction score
1,008
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
567
Best answers
12
Reaction score
180
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?
 

Animera

* * * * *
Joined
Dec 9, 2008
Messages
2,313
Best answers
1
Reaction score
435
Location
ANIMERA.ONLINE
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)
Why exactly it conflicts? i haven't encountered any issues so far.. didn't knew npcs had can see too.. (thought creature is player/monster or npc)
 

Madlander

Madlander
Joined
Sep 16, 2009
Messages
308
Best answers
0
Reaction score
12
Location
Madland
I am using TFS 1.0 to the latest commit the OtClient.


I had to do this


and everywhere they were
Map::maxClientViewportX and Map::maxClientViewportY switched to Map::maxClientViewportX2 and Map::maxClientViewportY2

and in map.cpp



Thus apparently worked!
Worked for me as well!!, thanks a lot, I was figuring out the correct dimensions in order to avoid map loading bugs...
 

JulianoZNSA

New Member
Joined
Apr 25, 2018
Messages
1
Best answers
0
Reaction score
0
Sorry to relive the topic, however in some places the character hangs and only comes back if some ADM pull to another location. it's not an error on the map
 

Zell

Intermediate OT User
Joined
Oct 23, 2010
Messages
112
Best answers
0
Reaction score
42
Hi all im using Avesta 7.6 SVN 0.6.3 and im trying to add more tiles, I've compiled the sources with the new one codes making some changes about diferences between the codes, but I guess i made some mistakes because when I try to log in server crash and I dont get any error, just crash and bye.

I tryed all the solutions on this thread and nothing, If i share protocol file can someone help me??

thanks in advance!!
 

Shadow_

Active Member
Joined
Jun 2, 2018
Messages
408
Best answers
16
Reaction score
94
Location
Cairo, Egypt
First thank you for this contribution but I'am facing a little issue the monster name appears when the monster is far from the screen with 4-5 Tiles
1567930705645.png
 
Top