
Spaceplan - dcminter
http://jhollands.co.uk/spaceplan/
======
christiangenco
I love it! Found myself doing mental calculations for the most effective thing
to buy next, and the next thing I knew I'd written a script to automatically
buy it:

    
    
        var clickBestThing = function(){
           var things = [...document.querySelectorAll("#manufacture__container > div")].map(function(e){
            var res = {e};
            [...e.getElementsByTagName("span")].map(function(s){
              res[s.id] = +s.innerText.replace(/[^0-9]/g, '')
            })
            if(e.id === "item__spudGun" || e.id === "item__potatoLauncher") res.powerGain *= 1000;
            res.score = res.cost / res.powerGain;
            // res.score = res.cost / res.spudGain;
            res.name = e.getElementsByClassName("manufacture__name")[0].innerText;
            return res
          }).sort(function(a,b){return a.score - b.score})
    
          window.things = things;
    
          var bestThing = things[0];
          if(!things[things.length-1].score) bestThing = things[things.length-1]
          console.info("clicking " + bestThing.name)
          things[0].e.click();
        }
        var timer = setInterval(clickBestThing, 5000)
    

Of course it's much easier to `power = 999...`, but this feels more like
automation and less like cheating.

~~~
TusanHomichi
You can actually improve this a little with a better scoring function. Suppose
we currently produce p, and A costs cA, for a power gain of pA. Likewise for
B. Under the assumption that we will buy at least one more of A and B, we can
look at whether A then B or B then A is faster, which is:

cA/p + cB/(p+pA) < cB/p + cA/(p+pA)

Solving this, we get cA * (p+pA)/pA < cB * (p+pB)/pB Since the left side is
all in A, if we pick the item minimizing that quantity, it is faster to buy it
before any other item. So changing res.score to be res.cost * (cur_power +
res.powerGain)/res.powerGain is going to be a bit faster

~~~
christiangenco
Ahh of course! I had the thought to take this into account but couldn't wrap
my head around the math last night.

cA/p is just the time it would take to earn the money to buy A at the current
production level - seems much simpler now.

I think the last term should be `cA/(p+pB)`. When I solve from there[1] I get
`cB * pB < cA * pA`, which means that the most optimal item A will have the
largest product `cA * pA`.

This would translate to:

    
    
        res.score = res.cost*res.powerGain
        ...
        }).sort(function(a,b){return b.score - a.score})   
    

Does that check out? It seems too simple, and now that I'm thinking more about
it I think this would be functionally equal to what I already have. Did I do
my inequality[1] wrong?

