« first day (19 days earlier)      last day (27 days later) » 

00:54
@TheNumberOne Looks like something is happening in your room.
debugging
Everything just died.
I accidently corrupted the memory of a bunch of creeps.
I'm trying to rework my transporter code.
I'm going to try to view it like an electrical circuit, with sources and sinks.
The movement of transporters with energy represents current.
01:12
Are there any other rooms that have opened up?
My script is working as expected.
I'll work on upgrading my controller tomorrow.
I'm launching a voyager into someone else's room.
Ugh... we're pretty much sealed in because of a bunch of other people's walls.
 
8 hours later…
09:43
I got my CPU raised to 300. Now I can actually play the game. :)
 
1 hour later…
10:49
congratz :-)
it's not always who pay, who has to win :-)
(my bot dropped to 15th place)
call it 16
 
1 hour later…
12:05
@avdg You are still using the 100 CPU limit right?
yeap
haha me :-)
And yous said it was 2000 lines long?
thats the code generated code alone
How on Earth are you running that within the time limit?
how did I get the engine not stuck on the same line of code?
most timeouts are still happening from the pathfinder though
12:07
How often are you timing out?
now rarely
got just 1 warning this night (IF I received all timeout warning)
I was wondering how a piece of code that long could run so fast, given that mine is 300 lines long and is always over 100.
though my builders aren't looking nearest refiller atm, they look at the spawn only
while(true) { /* this code is fast! */ }
thats how you get slow code
big decision trees are still faster than search algorithms
and caching helps
avoid recalculations or work that can be done more efficient
(thats why I end up digging in the api to understand how that code works, just to spot slow code)
the only problem with big code is compiling, but the javascript engine got used a lot and got a lot of fine tuning
v8 just converts code quickly, while code is being executed the executed part will be optimized by the engine again
so reusing code would make it go faster on v8
but don't stare blind at reusing code if there is no fundamental to abstract same-ish code
I still prefer functionality, and get merges by cleaning up / generalizing my own code very often
I also have a lot of flag commands, which are never executed unless I add flags
which takes a lot of checks, so it should be lots of fast but long to write code
12:26
@avdg If you don't mind, could you help me figure out some ways to speed up my own code?
how can I review the code?
well, its your code, so you decide :-)
I've put a part of my code public
I'll... post it on GitHub or something.
shhhh?
No modules are used.
I originally had a module-based design but it somewhat conflicted with my current method.
I also ran the code through a formatting tool, bumping it up to 400 lines.
Here is some code that measures the difference between time points: github.com/avdg/screeps/blob/master/scripts/_generics.js#L77
meh no worries
I've started with a base
ended up with duplicated code
then moved that to my extensions
now most of my code is in extensions I create new extensions from duplicated code in extensions
or at least, thats how I rolled
I would do it opposite
though it may not behave the same?
I'm just scanning the code, not digging in details yet
what does the timers say btw?
12:42
The variables aVal, hVal, raVal, rmaVal, etc. are the calculated hits that attacking/healing/rangedAttack/rangedMassAttack/etc. would deal.
If you are talking about console.log("ra" + (timer1) + ", act" + timer2 + ", role" + timer3 + ", upg" + timer4 + ", gath" + timer5) then just ignore the words. They used to be meaningful, most probably aren't anymore.
my ai spend around 80% of the time guiding creeps
setting up takes about 15%
collecting data and other stuff not much
finding hot spots are ideal in terms of improving the bot
13:00
also I would use more functions later on but introduce them slowly
it gives v8 more opportunities to optimize code if they are reused a lot
if they are only used once or twice, the code would probably spend most of the time being compiled
under 10 times (? maybe 5, maybe 20 didn't benchmark it) you'll get closer to compile par compared to code compiled once (unless v8 doesn't like to optimize the code)
above 10 uses I guess the code runs faster if reused (by putting them in a function)
13:27
Should I rip my thing off GitHub?
13:41
I'm not sure, I guess it prefers what you want
personally I don't care as much because if I don't push, code gets outdated quick anyway
(because code tends to improve a lot if worked on it and managed well)
but I do maintain my bot ai code on github itself, but only the core part
 
2 hours later…
15:46
ow boy my logs are getting spammed by other bots :p
probably trying to say hi :-)
17:46:11]invadersS ---- 3
[17:46:11]creeps ---- [object Object]
[17:46:11]rooms ---- [object Object]
[17:46:11]
16:32
that sink system is actually putting more load on the pathfinder
just noticing that when I'm generalizing the system to my transporters
already aiming to get such stuff done for few days, but transporters are complicated and I had to write a lot of code (and test it)
What sink system?
its actually more supply and demand
bringing them closer together
it seems that when both are trying to find the closest, it may seem to use a lot of time
but I need to box the situation before I can make a good conclusion
its actually a double sink system
and the target is a moving one
hmm maybe that is the problem
uh, I need to fine tune the path cache I guess...
 
4 hours later…
20:24
lol, my guards are protecting the edge
 
3 hours later…
22:57
Need to benchmark this function I guess

https://gist.github.com/avdg/d4dfe33cfd858cdcf58a

« first day (19 days earlier)      last day (27 days later) »