Class MapConstructor



    Purpose

    To construct the map data.

    Functionality

    MapConstructor reads the map data from the specified input stream, which can be a file or a socket, and store the data in the mapStructure in GlobalData.

    MapConstructor of the server

    The MapConstructor of the server reads the input data from a file which stores the whole map data right after the server starts. After the whole map is constructed, the MapConstructor stops.

    MapConstructor of a client

    The MapConstructor of a client reads the input data from a socket. Because a client only keeps 9 blocks of the whole map data, the client may throw some blocks away and ask for more blocks when it moves from one block to another. Therefore, the MapConstructor should standby all the time when the client is alive to construct the variable partial map structure.

    Important Data/Methods

  • MessageParser: To parse the incoming message string and convert it to the corresponding message format.

  • GlobalData: The map data is constructed and stored in mapStructure in GlobalData.

  • void waitdeap(): wait for this MapConstructor consumes all of the data from the specified input stream. This much happens in the server initialization stage, when the server prepares the map data from the objects.txt file.



    [Go to Class Index Table] [Go back to Program Architecture Diagram]
    [Source Code of MapConstructor.java]