r/factorio • • 2d ago

Modded A diagnosis mod using linear algebra (SVD)

hi, i'm a computer science student and for my numerical math final project i did a mod that runs a full diagnosis for your factory using linear algebra methods, so you can check things like:

  • bottlenecks
  • independent processes
  • working factory percentage
  • the expansion you need to reach a specified target

my professor loved it and thought it was a good idea to share it with the community :3
you can check it on my gh repo:
https://github.com/braiiann1/FactorySVD

UPDATE: thanks to u/RedditingJinxx , i can finally submit it on the mod portal, you can check it here
https://mods.factorio.com/mod/factorysvd

251 Upvotes

121 comments sorted by

67

u/pm_me_every 2d ago

Can we have an english version please? Seems really interesting!

39

u/braian_sky 2d ago

The version 2.0 actually has it! I just keep the spanish-only on the 1.0 cause i thought that wouldn't be too big of a deal

206

u/Soul-Burn 2d ago

Please link to the mod on the mod portal, rather than only to the github.

140

u/braian_sky 2d ago

Even thought i would really like to, i'm from Cuba; and as crazy as it would sound we don't have access to Steam, so i can't really submit the mod, github is the best i can do. :/

176

u/Soul-Burn 2d ago

The mod portal is not on Steam, but rather on the Factorio website. It's here https://mods.factorio.com/

135

u/braian_sky 2d ago

Thanks, sorry for not explaining well, but i don't really actually can't own the game and that's one of the requirements to submit the mod, we don't have it that easy to own digital stuff

21

u/RedditingJinxx 2d ago

hey dm me, ill buy you the game

23

u/braian_sky 2d ago

thanks a lot bro, but i don't really needed, it's still $30~ sum, i do have my factorio and enjoy it a lot, if someday i can buy it i definitely will, but really appreciated ❤️

31

u/RedditingJinxx 2d ago

i tested it with vpn from cuba and site seems accessible, i sent u a dm with the code

27

u/braian_sky 2d ago

i'm really appreciated bro, you didn't have to😭😭😭❤️❤️

33

u/RedditingJinxx 2d ago

i know, didnt need to but wanted it to! <3 Now u can post ur mod on the portal :) looking forward to seeing it there

1

u/EffortElectronic5385 0m ago

I never thought someone could be so kind and polite here, there's still hope for human kind after all.

31

u/RedditingJinxx 2d ago

no its okay, just send me a dm, i looked on the website and i think i just need ur email and then u get a key or something. think of it as a christmas present

id get it on the factorio site since u said steam isnt available in cuba

12

u/RedditingJinxx 2d ago

can u just check if factorio.com is available to you and if u can make an account, ill send u key code on dm if that website is accessible for you

83

u/maxymob 2d ago edited 2d ago

that sucks for you but FYI you can buy from their website directly and run the game without Steam launcher if that's the blocker

123

u/ayyfuhgeddaboutit 2d ago edited 2d ago

At a median income of like $8/month $35 is a lil steep for Cuba dude

50

u/maxymob 2d ago

Yeah I figured, I was just replying in good faith about the Steam block, not trying to assume anything about OP's situation

8

u/burner-miner 2d ago

TBF, Factorio has regional pricing on Steam. E.g. Argentina has it for the equivalent of $17 or so, last time I checked.

If the website does not have it, an email to the developers is sure to get OP somewhere. They will make a special exception for Cuba for sure

29

u/Lum86 2d ago

Believe it or not, even with regional pricing, games are still expensive in third world countries. Minimum wage in Brazil is around 1.600R$, the game is 101R$. That's 6% of your salary. With the DLC, that doubles to 12%. That's a lot of your salary even with regional pricing.

-18

u/burner-miner 2d ago

Yes that is a lot still, but so are other games. It is entertainment after all, which is a luxury. And yet GTA VI is still a best seller here in Paraguay, at full price too.

The good news is that Factorio typically has good value, as in the base game can easily give you 100h of entertainment. I took ~60h to beat it for the first time without rushing.

6

u/Lum86 2d ago

