#Allow Base Plan code to run for 1st spawn
41 messages · Page 1 of 1 (latest)
What if you could claim the controller in a room but not place a spawn? So you'd click the room, start the spawn process but just cancel that and you'd still have the controller so your code could run. The first spawn constructionsite placed gets automatically built.
It would still avoid pixel cheesing since you have a limited time before that controller goes away, and it sticks within the existing paradigm of Screeps without adding any new rules to how code runs (except the behavior of the first spawn placement I guess but that shouldn't break anything)
Having to work out where to put the first spawn using an external script is a bit of a faff
Maybe turning off or weaken respawn timer? Respawn, let the code work it out a bit, then re-respawn, with the spawn placed in the calculated position.
that's what auto-spawn is. It's handled by the admin-utils mod
TL;DR: +1.
I like giving 9999 CPU on a newly-claimed first room to enable planning, with no CPU regen until a Spawn csite is placed (which gets instantly built + resets CPU bucket o 0). But it is still a ceiling of sorts and fells a bit of a surprising behaviour for a standard behaviour. Perhaps a Room.claimFirstRoom and Room.placeFirstSpawn with clear documentation / mechanics etc. But notice how it it's very rare usage compared to most other API methods. So maybe it get hidden behind some kind of "you probably don't need this" object to avoid trapping new players?
With offline base planning you have to solve room terrain (easy) and room objects (less easy). If all of that was just made public all the time, would it devalue Observers?
If there was a "🪄" which you could wave to run your screeps code to enable base planning, claim first room, and place first spawn, would you wave that wand? (I've had too much coffee so right now I have a vague idea of a client solution to this but it'd cost me more hours than I'll ever save...)
Ill be honest even if you have to claim the first room before you can auto place the first spawn that will be ok. Im not too keen on full auto respawn. Too many zombies would become impossible to get rid of
Yeah, you could still have the first claim require a human to log in, to click a button. You just want to be able to automate the placing of the first spawn.
Yep exactly
auto spawn placement would be far superior to that imo. your suggestion is a lot more invasive in terms of how screeps works, as you'd have to add some mechanism to enable code running while not spawned in (which it currently doesnt to save on server cpu time).
i feel like you generally misunderstood auto functionality, perhaps? it basically only changes one detail of the spawn process. you claim the room normally, "place" your spawn - except if named auto it doesnt get placed, but a flag on the controller instead. then you own the controller since the room is claimed, meaning your code runs. you then plan your room and your code places its first spawn site. upon doing so it checks and sees that the auto flag is set on the controller and replaces your site with a fully built spawn.
this is the least invasive implementation to enable automatic spawn placement, no concerns of zombies respawning endlessly (without external tooling), etc.
_ _
and it doesnt change anything about how the bucket works, so whatever was in there (0 on new accounts) will be in there, as is the case now.
this also means that if you dont manage to get your room started within 20k ticks, you'll just timeout as you would have.
Yup, allowing code to run on a shard where I have no creeps or structures present would violate a lot of my bot's preconditions.
From what I understand, most people who want to automate spawning/respawning have an external process running that operates via the REST API.
I think the main issue is people don't want to have to manually place the first spawn. For me, I have an offline script that recreates my base builder for a room, just so I know where it wants me to place the first spawn, this should not be necessary. I like Rayder's solution
Isn't it possible to place the first spawn via the REST API?
No idea sorry, I am not familiar with that
It should be, yeah
I believe it's simply a https://screeps.com/api/game/create-construction API call
In that case, I refer to my previous statement:
From what I understand, most people who want to automate spawning/respawning have an external process running that operates via the REST API.
That includes placement of the first spawn
I like the auto spawn technique better, since it's less support code. You can just push your code out, pick a room you like, and let the bot do its own planning internally without having to do much.
I'm not as much of a fan of that one since it breaks pre-conditions that are currently valid on MMO.
My bot's init code makes the assumption that if it's initialized on a shard, it has at least one structure or creep there. It uses that to define consts for current username / etc without needing to define a function for it.
Sure but that's on you if you deliberately place an auto spawn. It doesn't break any existing mechanics or assumptions otherwise.
I think you have a fundamental misunderstanding of everything I've said.
To clarify:
- On MMO/PTR, your code will only execute on a shard if you have at least one structure or creep present on that shard
- To work around this long-standing behavior, players will write monitor processes that run externally and use the game's REST API to manage respawning, initial room planning/claiming, and initial spawn placement
- I don't currently use an external process or anything else to automate initial spawn placement or room claims.
Yes I understand that.
Then the following makes no sense:
Sure but that's on you if you deliberately place an auto spawn
I guess they could make auto vs current behavior a setting like they did with the execution environment, though.
You said you weren't a fan because it breaks your bot's assumptions
Auto isn't forced on you. You could still spawn normally or use the API if you want.
Okay, define a way this works without breaking documented behavior and I'll retract my statement. Go ahead, I'll wait
It doesn't matter if it breaks behavior when you deliberately choose to change the behavior
Unless you plan to run your planning/placement code with 0 CPU I guess
The only case in which it breaks previous behaviour is if you deliberately name your first spawn "auto".
If you name it anything else, including any of the game's default names, then it behaves exactly the same and breaks nothing.
Even in that case it doesn't break any behaviour from the point of view of your bot.
If you own a controller, your bot runs already. This is just a way to get to that state while still being able to get an auto-built spawn in the location of the bot's choice instead of a location the player has to place manually.
It doesn't, because claiming the room owns the controller
so you do have a structure in the shard
True
You can already get a spawn in the location of a bot's choice, but it won't be auto-built like a player-placed one.
And with no creeps, it never would be built.
I don't think it should literally work by naming a spawn a special name, that's kind of a hack. If it gets officially implemented it should just be a button or check box on the place spawn screen.