MineColonies

MineColonies

53M Downloads

Player's F3 not synced with server for other Towns.

Wissi opened this issue · 8 comments

commented

When player is on a Server and pressed F3 to see where nearest Colony might be at, it is not synced with the server to show them the correct status.

If player has NOT found (discovered) a Town on the client's side of game (although there is one on the server close to his coordinates), player tries to place Town Hall or Ship/Camp only to find out by Server that he/she is too close to a Town (or within a Town's area) and can't place it there.

Sync the client debug information of Town's close by to the Server's information. Updated it every "X" amount of time?

commented

@Raycoms any news?

commented
commented

Subscribers (who get packets):

// Players become subscribers if they come within 16 blocks of the edge of the colony
// Players remain subscribers while they remain within double the colony's radius

Range needed to place a townhall:

BlockPosUtil.getDistance2D(colony.getCenter(), pos) >= Configurations.workingRangeTownHall * 2 + Configurations.townHallPadding

So with default values, you need to be within 116 blocks to learn about a colony (need to stay within 200 to get updated information), and to place a colony, you need to be more than 220 blocks away. So there is the discrepancy.

Not sure if we should just remove remain subscriber range, and move to 2 * working range + 2 * padding, default 240, or if we need to send a simple view to all players on login for all colonies (simple view being colony name and location).

commented
commented

Why are the preliminary positions of all Colonies not synced over on dimension entering?

commented

I'm leaning to agree with Ray. Currently unless we made a new packet, we would need to send all the following information:

public IMessage handleColonyViewMessage(@NotNull final ByteBuf buf, final boolean isNewSubscription)
    {
        //  General Attributes
        name = ByteBufUtils.readUTF8String(buf);
        dimensionId = buf.readInt();
        center = BlockPosUtil.readFromByteBuf(buf);
        manualHiring = buf.readBoolean();
        //  Citizenry
        maxCitizens = buf.readInt();

        if (isNewSubscription)
        {
            citizens.clear();
            townHall = null;
            buildings.clear();
        }

        freePositions = new HashSet<>();
        freeBlocks = new HashSet<>();
        wayPoints = new HashSet<>();

        final int blockListSize = buf.readInt();
        for (int i = 0; i < blockListSize; i++)
        {
            freeBlocks.add(Block.getBlockFromName(ByteBufUtils.readUTF8String(buf)));
        }

        final int posListSize = buf.readInt();
        for (int i = 0; i < posListSize; i++)
        {
            freePositions.add(BlockPosUtil.readFromByteBuf(buf));
        }
        this.overallHappiness = buf.readDouble();
        this.hasWarehouse = buf.readBoolean();

        final int wayPointListSize = buf.readInt();
        for(int i = 0; i < wayPointListSize; i++)
        {
            wayPoints.add(BlockPosUtil.readFromByteBuf(buf));
        }
        return null;
    }

Also we would need to do it on more than just login/entering a dimension, we also would need to send packets on colony creation.

commented
commented

The simple packet could be requested on login and sent on creation. It wouldn't be that much data, and the info can't change (location of colony center).