Expose respawn/novice property on Game.map and/or Room



  • Whether or not a room is in a novice zone or a respawn zone is easily visible on the map and is known to the server, but cannot be directly determined from a player's script. In some cases these zones can wreak havoc pathfinding in nearby areas. The ability to check Game.map.isNovice or isRespawn would allow a routeCallback to ignore these rooms.

    isNoviceZone(roomName) {
        if(runtimeData.rooms[roomName].novice > Date.now()) {
            return true;
        } else {
            return false;
        }
    },
    
    isRespawnZone(roomName) {
        if(runtimeData.rooms[roomName].respawnArea > Date.now()) {
            return true;
        } else {
            return false;
        }
    },
    

  • Dev Team

    You can only access runtimeData.rooms for rooms with visibility, so it cannot be added to the Map API.


  • SUN

    Could it be added to the controller?



  • @stevetrov Would it really help that much if you needed controller visibility?


  • SUN

    It would tell you if your bot is in a novice / respawn area.



  • It would also allow rooms found through observers to know the difference.


  • Dev Team

    It could be added to the Room prototype, but it does much less sense if you aren't able to use it all over the world, since the main purpose for this would be path finding. This is why we haven't implemented it yet.



  • Looking at the server code that creates the runtimeData, it looks like another room query could be used to add an object with this structure to the runtimeData

    zones: { 
        [ roomName: string ]: { 
            novice: number, 
            respawn: number
        }
    }
    

    Which could then be used in Game.map. I am looking at doing this on my local server, but that really won't show the performance cost of this extra query.




  • Dev Team

    Yes, any such issue can be solved with adding more and more database requests, but this should be done only when you really need it. Adding a separate request for this feature alone doesn't look reasonable.



  • Could this be merged into Game.map.isRoomAvailable ?
    It could return a number instead of the bool.


Log in to reply
 

Looks like your connection to Screeps Forum was lost, please wait while we try to reconnect.