Data Oriented Driven ( DOD ) / Bevy game engine

Things that are not directly connected with Factorio.
Post Reply
fiwon123
Burner Inserter
Burner Inserter
Posts: 7
Joined: Fri Oct 20, 2023 2:27 am
Contact:

Data Oriented Driven ( DOD ) / Bevy game engine

Post by fiwon123 »

Hello,

I'm just curious about the Factorio ecosystem and how he was created.
I didn't understand so much about the concepts but I'd like to know about someone experience if the factorio game was created following something about DOD or ECS things.

Since the DOTS Unity that I heard 3 - 4 years ago, I hoped to see more games following these concepts, but I didn't see so much about this.
I really want to know the main point that made the factorio possible and very well optimized.

For now I'm just curious how is the best way to create a game with a lot of resource management and a lot of interaction without lose performance.

I'm don't know but till now I just see more about OOP. But DOD and Bevy engine is calling my attention now, just for hobby thing haha.

Thanks a lot for any explanation.

Kind Regards,

Felipe Inoue

Koub
Global Moderator
Global Moderator
Posts: 7212
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: Data Oriented Driven ( DOD ) / Bevy game engine

Post by Koub »

[Koub] Moving this to off topic subforum, feel free to discuss this here.
Koub - Please consider English is not my native language.

Qon
Smart Inserter
Smart Inserter
Posts: 2118
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: Data Oriented Driven ( DOD ) / Bevy game engine

Post by Qon »

fiwon123 wrote:
Fri Oct 20, 2023 2:56 am
I really want to know the main point that made the factorio possible and very well optimized.

For now I'm just curious how is the best way to create a game with a lot of resource management and a lot of interaction without lose performance.
A lot about performance has been written about in FFFs.
And on the forum as well.

What did you search for before making the thread?

Twinsen
Factorio Staff
Factorio Staff
Posts: 1330
Joined: Tue Sep 23, 2014 7:10 am
Contact:

Re: Data Oriented Driven ( DOD ) / Bevy game engine

Post by Twinsen »

I know a bit about ECS and I can say Factorio is not doing it.
We didn't really follow any frameworks/paradigms except OOP and some C++ practices.
Afaik DOTS is quite new. I never heard of Bevy. ECS is very popular but afaik it became popular within the last 5-8 years. Factorio started development 11 years ago.

We get high performance because:
1. We always focus on it. For almost every implementation detail we ask "what about performance?".
2. We code at a fairly low level, in C++. High level frameworks can easily make you forget about the basics like cache locality, context switching, branch prediction, avoiding unnecessary copying of data.
3. We try to use the correct data structures for performance.
4. We break OOP or clean code practices for the sake of performance, if necessary. The most common trade-off I see when writing code is do we want it simple, understandable, clean and respecting OOP or do we want it performant?
5. We profile a lot. Even with all of the above in mind, sometimes CPUs, RAM and compilers are magic and you just profile and see if your theory holds in practice.

And of course all these add development time. Factorio is a very well optimized game, but remember that we are making it for 11 years now.

fiwon123
Burner Inserter
Burner Inserter
Posts: 7
Joined: Fri Oct 20, 2023 2:27 am
Contact:

Re: Data Oriented Driven ( DOD ) / Bevy game engine

Post by fiwon123 »

Qon wrote:
Fri Oct 20, 2023 8:34 am
fiwon123 wrote:
Fri Oct 20, 2023 2:56 am
I really want to know the main point that made the factorio possible and very well optimized.

For now I'm just curious how is the best way to create a game with a lot of resource management and a lot of interaction without lose performance.
A lot about performance has been written about in FFFs.
And on the forum as well.

What did you search for before making the thread?
Hello,

Sorry for the late response.
Hmmm, In the forum I just searched for DOD, but I just saw I thread where some guys are discussing about how ECS is bad viewtopic.php?f=34&t=61021&p=387791&hilit=DOD#p387791

But as I saw that Factorio used some Entities things, I decided to create this thread to understand better haha. Sorry if I duplicated something old :P
I'm just curious how this game was created, maybe I won't create something, but I couldn't stop to think about it.

I saw now the FFFs things: https://www.factorio.com/blog/post/fff-147, I'll read more after, thanks.
FFFs is "Factorio Friday Facts"? Is like a news or a blog post?

Kind Regards,

