FOnline Development > Questions and Answers

[Solved] 2 Questions about Worldmap

<< < (2/2)

C4N:
Thanks rifleman17, I already figured about all of that, the problem about this is that you can't just have a 50000x50000 png image (this is an editing software issue not an actual limitation to the png format), you need to slice it into 25 10000x10000 png images.

And when you have all those 25 images, you need to logically (with what I said before) mash them up together like this:

01 02 03 04 05
06 07 08 09 10
11 12 13 14 15
16 17 18 19 20
21 22 23 24 25

Also, theoretically (I need to look further into this) slicing this (even further than this kind of 10kpx resolution limit) could improve performance on the server, my point here is that the server shouldn't call a big ass image every time it calls for a pixel, instead, it should call for the smaller corresponding one. Just a theory, but it may works.
I'm currently working on a template to make the biggest map currently possible, I'll release it here later.

I need to ask something on this topic, Where does the 100x100x500 limitation comes from? Is it some kind of bit overflow on the engine? Shouldn't this limitation could be solved by using double precision values?

Edit.
To put all of this into scale in a visually way, I made this to picture the scale. Top left black square is the base FOnline map:



As for a final conclusion, by slowing down the worldmap movement, the size of the map can be virtually incremented by huge proportions (at least the feeling of it).

C4N:
btw that question about the map size, it was made by a non-dev person, so he actually asked me about size in Km hehe, It was meant to define how far in geographical terms could the plot be written.

C4N:
I concluded my research on this topic... sadly, it can't be done.
TL;DR for the curious, don't make maps bigger than 8192 px, a 100x100x81 setup is the biggest I could manage to do.

Point by point.
The biggest of the issues is that the client can't handle an image bigger than 8192px. Because of that, the biggest worldmap I managed to make was 8100x8100, thats 100x100x81.
The second  problem, as I already said, is that even if the server could handle a 100x100x500 setup, I have no way to test it because I can't compile a 50000x50000 png image (not even a white flat one), because of that, the biggest map I could manage to make the server load was 10000x10000, but the client would CTD trying to load it. Unless you are ok with a black map on the client side, I wouldn't recommend this.

As a final note, I wasn't able to make the server load this grid worldmap image idea I was talking about, this is what I tried so far (ugly coding):

_defines.fos

--- Code: ---#define IMAGE_RELIEF01                             ( 0 ) // Global map relief
#define IMAGE_RELIEF02                             ( 1 )
#define IMAGE_RELIEF03                             ( 2 )
#define IMAGE_RELIEF04                             ( 3 )
#define IMAGE_RELIEF05                             ( 4 )
#define IMAGE_RELIEF06                             ( 5 )
#define IMAGE_RELIEF07                             ( 6 )
#define IMAGE_RELIEF08                             ( 7 )
#define IMAGE_RELIEF09                             ( 8 )
#define IMAGE_RELIEF10                             ( 9 )
#define IMAGE_RELIEF11                             ( 10 )
#define IMAGE_RELIEF12                             ( 11 )
#define IMAGE_RELIEF13                             ( 12 )
#define IMAGE_RELIEF14                             ( 13 )
#define IMAGE_RELIEF15                             ( 14 )
#define IMAGE_RELIEF16                             ( 15 )
#define IMAGE_RELIEF17                             ( 16 )
#define IMAGE_RELIEF18                             ( 17 )
#define IMAGE_RELIEF19                             ( 18 )
#define IMAGE_RELIEF20                             ( 19 )
#define IMAGE_RELIEF21                             ( 20 )
#define IMAGE_RELIEF22                             ( 21 )
#define IMAGE_RELIEF23                             ( 22 )
#define IMAGE_RELIEF24                             ( 23 )
#define IMAGE_RELIEF25                             ( 24 )

--- End code ---

worldmap.fos

