Search Unity

Should DOTS code be handled functionality instead of OOP?

Discussion in 'Entity Component System' started by Manablight, Mar 31, 2020.

  1. Manablight

    Manablight

    Joined:
    Aug 11, 2014
    Posts:
    4
    I learned to program using OOP. Code for DOTS projects looks like functional programming(what little I know about it) with the heavy use of lambdas functions and style of building. Am I correct? Or is it a mix of both? If so would do you have any book or site recommendations to help wrap my head around functional programming.
     
  2. Grimreaper358

    Grimreaper358

    Joined:
    Apr 8, 2013
    Posts:
    789
    It's not functional programming it's Data-Oriented Programming. If you want to learn more about it you can check out these tutorials which go over all the basics of ECS, Jobs, and burst. All of these together make up (DOTS) Data-Oriented Technology Stack.

    The first videos in each of these playlists explain things well.

    https://www.youtube.com/playlist?list=PLIbUZ3URbL0Eqk2o5rMyiLPtCoWuLAZwg

    https://www.youtube.com/playlist?list=PLzDRvYVwl53s40yP5RQXitbT--IRcHqba

    https://www.youtube.com/playlist?list=PLS6sInD7ThM3L4AtxjixzA-3vRUjAssa4

    And if you want something more advanced then you can check out the Data-Oriented Design Book

    http://www.dataorienteddesign.com/dodbook/node1.html
     
  3. RichardWepner

    RichardWepner

    Joined:
    May 29, 2013
    Posts:
    33
    @Manablight: functional programming usually uses immutable data. Rather than removing an entry of an array, a new array without this entry (or another datatype with a reference to the original array and the information "without element at index X") would be used. If you want to learn more about this, you could look for mutable vs. immutable, and the somewhat related topic of shared and non-shared data. (Related, since you can either have mutability or a shared state for easy/easier multi-threading.)