Giter VIP home page Giter VIP logo

screeps's People

Contributors

joshuacox avatar mazdur avatar tanjera avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

screeps's Issues

Turn "fleeing" into "kiting

When non-combat creeps are fleeing enemies, use RoomPosition.isWalkable(true) to look ahead and make sure they aren't walking into a wall!

Combat boosts

Add use_boosts to combat objects (from util_console and from toColonize)

Manual market orders

https://github.com/tanjera/screeps/blob/master/util.console.js#L375-L392

https://github.com/tanjera/screeps/blob/master/sites.industry.js#L544-L553

Due to the way the console commands work, manually entered market orders will always fail because room["from"] == null on market_buy and room["to"] == null on market_sell, this can be fixed by rewriting market_send and market_buy to use a room to send it to (or it can default to Game.rooms[0] and then the courier will handle redistribution of energy to equalize values across all rooms)

I may attempt to whip up a PR later this afternoon

Ramparts: energy sink at low RCL

At low RCL (<6), ramparts are a taxing energy sink.

Solution:

  • Add walls to blueprints, 2 walls / 1 rampart
  • Add console command to set blueprint design (change from walled to ramparts) without needing new coordinates

Harvesting Tweaks

I noticed in sites.mining.js there are a couple of minor issues presently.

Firstly, unless I've got my wires crossed, on line 126 the custom_population variable incorrectly references the memory entry for custom populations - which is just 'population'. Changing this one line fixed custom_populations and my mines have used this correctly.

From: let custom_population = _.get(Memory, ["sites", "mining", rmHarvest, "custom_population"]);
To: let custom_population = _.get(Memory, ["sites", "mining", rmHarvest, "population"]);

Another minor issue I found is that in Source Keeper mining rooms, the Paladin needs to have a re-spawn condition set for when they get down below 200 ticks for the colony to spawn another one. This is because an SK room's timing on keeper spawns is a careful balance and you need to have two paladin's per room at all times to manage it.

in popActual
case "paladin": popActual["paladin"] = _.get(popActual, "paladin", 0) + ((c.ticksToLive == undefined || c.ticksToLive > 200) ? 1 : 0); break;

And also, in remote rooms, a single container for each source is enough to capture most excess energy so it isn't wasted but not so hefty to maintain that a multirole can't keep it topped up. I've changed the code in buildContainers to reflect this

