#Allow Base Plan code to run for 1st spawn

41 messages · Page 1 of 1 (latest)

restive aurora
#

Either allow the auto-spawn module in MMO & Season
-- or --
Maybe we allow code to run, without spawn, but your bucket doesn't refill. So you get 10k CPU to do your baseplan code for your 1st room. It'd also, in theory, allow 10k CPU of code to run, when you lose your last spawn, before you're fully dead

neon night
#

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)

balmy cape
#

Having to work out where to put the first spawn using an external script is a bit of a faff

broken fog
#

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.

patent seal
violet talon
#

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...)

balmy cape
restive aurora
balmy cape
#

Yep exactly

livid fjord
# violet talon TL;DR: +1. I like giving 9999 CPU on a newly-claimed first room to enable plann...

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.

bright jungle
#

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.

balmy cape
bright jungle
balmy cape
#

No idea sorry, I am not familiar with that

patent seal
#

I believe it's simply a https://screeps.com/api/game/create-construction API call

bright jungle
#

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

patent seal
#

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.

bright jungle
#

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.

neon night
bright jungle
# neon night Sure but that's on you if you deliberately place an auto spawn. It doesn't break...

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.
bright jungle
#

Then the following makes no sense:

Sure but that's on you if you deliberately place an auto spawn

bright jungle
neon night
#

Auto isn't forced on you. You could still spawn normally or use the API if you want.

bright jungle
neon night
bright jungle
#

Unless you plan to run your planning/placement code with 0 CPU I guess

short bison
#

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.

patent seal
#

so you do have a structure in the shard

bright jungle
#

True

short bison
#

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.

neon night
#

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.