PurpleKingdomGames / indigo

An FP game engine for Scala.
https://indigoengine.io/
MIT License
636 stars 60 forks source link

Investigate: Supplying CloneTileData/CloneBatchData as a raw array #621

Open davesmith00000 opened 12 months ago

davesmith00000 commented 12 months ago

The point of cloning is to sacrifice usability / convenience for raw speed, but at the moment we force all users to allocated an object per clone. Could we offer an alternative where brave users could provide a packed array of raw data?

davesmith00000 commented 12 months ago

Had a quick snoop around the engine to refresh my memory. Essentially what happens is that the engine currently takes the list, loops over it, and sets attribute arrays with all the values.

I think we could change the internal process so that at the DisplayObjectConversion point, we convert the given batch of data objects into a flat array, and use that to do the engine updates. Then offering a way to provide that flat array directly should be trivial.

davesmith00000 commented 12 months ago

Parking this for now: https://github.com/PurpleKingdomGames/indigo/pull/629#issuecomment-1794244701