What programming language Factorio is written in?

Post all other topics which do not belong to any other category.
oux
Manual Inserter
Manual Inserter
Posts: 2
Joined: Sat May 06, 2017 7:53 am
Contact:

What programming language Factorio is written in?

Post by oux »

Hello, I would like to know which programming language do the devs use to create Factorio.
And what game engine as well.

Thank you for your responses in advance.
AndrewIRL
Fast Inserter
Fast Inserter
Posts: 240
Joined: Fri Mar 24, 2017 2:17 pm
Contact:

Re: What programming language Factorio is written in?

Post by AndrewIRL »

Programming Language: C++
Game Engine: custom (made with dedication)
Modding: using Lua, hundreds of actively developed mods
Level creation: in-game Map Editor + Lua scripting
Detailed machine visuals: based on our 3D models made in Blender
https://www.factorio.com/presskit
oux
Manual Inserter
Manual Inserter
Posts: 2
Joined: Sat May 06, 2017 7:53 am
Contact:

Re: What programming language Factorio is written in?

Post by oux »

Thank you, I am going to begin studing C++ then.
Daid
Fast Inserter
Fast Inserter
Posts: 200
Joined: Sun Jul 03, 2016 7:42 am
Contact:

Re: What programming language Factorio is written in?

Post by Daid »

oux wrote:Thank you, I am going to begin studing C++ then.
I highly recommend against that as a first language. It's one of the best languages to make high performance code. But it's also unforgiving on mistakes. If you are a beginning programmer, start with something like python or C#. If you like games, Unity is a nice platform to create some games and learn some programming at the same time.

I have 20 years of software development experience now. (Started when I was 12 with Basic, moved up to Unreal Tournament scripting, moved to Visual basic and C from there, do most my professional work in python, and hobby in C++) I consider myself quite experienced in C++, and they call me the guru at the office. But I am amazed by what the Factorio team has managed to create. It's a piece of art. Don't expect to build anything like it anytime soon.
t-lor
Long Handed Inserter
Long Handed Inserter
Posts: 64
Joined: Tue Apr 25, 2017 9:28 pm
Contact:

Re: What programming language Factorio is written in?

Post by t-lor »

I agree with everything that daid says above me.

I just wanna point oud that most mod-coding for factorio (and a LOT of other games) is done in LUA.
Which is very simple/user friendly. so its a nice language to start with, and has the advantage of having to make some cool shizzle for everyone favorite game :)
AxeSlash
Burner Inserter
Burner Inserter
Posts: 18
Joined: Tue May 09, 2017 8:40 pm
Contact:

Re: What programming language Factorio is written in?

Post by AxeSlash »

+1 on C# rather than C++ as a first language.

And yeah, the amount of dev time and experience that's gone into Factorio is not something you will be able to replicate as a rookie programmer.
British_Petroleum
Filter Inserter
Filter Inserter
Posts: 321
Joined: Tue Dec 23, 2014 7:21 am
Contact:

Re: What programming language Factorio is written in?

Post by British_Petroleum »

"made with dedication" - does this mean they made the engine from scratch? (ie the devs were very dedicated :P ) or is dedication the name of a tool used to make engines?

and yeah, it's hard to really understand how much work is required to make a game until you try and make one yourself. Unity is fun, free, and powerful, and there's endless info online on how to use it.
userasd
Inserter
Inserter
Posts: 26
Joined: Tue Feb 07, 2017 12:48 pm
Contact:

Re: What programming language Factorio is written in?

Post by userasd »

Daid wrote:I highly recommend against that as a first language.
I agree with Daid too and also recommends Python as a learning language. I am a software developer too, my major degree thesis was about comparing some programming languages and I found Python a very nice language to learn as first. Even my friend who is a biologist found Python easy... So easy he done some programs in Python to use in his lab.

Also, games require complex algorithms. I recommends you that after you learn how to code also learn things like recursion, design patterns, data structures (lists, trees...) and classic algorithms (sorting, dynamic programming, etc).

Good luck! :D
Foreros
Fast Inserter
Fast Inserter
Posts: 102
Joined: Mon Jan 09, 2017 11:02 am
Contact:

Re: What programming language Factorio is written in?

Post by Foreros »

AxeSlash wrote:And yeah, the amount of dev time and experience that's gone into Factorio is not something you will be able to replicate as a rookie programmer.
Not totally true.
You CAN, but you have to dedicate lot of time first learning, then planning and last programming it.
This require years doing it alone and when done, can be dramatically obsolete. :P
The guys here are a wonderful team.
User avatar
Deadly-Bagel
Smart Inserter
Smart Inserter
Posts: 1498
Joined: Wed Jul 13, 2016 10:12 am
Contact:

