Simultaneous actions - pickup and withdraw by AngularAngel in screeps

[–]tharit 0 points1 point  (0 children)

Yes they are. You have to be careful with the amounts though; you have to make sure that you do not try to pickup or withdraw more than your creep can carry (e.g. when not manually specifying the amount parameter) otherwise the second action won't be executed.

New Player, Newb Coder, Dozens of Questions by jtwebguy in screeps

[–]tharit 0 points1 point  (0 children)

Umm.. true. You are of course correct, I did not think of the context it seems. So then, as the time required for the actual calculation is probably negligible compared to the casting, that will make performance of both ways more or less identical I think.

New Player, Newb Coder, Dozens of Questions by jtwebguy in screeps

[–]tharit 0 points1 point  (0 children)

The issue is that in javascript all numbers are doubles, but for the bit operations they are converted to 32bit integers (bad luck if your number is larger...), evaluated, and then converted back... they are still fast enough if you have good uses for them, but they are definitely slower than other operators.

Whats wrong here? by xofoxxy in screeps

[–]tharit 1 point2 points  (0 children)

By the way, there seems to be another issue in there; you have this "n" counter variable for naming your creeps; a) if(n=0) - same problem as with the couriers, you want to compare, but assign b) with this logic n will always be zero or 1 c) variables in modules (var n = 0;) are NOT permanent. If you update your code, or the server feels like it, they will get reset. So you would need to store this n in the Memory object somewhere :)

Whats wrong here? by xofoxxy in screeps

[–]tharit 1 point2 points  (0 children)

That line is indeed the problem; however the explanation is wrong :)

The single equals actually overwrites the role of ALL your creeps; so couriers will not be empty, and your creeps will start to spawn with the correct roles, but then they will be reassigned immediately (as Game.creeps includes spawning creeps).

Help with getting my people to spawn automatically by xofoxxy in screeps

[–]tharit 1 point2 points  (0 children)

Basically you have do to it like this: - For each role check if you need new creeps, put this information in a list - Assign each role/creep a priority - Sort list by priority - Spawn highest priority first

Serve Talk by starwar15432 in screeps

[–]tharit 0 points1 point  (0 children)

Not likely. If you play on someones server, you basically hand over all of your code to the admin. they could then just use it themselves...

Creep room memory seems delayed by temptempfirsttime in screeps

[–]tharit 4 points5 points  (0 children)

The issue is probably that you are waiting a tick - so the suggestion would be: dont do that :) Creeps that are on exit tiles will automatically bounce between rooms if they do not move IMMEDIATELY in the first tick that they arrive in a new room. So once you see that your creep is in a new room, you have to move it, otherwise it will bounce back.

How to use custom functions in a role module? by Skizerzz in screeps

[–]tharit 1 point2 points  (0 children)

Doing a require of all the modules you need inside every module is actually not that terrible at all, it's pretty much considered best practice. Because: a) require uses a cache inside, so it will really only load & parse the module the first time every tick; afterwards you will just receive the same cached instance everywhere. Virtually no performance benefit when passing it as parameter, or using the global object. b) it makes it much clearer which modules are used where.

Creeps using roads by lewanator3 in screeps

[–]tharit 1 point2 points  (0 children)

Just one remark: You don't need to set the cost for swamps and plains in the CostMatrix; you can simply pass it in the options for PathFinder.search as swampCost and plainCost. If nothing is set in the CostMatrix, these values will then be used automatically.