TheEternalCitizens / mudlet-integration

A mudlet integration for The Eternal City
GNU General Public License v2.0
3 stars 0 forks source link

Mudlet Mapper Performance Increase #143

Closed davewiththenicehat closed 2 years ago

davewiththenicehat commented 4 years ago

Switch function: sortRoomExits to using a room area table rather than math. example code:

--Find exits that touch this room
        local roomArea = parthiaMap.getRoomArea(exitTable.room.size, exitTable.room.xpos, exitTable.room.ypos) --get the area of this room
        local possibleRoomExits = {} --an table to hold the rooms exits
        for _,exitToCheck in ipairs(parthiaMap.TECMapExits) do --loop through all exits that appear on the tec map when player is in this room
          local xposRounded = round(exitToCheck.xpos)
          local yposRounded = round(exitToCheck.ypos)
          if roomArea[xposRounded] then --if the exit shares a xposition with the current room on the TECMap
            if roomArea[xposRounded][yposRounded] then --if the exit shares both an x and y position with the current room.
              table.insert(possibleRoomExits, table.deepcopy(exitToCheck)) --exit on map is one for this room. Keep track of it
            end --if roomArea[xposRounded][yposRounded]
          end --if roomArea[xposRounded]
        end --for ipairs(parthiaMap.TECMapExits)

Check if this has a positive impact on local function mapVerSortAdjacentRooms in parthiaMap.createMapVerification. if it does than make the method global by replacing sortAdjacentRooms with its code. Keeping sortAdjacentRooms name space and removing local function

davewiththenicehat commented 2 years ago

Did do this. Had a performance increase from 600s milliseconds. Now takes about 60 miliseconds for the entire parthia map mapping process.