Re: What programming language Factorio is written in?

Post by Deadly-Bagel »

C# is a pretty neat language to learn first, once you get your head around OOP.

PowerShell is also a pretty good language to learn, with better debug options I would say it would be an easier language to learn first but while being a scripting language makes it possible to run individual lines of code instantly for much faster cause-and-effect learning, the built-in ISE isn't particularly helpful when diagnosing certain problems and it doesn't handle threading very well. At any rate if you're thinking about a job in computers it's an invaluable tool.
Money might be the root of all evil, but ignorance is the heart.
Selvek
Fast Inserter
Fast Inserter
Posts: 238
Joined: Fri May 06, 2016 4:04 am
Contact:

Re: What programming language Factorio is written in?

Post by Selvek »

Foreros wrote:
AxeSlash wrote:And yeah, the amount of dev time and experience that's gone into Factorio is not something you will be able to replicate as a rookie programmer.
Not totally true.
You CAN, but you have to dedicate lot of time first learning, then planning and last programming it.
This require years doing it alone and when done, can be dramatically obsolete. :P
The guys here are a wonderful team.
No, you can't replicate it as a rookie programmer... by the time you're done, you'll not be a rookie anymore :)
cerberusti
Burner Inserter
Burner Inserter
Posts: 5
Joined: Tue May 02, 2017 4:27 pm
Contact:

Re: What programming language Factorio is written in?

Post by cerberusti »

As someone who has been programming for a long time (more than 25 years, about 20 professional), your decision of first language is important.

If you plan to only be an amateur, or want a standard desk job implementing general business code, Java, C#, or Python are good choices. If you plan to make a career, start with C (or Verilog, or ASM... or even a decent grounding in the physics of EE, the lower level the better so long as you can rapidly absorb it).

In my experience, those who start with automatic memory management seldom become competent programmers in the languages which require it. For large programs (or those which deal with much data) the execution time difference is measured in multiple orders of magnitude, so that is important. You will not approach the performance of C or C++ with C# or Python, and so many problems will forever be out of reach for a programmer who primarily uses those languages, while being solvable for programmers who are experienced at managing their own memory. Even with a code base which already includes efficient memory management, not knowing how to do it yourself means many of the finer points will escape you, and you will code logic which presents an efficiency problem without realizing it.

The real benefit though, is that with experience and natural ability, being able to manage memory opens more possible solutions. I have programs in C which would be at least 10x as long if I could not use interesting memory tricks to handle part of the algorithm (and I lament this sometimes when I must use a higher level language for maintenance and financial reasons). It is difficult to even explain to someone for whom it has not "clicked" yet, but you never get there with Python.

The downside, of course, is that far fewer people do OK with C as do OK with Python, and the learning curve is universally years rather than months (or sometimes even weeks). If you do not plan to make a career of programming, it is difficult to justify starting from basic principles.

Edit: C++ is a terrible first language. It is only really good in the context of a language including most modern features, but with the power of C style code. This is not a learning language, either start with the spartan C and its brutal efficiency and logic, or with the high level abstract languages like Python or JavaScript.
Last edited by cerberusti on Tue May 16, 2017 3:35 am, edited 2 times in total.
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3716
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: What programming language Factorio is written in?

Post by DaveMcW »

