• 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!

Windows How many floors can client handle?

EvilSkillz

Back
Joined
Jul 12, 2012
Messages
1,810
Solutions
2
Reaction score
388
Location
Egypt - Cairo
@Mark , @Flatlander , @Summ

my question maybe strange
but i want to know how many floors can my server handle?
i know rme got 15 floors
but can i make them like 20+ or even 100+

if it possible ... i know there is a code in rme source about numbers of floors
but do i need any change at tfs?
or just rme is enough


if not possible to add more than 15 floor just reply no
 
Last edited:
Interesting question.
I'd like to know as well (even though I have no practical use for knowing :D)

Red
 
There is no limit when it come's to coding except the 21.4kk? integer limit.
So theoretically you could add 21.4kk floors to your map, if your server can handle it.
The "hard" part is that you won't be able to use a normal tibia client(I think), you need to(ofc) customize your tfs and change the code of rme(lucky you that its open source now).
Note that ive never done this, and im not sure how tfs is built up to handle floors over 15, thats a question for Summ or Mark who know's abit more about the source code then me.

AND HEY THANKS FOR TAGGING ME... jk.
 
in basemap.cpp
there is function called mapBegin

Code:
for(; index < 16; ++index) {
            //printf("\tChecking index %d of %p\n", index, node);
            if(QTreeNode* child = node->child[index]) {
                if(child->isLeaf) {
                    QTreeNode* leaf = child;
                    //printf("\t%p is leaf\n", child);
                    for(it.local_z = 0; it.local_z < MAP_HEIGHT; ++it.local_z) {
                        if(Floor* floor = leaf->array[it.local_z]) {
                            for(it.local_i = 0; it.local_i < 16; ++it.local_i) {
                                //printf("\tit(%d;%d;%d)\n", it.local_x, it.local_y, it.local_z);
                                TileLocation& t = floor->locs[it.local_i];
                                if(t.get()) {
                                    //printf("return it\n");
                                    it.current_tile = &t;
                                    return it;
                                }

and the same one in function called mapEnd

Code:
for(; local_i < 16; ++local_i) {
                                //printf("\t\tIterating over Y:%d of %p\n", local_y, child);
                                TileLocation& t = floor->locs[local_i];
                                if(t.get()) {
                                    if(increased) {
                                        //printf("Modified %p to %p\n", current_tile, t);
                                        current_tile = &t;
                                        return *this;
                                    } else {
                                        increased = true;
                                    }
                                } else if(first) {
                                    increased = true;
                                    first = false;
                                }
                            }
                           
                            if(local_i > 15) {
                                //printf("\t\tReset local_x\n");
                                local_i = 0;
                            }
i think change will be in for(; local_i < 16) maybe add more floors ?
also i think change will be in [if(local_i > 15) local_i = 0

in common_windows.cpp

Code:
for(int floor = 0; floor < 16; ++floor)
                    {
                        gui.SetLoadScale(int(floor*(100.f/16.f)), int((floor+1)*(100.f/16.f)));
                        FileName fn = wxstr(pre_sep + i2s(floor) + post_sep);
                        editor.exportMiniMap(fn, floor, true);
                    }
from 0 to < 16 :D

gui.cpp
to read change floor
Code:
void GUI::ChangeFloor(int new_floor)
{
    MapTab* tab = GetCurrentMapTab();
    if(tab)
    {
        int old_floor = GetCurrentFloor();
        if(new_floor < 0) return;
        if(new_floor > 15) return;
        if(old_floor != new_floor)
            tab->GetCanvas()->ChangeFloor(new_floor);

    }
}

and if you want to use live mapping with ur friends
u must change few things

live_socket.cpp

this to make them enable to recive floor
Code:
    for (uint_fast8_t z = 0; z < 16; ++z) {
        if (testFlags(floorBits, 1 << z)) {
            receiveFloor(message, editor, action, ndx, ndy, z, node, node->getFloor(z));
        }
    }

and this to make them send and u recive :D
Code:
    if (!node) {
        message.write<uint8_t>(0x00);
    } else {
        Floor** floors = node->getFloors();

        uint16_t sendMask = 0;
        for (uint32_t z = 0; z < 16; ++z) {
            uint32_t bit = 1 << z;
            if (floors[z] && testFlags(floorMask, bit)) {
                sendMask |= bit;
            }
        }

        message.write<uint16_t>(sendMask);
        for (uint32_t z = 0; z < 16; ++z) {
            if (testFlags(sendMask, 1 << z)) {
                sendFloor(message, floors[z]);
            }
        }
    }

in main_menubar.cpp

Code:
    MAKE_ACTION(FLOOR_0, wxITEM_RADIO, OnChangeFloor);
    MAKE_ACTION(FLOOR_1, wxITEM_RADIO, OnChangeFloor);
    MAKE_ACTION(FLOOR_2, wxITEM_RADIO, OnChangeFloor);
    MAKE_ACTION(FLOOR_3, wxITEM_RADIO, OnChangeFloor);
    MAKE_ACTION(FLOOR_4, wxITEM_RADIO, OnChangeFloor);
    MAKE_ACTION(FLOOR_5, wxITEM_RADIO, OnChangeFloor);
    MAKE_ACTION(FLOOR_6, wxITEM_RADIO, OnChangeFloor);
    MAKE_ACTION(FLOOR_7, wxITEM_RADIO, OnChangeFloor);
    MAKE_ACTION(FLOOR_8, wxITEM_RADIO, OnChangeFloor);
    MAKE_ACTION(FLOOR_9, wxITEM_RADIO, OnChangeFloor);
    MAKE_ACTION(FLOOR_10, wxITEM_RADIO, OnChangeFloor);
    MAKE_ACTION(FLOOR_11, wxITEM_RADIO, OnChangeFloor);
    MAKE_ACTION(FLOOR_12, wxITEM_RADIO, OnChangeFloor);
    MAKE_ACTION(FLOOR_13, wxITEM_RADIO, OnChangeFloor);
    MAKE_ACTION(FLOOR_14, wxITEM_RADIO, OnChangeFloor);
    MAKE_ACTION(FLOOR_15, wxITEM_RADIO, OnChangeFloor);
add more to let rme read more floors

and define them in main_menubar.h
Code:
        FLOOR_0,
        FLOOR_1,
        FLOOR_2,
        FLOOR_3,
        FLOOR_4,
        FLOOR_5,
        FLOOR_6,
        FLOOR_7,
        FLOOR_8,
        FLOOR_9,
        FLOOR_10,
        FLOOR_11,
        FLOOR_12,
        FLOOR_13,
        FLOOR_14,
        FLOOR_15,
 
in map_region.cpp

Code:
//**************** Floor **********************

Floor::Floor(int sx, int sy, int z)
{
    sx = sx & ~3;
    sy = sy & ~3;

    for(int i = 0; i < 16; ++i)
    {
        locs[i].position.x = sx + (i >> 2);
        locs[i].position.y = sy + (i & 3);
        locs[i].position.z = z;
    }
}

//**************** QTreeNode **********************

QTreeNode::QTreeNode(BaseMap& map) :
    map(map),
    visible(0),
    isLeaf(false)
{
    // Doesn't matter if we're leaf or node
    for(int i = 0; i < 16; ++i)
        child[i] = nullptr;
}

QTreeNode::~QTreeNode()
{
    if(isLeaf)
    {
        delete array[0];
        delete array[1];
        delete array[2];
        delete array[3];
        delete array[4];
        delete array[5];
        delete array[6];
        delete array[7];
        delete array[8];
        delete array[9];
        delete array[10];
        delete array[11];
        delete array[12];
        delete array[13];
        delete array[14];
        delete array[15];
    }
    else
    {
        delete child[0];
        delete child[1];
        delete child[2];
        delete child[3];
        delete child[4];
        delete child[5];
        delete child[6];
        delete child[7];
        delete child[8];
        delete child[9];
        delete child[10];
        delete child[11];
        delete child[12];
        delete child[13];
        delete child[14];
        delete child[15];
    }
}

QTreeNode .. it's important since the developer of rme said that :D

and the end
map_region.h
Code:
class Floor {
public:
    Floor(int x, int y, int z);
    TileLocation locs[16];
};

in the same file

    bool isLeaf;
    union {
        QTreeNode* child[16];
        Floor* array[MAP_HEIGHT];
#if 16 != MAP_HEIGHT
#    error "You need to rewrite the QuadTree in order to handle more or less than 16 floors"
#endif

hope this help you guys
 
Client probably does not handle more floors.
You have to adjust QTreeLeafNode and MAP_MAX_LAYERS (server side) and your otbm / mapeditor as you already said.
 
yes i already did it and i will try to compile i test for 25 floors xD to see if it work or not

but rme don't compile for me
always missing file even if the file is there :(

in include i need to make path
for boost
and wxWedgit ..

and in libs
wxWedgit lib
wxWedgit folder
lib at boost folder for msvc?

like we did with tfs?

or i need another config?
 
Will it not chew more memory, more floors you got?
Everything thing pretty much do, the diffrence is how much more it uses. In this case I woulden't say its that much more, you can make alot more things to your server that slows it down even more.

Edit: Haha forgot about the poll, would wanna know who those 3 are who voted no are :D, pretty much anything is posible with programming, adding a few more floors?...
 
Were you able to compile RME?

i compile it 32x bit only :D
never work with 64x :(
i just replaced all directions as @Flatlander said

Will it not chew more memory, more floors you got?


i make it up too 100 floor
i will map more area to see if it won't freezed
i make otclient handle 100 floor

give me few mins guys i will test again :D
 
Were you able to compile RME?

that's what have i done :D
C:\Users\crille\Documents\GitHub\rme\dependencies\vs\include;
E:\DevFolder\C++ Libraries\boost_1_55_0\include;
E:\DevFolder\C++ Libraries\wxWidgets-3.0.0\include\msvc;
E:\DevFolder\C++ Libraries\wxWidgets-3.0.0\include;

You need the 4 above pathes Included

E:\DevFolder\C++ Libraries\boost_1_55_0\lib;
C:\Users\crille\Documents\GitHub\rme\dependencies\vs\lib;
E:\DevFolder\C++ Libraries\wxWidgets-3.0.0\lib;

And the 3 above lib locations

If you do not have 4 Includes, and 3 libs, then you will not succeed.
(BTW it took me a good 10 hours to get it working, it isn't explained very well, and i'm at work so I can't even look at what settings I used, this is all from memory and the RME Github)
 
Where did you get wxWidgets libs? did you compile them yourself?

this is what i did brother
i made fresh install now
to start from 0

i installed wxWidgets
and i go to this dir
C:\wxWidgets-3.0.0\build\msw

and run this file : wx_vc10.sln

and wait for every thing to be ready
then i compile it in 32x bit
and w8 it to be ready

it will take like 10+ minutes :D
and after it success
========== Rebuild All: 23 succeeded, 0 failed, 0 skipped ==========

after that don't close MSVC
and open project of rme

release 32x bit
vc++ directions
and in include

in libs


and in linker


then rebuilt
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
 
Back
Top