W van Rij
W van Rij

Reputation: 536

Screeps Few errors / questions

I sort of want to use SO to point out a few things.

First of all, It was kinda weird to 'script' in this game because unlike a 'normal' Javascript script, the way things get executed are different. We all know that in scripts, the first thing, gets executed first. So if I have:

Game.spawns.Spawn1.createCreep( [Game.WORK, Game.WORK, Game.CARRY, Game.MOVE], 'worker1');
Game.spawns.Spawn1.createCreep( [ Game.TOUGH, Game.TOUGH, Game.MOVE, Game.HEAL], 'healer1');

You would assume worker 1 would get created. That is not true. Healer1 gets created. It would be usefull to enlighten people about the way scripts get executed. Now above example is mainly simple, but in my case I had a bunch of statements and it took me a while to figure this out.

Next is the creep name. In case of death of a creep, the name should be 'gone'. I did checked this and the name was 'available' to use again YET for some reason the name only gets available after some ticks. Not instant! So there is a difference between client and 'server'. Now, this is obvious fixable by iterating numerous time and not reusing names. Truth be told I prefer to reuse names. Why? Maybe your script will run for years and this would result in names like 'worker1209128102981209128' which is in my OCD opinion not 'nice'. In my case I wait till the error 'name already is in use' is gone' for a few ticks and create it after that. You kinda 'lose' time on that.

Console.log(); (empty) , will result in going your console mental. The style will get 'bugged'.

Next thing: The memory state is not always cleared in a new game. Resulting in some weird things either: You already have stuff in your own memory and or enemy creep waves are already on a wave beyond wave 1.

An other thing which I did not found in the API; Creeps get hits on their first modules first. So, you are smart to putt TOUGH in first since its a 'useless' module. Followed by other less useful modules.

Now for the gamemode, the enemy AI can get bugged. For instance if you -do not- move your creeps, the enemy will simply not attack. The same goes for when you leave one enemy creep alive from a wave, the AI may get 'bugged'. Not sure if its normal, but I had the following after a small while; I cannot 'believe' it is normal to fight that fast against so many and such strong enemy creeps (look the body modules alreadyexample

As last I might want to ask the developer to make something where we could communicate with the developer. Even tho stackoverflow is nice, IMO is more to be used for people who want a little push in the right direction.

Thanks, I really enjoy the game, and I hope it will get big! :)

Upvotes: 3

Views: 815

Answers (1)

Andrii Gook
Andrii Gook

Reputation: 53

if createCreep called more than once in a tick, only creep in the last call will be created. Each call will overwrite creep to create. But this has some issues:

  1. you can't get whether createCreep was called already in this tick - spawning property will be set only on next tick. So you would have to track this yourself.
  2. if you passed memory data to createCreep it will be set in memory immediately, even if creep will not actually be created, because another call to createCreep overwrote it. This makes memory dirty with unused data, unless you track (1) yourself and do not call createCreep on same spawn more than once per tick.

Upvotes: 2

Related Questions