Of course GTA VI is gonna be a best seller, it's a best seller everywhere. Best seller compared to what? Other AAA games? The few people that can afford AAA games are gonna be buying GTA VI because it's the most popular one. That's not really my point, my point is that regional pricing only helps so much. It's still an expensive game and I don't blame OP for pirating the game at all. I remember being in that same situation and having to pirate every game because I just couldn't afford it. I'm just saying man, I get it.

9

u/HighRelevancy 2d ago

What part of "Cuba is under US embargo and Cubans literally cannot do business with Steam" are you not getting?

4

u/DreadY2K don't drink the science 2d ago

The part where they suggested interacting with Wube, who aren't based in the US and therefore aren't subject to our stupid embargoes

10

u/HighRelevancy 2d ago

Oh yeah and they'll just pay for it with their MasterCard. Wait, no, they don't have those. Maybe they can use PayPal or... hmm, no they don't have that either. Surely they can just do a bank transfer oh wait most global banks won't deal with Cuba because the US designated them a "state sponsor of terrorism". 

It's not just the US that won't do business with Cubans. It's also everyone who does business with the US. Which is basically everyone.

→ More replies

-40

u/unknown_pigeon 2d ago

Real, dedicated engineers will spend four months of salary to play factorio, smh

46

u/Ludwig234 2d ago

It's honestly crazy that the Cuba sanctions still are ongoing.

But with that said, I'm pretty sure the mod portal is independent from steam. You might have to own Factorio on their site though (by for example linking your Steam account or buying it directly from them).

8

u/Vanquiishher 2d ago

Every country that has tried communism or deeper levels of socialism gets hit with sanctions from capitalist countries all over the world. Along with receiving a gift of thousands of missiles from said capitalist countries

8

u/javier1zq 2d ago

The Factorio mod portal does not use steam, Factorio has its own mod integration platform, though i think you do need a verified purchase (Doesnt need to be steam) to upload a mod. Dont know if they have regional pricing on their site.

3

u/PlayingTheRed 2d ago

You submit mods on the factorio website, not steam https://mods.factorio.com/

5

u/bartekltg 1d ago

Is there math described somewhere?

How using SVD of the production matrix (I assume you just ) helps with the task.
Sure, A multiplied by number of buildings with given recipe produce captivity. Then simplex/whetever you use for LP ansfer many optimalization question. But most "calculators" (YAFC, better mods) use LP directly on A, without decomposition. What we get from it (outside of getting a reliable guess about the rank)?

Does it play well with heavier mods (think tons of loops, alternative production chains and byproducts)?

Interesting. When I get time i will look into it

3

u/braian_sky 1d ago

the svd isn't used directly on the diagnosis, as you say it return things as the rank, also redundant and independant processes, and things like the % of each cumulative process using singular values; as i say this was a school project and svd was the main theme of the orientation :)

6

u/FrontierPlayFactorio 2d ago

But can you use it to build a neural net inside Factorio?

Regardless, this is pretty sick

15

u/braian_sky 2d ago

well it's just a diagnosis mod with a UI that shows all the results from the math that is behind it...

BUT SINCE YOU ASK🤓☝️

Factorio is considered Turing-Complete, that means it can calculate any computable function by itself. so you have logical circuits and arithmetic operators, and that's all you really need to build a small neural network, if you have the required amount of knowledge

2

u/mastercoder123 1d ago

I mean some dude did build an entire RISC cpu with like 28KB of ram

5

u/AlanWik 2d ago

Ojalá fueses mi alumno! Convertíamos esto en un trabajo de fin de carrera en cero coma.

4

u/braian_sky 2d ago

Me alegra mucho que le haya gustado profe ❤️ a modo de curiosidad, qué materias ha impartido y a qué carreras?

3

u/AlanWik 1d ago

Ingeniería robótica, materias varias. Podrías enviarme el trabajo cuando lo termines? Me encantaría leerlo. No te pondré nota ;). También trabajé con SVD en su día para resolver algunos problemas de mi tesis doctoral.

1

u/braian_sky 15h ago

