another option for artillery is to figure out whether (artillery_range² - (width_of_base/2)²) < tile_size² (or some other threshold) that way you know to insert a artillery tile in the middle. And you can adjust from there as you need to add artillery tiles and they get moved out of range of each other to make sure that you can always keep clearing.
That’s a really good idea. It would take a fair amount of annoying debugging (since potential bugs wouldn’t show up until the factory had been running for hours) but overall it’s probably the correct answer, even if it would be difficult.
@@sunofabeach9424 you don't need the sqrt operation to know whether the sqrt of something is smaller or larger than another known value, square both sides of the equation
This is a very elegant design. I am impressed. A few observations:- - The 2x2 breeder reactor design is great. Most people overcomplicate on nuclear, because they want to maximise neighbour bonus, but as you and I have both figured out, going above 2x2 increases your complexity massively. - I didn't think of going coal liquefaction only for oil. That's a wonderful idea. Automating the placement of pumpjacks is prohibitively difficult, as I'm sure you've observed, and by doing it that way, you've sidestepped the placement issue completely. You seem to have achieved something similar with your mining drills, by simply using a uniform square layout. Most people attempt to follow the shape of the ore patch, which again makes placement more difficult. - The design of your decision making system is the simplest and cleanest I've seen anywhere, as well. Most people seem to go for clock loop based designs, which get fiendishly complex. Designing based around quotas is definitely the way to go. - I haven't started using Recursive Blueprints yet. I am still placing my sectors manually, although at the moment I am using hexagons. It isn't possible to make perfect hexagons with Factorio's square grid, but I got around that by grouping four tiles together in a square, and using that as a single unit. My hexagons have side lengths of 11 of those 4 tile units each. The main practical reason why I use hexagons, is because I can both place roboports at the vertices, and get close to centroid equidistance. This means I have six roboports per sector, with minimal traversal distance. That in turn means that my bot flight time is minimal, which allows me to maximise the amount of bots I can have in the air at once, before I incur FPS loss. I experimented with squares, and found that the FPS/UPS drain was too big, due to excessive bot flight time; it was necessary for me to get that down as much as possible. Hexagons would be difficult to place with Recursive Blueprints though, because of the different horizontal and vertical length offsets.
This comment deserves a point-by-point reply, so here goes: (forgive any typos, I’m on my iPad with a terrible bluetooth keyboard) - Yeah, beyond 2x2 you start to have the problem where the surface area of your reactor cluster is too low and it becomes hard to efficiently distribute all that heat. Although in this case the real reason I didn’t go beyond 2x2 is because there would be no room for all the exchangers and turbines needed to soak up all of the heat they’d output. - The design was my own, but I gotta credit DroCa’s JOSEF for inspiring me to get off my ass and do coal liquefaction. And yeah, in general I try and make the placement of stuff as “dumb” as possible. The “smarter” the algorithm gets, the higher the likelihood of a really nasty and hard to isolate bug showing up deep into the run. - I tried as hard as possible to “encode” any sort of quotas into the blueprints and not the algorithm. It may seem to some like an arbitrary choice, but over time I developed a sort of intuition for what I considered the best way to separate concerns. - The idea of using hexagons makes my head spin, that’s nuts. Yeah, if you can get the offsets correct, you can probably reap a lot of benefits from the really good properties of the Bestagons. I’d recommend trying out the moon logic combinator, because once you’re in “programming land”, weird offsets become just another thing you can solve with a function and some for-loops.
@@uehreka Putting your quotas into the blueprints rather than your algorithm isn't arbitrary at all. It makes perfect sense. It will always make your life easier to incorporate as many event hooks into your terrain/topology as possible, because terrain checks are always simpler to write than generic/free floating clock loops. If I want a clock loop, I have to make a first loop of an arbitrary length, and then however many shorter loops to get down to the precise length I want; and the other disadvantage of clock loops is that I can't just add another instruction to the queue if something unforeseen happens. With a terrain check, all I'm doing is scanning the terrain ID for my nearest tile. The rock stupid way of doing things is to have a local storage tank tied to an RS latch. As long as the level in the tank is above a certain level, the output stays open, and everything proceeds as normal. When the output drops below the minimum, the output closes and the input opens in order to refill the tank; or for example, you build more mining sectors and bring in more ore. It resets once it is full again.
Video was made seriously well when I was just expecting an amateur level of production lmao. Also the turn while bringing up tool assisted speedruns was a good touch haha
This turns the game into an environment with a significantly smaller action space. The game doesn’t run quickly enough for any normal deep learning rig to optimize this, but it would be interesting to see what reinforcement learning could do to optimally place tiles in order to reach 1k SPM.
thats a thing that seems like it can be optimized using classical techniques. just gotta model all the variables, like the production speeds and increasing robot lag with distance, production costs for the blocks, energy usage and so on and then just ... find some maxima
@@davidebic yeah i mean i exhaustively searched all possibilities in my game that has 10 10 sided dice , so its just 10^10 cases and i let it run overnight and count occurrences because i was too lazy to do like an hour of math + looking up how to calculate how common each sorted way to roll 10 dice would be
Wow this was an extremely impressive video. Self-govourning machines are amazing in every single game. Massive props to you for doing this. I will try and simulate this on my ryzen 9 7950X and 6GHz 96 Gigs of ram rig to see how far the design can be pushed, I will return to you with the results in a month or so. May or may not also be recorded, I'm not sure if I can record as well. I'm 13 hours in at 500 SPM and 80-70 UPS without overclocking anything. Edit: Just passed 1000 SPM, needed to perform two restarts because of a bug that stopped the design of choosing what to build in a new mega tile, I'm not sure what's causing it, but I will trouble shoot. 27 hours in. Current CPU 1 clock 5.5 GHz, current ram speed 5.6 GHz, current UPS 55. Edit 2: Just passed 1.5k SPM. I managed to fix the issue and find the problem. 40 hours in. Current CPU clock 5.7GHz, current Ram speed 6.4GHz. Current UPS 43. Edit 3: A lot of time has passed and many changes have been made. Many, many bugs and things that took ironing out later.(I'm learning Lua due to this, thanks, Chris.) I've managed to create two worlds, one without biters and one with. Both of them are now at 2k SPM. They aren't the first worlds I created. I found some issues that I will post about in my full dissertation. Current CPU temperature 76' C, current clock 6GHz. Yeah, I'm at my limit. Current RAM speed 6.5GHz, I managed to squeeze a little more from them too. Even with my water cooler it doesn't work. I might attempt wiring a car radiator to my processor, but I've been busy so I can't really focus on that, it will take probably an entire day. Current UPS 30. I've also noticed the problem that it doesn't display the UPS correctly, it says it's 30, but from my tracking I found it to be closer to 20. Even my graphics card seems to be struggling a little bit when playing at 4k. Yes. This base is so insane that it's pushing against the ridiculously optimised factorio graphics. In the biterless world I'm getting 45 UPS, but it's closer to 35. Things I will need to do: Remove rocks and trees from the generation. I've been told it might improve the performance. If anyone has any other ideas, I would love to hear any other performance fixing tips and tricks. Soon I will begin changing up the individual tile designs to feature beacons. It should improve performance many fold. I might replace the water barreling chains with one of the waterfill mods too.
very impressive! cant wit for the full result. Might I recommend going to a lower than 4k graphic resolution to save on gpu bandwidth + overall system temps? Unless the cpu and gpu are running through 2 different water loops, the GPU temp and load will slightly contribute to higher CPU temp as well.
Wow, congratulations on this amazing SEF! This is on a level of complexity that JOSEF could only dream of... If he had the amount of brain cells needed for dreaming (n>1) And thanks for the shout-out, makes me very proud to be in a list with Grey Goo!
Thanks! When I found JOSEF a month ago (mid way through writing this script) I was still using infinipipes for crude oil, and it was seeing that JOSEF had handled both Coal Liquefaction AND offshore pumping that made me go “OK, I need to step up and solve at least one of those”. Good on you for managing to solve both. Also the brain train is brilliant, you manage to solve a lot of problems by using Factorio’s mechanics alongside combinators to accomplish things that would be really difficult with combinators alone.
@@uehreka As you two love puzzles with this level of complexity, you'll be happy to hear that Zacktronics--of 'Space Chem' fame--has his 'Inifinifactory' for free on Epic Games this week. Enjoy! (...or ragequit, uninstall, and question your life. Your choice. :evilgrin: )
You propably don't need much of an algorithm. I like your tier system becasue you can basically just turn this into a stack machine like the JVM. You start at the end condition and keep calling dependencies recursively. Just add special conditions that insert science and energy at the top of the call stack when demand or timing treshholds are encountered. In a way a factory is just a program anyway and you can construct the AST of that based on the tiered dependencies
Perhaps travel times could be optimized by tracking what each module requires, rather than using a tier system. That way, when there is demand for a certain resource, production for that resource is built close to where it is needed most.
I really love to see self expanding factories but i could not desing one, the most advanced thing i desinged is an automated miner for dangoreus with uranium mining and relatively easy to change direction. I will run this one for sure, just without infinite chests and i will try to remove modules too.
In theory you could run the factory, look at how many buildings come out of each infinichest using the combinators above them, then replace the infinichests with storage chests containing that many of the item. Some of them (concrete comes to mind) won’t fit into one storage chest though. Removing all the modules could be an interesting approach, just make sure to use the Max rate calculator mod to set new values for the constant combinators and inserter conditions in each blueprint.
I think the main reason why the base is hitting UPS issues at 1k spm instead of 10k is that things aren't beaconed. Prod modules without speed beacons makes production really slow. Maybe have it use entirely unmoduled tiles at the beginning and switch to beaconed ones once it has enough resources to craft tier 3 modules? That'd require 2 different tiles for the basic resources.
The issue there is that, since the tile size is constant, adding beacons means fewer assemblers, and the math on that didn’t usually work out well. My initial math told me that prodmods would be better than speed mods since by reducing the number of ingredients needed for everything, I’d be reducing the total number of bots needed to accomplish a certain amount of science. It’s possible I’m wrong there, and that the longer travel times caused by a larger, slower factory offset the reduction in traffic from using prodmods. However it feels like it would be difficult to demonstrate that mathematically given how complex this system is.
@@uehreka replacing a nonbeaconed tile with 12 assemblers with a beaconed tile with 1 assembler might make things slower but should improve UPS. Another option would be beaconed megatiles that are used later on for things that already have a large number of regular tiles.
Nice to see someone using general LUA for bot building. Our group normally just injects with C tooling and wraps python or c# for more streamlined builds. Props on sticking with LUA nicely done.
I've actually spent the entire day designing a city block blank template (rails, stations, some basic logic /wiring) to allow me to easily design whatever I want in them, and with the circuit network I am planning to build it might actually allow it to become a self expanding base, which I am thrilled about!
Wow, I'd been thinking to myself: "I should really buy Factorio, and then have someone else play it for me for optimal optimization" and here you've done it. This makes ME the top Factorio player of all time.
Question, in the recent factorio friday facts, they mentioned that in 2.0 you will be able to use circuits to change the recipes in assemblers. It allows a "universal assembler" design that can make anything as needed, instead of having a set assembler for one specific product. Would this be useful for your design in the future, or would you still stick to just having normal preset assemblers for everything?
Oh Factorio 2.0 is gonna blow this thing wide open for that and other reasons. The SEFs in 2.0 are gonna be insane. Part of the reason I got off my ass to make this video I’d been sitting on for over a year is because I know in a year or so when 2.0 comes out a lot of this will be obsolete and the meta will be so much crazier.
@@blacknight6147 Yes, but like I say in the video, you’d probably need at least a 3x3 megatile (9 megatiles) of combinators. Combinators operations are like even lower than assembly instructions in terms of compute power. But yeah, that would be very exciting. I haven’t heard anything to that effect in FFF though.
could it be possible to add in a function to remove some stuff? like the inner laser turret walls artillery tiles etc. and build over them after a certain time? seems like it could help with lag etc. in the later game
This is amazing. Downloaded and played it myself and it's stunning to watch all the processes working together to create a unique factory. Also, thank you for using DK64 and BK/BT music for this, loved it!
For the offshore pump issue, I would highly recommend the waterfill mod. It allows you to place a "lake" tile anywhere using a recipe similar to cliff explosives, that way, it is exactly the same shape no matter where you place it
Yo dawg, I heard you like automation. So we automated your automation, so you can just watch the game play itself, and then exit whenever that becomes pointless, which is about 2 minutes into a session.
This is such a neat implementation. The script could use a little refactoring to tidy up the 350 line wall of if/else statements. I tried coming up with a tiling strategy for vanilla and am pleasantly surprised that I also started by organizing the items into tiers as well as tiling. You went the extra mile and setup the logistics to automatically determine what tiles would be necessary and how to place them. Really good shit, man. I'd be proud as hell of this if I were you.
I've just started working on my own self-expanding factory, so this video is a great find for ideas. At the moment I'm leaning towards trains with either belts or isolated bot networks. Fully bot based feels wrong for some reason to me, maybe it's the inefficiency of when bots decide to travel the whole map to make deliveries. (Not that I think it's not a valid strategy) I'm also leaning towards pure combinator based setups but finding out about that Moon Logic mod might be useful since I can use it for more rapid prototyping. (It's much easier working out a program when you aren't laying transistors by hand). For defense, I'm planning on having the base expand in a layered spiral. The outer border is bordered with some walls and laser turrets with a station for an artillery train to come to a stop clear out any nests near the tile, then leave and lock out the station. The current plan is that as long as the base is expanding fast enough biter nests will never build up near the edge. As it expands previous sections will be deconstructed and converted to a new tile depending on resources (like if there is ore) and demand. Also a big change was going to Recursive Blueprints+ instead of the original because it provides detection for ghosts. With it, it's possible to detect if a tile is still being built before progressing which I wouldn't be able to do without a connected construction network like yours. Also I'm using the Constructron-Continued mod so that I can have Spidertrons automatically handle any builds, I think the only other option for expanding with this style is a mod for trains with some sort of bot capability. Would love any feedback you might have. I'm generally trying to keep it more vanilla (makes me want to switch to your style so that I can remove Constructrons) but it's a balance. I think, for train based builds, Factorio 2.0 is going to be massive. Train interrupts will simplify trains massively (as it stands they are terrible in some respects). EDIT: I forgot to mention, that I was also using Waterfill so I didn't have to deal with figuring out pumping but that shot of a blueprinted pump setup might let me switch to barrels (which kinda sucks because of how much complexity that brings with a train setup).
As soon as I saw you were only using productivity modules I knew it was going to be a serious issue. Tier 3 productivity modules are incredibly overpowered, but they're only really feasible when used with beacons of speed modules. Using speed modules like this decreases both the amount of modules used total and the energy consumption by a large factor. When you use 4 productivity modules the speed is extremely slow by itself, so without speed modules you will need to use several times more assemblers that all need to have all 4 module slots with tier 3 modules, which is an insane amount of tier 3 modules that no one would want to use in practice. If I were making a base like yours legitimately, I would either not use modules at all or I would start using combinations of productivity and speed modules in particular assembling blocks that consume the most resources, such as blue circuits and purple/yellow science production, and labs. For labs you could start building moduled labs after tier 3 modules are craftable while keeping the old labs in place, or you can have a mechanism that upgrades the older labs in place after a certain point in time.
The water barrelling process is so inefficient, that it's almost have kind of a loop. need more energy -> more power plants -> more barrels and materials for them -> more bots carrying barrels -> need more energy. Just replacing a single power-plant blueprint (with Pump Anywhere mod) increased UPS and useful production tiles count a lot.
This is goddamn amazing and the banjo tooie music elevates it to 11/10. I apologize if you mention it in the video, but I'm really curious what your total produced/consumed bot numbers look like. Clearing Biter waves with a single line of laser turrets must've consumed tons of the little guys. Also, how does it initially start out? Do you manually have to play through until you unlock the needed tech for it to function?
Glad you noticed the music! Wrt the bots: I have inserters and logistic chests wired up such that at any time I try to have 1000 construction bots and 500*(number of megatiles) logistic bots (a coefficient I found through trial and error). So I get a couple 100k logistic bots if biters are turned off. You’re right about casualties though: this week I’m away from home and can’t check the exact numbers, but I recall at one point seeing that I had churned through over 1 million of each bot type after a couple hundred megatiles. As for how it starts: I use the scenario editor and do things like pre-unlock the tech tree and disable the intro and victory text boxes. The first clip of the video is what it looks like when I hit “Save and Play”.
Not using the lua mod would be a nightmare, I feel it's justified to use it. I can't imagine you're doing anything with it that can't be solved in any way using the default wires and combinators and stuff. (wire signals are touring complete, right?)
Yeah, you’re right on all counts: combinators are Turing complete, so they can perform any arbitrary compute task, however just because they can doesn’t mean it’s easy or fun to do so. And yeah, I’m not doing anything with the Lua code that isn’t possible in stock, with one exception: I reach through to _api and set map pins for each tile to make it easier to keep track of things. But that’s just a quality-of-life thing, not required for the factory to accomplish its goal.
@@uehreka How about a compromise: a standalone script (in Lua or whatever other language) *that writes the blueprint string* full of combinators, to be imported into the game?
@@СергейМакеев-ж2н So at this point Lua is not the UPS bottleneck, so whatever algorithm you’d want to do in that outside script you could just write in the moon logic combinator. Unless you’re thinking of deep learning stuff (at this point I’ll address that in my followup video) I don’t know that there’s much reason to offload to an external script.
@@uehreka I meant that as a way to use one less "cheaty" mod. The game itself will just receive a regular blueprint of the "control center" - and yet, every part of that control center will be documented in code. And deep learning is an interesting idea. I haven't thought of that before you brought it up. You might not even need it to be very "deep" - maybe you can get away with a simple Logistic Regression with hand-picked features. I've seen a guy get quite far in the game of 2048 using that method.
That is amazing! I've always wanted to see what would happen on one of these self expanding bases if you could throw an insane amount of high end hardware at it and let it run for a few weeks.
hello, I watched a while ago one of your earlier videos where you talk about teaching. Now, I watched this on YT: "How I Learn to Speak Any Language in 24 Hours" And saw a connection. You prob enjoy this. Have a nice day! cheers
@@OshidaBCF you jest, but after watching this video I legit started thinking about training a Reinforcement Learning model to play Factorio (which would likely involve “judging” game states): ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-DcYLT37ImBY.htmlfeature=shared However given that it took this guy $1000 in cloud computing resources to beat Brock, I don’t see RL in Factorio being a thing unless someone wants to throw $1M at it or new significantly cheaper RL techniques emerge.
@@uehreka i think instead of an ai "playing" factorio, an ai piloting this "self building" base could work. Perhaps a special mod to allow interactions between a external software and factorio i aint gonna try because my pc cannot run ai at all, although it would likely be cool as hell
@@OshidaBCF Ooh I see. So there are definitely hacky ways of having Lua code communicate with another program by like, writing to a file and then reading from another file. So replacing my handwritten “function” with a neural network that estimates that function is totally possible. With that being said though, the amount of time it takes for this factory to start producing science means that the training process would be grueling. You’d have thousands of games where the factory just runs out of power or produces tons of stuff randomly before anything coherent started happening. But with a well defined reward metric and… still probably $10k-100k, you might end up with an AI that can improve on my algorithm by better predicting what will be needed next instead of reacting to demand and power spikes after they happen.
I dont like "cheating" in these games, since it breaks the point. But you broke the point, made a new goal and clearly made thoughts on the cheats, which makes it ok and no less impressive. Amazing work :D really impressive
I've found a new way to torture myself but would love to see if I can pull it off... Taking this and applying some of the extra mods (like Krastorio2 or something), or the "too many science" mod to test the strain on demand.
I have not installed a scenario before but I put the folder in my scenarios folder and installed the moon logic and recursive blueprints mods but when I start a new game it does not show up in my scenarios.
Hey, so I have a followup video where I give a general tutorial on how to install the scenario: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-w2IoMaIrkpo.html
Awesome work! Right now running it and its quite fun to watch. On your side its a really great achievement, kudos for this. From a player's point of view: This is something for factorio mid-/lategame, eg we need a path in the game to reach the level where our factories start to become "von neumann"ish. Eg, investing at first a couple of hours, days, to get our building blocks right, or even old school main-busses, with the aim to reach the stage where we can finally let the bots do their job, incrementally. Btw, it has build meanwhile 65 megablocks, with overall 34 rocketsilos (non buildable).
Hmm, everyone keeps having that silo problem. When you start the scenario, is there a -10K signal on the red circuit network for all the items in the mall?
one idea - limit the amounts of bots in relation to the power provided. Meanwhile I have 81 megablocks, the latest 15 always solar, mostly not finished, but the day/night-cycle isnt enough to get the bots (const & log) loaded (so neither placed solar arrays nor removed trees etc). add the consumption of the laser-turrets (based on the scenario right now my biggest consumers) there should be more overhead for energy production. or a more aggressive approach to the placement of solar-megablocks => if max consumption is less then 20% of maximum provisiong place a new solar-mega-block?
I used /c to add some thousands of solar-panels and accumulators into the game, it improved, but still the problem is that the deficit of power generation it to huge to make nuclear work again - meanwhile 110 megatiles, the last always solar-arrays, but still not enough to get production + nuclear + korvax running again (need is 58gw - including accumulators, production via solar is 428mw).
Restarted the scenario, as it built only empty megablocks in the end. with the new start power-supply isnt an issue right now and the build order is a bit different (49 blocks so far, no rocket silo yet, but instead meaningful factories).
@@uehreka havent checked it - but also in my third retry it starts to build rocket-silos, which it cannot build, in the end resulting in a cycle, which results in power-problems. instead of cheating in solar-arrays & capacitors now I have cheated in 6 rocket silos, building now looks good.
To capture footage from the MacBook Pro (which I did for any part where I verbally reference UPS stats) I used a 4K30 capture dongle and turned display mirroring on to force the resolution. However I really wanted 4K60 for as much footage as possible, so the rest of the footage is from my Windows Desktop, rendered using a GTX1080, but encoded using my RTX2080Ti so I could get high quality captures. I had hoped that the M1 Max’s media engine would allow me to capture 4K60 locally without a capture card, but for some reason it wasn’t working out and I was getting 1FPS garbage captures, which was definitely a bummer. I’ll add this info to the description to clarify since I don’t say it out loud in the video.
I like automatic lura, however, your script required pre complish labatory works simply sandmode simcity, could be possible do from scrach include labatory research too?
Have you considered running a "defragmentation" step in the factory to relocate/swap existing tiles so that related products are closer together and thus make the factory potentially significantly more efficient?
You could even have specially designed efficient megatiles for a single product that get used when all tiles within get assigned the same thing after relocation to further improve efficiency.
i kinda wanna see it have a revamp system where after it reaches a point it starts going back from the start, clearing old tiles, and replacing them with more UPS friendly systems. sadly i dont understand the mod at all so making that myself is a no go.
I start with everything researched and those cheater chests, so all the tiles I’m placing are already optimized against what I thought were the best tradeoffs. Still though, it could’ve been cool to lay down tiles with level 1 mods, then later use upgrade planners to get them to levels 2 and 3.
@@uehreka i was thinking more once its got its main goal it switches to improvement mode and starts redoing itself while also expanding. the inside slowly becomes UPS friendly and doesnt use bots at all while the bots are pushed more and more to the outside. eventually it takes the swarm of bots moving across the map and turns them into a river along the border.
Regarding solar panels barely breaking even due to the amount of roboports required to cover the panels, wouldn't it be possible to remove roboports once the solar panels are built? I suppose that opens up all sorts of problems for when and how to expand beyond the current solar panel tiles though.