New player zone wall
-
A new player zone wall just went up in the E20 rooms and it creates huge problem, the algorithm that I have to scan for Power Banks has no way to exclude Power Banks inaccessible from my rooms.
The only way I saw to code around it is:
- Hardcode bunch of areas as "not accessable" and exclude them in search. That requires maintaing manually a table of rooms.- Try to do "FindRoute" to power bank. That is very expensive.
Since new players will not be able to reach lvl 8 can you make a change to not place power banks into their area ?
Alternatively can you add a search parameter to exclude newbie zones?
-
There are simpler ways to check for this. If the room has no controller but does have constructed walls it currently has a novice wall. You can even pull the decay time off the constructed wall and use that to tell your scripts not to check that room.
That being said you're only excluded from mining half of the room. I can think of a few to do this that shouldn't be too expensive.
-
You misunderstand my problem, it's not enough to detect that the room has the wall, a detection on which side of the wall is the power bank is what is needed. How can you do it inexpensivly without hardcoding manual table ( ignore west side of E20 line for example) ?
-
Well, newbie walls don't change every few minutes, so all you need is a script that runs every 10k ticks or so, to do the whole findRoute stuff and store the list of rooms to exclude in your memory somewhere, right?
-
Amadox, you are wrong, once again I am checking Power Bank inside the room.
For E20 if the powerbank is on the west side of the wall - I can mine it, it it's on the east side - I can not.
PowerBanks spawn randomly. I have a function that checks a room to see if it has a PowerBank. What I need is a way to filter PowerBanks (but could be other objects) based on newbie wall.
-
You can do this a number of ways. You can scout up and down until you find a place where the walls change direction (from vertical to horizontal or horizontal to vertical) by seeing that there's a left||right and top||bottom constructed wall, which will help you figure out the inside versus outside of the novice area.
You could also use a room that you are already aware of the status of (where one of your creeps or structures exists) and, using that as a reference point, you should be able to figure out which side of the room is accessible. From there it's fairly simple to see if the powerspawn is on that side.
-
> which will help you figure out the inside versus outside of the novice area.
How do you know which side of the wall is novice area?
> using that as a reference point, you should be able to figure out which side of the room is accessible.
Requires a very expensive FindPath function ( for example from my observer to powerbank in E20 it takes 40 CPU )
-
The recommended solution is to use pathfinding. It has to be done only once per power bank's lifetime, so the CPU cost doesn't matter much.
-
> Amadox, you are wrong, once again I am checking Power Bank inside the room.
And as you said yourself, that can be done with findPath.
> Requires a very expensive FindPath function ( for example from my observer to powerbank in E20 it takes 40 CPU )
Exactly. which is why you don't do it every tick, but every 10k or so, like I suggested, and store the results (a list of rooms that are accessible or unaccessible, however you wanna go, or even a list of all rooms with a bool value determining if it's currently accessible or not) in memory. Then cost really doesn't matter if you only do it that rarely. A few high-CPU ticks every 10k ticks shouldn't really hurt.
Once you have that list in memory, you can use it every tick with no cost. Only downside is it takes up to 10k ticks to update once the newbie walls come down or new newbie walls are put up.
That being said, an API way to check if a certain room is protected and or part of a newbie zone even without having visibility to that room would indeed be very useful.