PTR Changelog 2017-07-30
This post describes changes on the Public Test Realm. The estimated launch date is August 3.
- Added new
WORLD_HEIGHTare now considered deprecated and should not be used.
- Removed obsolete and undocumented
Room.modeproperty. If you used this property to check for simulation mode, please use
Game.shard.name == 'sim'instead.
- Added new
When was `Room.mode` deprecated? I know some people (such as myself) are using it to detect when we're in a simulation. While we certainly can change it I just don't remember seeing a deprecation notice.
It doesn't exist in the documentation since 2015. In fact, it's not just deprecated, it is simply an undocumented remainder of the old Survival mode in pre-MMO times.
Even still, it was around when I started to play and I imagine many other people are also using this to see if their code is running in the sim or not. I doubt many players pay attention to when things are removed from the docs. It may be better to deprecate this officially (and spit out a console notice like you've done with other things).
All I know is that if I wasn't around to catch this notice my code would have completely broken, so I'd personally feel better if deprecation notices were given out in advance of changes like this.
Well, it's an undocumented feature. You always use undocumented features at your own risk. Undocumented aspects of the game may change at any time, you should not rely on their behavior.
And it's not about paying attention to the documentation changes. It never existed in the final release documentation since Early Preview in 2015, see this blog post. In fact, it had been already removed from it by the time you registered in Screeps.
Here's a forum post from Dissi reference the documentation you claimed to have erased-
Note the date on that post- it's december 2015, which is seven months after you claim to have erased it from the documentation site. That means it was in fact on the main website documentation well after the early preview. Unfortunately you took the old documentation site down already, but I don't remember you ever removing the mode and you certainly did not announce it.
Also, if you erased it from the documentation site before I started playing then how did I find it?
Hell, it's still on the main docs site!
Indeed Room.mode still exists in the version of the documentation as of the time of this comment.
It is incomplete, but it is there, therefore I have to back tedivm on the fact that removing a property like that without a grace period of deprecation can lead to a lot of code crashes.
So how are you using it without knowing the possible values? Or, how did you learn what are the possible values? Obviously, experimenting with its behavior, right? It is what people call "undocumented feature" exactly. The undocumented part is the values, not the property itself. This property doesn't have any documented values, so you are supposed not to mess with it.
> So how are you using it without knowing the possible values? Or, how did you learn what are the possible values? Obviously, experimenting with its behavior, right? It is what people call "undocumented feature" exactly.
I did not have to experiment or look at at. It was literally documented on the old website. The only difference between the new and the old website here is that the constants are missing now, but they were on the old site.
Again, read the link from Dissi. He flat out mentions the MODE_ constants and recommends you add a new one (MODE_PTR). Why would he recommend adding a new one if the other ones weren't already documented?
Also, this conversation is ridiculous. You made a mistake, which all humans tend to do- you thought that the documentation was updated in May 2015, but it turns out it was accidentally left in place. Instead of arguing with me about it just own up to the mistake and move on. There is no reason this should be as complicated or argumentative as you're making it.
You also still have the constants defined on the "CONSTANTS" section of the website-
The post literally has comments from a month ago showing that people are using this feature.
Literally one single month ago.
You still seem to misunderstand the point here. “Deprecated” is simply a wrong word here, since there is no process of deprecation of something that worked before and doesn’t work now. It never worked. It is just an obsolete remainder from Early Preview game release which is not in effect since 2015. You may have guessed on your own that it’s obsolete from things like MODE_ARENA and MODE_SURVIVAL, they are the reason why this property existed.
I can’t remember whether they were present on the old documentation site or not, but I’m pretty sure that we simply copied all HTML content to the new documentation site, so it should have been copied as well if it were there.
I still insist that if you rely on something that is not explicitly and fully documented, and do this without proper checks, then you should not blame us when your code breaks.
However, we wouldn’t like to make anyone upset, so we’ve run a quick check for usage of this property in players’ scripts. It has shown that some players use
MODE_constants and removing them from the global scope will create an exception in their scripts, so I've added this commit. Literally all usage cases look like
.mode == MODE_SIMULATION, it is not something that would break your colony. In case of
.mode == MODE_WORLD, it will still remain a valid check, since it’s
undefined == nullnow. There is no players doing
I believe we should be fine now.
Game.map.getWorldSize() isn't currently working- it's returning an array with objects that seem to correspond to rooms.
By the way, if you’re looking for a replacement for
Room.mode == MODE_SIMULATION, the correct check now is
Game.shard.name == 'sim'.
cyberblast last edited by
I don't care about the change.
But I wanted to note, that the old documentation indeed contained mode values as well.
There is a cached version of that page here. Well, it's not loking the same anymore, I guess it's lacking some stylesheets...
Whatever. Keep up the good work
Fun fact! It might have been hidden somehow, since I can’t remember that we manually removed anything while moving to the new site, it was fully automated. Or it might be marked as
obsoletein styles and thus the migration script didn’t process it.
Anyway, the main reason why it must be removed now is that
Game.shardis a more correct way to distinguish between sim/ptr/live.
Room.modeis no longer needed and can be safely removed without breaking anyone’s live code.