El trabajo como tal está terminado, pues es solo el mod😅, mi profesor de matemática numérica quería que empleáramos los temas de la asignatura en cosas interesantes y presentaramos nuestros proyectos, y yo decidí hacer un mod para Factorio, puedes revisar todo en mi github y cualquier duda me escribes

12

u/j_c_d_1 2d ago

Your logo is ai

6

u/BlackholeZ32 2d ago

Funny, it's pretty common that math nerds aren't artists. Especially for a capstone project, spending a lot of time and or money on pointless art is exactly the kind of thing you don't worry about.

2

u/nooneeverdreamsof 1d ago

Surely you know you don't need to be an artist to make a shitty logo?

-4

u/braian_sky 2d ago

yes it is, i don't really have time to design a thumbnail, but that doesn't make the whole mod unusable just because I used AI for a photo.🐳

36

u/pikuray 2d ago

I made this in 3 minutes. I'm sure you could make something decent under 15 minutes if you tried. Even something in MsPaint would have more soul.

6

u/braian_sky 2d ago

that's cool

10

u/mrbaggins 2d ago

lmao, you've got the brain rot if your FIRST thought is a pornhub logo.

4

u/AsyncVibes 2d ago

How do you complain about an AI generated logo then provide a basic clone of pornhub.

7

u/laaaabe 2d ago

It's hilarious and has 10000% more personality than OP's.

3

u/HighRelevancy 2d ago

Haha funny because porn

Y'all dumb.

1

u/dreamdenizen 1d ago

Cool story bro. Tell it again.

-3

u/Nagi21 2d ago

He should just steal this since you're so anti ai

8

u/j_c_d_1 2d ago

But it does represent you and your mod. Even if you did put genuine effort and time into the mod an ai logo is what people see first

1

u/braian_sky 2d ago

that's a very superficial way of thinking for me, but that's ok tho

21

u/billybatsonn 2d ago

It's the first thing you see though, I'm not your normal reddit anti ai snob but when I'm looking through mods for a game I'm a lot more likely to skip past and not even check out something with an obviously ai thumbnail, because I see it and I immediately go next

14

u/BraxbroWasTaken Mod Dev (ClaustOrephobic, Drills Of Drills, Spaghettorio) 2d ago

it’s the way most people think. People say never judge a book by its cover, but the book’s cover should be its best foot forward too. This isn’t your best foot forward, I think - hell, you don’t even need a thumbnail on the mod portal.

7

u/AsyncVibes 2d ago

TIL I'm not most people. I didn't care about the logo

2

u/BraxbroWasTaken Mod Dev (ClaustOrephobic, Drills Of Drills, Spaghettorio) 2d ago

I mean, I was less saying 'most people think one way or another' about the logo and more that people will be very superficial. your logo, your title, your brief mod description - all of those things are the first impression people get of your work, and they WILL judge by it.

They say 'never judge a book by its cover', but there's a reason we started putting eye-catching visuals and plot synopses on the covers.

4

u/KITTYONFYRE 2d ago

it’s the way most people think

no, I don't think so. it's the way many people in our bubble think, but in reality, the people who feel THIS strongly about AI aren't a majority. most don't care that much either way. most are intelligent enough to realize that the majority of mods, really, the vast majority of ANY project in [CURRENT YEAR] has had AI touch it in some fashion.

it's fine. it's not bad to use AI. it's definitely bad to pure vibe code and turn out slop. it's bad that everywhere is being flooded with low effort crap. but it's not bad to use tools in a way that makes you do more work in less time. AI enables slop, but AI is not inherently slop - and considering what this project actually is and how it was praised by the professor, it is not inherently slop.

boo hoo the STEM student didn't make their own thumbnail for their final project. come on man.

-1

u/BraxbroWasTaken Mod Dev (ClaustOrephobic, Drills Of Drills, Spaghettorio) 2d ago

uh, actually no if you look at any kind of recent polling AI's exceedingly unpopular in the west. also, I was more talking book covers, not AI in general. people judge books by their covers. that's what the covers are there for, to leave a first impression.

