Kyrium
Kyrium
SMSatisfactory Modding
Created by FreakinaBox on 11/10/2024 in #modding-resources
How to make your own Factory Tick ish group
Never change a running system πŸ˜‚ but yeah maybe if we need to touch that part we can also refactor this πŸ˜„
12 replies
SMSatisfactory Modding
Created by FreakinaBox on 11/10/2024 in #modding-resources
How to make your own Factory Tick ish group
Of course is not perfect but it’s run πŸ˜„ also don’t like some parts of this code ^^ since it’s not really clean πŸ˜„
12 replies
SMSatisfactory Modding
Created by FreakinaBox on 11/10/2024 in #modding-resources
How to make your own Factory Tick ish group
Yeah both is the same thing πŸ˜„ In RP I write that thing idk 2/3 years ago? πŸ˜‚ in DS it was Basically a copy of this.
12 replies
SMSatisfactory Modding
Created by Kyrium on 11/13/2024 in #modding-resources
Draw Abstract Instances in Editor
@Rex https://github.com/satisfactorymodding/SatisfactoryModLoader/pull/268/files I see this PR I think thats a better way also because it doesn't need any header edit's
3 replies
SMSatisfactory Modding
Created by FreakinaBox on 11/10/2024 in #modding-resources
How to make your own Factory Tick ish group
You can significant improve the performance if you tick a lot of actors in this way if you group them and limit the threats otherwise it overflows the queue. thats some code from RP solar panel subsystem . it also comes closer to the FactoryTick
void ARPSolarSubsystem::UpdateSolarPanelsRotation(const float dt)
{
FCriticalSection Mutex;
if(bSolarPanelsAreDirty)
{
mSolarPanelGroups.Empty();
mSolarPanelGroups.SetNum( 100 );

if(mSolarPanels.Num() <= 0)
{
return;
}

const int32 NumPerGroup = FMath::Max( FMath::DivideAndRoundUp( mSolarPanels.Num(), 8 ), 1 );
ParallelFor( 8, [&, NumPerGroup](const int32 Index)
{
TArray<TArray<ARPSolarPanel*>> Grouping;
Grouping.SetNum( 100 );
for(int32 Member = Index * NumPerGroup; Member < FMath::Min( (Index + 1) * NumPerGroup, mSolarPanels.Num() ); Member++)
{
const int32 GroupIndex = fmod( Index, 100 );
Grouping[GroupIndex].Add( mSolarPanels[Member] );
}

for(int i = 0; i < Grouping.Num(); ++i)
{
if(Grouping[i].Num() <= 0)
{
continue;
}

Mutex.Lock();
mSolarPanelGroups[i].Append( Grouping[i] );
Mutex.Unlock();
}
} );
}

for(int32 I = 0; I < mSolarPanelGroups.Num(); ++I)
{
bool Dirty = bSolarPanelsAreDirty;
if(mSolarPanelGroups[I].Num() == 0)
{
continue;
}

const int32 NumPerGroup = FMath::Max( FMath::DivideAndRoundUp( mSolarPanelGroups[I].Num(), 8 ), 1 );
ParallelFor( 8, [&, I, BuildableSubsystem, Allowed, Dirty](const int32 Index)
{
for(int32 Member = Index * NumPerGroup; Member < FMath::Min( (Index + 1) * NumPerGroup, mSolarPanelGroups[I].Num() ); Member++)
{
mSolarPanelGroups[I][Member].CustomTick(dt);
}
} );
}

bSolarPanelsAreDirty = false;
}

void ARPSolarSubsystem::OnSolarPanelBuild(ARPSolarPanel* SolarPanel)
{
if(ensureAlways( SolarPanel ))
{
if(mSolarPanels.Add( SolarPanel ) != INDEX_NONE)
{
bSolarPanelsAreDirty = true;
}
}
}
void ARPSolarSubsystem::UpdateSolarPanelsRotation(const float dt)
{
FCriticalSection Mutex;
if(bSolarPanelsAreDirty)
{
mSolarPanelGroups.Empty();
mSolarPanelGroups.SetNum( 100 );

if(mSolarPanels.Num() <= 0)
{
return;
}

const int32 NumPerGroup = FMath::Max( FMath::DivideAndRoundUp( mSolarPanels.Num(), 8 ), 1 );
ParallelFor( 8, [&, NumPerGroup](const int32 Index)
{
TArray<TArray<ARPSolarPanel*>> Grouping;
Grouping.SetNum( 100 );
for(int32 Member = Index * NumPerGroup; Member < FMath::Min( (Index + 1) * NumPerGroup, mSolarPanels.Num() ); Member++)
{
const int32 GroupIndex = fmod( Index, 100 );
Grouping[GroupIndex].Add( mSolarPanels[Member] );
}

for(int i = 0; i < Grouping.Num(); ++i)
{
if(Grouping[i].Num() <= 0)
{
continue;
}

Mutex.Lock();
mSolarPanelGroups[i].Append( Grouping[i] );
Mutex.Unlock();
}
} );
}

for(int32 I = 0; I < mSolarPanelGroups.Num(); ++I)
{
bool Dirty = bSolarPanelsAreDirty;
if(mSolarPanelGroups[I].Num() == 0)
{
continue;
}

const int32 NumPerGroup = FMath::Max( FMath::DivideAndRoundUp( mSolarPanelGroups[I].Num(), 8 ), 1 );
ParallelFor( 8, [&, I, BuildableSubsystem, Allowed, Dirty](const int32 Index)
{
for(int32 Member = Index * NumPerGroup; Member < FMath::Min( (Index + 1) * NumPerGroup, mSolarPanelGroups[I].Num() ); Member++)
{
mSolarPanelGroups[I][Member].CustomTick(dt);
}
} );
}

bSolarPanelsAreDirty = false;
}

void ARPSolarSubsystem::OnSolarPanelBuild(ARPSolarPanel* SolarPanel)
{
if(ensureAlways( SolarPanel ))
{
if(mSolarPanels.Add( SolarPanel ) != INDEX_NONE)
{
bSolarPanelsAreDirty = true;
}
}
}
12 replies
SMSatisfactory Modding
Created by StolleJay | Daniel on 11/10/2024 in #help-developing-mods
Unexpected crash after mod deletion
I think that the lightweight subsystem try to load this class that saved in the subsystem and crash because it doesn’t exists anymore.
25 replies
SMSatisfactory Modding
Created by sunyudai on 10/27/2024 in #help-using-mods
[More Swatches] - some paint swatches overwrite Metallic textures
I know there will be a fix today wasn’t available to fix that yesterday
6 replies
SMSatisfactory Modding
Created by Averdrity on 10/27/2024 in #help-using-mods
Installed some mods and it crashes.. :(
ah wait you installed KUI allone yeah there is an issue not sure why thats happen tbh ^^"
13 replies
SMSatisfactory Modding
Created by Averdrity on 10/27/2024 in #help-using-mods
Installed some mods and it crashes.. :(
execCallMathFunction is fun to debug.. ^^"
13 replies