from: if (source.pos.findInRange(containers, 1).length < 2) {
to: if (source.pos.findInRange(containers, 1).length < 1) {

A change I haven't implemented yet, but that would increase efficiency, is for the buildContainer's not to run/create container construction sites if there are existing constructionSites for roads in that remote room. This is because, while a remote is being setup with roads connecting sources etc, a container's build steals priority, delaying important infrastructure, and once built, a container quickly loses health, to the point that one multirole cannot upkeep a container and actively build roads in a remote room with complex pathing, such as swamps etc. I would guess a simple look for constructionSites and return if found at the start of the function would suffice for this.

help function seems to be acting funny

I am seeing some errors like this:

help(blueprint)
[11:42:51 AM][shard3]TypeError: submenu.toLowerCase is not a function
    at help (main:7612:21)
    at eval (eval at <anonymous> (_console1572021771689_0:1:46), <anonymous>:1:1)
    at _console1572021771689_0:1:46
    at _console1572021771689_0:1:60
    at Object.exports.evalCode (<runtime>:16006:71)
    at Object.exports.run (<runtime>:30559:41)
help(labs)
[11:43:50 AM][shard3]TypeError: submenu.toLowerCase is not a function
    at help (main:7612:21)
    at eval (eval at <anonymous> (_console1572021833776_0:1:46), <anonymous>:1:1)
    at _console1572021833776_0:1:46
    at _console1572021833776_0:1:60
    at Object.exports.evalCode (<runtime>:16006:71)
    at Object.exports.run (<runtime>:30559:41)

Industry, tweaks for reactions

  1. when defining reactions, splice out labs already defined in boosts!!!!!!! but not empty...

  2. @ sites.industry() line ~141: if no reaction available to be assigned, check if any labs need emptying ... and empty them!

  3. refactor industry functions; write out steps for industry and try to refactor to it

  4. In defining labs, if no reaction or boost, if not empty, then empty

Implement Tombstones

And collecting dropped resources off tombstones as if they were dropped on the ground (e.g. for carriers)

Grafana Dashboard Share?

Hi - Not an issue, but love your implementation of the Grafana stats. Wondering if you have a sample dashboard you have built and would be willing to share?

Learning significant amount of JS just reading through your screeps files!

THanks
Charlie

Log boosts

Implement log.boosts: list all active boosts

Combat tactic: griefing

https://www.reddit.com/r/screeps/comments/cm5o0w/so_is_everyone_just_using_overmind_now/

frankster
Asymmetric warfare against overminds gives good results if you force them to over-respond. So send into one of their remotes a little attacking creep with 1 attack, 1 ranged attack part. Attack their miners/transporters.
Overmind tends to respond with a fullsize creep with melee parts, and another creep with ranged/healing parts. This creep will smash your little creep (and then some), so there's no reason to fight it! As soon as the creep comes in, leave the room. Those responders will stay guarding that room.
If your little creep were then to go to another of his remotes, the overmind would usually spawn another pair of creeps to guard that remote.
You can pretty much automate this and cause them to spend thousands of energy defending against your 300 energy annoyer creep.

No extractors to extract minerals

I have been fairly busy with the holidays coming up so I haven't been paying too close attention, however I couldn't help to notice that ALL of my minerals are completely full waiting to be extracted, I don't know if theres spawn requests being made for them or not, but I haven't found a single extractor across all my rooms.

E: when I say 'extractor' I am referring to the creep type, not the actual building (those seems to be placed without a problem)

Labs

I have a couple rooms that have 6 labs in them now. My original room will only use the 4 original labs for supply and reactions. All of the lab id's are in memory. My other room seems to be performing properly.

Anyone else experiencing this issue? Any thoughts?

Courier can't haul resources to labs fast enough

I am surrounded by many rooms with some unfavorable random wall placements making me choose compact base layouts, because of this I elected to put my labs near my mineral, but because of this there is not enough time for the courier's to make it to the labs before they are given a new task (to redeposit the minerals they are transporting)

My solution was just to change the timer to 30 for all of these tasks (I feel 30 ticks is enough time to take resources from nearly two opposite corners of a room)

screeps/sites.industry.js

Lines 310 to 467 in ceec989

createLabTasks: function(rmColony) {
/* Terminal task priorities:
* 2: emptying labs
* 3: filling labs
* 4: filling nuker
* 5: filling orders
* 6: emptying terminal
*/
for (let l in labDefinitions) {
var lab, storage;
let listing = labDefinitions[l];
switch (listing["action"]) {
default:
break;
case "boost":
lab = Game.getObjectById(listing["lab"]);
if (lab == null)
break;
if (_.get(Memory, ["rooms", rmColony, "stockpile", listing["mineral"]]) == null)
_.set(Memory, ["rooms", rmColony, "stockpile", listing["mineral"]], 1000)
// Minimum amount necessary to boost 1x body part: 30 mineral & 20 energy
if (lab.mineralType == listing["mineral"] && lab.mineralAmount > 30 && lab.energy > 20) {
Tasks.addTask(rmColony, {
key: `boost:boost-${listing["mineral"]}-${lab.id}`, room: rmColony, dest: listing["dest"],
type: "boost", subtype: "boost", role: listing["role"], subrole: listing["subrole"],
resource: listing["mineral"], id: lab.id, pos: lab.pos, timer: 10, creeps: 8, priority: 1 });
}
storage = Game.rooms[rmColony].storage;
if (storage == null) break;
if (lab.mineralType != null && lab.mineralType != listing["mineral"]) {
Tasks.addTask(rmColony, {
key: `industry:withdraw-${lab.mineralType}-${lab.id}`, room: rmColony,
type: "industry", subtype: "withdraw", resource: lab.mineralType,
id: lab.id, pos: lab.pos, timer: 10, creeps: 8, priority: 2 });
} else if (lab.energy < lab.energyCapacity * 0.75 && storage.store["energy"] > 0) {
Tasks.addTask(rmColony, {
key: `industry:withdraw-energy-${storage.id}`, room: rmColony,
type: "industry", subtype: "withdraw", resource: "energy",
id: storage.id, pos: storage.pos, timer: 10, creeps: 8, priority: 3 });
Tasks.addTask(rmColony, {
key: `industry:deposit-energy-${lab.id}`, room: rmColony,
type: "industry", subtype: "deposit", resource: "energy",
id: lab.id, pos: lab.pos, timer: 10, creeps: 8, priority: 3 });
} else if (lab.mineralAmount < lab.mineralCapacity * 0.75 && Object.keys(storage.store).includes(listing["mineral"])) {
Tasks.addTask(rmColony, {
key: `industry:withdraw-${listing["mineral"]}-${storage.id}`, room: rmColony,
type: "industry", subtype: "withdraw", resource: listing["mineral"],
id: storage.id, pos: storage.pos, timer: 10, creeps: 8, priority: 3 });
Tasks.addTask(rmColony, {
key: `industry:deposit-${listing["mineral"]}-${lab.id}`, room: rmColony,
type: "industry", subtype: "deposit", resource: listing["mineral"],
id: lab.id, pos: lab.pos, timer: 10, creeps: 8, priority: 3 });
}
break;
case "empty":
_.forEach(listing["labs"], l => {
lab = Game.getObjectById(l);
if (lab.mineralAmount > 0) {
Tasks.addTask(rmColony, {
key: `industry:withdraw-${lab.mineralType}-${lab.id}`, room: rmColony,
type: "industry", subtype: "withdraw", resource: lab.mineralType,
id: lab.id, pos: lab.pos, timer: 10, creeps: 8, priority: 2 });
}
});
break;
case "reaction":
storage = Game.rooms[rmColony].storage;
if (storage == null) break;
let mineral = _.get(Memory, ["resources", "labs", "reactions", rmColony, "mineral"]);
if (mineral == null)
return;
let reagents = getReagents(mineral);
let supply1_mineral = reagents[0];
let supply2_mineral = reagents[1];
_.set(Memory, ["rooms", rmColony, "stockpile", supply1_mineral], 1000)
_.set(Memory, ["rooms", rmColony, "stockpile", supply2_mineral], 1000)
lab = Game.getObjectById(listing["supply1"]);
if (lab == null) {
console.log(`<font color=\"#FF0000\">[Error]</font> Sites.Industry: Game.getObjectById(${listing["supply1"]}) is null.`);
return;
}
else if (lab.mineralType != null && lab.mineralType != supply1_mineral) {
Tasks.addTask(rmColony, {
key: `industry:withdraw-${lab.mineralType}-${lab.id}`, room: rmColony,
type: "industry", subtype: "withdraw", resource: lab.mineralType,
id: lab.id, pos: lab.pos, timer: 10, creeps: 8, priority: 2 });
}
else if (Object.keys(storage.store).includes(supply1_mineral)
&& lab.mineralAmount < lab.mineralCapacity * 0.25) {
Tasks.addTask(rmColony, {
key: `industry:withdraw-${supply1_mineral}-${storage.id}`, room: rmColony,
type: "industry", subtype: "withdraw", resource: supply1_mineral,
id: storage.id, pos: storage.pos, timer: 10, creeps: 8, priority: 3 });
Tasks.addTask(rmColony, {
key: `industry:deposit-${supply1_mineral}-${lab.id}`, room: rmColony,
type: "industry", subtype: "deposit", resource: supply1_mineral,
id: lab.id, pos: lab.pos, timer: 10, creeps: 8, priority: 3 });
}
lab = Game.getObjectById(listing["supply2"]);
if (lab == null) {
console.log(`<font color=\"#FF0000\">[Error]</font> Sites.Industry: Game.getObjectById(${listing["supply2"]}) is null.`);
return;
}
else if (lab.mineralType != null && lab.mineralType != supply2_mineral) {
Tasks.addTask(rmColony, {
key: `industry:withdraw-${lab.mineralType}-${lab.id}`, room: rmColony,
type: "industry", subtype: "withdraw", resource: lab.mineralType,
id: lab.id, pos: lab.pos, timer: 10, creeps: 8, priority: 2 });
}
else if (Object.keys(storage.store).includes(supply2_mineral)
&& lab.mineralAmount < lab.mineralCapacity * 0.25) {
Tasks.addTask(rmColony, {
key: `industry:withdraw-${supply2_mineral}-${storage.id}`, room: rmColony,
type: "industry", subtype: "withdraw", resource: supply2_mineral,
id: storage.id, pos: storage.pos, timer: 10, creeps: 8, priority: 3 });
Tasks.addTask(rmColony, {
key: `industry:deposit-${supply2_mineral}-${lab.id}`, room: rmColony,
type: "industry", subtype: "deposit", resource: supply2_mineral,
id: lab.id, pos: lab.pos, timer: 10, creeps: 8, priority: 3 });
}
_.forEach(listing["reactors"], r => {
lab = Game.getObjectById(r);
if (lab == null) {
console.log(`<font color=\"#FF0000\">[Error]</font> Sites.Industry: Game.getObjectById(${r}) is null.`);
return;
}
else if (lab.mineralType != null && lab.mineralType != mineral) {
Tasks.addTask(rmColony, {
key: `industry:withdraw-${lab.mineralType}-${lab.id}`, room: rmColony,
type: "industry", subtype: "withdraw", resource: lab.mineralType,
id: lab.id, pos: lab.pos, timer: 10, creeps: 8, priority: 2 });
} else if (lab.mineralAmount > lab.mineralCapacity * 0.2) {
Tasks.addTask(rmColony, {
key: `industry:withdraw-${mineral}-${lab.id}`, room: rmColony,
type: "industry", subtype: "withdraw", resource: mineral,
id: lab.id, pos: lab.pos, timer: 10, creeps: 8, priority: 2 });
}
});
break;
}
}
},

Colony pathing: Don't path through other rooms

When current position and destination are both within same room (e.g. colony creeps within colony, colony miners within colony), do not path through other rooms to avoid natural walls-

Currently an edge case, but creeps end up idling on edge of room wasting time & CPU.

Safe Mode implementation?

Double check if pinging into Safe Mode is implemented properly.

That it goes into safe mode if:
Enemy gets to core structure? (e.g. Tower spawn extension storage etc)

RCL8 Soldier's Camp

Currently the behaviour of Idle soldiers is to find a camp and set up shop there. Part of this code looks for the closest rampart and the soldier attempts to move under there, as this is usually a defensive barrier. However in RCL8 rooms, their are ramparts under base structures such as spawns and towers. Therefore the soldier attempts to make its camp under a spawn. This results in spawns getting clogged with soldier's who remain immediately upon the exit tile once spawned.

CPU optimization re: _.sort

When sequentially calling _.sortBy ... figure out how to combine sorting conditions into 1 statement... potentially using tertiaries or multipliers??
Because more _sortBy's * longer arrays to sort == CPU hog.

Colony death by lazy couriers

When testing on local server a colony run into death spiral (one room, 2 sources, RCL 4) where couriers where refilling and taking from storage, and nobody was refilling spawn or extensions. (only couriers and burrowers were left alive).

Now retesting again, with added code to couriers to refill extensions first.

Market orders fail to process

Upon reaching RCL6 I began buying/selling minerals but could not get the codebase to perform market transactions at first, after debugging the code this if statement was determined to be the culprit.

screeps/sites.industry.js

Lines 544 to 547 in ceec989

if ((rmColony == order["room"])
|| (order["from"] != null && rmColony != order["from"])
|| (order["to"] != null && rmColony != order["to"]))
continue;

I had troubles following the logic of this code, but it is filtering all orders based on the 2nd or 3rd statements

remote mining energy efficiency (multiple reservers at low RCL)

at RCL 4-6 the reservers that spawn will most likely only spawn with 1 claim part due to the already tight energy budget around this point, however because of this room reservation in remote mining rooms will only 'hold' for as long as the sole reserver dies, this means that you can potentially lose out on 1.5k energy from the reservation dropping on a newly regenerated energy block, setting the reservers to two is a two-pronged solution, it fixes the problems of having enough claim parts to steadily increase the reserve time and it also ensures that your mining room will not instantly lose its reservation from 30 tick spawn time for a replacement

Overflow Energy Issue

I realise you aren't actively working on your screens code at this time, but thought I would highlight this issue anyway, as it has a significant impact on an empire's sustainability when using your codebase.

Currently, there is an issue when a room with more energy than the defined overflow amount creates a terminal order to send that energy to a colony with the least energy. Instead of the room with the overflow sending the energy, currently ANY terminal in ANY owned colony attempts to send energy to meet the order.

This results in successive terminal orders from the overflow colony being made as it attempts to offload its own energy but with the orders being fulfilled by other colonies. Essentially, over time, a significant amount of energy is wasted in transfer costs as energy essentially bounces around your empire ceaselessly.

I have an idea of how to fix it, but haven't attempted to implement it yet. I believe it is about changing sites.industry runOrder_Send to not use rmColony if the terminal order in question has a 'from' entry, and to use that instead as the source room.

Industry, supply to reactors

Set of 6 labs (RCL 7) not defining supply1 and supply2 accessible to all labs
-> Needs to define central labs as supply to reach all reactors

Creeps dying immediately after spawn

Using your base code with no modifications on a private server. It seems sometimes creeps will spawn and die immediately, actually happens quite often. I haven't changed any of your code, one room at RCL 4, using def_hor blueprint.

Creeps trying to repair a wall with hitsMax of 0

Problem: Colonizing a new room, some STRUCTURE_WALL's have hits of 1/0 (hits: 1, hitsMax: 0). Workers will continually try to repair this wall, failing.

Fix: On finding a repair task for creeps, filter out STRUCTURE_WALL with 0 hitsMax.

Carrier target priority issue

Hi. Love your work, btw.
The following situation occurs, which I feel is wrong, and you may wish to be aware of...

Clusered in a room are:

  1. A source
  2. Spawner and all extensions.
  3. An empty container.
  4. A 15% full storage.
  5. A receiver link.

A sender link is 20 squares away from the nearest object in the cluster, by the room's second source.

For some reason, creeps will deliver to the link when the much nearer storage/container is available.

Road building...

Implement road building for:

Roads in colonies- from sources, extractor, and controller to ... ramparts?
Roads in remote_mining rooms- from sources to exit tiles

Industry tasks are not being performed (again)

I have noticed that my industry tasks are no longer running, I have only just begun investigating the cause of this, I set my reaction targets with the console command labs.set_reaction("OH", 25000, 60) without any issues, and my labs began to produce some lovely hydroxide! Things were fine and I went away to worry about IRL things, I came back to labs full of resources (but nowhere near the amount I need/want in storage) and way more base resources than I have set to allow, so I have narrowed this down to the couriers not doing much, memory says these tasks are being picked up, but the creeps sit motionless next to the spawn, I am still looking into this, ill provide more info as I come across it.

TL;DR: Couriers are once again sitting idle, I am still debugging but so far it looks to be that tasks are being picked up but couriers are sitting idle.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.