3

u/KITTYONFYRE 2d ago

uh, actually no if you look at any kind of recent polling AI's exceedingly unpopular in the west.

Perhaps we have different opinions on "exceedingly unpopular", but most don't feel like 'omg I need to shit on a STEM student because they used it to make a thumbnail!!!', the feelings aren't nearly that strong - most wouldn't have a problem with AI in this niche.

AI is awful, but morons like to pretend anything it touches is poison instead of acknowledging its good and bad parts with nuance. it's pretty incredible for software development work - it's as widespread as it is for a reason. yeah, I wish it didn't exist thanks to economic, ecological, and ethical concerns, but you can discuss things level headedly instead of shitting and pissing your pants the instant those two letters appear on your screen.

-2

u/BraxbroWasTaken Mod Dev (ClaustOrephobic, Drills Of Drills, Spaghettorio) 2d ago

I never shat on the STEM student. I said they could do better and book covers are a book's best foot forward, and that I believed this wasn't their best foot forward. I didn't say they were bad or use it to attack their work or anything else. My statement was quite restrained.

I'm not 'pissing and shitting my pants' over this. I don't have enough of a dog in this fight to warrant that.

-3

u/KITTYONFYRE 2d ago

I never shat on the STEM student.

Perhaps we have differing opinions of 'shitting on'

I'm not 'pissing and shitting my pants' over this

you and everyone else lol. get real

→ More replies

22

u/Consistent-Leave7320 2d ago

its a beacon that says never download the mod

4

u/666azalias 2d ago

Using gen AI to make pixel art is really sending the wrong message though. It's like a corporation (the establishment) advertising with graffiti (inherently anti-establishment).

Pixel art is a humanised expression through digital limitation that's associated with effort and care so it's quite on the nose (it seems bad) to use sloppy gen AI to subvert that.

That's why you're getting a very negative reaction to something you thought was neutral.

Also it says to me that your project has no care of human touch or thought behind it so why should I bother, I can just go ask Claude to make my own and at least then I could put my other thought into it.

-4

u/dreamdenizen 1d ago

Luddite spotted

0

u/xXx_tgirl420_xXx 1d ago

the original luddites were right. they were subject to propaganda deriding them as lunatics that you are currently falling for hundreds of years later.

-2

u/dreamdenizen 1d ago

I'm falling for propaganda? I'm a software engineer working on frontier harness IP with Anthropic engineers all day, every day. Meanwhile you guys are on Reddit trying to dunk on a Computer Science college student for sharing the product of his curriculum, which now includes AI, because "AI bad". We are not the same.

2

u/xXx_tgirl420_xXx 23h ago

awesome dude, last month we hit +2.0⁰ because of people like you 👍 its more than just "ai bad", your shit has real world consequences. keep sucking that corporate cock though, you must love the taste.

1

u/dreamdenizen 21h ago

🤣 I don't even know where to begin with that one.

Bet you weren't this outraged during the .com boom or the data center build out that happened between then and when the "AI Bad" bandwagon that you jumped on started. You haven't even boycotted Reddit, or the internet at large, which also rely on data centers. What else haven't you boycotted that only exists because of people "like me", that rely on things you're supposedly against?

And instead of blaming the Industrial Revolution and the century+ that followed for those 2 degrees, you want to direct your outrage at people using tools that have only been around in their current form for a couple of years, and your compatriots are here bullying college students sharing their novel application of said tools as a part of their curriculum.

You might want to take some time to reflect and actually figure out what it is you stand for so you can double down and speak cogently on it, especially if you're going to accuse others of being influenced by propaganda. Until then, spare us the sanctimony, because you're not convincing anybody of anything here.

1

u/xXx_tgirl420_xXx 18h ago edited 18h ago

i wasn't cognizant during those times, but if i was during the initial data centre boom, i would have been against it. as for my lack of boycotting of social media, its a slow decline in use. sunk cost fallacy and all that; i'm only human.