Felipe Inoue

fiwon123
Burner Inserter
Burner Inserter
Posts: 7
Joined: Fri Oct 20, 2023 2:27 am
Contact:

Re: Data Oriented Driven ( DOD ) / Bevy game engine

Post by fiwon123 »

Twinsen wrote:
Fri Oct 20, 2023 8:44 am
I know a bit about ECS and I can say Factorio is not doing it.
We didn't really follow any frameworks/paradigms except OOP and some C++ practices.
Afaik DOTS is quite new. I never heard of Bevy. ECS is very popular but afaik it became popular within the last 5-8 years. Factorio started development 11 years ago.

We get high performance because:
1. We always focus on it. For almost every implementation detail we ask "what about performance?".
2. We code at a fairly low level, in C++. High level frameworks can easily make you forget about the basics like cache locality, context switching, branch prediction, avoiding unnecessary copying of data.
3. We try to use the correct data structures for performance.
4. We break OOP or clean code practices for the sake of performance, if necessary. The most common trade-off I see when writing code is do we want it simple, understandable, clean and respecting OOP or do we want it performant?
5. We profile a lot. Even with all of the above in mind, sometimes CPUs, RAM and compilers are magic and you just profile and see if your theory holds in practice.

And of course all these add development time. Factorio is a very well optimized game, but remember that we are making it for 11 years now.
Hello,

Oh, thank you very much for the answer. This is the answer I was looking for until now. I didn't know what paradigms you had used.
Good to know that you guys followed OOP, I'm breaking my head till know if they used it or mixed OOP with DOD too haha.

Thanks for the explanation about performance and how to make something with that purpose. That make sense, if you follow OOP and you code very well, you will reach a good result if you are thinking how to program thinking in performance first.
And yeah, for DOD I just saw someone talking on youtube and someone writing that is a good way to make more cache locality more performative... But as you mentioned on the second bullet it explain a lot.