1\. [http://i.imgur.com/pyMY3zr.jpg](http://i.imgur.com/pyMY3zr.jpg)

------
new299
I might just be tired and dense. But does watts per second make sense here?
Shouldn't the accumulated power be in joules (or Watt hours?) and the per
second value just be watts?

~~~
rzzzt
In our universe, energy would be accumulated (measured in joules or watt-
seconds), and each upgrade bought would produce more power (measured in watts
or joules per second). But the game might be taking place in an alternate
timeline where James Joule and James Watt were switched at birth (also born at
the same time).

~~~
TaylorAlexander
This is the best explanation.

------
arnorhs
A really well executed Incremental game[1] and the best part about it is that
it has an ending. Even a retro end-game sequence. Well done. I really enjoyed
it.

[1]
[https://en.wikipedia.org/wiki/Incremental_game](https://en.wikipedia.org/wiki/Incremental_game)

~~~
kristianp
See Cookie Clicker for the original (or early) quirky game:
[http://orteil.dashnet.org/cookieclicker/](http://orteil.dashnet.org/cookieclicker/)

------
hijp
Nicely done! I just finished with no cheats and thoroughly enjoyed myself.

The level of polish is what kept me clicking 285 times just to 'start' the
game. Very cool.

------
leovander
And here's the Stranger Things Soundtrack[1] to play in the background.

[1] [https://youtu.be/5sy2qLtrQQQ](https://youtu.be/5sy2qLtrQQQ)

------
josscrowcroft
There goes my Saturday morning! Time to go stick my wrists in a bucket of ice.

Kudos to the developers. Really lovely game, intuitive and entertaining, well-
built.

~~~
tgibson
Once I figured there would be lots of clicking, I went into the console and
typed the following to automate the Kinetigen:

var ki = setInterval(function() { kinetigenClick(); kinetigenRelease(); },
10);

Then later on at a certain point in the game, I had to stop it:

clearInterval(ki);

~~~
mrblackbull
Tried pasting your code into the console, but i'm getting the following error:

(program):1 Uncaught ReferenceError: kinetigenClick is not defined

What am I doing wrong?

------
DblPlusUngood
Never before have I been so eager to shoot potatoes into the sun.

------
ORioN63
Why do you keep doing this? :(

You put a clicker in front of me and baam. Lost a hour.

~~~
monk_e_boy
Loading 'Cookie' library -- haha, nice. Lost a lot of time to cookie clicker

------
erdevs
I think I like it more than No Man's Sky. But I'm suing you for carpel tunnel.

Good stuff, thanks for sharing!

~~~
karshan
If you wanna avoid carpel tunnel, window.setInterval(kinetigenClick, 1) :P

~~~
verelo
or even less annoying:

var x = 0; while(x < 10000) { x++; kinetigenClick(); kinetigenRelease(); }

~~~
oscilloscope
Had to save+reset after bumping this up to 100000, but it only took a few
seconds and now I have 6 million watts. Dropping my first Tater Tower.
Beautiful, elegant cheat.

~~~
verelo
"Beautiful, elegant cheat."

That is the nicest thing anyone has ever called me.

------
wanda
Reminds me of Larry Niven's _Ringworld_ , or more specifically the Puppeteers
and their planet-ships fleeing the galaxy.

~~~
twic
For me, it was Liu Cixin's 'The Wandering Earth', with a heavy dose of Stephen
Baxter hard-SF (ish) cosmic madness. And potatoes.

------
threepipeproblm
I learned so much about myself. Time to cook some potatoes.

------
stepik777
Why do we accumulate watts? That's stupid.

~~~
rurban
Check Tipler. We won't need them now, we would be even much better off to save
more, but we would need them to save the world on the galactic scale.

~~~
terminado
C'mon man, what's it take to post a link?

[https://en.wikipedia.org/wiki/Frank_J._Tipler](https://en.wikipedia.org/wiki/Frank_J._Tipler)

------
rurban
Love potatoes. And saved the world in 2 hours. (without cheating)

~~~
transfire
Hmm... I seriously doubt that's possible. How?

------
wodenokoto
Looks like Cookie clicker [1]

[1]
[http://orteil.dashnet.org/cookieclicker/](http://orteil.dashnet.org/cookieclicker/)

~~~
runevault
It's basically cookie clicker with an actual plot and an ending.

------
mablap
Here are some useful shortcuts:

power = n; (where n is whatever you need)

sol.mass = 3e7;

Cool game!

------
erdevs
Okay, now that more people have played, what is everyone's fastest time
getting to the end (without cheats)?

Fun game concept!

~~~
taneq
Took me about four hours, toward the end I was playing it more like a
Tamagotchi (click the buttons every now and then and then leave it to rack up
more power).

Also [[SPOILERS]] the ending sequence wedged after 'go be a hero', luckily
when I refreshed the page it put me back to just before the black hole bit.
Maybe it broke because I was on the solar system view and not the planet view
or something? It worked the second time anyway.

------
rcarmo
This is bloody amazing. Best way to spend a quiet Saturday morning :)

------
evantahler
Just came back to this... they've done a very good job of blocking "click"
automation!

------
rotomatt
хороший один товарищ

~~~
DblPlusUngood
Obviously a direct translation from English to Russian -- I doubt a Russian
would ever actually say this.

They should change it to: молодец.

~~~
terminado
Неплохо, товарищ

------
makkesk8
Pomme de terra

------
omginternets
Is this a Latvian game studio?

------
omginternets
How do I obtain the planet boosters?

Also, thanks for ruining my dissertation...

~~~
lionyo
Click "System Peeker" in the top middle of the screen, under "Planet Looker"

------
c3RlcGhlbnI_
Cool, but does a clicker game really need to use 4 cores?

------
arawde
Beautifully done :)

------
transfire
POMME DE TERRE

------
buremba
nice ending scene with pomme de terre.

------
itsjoesullivan
Very fun! Only cheated a little.

------
nyxtom
Great game! Thanks for sharing :D

------
oxplot
so I did `for i in {1..10000}; do xdotool click 1; done` and ... the game
crashed :(

~~~
christiangenco
Do `setInterval(kinetigenClick, 1)` instead.

------
djhworld
Frighteningly addictive.

------
gozur88
Surprisingly addictive.

------
tdburn
Loved it

