#ECS Cellular Automata

1 messages · Page 1 of 1 (latest)

weary crown
#

I'm working on a voxel game with physics using Unity and ECS. I store all the voxels as a 3D array, which I then convert into a one-dimensional array. To move voxels, I simply change the ID of the relevant voxels, creating the illusion of movement. Is this approach correct in terms of ECS?

drowsy storm
#

If it works and meets your requirements, can it be the wrong approach? 🙂
Looks cool btw

weary crown
#

This is only day 3 of learning ECS, so there are a lot of things I just don't understand...

drowsy storm
#

well you shouldn't use entities foreach ever as it's deprecated

#

so i hope you mean ijobentity

drowsy storm
weary crown
weary crown
drowsy storm
#

EFE causes slow iteration times and will be removed in the 2.0/entities for all update

#

IJobEntity and EFE both produce IJobChunk jobs

weary crown
drowsy storm
#

well one iterates arbitrary data (usually a native array)

#

one iterates entities

#

different tools

weary crown
# drowsy storm different tools

I understand the difference in terms of behavioral logic. I am interested in the difference in execution speed. Roughly speaking, if you make a million components and a million entities with a component and pass them through IJobParallelFor and IJobEntity, which one will be faster?

drowsy storm
#

well to use ijobfor on components you would have to first copy them all to an array

#

and if you make chagnes, then copy them back to entities

#

thats never going ot be remotely as fast as just working on the entity data directly

wanton garnet
# weary crown I understand the difference in terms of behavioral logic. I am interested in the...

It should probably be mentioned that when you have an IJobEntity you can use ScheduleParallel to have it be scheduled in parallel. This will automatically parallelize it per chunk.

You might want to look at some of the submissions to the Dots Community Challenge #1 which had the game of life as the theme. I think most people ended up making entities that stored chunks of array-data on them directly, without the use of native-arrays.