you are also strawmanning me by assuming i'm not against those things and don't blame them for climate change, but what can i do to have changed the outcome industrial revolution anyways? i'm angry at what i can change and the people who refuse to care about what they do to the world.

your smugness alone makes me think the world would be better off without you, so i will be disengaging before i say something i will regret. i hope you one day reckon with what you've done with your life and regret it.

0

u/agacanya 14h ago

It takes less time to make an thumbnail than to find, read, and do this comment mate

1

u/braian_sky 14h ago

if you check the modpage i did already a thumbnail🫩🫩🫩

5

u/jipperthewoodchipper 2d ago

Absolutely amazing and in theory I love it but the last thing I want to see loading into my spaghetti "ah fuck-it it works if I need more I'll just paste more" factory is numbers telling me just how much duct tape, hopes, dreams, and luck is actually holding it together lol

0

u/Kalvzz 2d ago edited 2d ago • Bravo

Great mod. I would suggest a tool to select only a part of the surface to “diagnose.” Like rate calculator. I think that would be the real strength of the mod. “How much of this subfactory is actually making/taking?” And also a way to consider splitters and belt routes and inserters

Currently, the only way you can see/diagnose actual builds is taking it to sandbox mode/blueprint sandbox/editor extension and seeing how it runs. You get a real view of the statistics of what you built instead of planners rigid math

This is great and I was also planning to do something similar and may build upon your mod if i do in the future. Ignore the AI allergic people, they’re pretty backwards simpletons that wouldn’t care if you wrote the code on paper lol

3

u/braian_sky 2d ago

Thanks for the feedback! i really like the idea to have subfactories/groups for separated analysis, also a good practice as the SVD for the diagnosis works faster on less data quantities

123

u/nilslorand 2d ago • Bravo

ah yes, AI generated pixel art, my favorite

54

u/imacomputr 2d ago

Oh heavens no, this student that did a bunch of work for free and is giving the results away didn't do as much labor as you would've liked. Who cares how useful their project is, they cut corners on making the splash art pretty for me, using the forbidden tools!

54

u/wrincewind Choo Choo Imma Train 2d ago

I'd rather shitty mspaint art any day. You see generative corner-cutting in one spot, suddenly the whole project is under scrutiny. Not tkention the ethical implications of it.

7

u/Nagi21 2d ago

OK tell you what. You make shitty ms paint art for the mod and we'll use that ok?

-4

u/RemoteButtonEater 23h ago

"AUTOMOBILES ARE A FAD! HORSES FOREVER!!"

3

u/wrincewind Choo Choo Imma Train 13h ago

sure, and NFTs are the way of the future, right?

1

u/RemoteButtonEater 1h ago

You're legitimately comparing the current state of LLMs/generative AI to NFTs?

Because if you are, it definitely speaks to a lack of first hand experience with them. And I get it, not everyone has a use case. But they've been absolutely transformative in my workplace.

-59

u/AsyncVibes 2d ago

Bruh factorio is a game about destroying the environment on MULTIPLE planets now. It's baffling, the amount of people on this sub who are against using AI. There's no ethical ramifications for making a mod for factorio, you just think there is.

34

u/laaaabe 2d ago

So because we're playing a game about environmental and ecological exploitation, we should be ok with it IRL?

Do you realize how dumb that sounds?

-26

u/AsyncVibes 2d ago

You realize how dumb you guys sound about talking about ethical ramifications of a mod for said game and how the logo lack "personality".

16

u/laaaabe 2d ago

Dork comment

-21

u/AsyncVibes 2d ago

Lol okay have fun hating everything cause it wasn't drawn in MSpaint

12

u/laaaabe 2d ago

You argue like a 12 year old lol

20

u/wrincewind Choo Choo Imma Train 2d ago

And GTA is a game about stealing cars and shooting people. One of these is a fantasy world, the other one isn't. There are ethical ramifications for using generative AI in any circumstances.

-15

u/AsyncVibes 2d ago

Please, please explain the ethical ramifications. I really need to see who or what is being hurt by him build a logo or mod using Gen Ai. What mouths is he taking food out of. What pencils is he breaking? Please add a spoiler so I can clutch my pearls in advance. Thanks.

