Parallel Lua A 2D Grid Pathfinding problem with tables

Context, a 2D game that uses a canvas to visualize the game. I’ve been trying lately to implement multithreading in my pathfinding system as its a task that takes about 2-5ms on average and its gonna happeen waaaayyy too there are going to be hundreds of ships on game so often that well I figured out the way to go around this is with multithreading. Process the pathfind one time and then reproduce the steps.

So I started to work on it.

I’ve done my research and whilest the docs are really scarce i ended up with ActorGroup2 which should work perfectly, im doing the reqs correctly everything should be parallel safe buuuut now heres the issue. Multithread hates arrays, I’m not completely sure if its the way the module works by sending a bindable event and there are better options out there or if parallel lua genuinely hates grids tables but it simply takes way too long to process

The grid is about 500x500 holding 5 different values per cell in this example, so I can understand why copying it would slow down the game, but why should it copy it? there isn’t a workaround for this? I know that for Voxel maps it works as a charm so I’m not understanding how working with 1 dimension less would be so troublesome

And yes, its 100% the grid because removing it from the event fire it just goes instantly, but how im supposed to do a pathfinding without a grid to read.

All I need is a way to work with my Grid ={ {CellValues} } in a multithread

I really hope someone around here that is more awknowledged than me would lend me a hand, I’m open to figuring another options and sending more pics if needed

1 Like

The answer is Shared Tables, theyre the solution haha, they don’t need any processing to duplicate

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.