Page 1 of 1

Coding language of Factorio?

Posted: Tue May 14, 2013 3:52 pm
by metzyn
In what coding language and/or API is Factorio developed?

If this question has been asked before, I sincerely apologize.

Re: Coding language of Factorio?

Posted: Tue May 14, 2013 4:25 pm
by kovarex
Hi, Factorio is coded in C++, we use just basic graphics library (allegro), and some other utility libraries (boost, agui (for gui) etc), but no premade, game engine.

Re: Coding language of Factorio?

Posted: Tue May 14, 2013 7:21 pm
by POJO
Which means that you are developing your engine straight with the game :) great achievement.

I really wonder how you got this amount of performance, since the factory can contain a large amount of components and even one single belt might contain 4 items + the belt itself.
My assumption is a data-driven design, like an mmo-entity system, or an OOP-Flightweight Pattern :)

Dont worry to keep technical details for yourself, it is just fascinating to see such a system since i ran into performance issues at amounts of 2000+ entities in my own experiments :) (Hard OOP-Approach).

Best regards

Re: Coding language of Factorio?

Posted: Tue May 14, 2013 8:47 pm
by kovarex
POJO wrote:Which means that you are developing your engine straight with the game :) great achievement.
Well, thx, It was really very hard decision in the start, but I was too afraid to find limitations of existing engines too late, and I wanted to be able to push the limits of the engine as far as possible (performance, predictibility, mod support), now I'm almost sure it was good decision, but it was tough in the start.
POJO wrote: I really wonder how you got this amount of performance, since the factory can contain a large amount of components and even one single belt might contain 4 items + the belt itself.
My assumption is a data-driven design, like an mmo-entity system, or an OOP-Flightweight Pattern :)
I don't know any of these word-connections (data-driven design, mmo-entity system, OOP-Flightweight) :)
Actually we use quite stupid system to keep it going.
1) Make the mechanism the most easy and stupid way it can be done and see if it works, and how it works
2) Find the most slow slow thing in the game (and most easily optimisable) and -> Use the most easy and stupid way to make it (much) faster
3) Go to 2 or 1, depends if we need to make it run faster or add new features.
Sometimes we need to work with custom data structures that helps with some particular task, but it is very different for every task.
POJO wrote:I ran into performance issues at amounts of 2000+ entities in my own experiments :) (Hard OOP-Approach).
Best regards
If you used our 1) 2) 3) way, you would speed it up a lot :)

Re: Coding language of Factorio?

Posted: Tue May 14, 2013 9:09 pm
by ficolas
1) Make the mechanism the most easy and stupid way it can be done and see if it works, and how it works
2) Find the most slow slow thing in the game (and most easily optimisable) and -> Use the most easy and stupid way to make it (much) faster
3) Go to 2 or 1, depends if we need to make it run faster or add new features.
Sometimes we need to work with custom data structures that helps with some particular task, but it is very different for every task.
Nice sistem :)

Re: Coding language of Factorio?

Posted: Tue May 14, 2013 9:38 pm
by kovarex
The only problem is, that over time, you can run out of stupid ways, and the "most stupid way" will start to be quite complicated :)

Re: Coding language of Factorio?

Posted: Tue May 14, 2013 11:03 pm
by SilverWarior
kovarex wrote:The only problem is, that over time, you can run out of stupid ways, and the "most stupid way" will start to be quite complicated :)
That is the biggest problem with such approach. But the biggest advantage is that it is usually quickly impleminted.
So one thing that we programers should do is spend a lot of time planning our work which definitly isn't easy since you have to sort everything in your head first.
That is the main reason why I still haven't completed development of my own game even to the point where I could show it to the public. But I'm getting there slowly.

Re: Coding language of Factorio?

Posted: Wed May 15, 2013 3:44 am
by metzyn
I am working on a game myself using Java and the Slick2D API. Nothing complicated like Factorio, in fact 95% is text-based. Making an "interactive fiction" -esque game similar to Zork. Its my first project so I'm trying to start simple.

Anyway, because I'm starting to get into game development I like to see what languages/tools are being used and how successful developers are coming along.

Re: Coding language of Factorio?

Posted: Wed May 15, 2013 7:27 am
by POJO
Nice Thread :)

As reference to the entity-systems this might be fun to read: http://t-machine.org/index.php/2007/09/ ... nt-part-1/

The core idea behind such a system is to get away from the OOP-approach where everything is an object with a class.
Instead the entities are not more than unique ids which can be composed with different components.
A component is something like a block of data (e.g. a position or rendering-informations).
The next part is a system, like a renderer or the movement-system.
A system handles a specific part of the entities (e.g. the movement-system might handle all entities which have a position and a velocity as component).
Artemis is such a Framework (I am going to test it in my next experiment since I am more comfortable with Java) http://gamadu.com/artemis/index.html

@metzyn
For a Textgame Slick might be a bit too much :)
Still it seems to be a bit outdated (ran into great issues as soon as we needed multithreading at loadtime) http://slick.javaunlimited.net/viewtopic.php?f=2&t=5171
Maybe not for a textgame, but for other projects libgdx might be a choice (http://code.google.com/p/libgdx/)

Best regards

Re: Coding language of Factorio?

Posted: Wed May 15, 2013 4:22 pm
by ficolas
I thought that the simple game menu and buttoms were from some game engine, in my opinion, you should make it have better graphics :s

Edit: Lol I have just readed that it will be changed for the next version :)

Re: Coding language of Factorio?

Posted: Wed May 15, 2013 6:47 pm
by metzyn
POJO wrote:Nice Thread :)

@metzyn
For a Textgame Slick might be a bit too much :)
Still it seems to be a bit outdated (ran into great issues as soon as we needed multithreading at loadtime) http://slick.javaunlimited.net/viewtopic.php?f=2&t=5171
Maybe not for a textgame, but for other projects libgdx might be a choice (http://code.google.com/p/libgdx/)

Best regards
Thanks for the info! I do not like Slick2D but it seemed to be the easiest to implement and best supported out of the few libraries/engines I found.

I know it seems like a bit much for a text-based game, but I am building the entire GUI myself instead of using a specific GUI library so that I can have a bit more control. That is why I wanted to use a graphics library like Slick2D. Again, thanks for the tip and I will check out libgdx.

Re: Coding language of Factorio?

Posted: Wed May 15, 2013 11:16 pm
by metzyn
After checking out libgdx not pleased of its reliance on the android SDK.