Advanced Question involving structural integrity linkage calculation

Hey everyone! I’m having a lot of trouble figuring out an issue for my game. I currently have a system employed that allows people to build using a rust linkage system, which basically has attachment points on parts and they can link together. It looks a little something like this:

The problem is, I cannot find an efficient way to calculate the “Structural Integrity” of a given part based on how far it is from the ground / how well supported it is. Think of games like Valheim or PolyBridge. (mostly valheim). I need to devise an algorithm that starts from the base at an integrity of 1, and move to all of the connected parts and go from there.

To make it easy on myself, I made sure to include a dictionary of all parts and their attributes:

local StructureTemplate = {
[“Grounded”] = false,
[“Player”] = nil,
[“Building”] = true,
[“Health”] = 1,
[“MaxHealth”] = 100,
[“Integrity”] = 1,
[“Connections”] = {},
[“AttachedTo”] = {},
}

However, my problem still stands.

Any ideas would help!

Could u explain more in depth? I read ur post 3 times and I’m still confused

Check out this algorithm

I’d imagine to start off, you’d have to to start with every part that’s grounded (which gives them a default integrity of 1), spread out through their connected parts one layer at a time (refer to the algorithm I linked above), and reduce the integrity the farther it goes.

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