The bevy (https://bevyengine.org) is a new game engine, I appreciate game engines open sources, like GODOT (https://godotengine.org) for example. I think the community contribute for a good purpose that is make games. I didn't contribute anything on the engine, but I already study a little on the start of game development and I saw that engine increase in terms of popularity.
Going back to bevy I just saw that it follow the same direction but this time using the DOD as the first principle. It make me curious because I don't know what it works in practice.
I don't know if it will became good or not in future... But interesting to know that someone is creating something thinking this.

Sorry for talking a lot, and thanks again.
The Factorio is not just a game for me, but a study for anyone that wants make something more optimized and follow good principle in game programming.

KInd Regards,

Felipe Inoue

fiwon123
Burner Inserter
Burner Inserter
Posts: 7
Joined: Fri Oct 20, 2023 2:27 am
Contact:

Re: Data Oriented Driven ( DOD ) / Bevy game engine

Post by fiwon123 »

Koub wrote:
Fri Oct 20, 2023 6:17 am
[Koub] Moving this to off topic subforum, feel free to discuss this here.
Sure, thanks a lot :D

Qon
Smart Inserter
Smart Inserter
Posts: 2118
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: Data Oriented Driven ( DOD ) / Bevy game engine

Post by Qon »

fiwon123 wrote:
Fri Oct 20, 2023 12:05 pm
Sorry for the late response.
Hmmm, In the forum I just searched for DOD, but I just saw I thread where some guys are discussing about how ECS is bad viewtopic.php?f=34&t=61021&p=387791&hilit=DOD#p387791

But as I saw that Factorio used some Entities things, I decided to create this thread to understand better haha. Sorry if I duplicated something old :P
I'm just curious how this game was created, maybe I won't create something, but I couldn't stop to think about it.
I haven't seen anything written on DOD by the devs, and I don't think I've heard about it before at all. I've heard about data driven and data oriented, but I don't really know the names of the techniques I use always, I just think about what the hardware has to do to execute my code and take that into account.

What I meant is, you should search for their writings on performance, not on their posts about DOD. Performance is a big and important topic, DOD is not.
fiwon123 wrote:
Fri Oct 20, 2023 12:05 pm
I saw now the FFFs things: https://www.factorio.com/blog/post/fff-147, I'll read more after, thanks.
FFFs is "Factorio Friday Facts"? Is like a news or a blog post?
It's their weekly blog, yes. Some posts are about more about performance, others less. And a lot of questions on performance have been answered all over the forum, but quite scattered. If you could just scan through all Wube member posts that would help, but there's not really any keywords like "performance" that will always appear for that. Also, the code dev team have more to say on performance, but there's a lot about other things like bug fixes that is also mixed in. The search functionality doesn't provide any easy ways to filter away subforums. You can do a search on a forum user and supply a keyword list with | as separator for several keywords that might be found. But when I tried it I got 0 results while using 1 keyword gave a lot.
Factorio Staff
On forum, something like this:Reseding on "performance"

The FFFs aren't in the forum so I guess you would have to use an external search engine for that.

fiwon123
Burner Inserter
Burner Inserter
Posts: 7
Joined: Fri Oct 20, 2023 2:27 am
Contact:

Re: Data Oriented Driven ( DOD ) / Bevy game engine

Post by fiwon123 »

Qon wrote:
Fri Oct 20, 2023 3:37 pm
fiwon123 wrote:
Fri Oct 20, 2023 12:05 pm
Sorry for the late response.
Hmmm, In the forum I just searched for DOD, but I just saw I thread where some guys are discussing about how ECS is bad viewtopic.php?f=34&t=61021&p=387791&hilit=DOD#p387791

But as I saw that Factorio used some Entities things, I decided to create this thread to understand better haha. Sorry if I duplicated something old :P
I'm just curious how this game was created, maybe I won't create something, but I couldn't stop to think about it.
I haven't seen anything written on DOD by the devs, and I don't think I've heard about it before at all. I've heard about data driven and data oriented, but I don't really know the names of the techniques I use always, I just think about what the hardware has to do to execute my code and take that into account.

What I meant is, you should search for their writings on performance, not on their posts about DOD. Performance is a big and important topic, DOD is not.
fiwon123 wrote:
Fri Oct 20, 2023 12:05 pm
I saw now the FFFs things: https://www.factorio.com/blog/post/fff-147, I'll read more after, thanks.
FFFs is "Factorio Friday Facts"? Is like a news or a blog post?
It's their weekly blog, yes. Some posts are about more about performance, others less. And a lot of questions on performance have been answered all over the forum, but quite scattered. If you could just scan through all Wube member posts that would help, but there's not really any keywords like "performance" that will always appear for that. Also, the code dev team have more to say on performance, but there's a lot about other things like bug fixes that is also mixed in. The search functionality doesn't provide any easy ways to filter away subforums. You can do a search on a forum user and supply a keyword list with | as separator for several keywords that might be found. But when I tried it I got 0 results while using 1 keyword gave a lot.
Factorio Staff
On forum, something like this:Reseding on "performance"

The FFFs aren't in the forum so I guess you would have to use an external search engine for that.
Hello,

Oh, Sure! Thanks a lot. Yeah I'll keep it in mind.

I'll search for FFFs and analyze better everything. Thanks for the direction :D .

Kind Regards,

Felipe Inoue

EustaceCS
Inserter
Inserter
Posts: 42
Joined: Tue Dec 15, 2020 5:41 am
Contact:

Re: Data Oriented Driven ( DOD ) / Bevy game engine

Post by EustaceCS »

fiwon123 wrote:
Fri Oct 20, 2023 2:56 am
I'm don't know but till now I just see more about OOP. But DOD and Bevy engine is calling my attention now, just for hobby thing haha.
Define "hobby".

From my point of view, for "just for hobby" you either
- pick an engine which allows you actually programming the actual game, RPG Maker and its "clones" being worst offenders best examples. Good if playable game is your ultimate goal;
- or pick an engine which allows actually coding (with pseudo-language or even point-and-click graph building) what you need, automatizing what you don't, Construct 2 and GoDot being fine examples. Good if mastering best practices is your ultimate goal;
- or go low-level with pure coding language + some extra frameworks for things which are too massive to code from scratch but too important to drop (i. e. work with sound), dreaded Mono/.Net being kinda adequate examples of that.

I. e. even if it's "just a hobby" you have to line out both direction and depths you're willing to dig to.

P. S.
I really want to know the main point that made the factorio possible and very well optimized.
I assume that it's "colossal amount of paperwork".
It's not the answer you expect.
But it's probably the only way to go with project of such complexity. Since without it no platform can "fix" inevitable flaws and oversights.
This antique article (published in Russian originally) sums this approach up. If it STILL shows up in Russian, refresh the page few times. For some reason, Google translates it really slowly.
I don't know if any similar documents written in English originally exist (and if some equally well written documents are available elsewhere for free, I'll be much obliged for a link or three to some).