cerberusti wrote:If you plan to make a career, start with C... the learning curve is universally years
Not very encouraging. :(
AndrewIRL
Fast Inserter
Fast Inserter
Posts: 240
Joined: Fri Mar 24, 2017 2:17 pm
Contact:

Re: What programming language Factorio is written in?

Post by AndrewIRL »

Who are you guys talking to?

OP Last visited: Sat May 06, 2017 8:34 am
cerberusti
Burner Inserter
Burner Inserter
Posts: 5
Joined: Tue May 02, 2017 4:27 pm
Contact:

Re: What programming language Factorio is written in?

Post by cerberusti »

DaveMcW wrote:
cerberusti wrote:If you plan to make a career, start with C... the learning curve is universally years
Not very encouraging. :(
Unfortunately, wielding C++ as the developers of this game did is not something you will do in a few months. C was a language written by a genius for his own use after a decently long career programming, and it reflects that (it was developed in order to be able to write UNIX portably, before that everyone just wrote operating systems in assembly language [mnemonics for machine operation codes]).

The main features of C are direct memory addressing and a close relationship to the operations a computer can actually perform. C++ extends this to including many modern features, features which are possibly dangerous or conflicting in certain circumstances as the language cannot provide the kind of guarantees or checks a very high level language like Python can. As many will say, it happily lets you shoot yourself in the foot with the assumption you know what you are doing. If you are a gunslinger you can do impressive things, but most people would be more likely to hurt themselves in the attempt.

As a more common reference point, if you were the kind of person who took formal proofs in geometry, decided it was mostly trivial, and it was easier to just prove most things from basic principles readily and easily rather than memorizing it, you probably have the logical ability to handle C and C++ well. If it was a struggle at all, you should save yourself the effort and stick with Python or C# (you will never create a program like Factorio in Python though, it is outside the capabilities of the language no matter how good you are with it).

Edit:
It is not intended to be discouraging, but the background knowledge which went into doing something like this is vast, and not something even many of the motivated will accomplish. It is professional level, and is a good example of professional competence at that.

I smirked a bit at their UDP problem when I saw it in a steam news article for the game, as I knew what the problem was before I finished reading the article. I have implemented stacks on industrial equipment which included ARP through HTTP, and everything in between, and it is a good example of why conventional wisdom among programmers is frequently "do not roll your own" in certain contexts. They did, and they successfully debugged it. Despite conventional wisdom that one should not write their own operating system or otherwise high performance code, they decided no game engine fit what they wanted to do, and wrote their own custom and task specific engine to perfectly do the task they needed. Unlike most, they were successful and really did have the ability to pull it off either by already knowing the answer, being able to find it, or being able to design it.

If you are expecting to go from a programming knowledge of zero to this in less than a few years, your expectations are bad. I find it impressive even as a programmer who primarily writes C, knows Verilog and VHDL, started with x86 ASM, has been doing this for decades, and mostly ends up on the business side these days unless the task is uncommon enough that I think those I employ at great expense will screw it up with too high a degree of probability. I use C++ quite a bit.
userasd
Inserter
Inserter
Posts: 26
Joined: Tue Feb 07, 2017 12:48 pm
Contact:

Re: What programming language Factorio is written in?

Post by userasd »

I wonder what is the ratio of programmers playing factorio and if it the profession with the most number of players...
Zool
Fast Inserter
Fast Inserter
Posts: 107
Joined: Fri Jul 10, 2015 6:55 pm
Contact:

Re: What programming language Factorio is written in?

Post by Zool »

Also important when thinking about programming:
If should have enjoyed mathematics at school, didn't get confused by formulas, and understand the basics of logic. If any of that was unpleasant and annoying at school, its hard to program anything complicated. An alternative in that case would be sound or grafic artist if thats more your preference ^^

Btw, I'm also former programmer, started with Turbo Pascal and Visual Basic, later a lot of database stuff, C, and so on
User avatar
Deadly-Bagel
Smart Inserter
Smart Inserter
Posts: 1498
Joined: Wed Jul 13, 2016 10:12 am
Contact:

Re: What programming language Factorio is written in?

Post by Deadly-Bagel »

Zool wrote:Also important when thinking about programming:
If should have enjoyed mathematics at school, didn't get confused by formulas, and understand the basics of logic...
This doesn't necessarily extend to needing to remember 103 obtuse formula, such as those required for my HSC. It's more the application of the formula rather than needing to remember them.

So perhaps a better test would be how much you enjoyed general algebra (that is essentially what programming is) rather than Maths in general, if not some other logical task.

Something like this logic puzzle:

Image

This shouldn't be difficult for anyone with an aptitude for programming.
Money might be the root of all evil, but ignorance is the heart.
AndrewIRL
Fast Inserter
Fast Inserter
Posts: 240
Joined: Fri Mar 24, 2017 2:17 pm
Contact:

Re: What programming language Factorio is written in?

Post by AndrewIRL »

is_border, is_square, is_red, is_large
Y, Y, Y, Y - Far left
N, Y, Y, Y - Left
Y, N, Y, Y - Centre
Y, Y, N, Y - Right
Y, Y, Y, N - Far right
User avatar
DerivePi
Filter Inserter
Filter Inserter
Posts: 505
Joined: Thu May 29, 2014 4:51 pm
Contact:

Re: What programming language Factorio is written in?

Post by DerivePi »

void C()
{
printf ("Hello computer, I need you to quickly do some things for me.");
}

class C {}; //base class

class c_pp: public C
{
void classes( );
virtual void garbageCollection();
std::cout << " Computer, use the larger standard cpp library to implement containers and graphics functions." << std::endl;
};

class c_sharp: public c_pp
{
void garbageCollection();
system.console.writeline ("Computer, I don't want to think about memory allocation. You take care of it for me.")
};
Locked

Return to “General discussion”