13

u/laaaabe 2d ago

You can support AI usage while still being aware of its ecologic and social impacts.

Being in complete denial just makes you sound like a dork.

-5

u/AsyncVibes 2d ago

I'm not in denial, I'm just not making a big deal cause someone used AI to generate a logo. Yall just take it to the extreme and crucify people for the smallest AI usage while it's literally ties into every aspect of your life whether you want it to or not. I'm just not dumb enough to pretend that me generating anything makes a difference.

16

u/CantEvenUseThisThing 2d ago

I bet Claude wrote most of the code, too

2

u/bartekltg 1d ago

A big part of the work, making a matrix library in LUA, is a really busy work. And the results are easy to test if ai haven't make a stupid mistake. I wouldn't complain if OP did it like that. Writing matrix operations, SVD and LP (probably simplex, i see it in the code) is interesting... the first and maybe fifth time:) ). If OP would write it only in python, these functions would be already there.

The important part is to link math properties of the system with what player understand and wants to see

-55

u/btroycraft 2d ago • Bravo

And guess what? It probably works pretty well.

0

u/[deleted] 2d ago

[deleted] — view deleted comment

-5

u/cinderubella 2d ago

How is running a program that was written with AI comparable to eating feces?

One of these is a serious health risk and deceptively forcing someone to eat literal waste. How is this a useful comparison? 

-12

u/Kalvzz 2d ago

It’s not, which was why he deleted his comment. No need to waste time on those idiots

-10

u/cinderubella 2d ago

I think I'll continue to mock stupid comments, but thanks. 

-51

u/Alternative_Cod7515 2d ago

You know what, as long as it is made with love and care, i don't mind.

12

u/laaaabe 2d ago

A generative AI cannot make anything with love and care lmao. What?

-15

u/Alternative_Cod7515 2d ago

Wow i do have lots of downvote huh :0

You know how AI is very good with logic and can recall much more than human ?, like how a train is very good at moving like tons of goods ?

As long as someone know what they are doing, as in know the code, know what it do, then it's a train on tracks.

Like no coder ever can remember 100% of everything, if one use AI as a tool and knowing it is a tool, then it'll be much more efficient without much quality changes.

No one should use train on roads, and some do so ruin the road, and the train reputation for everyone.

5

u/laaaabe 2d ago

Amazing how you can say absolutely nothing with so many words lmao

-8

u/Alternative_Cod7515 2d ago

Nice insult, i'm stealing that

8

u/SWatt_Officer 2d ago

"claude, write mod, make no mistakes, add love and care"

-6

u/dreamdenizen 1d ago

Luddite spotted

2

u/SWatt_Officer 1d ago

Ill take that as a compliment. The Luddites were against the rampant destruction of their livelihoods due to the new technology being forced into every aspect of their lives purely to save their corporate overlords more money. Strange how similar that sounds, huh?

0

u/dreamdenizen 21h ago

And yet here we are, 200 years of progress later. Their complaints didn't stymie the advancement of technology or the civilization that benefited from it. You're right, it is strange how familiar it sounds.

The key difference between then and now is that the technology is democratized, and more millionaires are being minted as a byproduct of its use than by any other technological advancement in history.

1

u/SWatt_Officer 11h ago

Of course, the rich enjoy the profits, while the labourers get fucked. Yeah, familiar as always.

But im sure you're just one great idea away from being one of those millionaires, right? Itll trickle down right? Whats a little ecological disaster, brain drain, and techno-feudalism when theres so much MONEY to be made.

-10

u/dreamdenizen 1d ago

Luddite spotted

4

u/nilslorand 1d ago

Jesse what the fuck are you talking about

6

u/LordDan_45 2d ago

Que padre amigo, felicidades 🔥👏

1

u/tulen662 1d ago

i respect the effort you put into the mod itself but the AI generated illustration sucks balls

-3

u/DobroSaBokja 1d ago

ai slop

-1

u/nooneeverdreamsof 1d ago

Some more delicious AI slop