Changes to code made shortly after saving it are discarded


  • TMB

    Yes, this happens even in a fresh new external window after zooming into a room. This tend to happen in the embedded window as well.
    Recently it's been affecting the simulation a lot more noticeably too.


  • TMB

    Please, this is getting worse. Even in the simulation I'll have my writing interrupted several times in a row. It's getting infuriating.
    I mentioned it happening in the external windows, but it happens has badly in the embedded editor.
    Isn't there a way I can just forbid pulling my code without asking ?

    I noticed that sometimes if I save two changes in a short interval, the window will pull the earliest changes despite the latest changes being properly pushed. It's just being confusing.


  • TMB

    I'm loosing whole snippets of code without realizing it.

    What is it you need to look into the issue? More data? I'd love to provide some, what do you need ?



  • This is simply due to the client <-> server architecture.
    It is fine for small scale stuff but not for bigger projects.
    If your ISP doesn't provide you with a stable and fast internet connection your are bound to run into those issues.

    It is way better to use a external editor like:
    https://code.visualstudio.com/
    It is free and way more useful than the screeps IDE.

    It is very customizable and expandable too, there is tons of creature comfort stuff you can use.


  • TMB

    @mrfaul said in Changes to code made shortly after saving it are discarded:

    It is way better to use a external editor like: https://code.visualstudio.com/ It is free and way more useful than the screeps IDE.

    Using an external code editor is what I'd call resorting to a clientside solution, this seemt to be a big nope to you on other matters.
    I'm not fond of clientside solution myself .I do know of VSC but I'd rather have avoided having to look up how to set up screep's autocomplete. I'd find the screeps IDE good enough if it wasn't for its nasty instability.

    I think its sad that a unique game like this would ship with buggy and potentially destructive tools. If they want people not to use their editor they might as well not provided it than provide one that rewrite your code on its own.



  • @estecka I get your point, but fixing this isn't really necessary because this is mainly a tool for viewing and fixing stuff on the fly.
    There are only a handful of people who use that editor and revamping the entire backend is imo not worth the afford.

    The main problem by using this tool is that every freaking save is synchronized and results in a reset of your screeps script.
    Using a external editor allows you to circumvent this, by simply editing a non active branch.

    Oh and writing code is and should be always a local thing that gets deployed at some time.
    I generally dislike things that are not where they should be for performance reasons, regardless on which side they are 😏
    And I don't have the buggienes with the internal IDE with my ISP connection at home due to very low latency,
    however I get those if I use a mobile connection if I check stuff on the go. This is simply a result from the current architecture.

    You can find your local scripts on windows in %appdata%/Local/Screeps/scripts/ those are the ones who get synced by the steam client.


  • TMB

    You keep saying it's about the backend, but I still don't understand how it has anything to with this. If my local scripts are overwritten, it's the deed of the client; even if the server keeps sending me back my code after I save it, the client could simply ignore that data and keep the local changes.
    I don't even understand why sending me back my would be relevant to saving it online; Aside from when I login, I don't actually see a point in sending me back my code at any time through the game.

    I'm probably gonna do it some day anyway, but I still feel this shouldn't be a need.
    Even if most veteran players use external editors, the in-game editor is the first thing they'll see of the game; they might avoid this specific issue, but if they fall into the bigger ones like overwriting whole branches with the wrong code, not all of them might want to stick with the game.



  • The client has one job to do, and that is to show what is currently on the server, and that is exactly what it does.
    So if you are working on multiple files and don't save them before you give a other file focus it will simple load what is currently running on the server.


  • TMB

    I find client actually does more than read and show what's on the server. Even then, it still ultimately boil down to what the client decides to do with what it finds there.

    you are working on multiple files and don't save them before you give a other file focus

    I'm not sure what you mean with this.



  • Focus means if you click anything that is not in the code window and return to it and click it again so you can edit again it may decide to refresh whats shown from the server.


  • TMB

    Not sure how it works with the anchored editor, -I only use this one for the console,- but in the unanchored editor windows I can tell for sure it has never spontanesouly refreshed whatever I'd do in the main window. It strictly only does this after I save the code.
    That sounds like an incredibly annoying behaviour you're describing here; I'll go test that later.



  • It's really weird that youre having issues. I've been playing since July 2016, and I've never had an issue with code reverting, unless i go into map view then return to room view without saving. I learned not to do that in less than a month, and have never had any issues since. Perhaps it is a connection issue thing as someone mentioned above. Also, in regards to the local folder cache in %userprofile%\..., I learned to never touch that except for backups. So I've effectively had no issues in over 2 yrs. I know of one other of the old guard that has solely used the in-game IDE, and he has never reported issues either. Perhaps just figure out what causes it to revert, and avoid it like everyone else. Just a thought. 😛

    P.S. reread, and it sounds a little patronizing. that was not my intent, simply enlightenment that you can successfully work in-game.


  • TMB

    I do look for patterns and causes, that's how I learnt over a year ago that you should never switch branch with the unanchored editor, but in this very case it's not something I can fix or avoid easily.

    As for what causes the refresh, it's easy, it's saving the code; you see how never saving my code is not a solution... I could wait a minute or so before typing again, so I can be really sure the refresh has proceeded already, but I don't have that patience when I'm trying to fix a critical bug and have to make swift small edits edit to get the important part running again, or trying to console log datas to figure out what is wrong.

    As for why it happens to me, I totally believe this must be a connection issue. Out of several places where I've played, I've only seen it happen home, and the phenomenon is strongest around 22h, which I've know in this house as the "low internet time" way before screeps. I can't prevent 22h from happening or fix whatever happens out there at this time, and even if I could avoid playing around this time, it's still the only time when I'm home...

    And before anyone says that my connection is my problem or so, I'm not here asking for naive network optimization, I'm very specifically arguing that re-downloading the code right after uploading it does not serve any purpose, if anything I'm the living example that it's actually harmful in some edge cases. (Plus it's not consistent with all the times where the game actually asks me if I want to redownload it, everytime I login or create/delete a branch.)



  • For fast iterations just use a local server, you shouldn't have those problems then.
    It is far better anyway to only push "stable" versions to the server anyway.