fiwon123
Burner Inserter
Burner Inserter
Posts: 7
Joined: Fri Oct 20, 2023 2:27 am
Contact:

Re: Data Oriented Driven ( DOD ) / Bevy game engine

Post by fiwon123 »

EustaceCS wrote:
Wed Oct 25, 2023 11:45 pm
fiwon123 wrote:
Fri Oct 20, 2023 2:56 am
I'm don't know but till now I just see more about OOP. But DOD and Bevy engine is calling my attention now, just for hobby thing haha.
Define "hobby".

From my point of view, for "just for hobby" you either
- pick an engine which allows you actually programming the actual game, RPG Maker and its "clones" being worst offenders best examples. Good if playable game is your ultimate goal;
- or pick an engine which allows actually coding (with pseudo-language or even point-and-click graph building) what you need, automatizing what you don't, Construct 2 and GoDot being fine examples. Good if mastering best practices is your ultimate goal;
- or go low-level with pure coding language + some extra frameworks for things which are too massive to code from scratch but too important to drop (i. e. work with sound), dreaded Mono/.Net being kinda adequate examples of that.

I. e. even if it's "just a hobby" you have to line out both direction and depths you're willing to dig to.

P. S.
I really want to know the main point that made the factorio possible and very well optimized.
I assume that it's "colossal amount of paperwork".
It's not the answer you expect.
But it's probably the only way to go with project of such complexity. Since without it no platform can "fix" inevitable flaws and oversights.
This antique article (published in Russian originally) sums this approach up. If it STILL shows up in Russian, refresh the page few times. For some reason, Google translates it really slowly.
I don't know if any similar documents written in English originally exist (and if some equally well written documents are available elsewhere for free, I'll be much obliged for a link or three to some).

Hello,

I didn't have any objective or a dream for now... Just using my free time to study and search something that I always thought a lot. But yeah... have an objective is good for anything you do in life. I'm trying to find something from the start, but just thinking and trying to enjoy with I already have haha :D

I read your bullet points and maybe I'm more in the first and second one.
- The first one maybe is more to a simulation project that I'd like to create ( that new and I don't know yet, just looking for similar games are being good till now ) . Because I had a dream when I started to study programming and an objective when I started study game development that was create a SAO world... But just a dream kid.
In the final, I just used this to break some barriers in life, prove to myself that I could learn something new and work with it at some point. I didn't reach 1% to create something with this proportion, but I definitely learnt a lot about game development and I had the experience to work with it.

- Now talking about the second one, Its something that I thought from the start of development as I saw people helping in the creation of a game engine as GODOT to help other developers in your game creations. That something incredible and admirable, because its open source and everyone can contribute someway with this. But yeah, I feel I can just admire for now, maybe I can experiment at some point.

Well but just some game development things. I already have a job that I can focus in game programming and I'm very happy doing this for now.
I'm looking just for pauses, I'm a guy that like technical issues and I need this in form as studying or practicing some way, because I focused a lot and I don't know I feel empty if I try to remove it.
And I'm learning how to do other things in life without thinking just in game development...

I'll read the article that you recommended after. Thanks a lot.
Yeah I don't worry so much how many paperwork I need looking for as I didn't anything in mind to do for now as I can consider a objective for my life.
Well independently what will happen. I just thinking more how I can enjoy more . Weird but yeah... :D

Enjoy the path not the end.

Kind Regards,
Felipe Inoue

immibis
Filter Inserter
Filter Inserter
Posts: 303
Joined: Sun Mar 24, 2013 2:25 am
Contact:

Re: Data Oriented Driven ( DOD ) / Bevy game engine

Post by immibis »

Factorio is using something akin to ECS/DOD, simply because that's what you converge on when you try to make something fast on current hardware. It doesn't follow this strictly and universally, but it does when performance matters, like with the belts and the power grid. One of the FFF blog posts described the new (now old) belt system, where belts don't keep updating the positions of items on them, but only track their relative positions and compute absolute positions when needed. And the power grid keeps all the buildings' energy nodes in one big array.

Post Reply

Return to “Off topic”