Friday Facts #115 - The power switch

Regular reports on Factorio development.
kovarex
Factorio Staff
Factorio Staff
Posts: 8053
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Friday Facts #115 - The power switch

Post by kovarex »

The power switch in action and more: https://www.factorio.com/blog/post/fff-115

mazetar
Burner Inserter
Burner Inserter
Posts: 17
Joined: Fri Jan 02, 2015 7:45 am
Contact:

Re: Friday Facts #115 - The power switch

Post by mazetar »

Awesome! :D

Gouada
Fast Inserter
Fast Inserter
Posts: 100
Joined: Sun Sep 21, 2014 3:57 pm
Contact:

Re: Friday Facts #115 - The power switch

Post 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!
No, I'm not a piece of cheese! :D

User avatar
Gandalf
Filter Inserter
Filter Inserter
Posts: 294
Joined: Fri Dec 19, 2014 10:15 pm
Contact:

Re: Friday Facts #115 - The power switch

Post by Gandalf »

Posts about your code always make me so curious. How about gimme access so I can snoop around a little, kthxbye
OS: Linux Mint 19 x64 | desktop: Awesome 4.2  |  Intel Core i5 8600k  |  16GB DDR4  |  NVidia GTX 1050 Ti (driver version: 410.104)    (2019-03)

Ohlmann
Long Handed Inserter
Long Handed Inserter
Posts: 67
Joined: Tue Jun 10, 2014 11:22 am
Contact:

Re: Friday Facts #115 - The power switch

Post by Ohlmann »

Open source factorio !

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

ps666
Long Handed Inserter
Long Handed Inserter
Posts: 87
Joined: Sat Jul 04, 2015 8:40 pm
Contact:

Re: Friday Facts #115 - The power switch

Post 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"? :?

d.kr
Burner Inserter
Burner Inserter
Posts: 6
Joined: Wed Dec 24, 2014 1:04 am
Contact:

Re: Friday Facts #115 - The power switch

Post 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)

genericname1
Burner Inserter
Burner Inserter
Posts: 16
Joined: Fri May 22, 2015 12:55 pm
Contact:

Re: Friday Facts #115 - The power switch

Post by genericname1 »

OOI what does your build hardware look like?

Jonathan88
Fast Inserter
Fast Inserter
Posts: 179
Joined: Tue Jan 20, 2015 7:49 pm
Contact:

Re: Friday Facts #115 - The power switch

Post by Jonathan88 »

I love the crackly effect inside the switch! :D :D
FactoriOh No: when it's accidentally 2am, again

User avatar
Xterminator
Filter Inserter
Filter Inserter
Posts: 980
Joined: Sun Jun 15, 2014 4:49 pm
Contact:

Re: Friday Facts #115 - The power switch

Post 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
Image Image Image

radu
Burner Inserter
Burner Inserter
Posts: 5
Joined: Fri Dec 04, 2015 5:22 pm
Contact:

Re: Friday Facts #115 - The power switch

Post 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.

kds71
Long Handed Inserter
Long Handed Inserter
Posts: 91
Joined: Fri Mar 06, 2015 12:27 pm
Contact:

Re: Friday Facts #115 - The power switch

Post 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!

nobodx
Fast Inserter
Fast Inserter
Posts: 157
Joined: Mon Jul 06, 2015 3:22 pm
Contact:

Re: Friday Facts #115 - The power switch

Post 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

User avatar
mngrif
Fast Inserter
Fast Inserter
Posts: 171
Joined: Wed Feb 13, 2013 10:44 am
Contact:

Re: Friday Facts #115 - The power switch

Post 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
Some Stuff About Stuff And Things || My Silly Factorian Tricks
<_aD> OBSERVE SIGNAL ASPECT BEFORE CROSSING TRACK

roman566
Fast Inserter
Fast Inserter
Posts: 136
Joined: Sat May 24, 2014 10:53 pm
Contact:

Re: Friday Facts #115 - The power switch

Post 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.

goertzenator
Inserter
Inserter
Posts: 30
Joined: Thu Feb 20, 2014 8:59 pm
Contact:

Re: Friday Facts #115 - The power switch

Post 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.

Kuro-Maii
Burner Inserter
Burner Inserter
Posts: 9
Joined: Tue Nov 24, 2015 11:58 am
Contact:

Re: Friday Facts #115 - The power switch

Post 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...

ratchetfreak
Filter Inserter
Filter Inserter
Posts: 950
Joined: Sat May 23, 2015 12:10 pm
Contact:

Re: Friday Facts #115 - The power switch

Post 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.

cncr04s
Inserter
Inserter
Posts: 27
Joined: Wed Aug 19, 2015 3:58 pm
Contact:

Re: Friday Facts #115 - The power switch

Post 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.

Noro
Burner Inserter
Burner Inserter
Posts: 17
Joined: Fri Dec 13, 2013 2:14 pm
Contact:

Re: Friday Facts #115 - The power switch

Post 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.

Post Reply

Return to “News”