Advertisement

Anyone tried Screeps, the MMO for programmers?

Started by June 21, 2015 12:29 AM
59 comments, last by Dragonsoulj 9 years, 2 months ago

Well, you have the idea that the order of the parts matters. As creeps lose points, they lose those parts, in reverse order. Also, you have theflamingskunk's idea of going with minimums in some areas to streamline processes.

Going with dedicated creeps is definitely the way to go, it's not really viable for creeps to take on multiple roles at once since that makes them both more expensive and also slower...

Anyway I've been given 3 more codes since I've been playing over the weekend so they're up for grabs if anyone is interested!

Also, here's a low-tech snippet that I've been using for energy control when the supply doesn't quite match the demand:


if (creep.ticksToLive <= 150) {
    creep.say(creep.ticksToLive); // or send yourself an email with Game.notify() if afk
}

That way if you are doing some construction for instance and one or more of your harvester creeps are about to die, and you don't have creep spawn priority implemented yet, this'll give you some time to turn off your greedy builder creeps to prevent them sucking out all the energy from your spawn (you can use the "reinforcement" button for an instant 300-energy boost with cooldown apparently but running out of energy can really mess you up). Remember to prioritize filling your extensions to make sure you can always spawn new creeps.

“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”

Advertisement

Im beginning to regret my choice of starting room. Only two energy resources with limted access space and its hard to defend. But Im too committed now to respawn. I'll just struggle through. My walls come down in less than a day so I need to try get defence set up soon. I'm E4S8 in case anyone is around and wants to take it easy on me.

Bac, I think Tvoy may be eyeballing you. It looks like he's marshalling troops on the far side of the swamp, lol.

void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.

Bac, I think Tvoy may be eyeballing you. It looks like he's marshalling troops on the far side of the swamp, lol.

Yeah, I noticed haha, set up emergency defenses yesterday evening but I don't yet have the energy required to maintain a strong defensive army at the moment, not to mention that I don't have the time to write a sophisticated defense script that can cope with healer creeps. If he attacks I'm pretty much screwed laugh.png (but if he does I'll pick a better room and spawn location for sure)

“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”

I use dedicated creeps too. Like most, I have miners that mine and trucks that pick up any energy and deliver them to builders or structures. Trucks have a dedicated pickup location but dynamic dropoffs. For dropoffs I use spatial map in which consumers report their demands along with a priority. Structures always get precedent over builders so that I can keep spawning before building things. It took a while to get working and tweaked properly but it works pretty nicely.

Currently working on a spawn system that takes average energy production and number of extensions into account and also plans on which creeps to replace with which. I've had a few hickups where all creeps died quickly after eachother, clogged up the build queue with the wrong creeps and ended up in a coma. It happens less and though, which is kinda nice.

After that, I think I'll implement soldier logic to hunt down source keepers and construction logic to build ramparts after which I think I got all the basics in for an AI that can sustain a room by itself and then start on expanding/combat.

Advertisement

Concerning potential alliance:

Since memory is at a premium it would be ineffective to tag all units, and errors could potentially lead to friendly-fire incidents. Instead it seems more effective to simply store an array of the names of alliance members in an array in the memory root and simply compare this to the owner tag of foreign units. CPU cost for the search could be reduced by pulling detected contacts out of the array and unshifting them to the front of the array so that subsequent array searches will return on the first element. I would also advise detection routines to prevent abuse of the system by alliance members (check attacker names against the internal array and remove traitors from the array or move them to a 'traitor' array).

Also, due to the sensitive nature of tactical information, if we proceed with an alliance it would be wise to find a private channel of communication.

void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.

As we are looking at a simply list of friendlies only, it seems to make more sense to detect "enemy" creeps and structures, check list, act based on result. You can have constants built into your scripts, so it's not necessary to keep it in memory, only code and code only gets called when "enemy" items are within range.

Presently, we have, what, 6 GameDevers?

As we are looking at a simply list of friendlies only, it seems to make more sense to detect "enemy" creeps and structures, check list, act based on result. You can have constants built into your scripts, so it's not necessary to keep it in memory, only code and code only gets called when "enemy" items are within range.

Presently, we have, what, 6 GameDevers?

Also, theoretically speaking these script constants are made writeable (with some latency) by the fact that you can send yourself email notifications through code: install a handler on your mail client, modify scripts locally based on contents, and upload updated scripts via the screeps API. I feel this isn't really an intended mechanic though even though it is in the spirit of the game.

Now that I think of it this would suffice to offload heavy computational tasks (like computing optimal paths/configurations and the like) off the server and perform them on your own computer away from the CPU limit. But yeah that is probably cheating on the other hand.

“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”

Unless someone is hitting our "alliance" then I see no need for the extra overhead. Simply see the log and wipe them from the constants list.

Edit: Of course fully automated is in the spirit of the game. :D

This topic is closed to new replies.

Advertisement