--- Code: ---uint GetGlobalMapRelief( uint x, uint y )
{
    // Used low four bits of image
    // Zero is water
if(y<=10000) // Row 1
{
    if(x<=10000)
{
    return GetImageColor( IMAGE_RELIEF01, x, y ) & 0xF; // Column 1
}
else if(x<=20000)
{
    return GetImageColor( IMAGE_RELIEF02, x, y ) & 0xF; // Column 2
}
else if(x<=30000)
{
    return GetImageColor( IMAGE_RELIEF03, x, y ) & 0xF; // Column 3
}
else if(x<=40000)
{
    return GetImageColor( IMAGE_RELIEF04, x, y ) & 0xF; // Column 4
}
else
{
    return GetImageColor( IMAGE_RELIEF05, x, y ) & 0xF; // Column 5
}
}
else if(y<=20000) // Row 2
{
    if(x<=10000)
{
    return GetImageColor( IMAGE_RELIEF06, x, y ) & 0xF; // Column 1
}
else if(x<=20000)
{
    return GetImageColor( IMAGE_RELIEF07, x, y ) & 0xF; // Column 2
}
else if(x<=30000)
{
    return GetImageColor( IMAGE_RELIEF08, x, y ) & 0xF; // Column 3
}
else if(x<=40000)
{
    return GetImageColor( IMAGE_RELIEF09, x, y ) & 0xF; // Column 4
}
else
{
    return GetImageColor( IMAGE_RELIEF10, x, y ) & 0xF; // Column 5
}
}
else if(y<=30000) // Row 3
{
    if(x<=10000)
{
    return GetImageColor( IMAGE_RELIEF11, x, y ) & 0xF; // Column 1
}
else if(x<=20000)
{
    return GetImageColor( IMAGE_RELIEF12, x, y ) & 0xF; // Column 2
}
else if(x<=30000)
{
    return GetImageColor( IMAGE_RELIEF13, x, y ) & 0xF; // Column 3
}
else if(x<=40000)
{
    return GetImageColor( IMAGE_RELIEF14, x, y ) & 0xF; // Column 4
}
else
{
    return GetImageColor( IMAGE_RELIEF15, x, y ) & 0xF; // Column 5
}
}
else if(y<=40000) // Row 4
{
    if(x<=10000)
{
    return GetImageColor( IMAGE_RELIEF16, x, y ) & 0xF; // Column 1
}
else if(x<=20000)
{
    return GetImageColor( IMAGE_RELIEF17, x, y ) & 0xF; // Column 2
}
else if(x<=30000)
{
    return GetImageColor( IMAGE_RELIEF18, x, y ) & 0xF; // Column 3
}
else if(x<=40000)
{
    return GetImageColor( IMAGE_RELIEF19, x, y ) & 0xF; // Column 4
}
else
{
    return GetImageColor( IMAGE_RELIEF20, x, y ) & 0xF; // Column 5
}
}
else // Row 5
{
    if(x<=10000)
{
    return GetImageColor( IMAGE_RELIEF21, x, y ) & 0xF; // Column 1
}
else if(x<=20000)
{
    return GetImageColor( IMAGE_RELIEF22, x, y ) & 0xF; // Column 2
}
else if(x<=30000)
{
    return GetImageColor( IMAGE_RELIEF23, x, y ) & 0xF; // Column 3
}
else if(x<=40000)
{
    return GetImageColor( IMAGE_RELIEF24, x, y ) & 0xF; // Column 4
}
else
{
    return GetImageColor( IMAGE_RELIEF25, x, y ) & 0xF; // Column 5
}
}
}
.
.
.
.
.
.
.
void WorldmapInit()
{
    LoadImage( IMAGE_RELIEF01, "BIGASM01.png", 1, PT_SERVER_MAPS );
LoadImage( IMAGE_RELIEF02, "BIGASM02.png", 1, PT_SERVER_MAPS );
LoadImage( IMAGE_RELIEF03, "BIGASM03.png", 1, PT_SERVER_MAPS );
LoadImage( IMAGE_RELIEF04, "BIGASM04.png", 1, PT_SERVER_MAPS );
LoadImage( IMAGE_RELIEF05, "BIGASM05.png", 1, PT_SERVER_MAPS );
LoadImage( IMAGE_RELIEF06, "BIGASM06.png", 1, PT_SERVER_MAPS );
LoadImage( IMAGE_RELIEF07, "BIGASM07.png", 1, PT_SERVER_MAPS );
LoadImage( IMAGE_RELIEF08, "BIGASM08.png", 1, PT_SERVER_MAPS );
LoadImage( IMAGE_RELIEF09, "BIGASM09.png", 1, PT_SERVER_MAPS );
LoadImage( IMAGE_RELIEF10, "BIGASM10.png", 1, PT_SERVER_MAPS );
LoadImage( IMAGE_RELIEF11, "BIGASM11.png", 1, PT_SERVER_MAPS );
LoadImage( IMAGE_RELIEF12, "BIGASM12.png", 1, PT_SERVER_MAPS );
LoadImage( IMAGE_RELIEF13, "BIGASM13.png", 1, PT_SERVER_MAPS );
LoadImage( IMAGE_RELIEF14, "BIGASM14.png", 1, PT_SERVER_MAPS );
LoadImage( IMAGE_RELIEF15, "BIGASM15.png", 1, PT_SERVER_MAPS );
LoadImage( IMAGE_RELIEF16, "BIGASM16.png", 1, PT_SERVER_MAPS );
LoadImage( IMAGE_RELIEF17, "BIGASM17.png", 1, PT_SERVER_MAPS );
LoadImage( IMAGE_RELIEF18, "BIGASM18.png", 1, PT_SERVER_MAPS );
LoadImage( IMAGE_RELIEF19, "BIGASM19.png", 1, PT_SERVER_MAPS );
LoadImage( IMAGE_RELIEF20, "BIGASM20.png", 1, PT_SERVER_MAPS );
LoadImage( IMAGE_RELIEF21, "BIGASM21.png", 1, PT_SERVER_MAPS );
LoadImage( IMAGE_RELIEF22, "BIGASM22.png", 1, PT_SERVER_MAPS );
LoadImage( IMAGE_RELIEF23, "BIGASM23.png", 1, PT_SERVER_MAPS );
LoadImage( IMAGE_RELIEF24, "BIGASM24.png", 1, PT_SERVER_MAPS );
LoadImage( IMAGE_RELIEF25, "BIGASM25.png", 1, PT_SERVER_MAPS );
    for(uint i = 0, j = Worldmap.length(); i < j; i++)
        @Worldmap[i] = CZone(i % ZONE_COUNT_X, i / ZONE_COUNT_X);

// Groups be here
    LoadWorldmapGroups("maps/groups.fowm");
    Log("Encounter groups loaded.");
 
RecolorLocations();
    Log("Locations Colored.");

    LoadWorldmapTables("maps/worldmap.focwm");
    Log("Worldmap loaded.");
    //LoadGroupsQuantities();
}

--- End code ---

config.fos

--- Code: ---    __GlobalMapWidth            = 100;     // Maximum 100
    __GlobalMapHeight           = 100;     // Maximum 100
    __GlobalMapZoneLength       = 500;     // Maximum 500

--- End code ---

worldmap_h.fos

--- Code: ---#define ZONE_COUNT_X                       (100)
#define ZONE_COUNT_Y                       (100)
#define ZONE_LENGTH                        (500)

--- End code ---

The result was the server loading only the first image, so the player only was able to move inside a 10000x10000 worldmap (black clientside of course).
I'm dropping any further effort on this, since the client can't handle large image setups (not even sliced little images), I don't think it's worth the trouble.

Navigation

[0] Message Index

[*] Previous page

Go to full version