Best way to perform simulations



  • I am currently trying to write some difficult code, or at least code that is dependent on specific scenarios on a number of different fronts.

    e.g:

    Combat code for this combination of creeps and this combination of creeps

    Or evaluating the AI's decision making and execution process in a specific scenario, with so and so rooms, creeps, etc. present.

    Unit tests can only take you so far with a live action environment like screeps.

    What is the best way to develop and more importantly test and debug code like this? I am aware of:

    simulation room: high speed but extremely limited environment

    custom: decently customisable and can simlulate combat with two players, but once more limited to only one room

    private server: my current go to, but takes a long time to build an empire up to the point of having enough resources to put together everything needed for the scenario, not to mention even more code needed to 'prep' the scenario in a live environment.

    The private server is pretty much the only viable option for me so far, since all my code is multi-room code, I am leveraging very little 'room-isolated' code.

    One thought I had was that maybe the private server cli commands could be leveraged, to do things, like:

    modify terrain
    create creeps
    build structures
    set energy levels
    

    Just these four things alone would make a huge difference. But I can't seem to find any documentation on the private server cli, except a literal handful of commands.

    Are there private server commands that can help me achieve my goals?

    Is there another viable alternative that I am missing here?


  • Dev Team

    You have full control of game objects state through the storage CLI object. Just use it to learn how various game objects are stored, and modify them accordingly. This link may also be of some help:

    https://wiki.screepspl.us/index.php/Private_Server_Common_Tasks



  • It's not quite up to date, so you might have to do some updating yourself, but you might go ahead and try out screeps-server-mockup. It allows you to setup a private server via API including things such as terrain and RoomObjects (creeps, structures, etc) and run it one tick at a time.



  • @artch Thanx. I actually only skimmed that page originally so only now do I realise the commands on there are for mongoDB (face palms) so they should be easy enough to inspect and figure stuff out.

    @postcrafter I have to try that it, sounds like the best thing since undead goth-loli necromancer waifus.

    Jokes aside, it seems like a third party thing? So I may or may not be able to get that working and it may or may not have some much needed a-typical screeps server functionality. Can't tell much from the practically zero documentation it has lol.

    Regardless will definitely give it a go.

    Assuming however that I do not get that working, @PostCrafter @artch , Is there a way to make a traditional private server run one tick at a time? Say from cli for example.



  • @devblazer screeps-server-mockup, despite its name, is essentially just a wrapper to the official screeps server. All you should really need is to update the dependencies to the most recent server version and it should be good to go, I personally haven't used it in a while though.

    AFAIK there is no builtin way to run a server one tick at a time, but it should be able to do so with a custom mod. You might want to check out the #servers channel in slack, @ags131 is usually able to help with any kind of server related questions.