Page 1 of 4

Friday Facts #115 - The power switch

Posted: Fri Dec 04, 2015 3:08 pm
by kovarex
The power switch in action and more: https://www.factorio.com/blog/post/fff-115

Re: Friday Facts #115 - The power switch

Posted: Fri Dec 04, 2015 3:25 pm
by mazetar
Awesome! :D

Re: Friday Facts #115 - The power switch

Posted: Fri Dec 04, 2015 3:33 pm
by Gouada
Do you have an estimate of the .13 extra experimental release date? Also will there be a way to measure the electricity consumption graphs?
Keep up the great work!

Re: Friday Facts #115 - The power switch

Posted: Fri Dec 04, 2015 3:34 pm
by Gandalf
Posts about your code always make me so curious. How about gimme access so I can snoop around a little, kthxbye

Re: Friday Facts #115 - The power switch

Posted: Fri Dec 04, 2015 3:35 pm
by Ohlmann
Open source factorio !

I hope it would be a thing, but only well after they squeezed all the money from Factorio.

Re: Friday Facts #115 - The power switch

Posted: Fri Dec 04, 2015 4:31 pm
by ps666
P.S. I know about the modules proposal, but it will take years until it gets to standard and implemented. Unity build is another thing on my list to try out.
Which "modules proposal" and "unity build"? :?

Re: Friday Facts #115 - The power switch

Posted: Fri Dec 04, 2015 4:49 pm
by d.kr
There is EASTL, which is an std-like library.

And are you building incrementally for testing?

Edit: Except you might want to make sure that EASTL has an appropriate license. (GPL might have some interesting side effects)

Re: Friday Facts #115 - The power switch

Posted: Fri Dec 04, 2015 5:06 pm
by genericname1
OOI what does your build hardware look like?

Re: Friday Facts #115 - The power switch

Posted: Fri Dec 04, 2015 5:11 pm
by Jonathan88
I love the crackly effect inside the switch! :D :D

Re: Friday Facts #115 - The power switch

Posted: Fri Dec 04, 2015 5:41 pm
by Xterminator
Awesome! Power switch looks really cool, I can't wait to see what kind of stuff people end up doing with that when connected to the circuit network. :D

Re: Friday Facts #115 - The power switch

Posted: Fri Dec 04, 2015 5:48 pm
by radu
I used the following workaround for long compile times when developing some small games (granted, factorio is much more complex): I combine all my cpp files in a single file (either with cat or #include) and I compile them as a single source. This way you only pay the cost of library inclusion only once. You do pay more for the actual code generation but with -O1 it's not a problem.

That does require though that you have no name collisions.
I had a 10 second compile time for my game (I wouldn't touch boost with a 10 foot pole though so maybe that was part of it).

You could generalize this to a small number of modules, each of which is compiled monolithically, to keep all your cores busy.

Re: Friday Facts #115 - The power switch

Posted: Fri Dec 04, 2015 5:53 pm
by kds71
Compilation times in C++ suck. The fact that I have to wait 3 and half minute whenever Factorio is recompiled makes me impatient and ineffective.
Hey, compiling can be a lot of fun!

Re: Friday Facts #115 - The power switch

Posted: Fri Dec 04, 2015 6:05 pm
by nobodx
I expected the little lever on the bottom left of the switch would move as well when you togglethe switch on or off

Re: Friday Facts #115 - The power switch

Posted: Fri Dec 04, 2015 6:38 pm
by mngrif
kds71 wrote:
Compilation times in C++ suck. The fact that I have to wait 3 and half minute whenever Factorio is recompiled makes me impatient and ineffective.
Hey, compiling can be a lot of fun!
I don't know how Wube's build environment is set up, and I'm almost afraid to ask, but, here's some stuff I've used in the past to make compilation take much less time.

https://github.com/distcc/distcc
https://ccache.samba.org

Anything that offloads tasks to much bigger computers. What about continuous Integration? Do ya'll do that?
https://blogs.aws.amazon.com/applicatio ... Amazon-ECS

Re: Friday Facts #115 - The power switch

Posted: Fri Dec 04, 2015 6:43 pm
by roman566
Will we get an option to turn on/off the switch based on % of available power in accumulators? Being able to turn off part of the factory when power runs low would be very helpful.

Re: Friday Facts #115 - The power switch

Posted: Fri Dec 04, 2015 6:45 pm
by goertzenator
A few ideas to increase compile speed:

1. Turn down optimization levels. Optimizing away templates takes a lot of grunt.
2. Try clang for faster test builds (http://www.phoronix.com/scan.php?page=n ... px=mtgznde)
3. Rent a big computer in the cloud. AWS has 36 core computers with 60G RAM for example.

Re: Friday Facts #115 - The power switch

Posted: Fri Dec 04, 2015 7:00 pm
by Kuro-Maii
I worked on a project for a hospital.
If we wanted to compile for a release or the first time we had a compile time of 10~15 minutes at most we where looking at 20 minutes.
that was us compiling about 1.5GB of source code.

when we working on a feature/bug and we needed to compile to test said feature/bug we where never waiting for more then 5 seconds. and that was including the time we had to wait to install it all.

when we used any thing from boost and or std we pointed to that explicitly, so if we needed string from std for example, we used:

Code: Select all

#include <string>
using std::string;
also make sure you prevent your headers form being included more then once it helps a ton:
in your .h/.hpp

Code: Select all

#ifndef __FILENAME_HPP__ 
#define __FILENAME_HPP__
// your header code here
#endif //__FILENAME_HPP__
if you are already doing that make sure you call make with the option -j4 you can call up to -j8 if you have a quad core with multi threading.

if you are also doing that.... I really want to take a look at your code.... because this is interesting to me....

on the topic of the switch:
that is an awesome looking switch. but I am wondering? why the sparks... makes me feel like the connection is not sound...

Re: Friday Facts #115 - The power switch

Posted: Fri Dec 04, 2015 7:50 pm
by ratchetfreak
use "#pragma once" if your compiler supports it

Does the compiler include the expanded template in a compiled header if you typedef it? (something to profile) If so then you can put the typedef for every template you use in the compiled header.


Otherwise you can sub out the typedef for std::string (which is a template) with the specific std::string and remove the std version from the include path.

Re: Friday Facts #115 - The power switch

Posted: Fri Dec 04, 2015 9:57 pm
by cncr04s
I'd go with some of the suggestions already, more hardware, better compile options, header optimizations. I'm anti-boost. The whole library sucks to be honest. I write my own stuff, I try not to use some one elses code. But if your set on using boost, then just cut and paste the classes that you use from it into your own source code tree. It shouldn't take too long tbh.

Re: Friday Facts #115 - The power switch

Posted: Fri Dec 04, 2015 10:08 pm
by Noro
I've learned really lot from Casey about compile time optimization: https://www.youtube.com/watch?v=Ee3EtYb8d1o
It seems ridiculous first, but I've tried to reorganize one of my projects this way, and well, got compile time down to 4-5 seconds from 3 minutes.