Posted February 28, 20223 yr It's me again. I'm currently studying Dijkstra Algorithm and BFS (Graph theory) to make this thing work. And I've looked up a few codes like https://github.com/refinedmods/refinedpipes/tree/develop/src/main/java/com/refinedmods/refinedpipes this. Q. If I use BFS to measure the distance to find the shortest, is there any different thing with using Dijkstra or not? I'm more used to C rather than Java, so I coded a few BFS(Also DFS) problems with C. Let's say that I could make cable networks into a certain graph, then the edges of the graph will have no weight, which means that I can use BFS, isn't it? Sorry that I have poor knowledge about theory yet because I'm a student. Edited February 28, 20223 yr by 1HA
March 3, 20223 yr Author On 3/2/2022 at 9:44 AM, MFMods said: yes, you can use bfs. what are you trying to do? Glad to hear that I can use BFS. I need some cable to connect the power. I used a 3d array in the C test code to get the "map". And it worked pretty well. However, in minecraft, the server can't receive the cable network data with a 3d array cause it's inefficient. Therefore somehow, as others did, the server has to receive the data with a linked list? maybe? And I have no idea what to do. thx for replying
March 3, 20223 yr i think this "server receiving things" is confusing you. server knows the stuff you see in the world - blocks, sheep, zombies. the only time you send information to server is when you receive a mod-specific keypress or you open a gui window and interpret clicks into something the server would know about. even things like immersive engineering cables - player sets two endpoints, client will have to draw a "cable" all the time, but server should know about endpoints of each cable all the time - no need to send anything manually. and before you tackle this, look into more dynamic algorithms. do not calculate unchanged distances multiple times - store them somehow, and when another cable piece is added (i assume you are using blocky cables), see if any of the distances might be improved thanks to the new block; and if i destroy a block, recheck distances. do not do any non-trivial calculations when worlds "tick" and when block entities "tick".
March 4, 20223 yr Author Thx I'd like to ask you one more thing. The current of the cable might constantly change(caused by generators and machines). In this case, the server has to fix the change every tick, right?🤔 And I used neighborChanged() to check distances Edited March 4, 20223 yr by 1HA
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.