#plugins-dev-chat
1 messages ยท Page 108 of 1
50 for loops my beloved
There's no premature optimization for SL whatever you do will likely have a positive impact
There's a point where premature optimization is all well and good but you guys take it way too far sometimes
Especially on limited hardware like you'd have running multiple servers on one machine
Telling people to shave off nanoseconds when they don't need to
some of us just like optimizing lol
Spawning 100_000 item in every room ๐ฅ in same tick
i like spans
It's a big part of my skillset 
john if statement
You guys are the case in point of "...the true issue is that programmers have worried about efficiency much too much, in the wrong places, and at the wrong times."
this is just decompiled code
Switches my beloved
yea ik lel
No I optimize aggressively because I work on games that wanna target 64-100 players per server
just found that hella funny seeing it
who cares
Good for you, that doesn't mean everyone else needs to do what you do
funny monster game
Doesn't mean it's a bad thing
You guys are the ones talking to me about his
Good habits and good skills to have
my singing monsters
No, but small optimizations like a "are you actually in need of viewing this data? No? Okay we dont gotta give you it"
A website doesnt need to send every single page at once
Nah send me the admin page too
All I did was tell one person the optimization set forth is unnecessary and you guys wanted to start talking about how "important micro-optimizations are" and I think you all are fucking crazy
Not a bad idea
With the full DB dump
who isnt a bit whacko in here ๐
You guys are all likely victims of the fallacy of always needing premature optimization
Error driven programming is how I work
There are whole books written about why premature optimization isn't always a good thing
I get your point but I don't think it was overkill in this case
Not with SL's bs with RPCs
this is REAL ^ Get an error then fix then repeat
that must be a boring ass book
What if you never be mature?
Just in nature
If it doesn't have any noticeable performance impact then it is overkill
no ?
Honestly it probably would at higher player counts
It's written for nerds
Yes?
If you optimize something and it has no impact on performance then it's not a good optimization to include
Again SL runs on hopes and dreams I've done stuff that looked minuscule and somehow improved performance
You're making the assumption that one primitive is going to substantially drag down performance
what if you didnt do 5 optimizations that "didn't improve performance"
And that's arguably wrong because you need to think about future work on a codebase. It might not look like much but it piles up.
Question 1:
Do you need the performance?
If not, you don't need to optimize
That's my entire fucking point
That's how you get tiny things that suddenly eat milliseconds later down the line
I think I remember the + and - Vector3 patch, or something, it was not a huge but a noticable impact
You guys keep thinking "everyone needs to optimize everything"
Not everyone is hogging resources with 1500 primitives
Don't need the performance? Why fucking optimize
There's 0 point
That's what I've been saying the whole time and it's gone over all of your guys' heads
Who doesn't need the performance in SL???
huh
I don't understand how this is a complicated point of view
My optimalization on my Custom Items was literally dont create new classes
Like okay sure but who's gonna go "fuck yeah ruining my server's tps and idc"
Missed the point
I give up
If you're ruining the server TPS then you need the optimization
Hi eve
Okay and my tiny piece of code that could be done better doesn't affect tps
100 of these later I lost 20 tps
Cool so optimize it
And nothing screams out at me about what's eating performance
How? No idea where to start I can't profile the game 
Oops should've dealt with it earlier
That's entirely a skill issue
Deal with in the root
Dont make plugins
"skill issue that you did smth w no noticeable tps drop a few times and now there's drop"

๐ญ
Yes
It is
stop the root problem. no more living
If you use it 100 times it should be pretty fucking obvious why you're losing TPS
gg
I'm getting brainrot
Just don't be stupid
Goofbye
Arent we all
You say optimizing bad and then it's a skill issue if it piles up
Optimizing isn't bad
Like, hello?
Premature optimizing is sometimes bad
hellom
omfg
You're, again, missing the point
Good luck finding the performance hog in 45 plugins when it's tiny things that pile up
You have no profiler, again
this entire started based on "pls make distance check to avoid giving someone 60 network msgs a second that they cant see because theyre on the other side of the planet"
Im going to bed
Which is why I aggressively optimize else you fall into that pitfall
Well sleep
my profiler is disabling everything untill it works better 
If you write something and reuse it 500 times it should be obvious that that is probably part of what's weighing down the performance
No I mean if you write 100 different pieces of code that gradually add up
You didnt optimize them because it's tiny
I think you overestimate the size of the average plugin
And now you're fucked
FunFact MIRROR has something like that defaultly you just have to add it into network object
You're acting like everyone has 45 plugins and a large codebase
Goodnight slejm
Right so all you've said is only valid for small communities?
Goodnight eve
Please feed my pet raccoon for me
goognight
What I'm saying is valid for smaller plugins
Be evil in your dreams like a devil
If you have a large plugin, sure, you may need the optimization
But if you're spawning one or two primitives, why bother
My whole point is when people come in here asking for help, you guys act like they 100% need to optimize the shit out of it
It's okay to have slightly unoptimized code when working small-scale
(not SL code btw)
OFC its mine
lel
I could take the time to look at every little nook and cranny of my plugin and hyper-optimize it, but I have no need for it because I don't need the performance
Decompiled exiled switch
Because my server runs steady 60 tps
And I don't do a crazy amount of stuff in my plugin
(its a switch but IL decided to be if)
Not everybody has a Ryzen 9 for a server
I dont host shit, I playing with my own pc
Oh, hey Cyn
I didn't know you were on here
So if I having issues with the server on my home pc, then definitely it will be fucked when it goes to public.
I have a lot of shit open and when I test my plugins I firstly write code that "should be good, fix later". Yes indeed for testing you dont need to write a 0 alloc , clean whatever code, but later on when you have a full solution for it then it is good to make your own code not a mess, and somewhat optimize it
Making your future self better to less time to rewrite shit. ofc you also doesn't need to write code like the unsafe iterator in list to be optimized
There is also many cases where in SL itself could be optimized in such ways that it requires less network packets, more friendly api, easy access to things.
tldr;
- Make whatever
- Write //todo on shit thats not amazing
- if its bad when working, fix that stuff
- if still bad, blame northwood via cope seeth and mald and move on
Mirror also have some solution for those, well not for all.
Some code in the game is old af so, and probably not been touched since. (ie: 096)
Anyway sleepy time
Slowly inching out of SL stuff heh
I see
ngl i got so burned out
๐ฃ๏ธ ๐ฅ ๐ฅ
I like this Fallout guy
๐ฅ
dead chat
Because someone sleep at this time
there are definitely cases where you can super easily save time
like NOT GETTING THE TRANSFORM 3 TIMES IN ONE METHOD
say you're writing a UI library
it's really not that difficult to convert a .Where() to a if (!) continue
so real
Make the where static

That's on you
Ye
you think?
So?
That means nothing
At least not for the point I'm making
Make your own

Consider that some devs don't want that 
I don't want it
I no longer lead the labapi, but it's literally 1 line to register a handler
Also not everyone wants that
and also yeah it takes a minute to write a base class to do it for you
if it's really what you want
Making your own also lets you control the order in which you register them
Which is something I'm actually doing right now
when you realize that delegate invocation order is not deterministic
also, looking at you, func event
The Big Locker is the old mid one?
This one?
because i totally have the old model and i don't wanna update it but just doing some stuff
no
which one is it?
idk what you mean by big locker
The black big one
then
Yea
what's the issue ๐ญ
Because the 3D model on SL is called BasicLockerMid
The 3 locker replaced by this one
gotta love windows search
Love how i replace everything with basic colors just because i didn't want to import full model
MiscLocker?
wasn't it replaced with the normal one
i guess they didn't rename the prefab
ig
I like it alot that it doesn't have texture
and you can see the colors
idk why at the time i did it like this
its almost 8 months ago i did this
bruh I made the server SIGSEGV by doing a patch
https://ratcentral.skibiditoilet.net/๐/0v0f1qiu.png
Btw by checking the wiki, yes its the correct one
@unique crane do you know if the like size changed so in a way like is it longer?
or smaller
0 clue
Guys wtf is wrong with the client
https://ratcentral.skibiditoilet.net/๐/lg6n9n6d.png
For the server this is surface, for everything this is for surface BUT Not for the client, like how do i trick the client into thinking this is surface even tho IT SHOULD BE SURFACE
Where can I changed SCP1576's cooldown?
Its hard coded
but you can change it
by transpilers or by prefixing ig
Scp1576Item::ServerStopTransmitting contains it
Thanks I will try to do it ๐
Do not understand as well
I noticed that based on height, you cannot spawn primitives and things starts to glitch out concerning colliders / desync
I mean im higher than the surface by 20 because you know colliders and stuff
but primitives do spawn fine
and im still inside the lovely Waypoint
they spawn fine, yes, but at some point, if you try to walk on them, you die 
x: 0
y: 352
z: -42
This is where they spawn
Oh i don't have that issue
for alot of reasons :3
but yea i need to find a fix
if you spawn it at normal position and then move it?
by normal I mean expected surface location
no because if you join and leave
then the issue still happens
interesting
I think i should bug report it?
does it happen with other prefabs?
im waiting for david to respond or another dev
wait is this prefab at all
No
yes
very interesting
Lockers are prefabs
I assume this is the older locker right?
I would assume that older locker is not using the waypoint system, but newer one?!
Sounds like a bug
Standard locker got updated
like all of the others
so its still technically old one but with a new model
ah
https://ratcentral.skibiditoilet.net/๐/fo7u1xk9.png
The problem doesn't trigger on the server but just on the client
which makes me think that the server is doing something different
When are you spawning the structure
Is this your own image hoster site btw?
no i use e-z.bio
After Map
Do it after OnWaitingForPlayers
Is that still inv only?
Yea after that
the player is already spawned
and everything
its in a select screen
weird
Should i report it as a bug?
because yea this is a big issue, and probably need to delay the stuff i was doing :3 (until this gets fixed)
I guess
git or LabAPI?
Labapi
You sure? because this is base game
i did spawn it with base game
obv no
Well then
Yea
You need to call StructurePositionSync.Start
Its client side
im 100% sure
Well
check the screenshot attached
it spawns for the server fine
and spawning it anywhere else works fine
just on surface
Huh
hmm, could you try using the labapi wrappers to spawn it on surface?
client side labapi wrapper
The problem is base game
let me see
not really labapi
if it works with sloc, it's zero's fault
Im 100% sure its not my fault
because i can spawn them everywhere else
but NOT in surface
send exact spawn pos
(0, 356 / 352, -42)
Here's the coordinate
Read the bug report they are inside
right
but here's
forgor already
the spawn location for the map is 352 but locker is 356
but in any case both of them don't work
so
Wtf?
you forgot to write the StructurePositionSync stuff
No?
sloc or labapi?
So its Zero moment isnt it
I spawn them on the server?
sloc
can you try with labapi
yes
i 100000000000000000% spawn them on the server
or does sloc use labapi
does labapi has structure wrapper spawning?
yeah
since when
it should handle it correctly iirc
again
As of rn i can show it to you in vc
Doors are still pending pr ๐ญ
call StructurePositionSync.Start
Show us the code then
oh
there's no create method for structures
i guess its still not merged
xddd
UnityEngine.Object.Instantiate(instance); (which is locker)
NetworkServer.Spawn(instance);
thats it
I think this is honestly stupid
because Start is 100% called
else how the server does have it
but you've spawned it already
what?
instantiate
networkserver.spawn
on the next frame, start gets called which sets network props
but it's too late
the problem was much simpler
idk who's the smart pants at nw
but the solution was just Start that Component
because IT NEVER starts
๐คฆโโ๏ธ
i told you 3 times
I just tried as a joke because ITS A START it should be STARTING
btw closed it myself
with the solution
you'd think
but that's not how unity works
and nw did not think through unity
when writing this
TryGetComponent 
GetThisComponentOrCrash
OH LOL
the magic of Loot , locker don't call loot
Locker.Loot is never called ;(
when im spawning them they spawn with default items
even tho i change them
Discord search sucks so good luck
Real
I just do a patch
because im doing it for just one plugin
not for meow
what patch where
[HarmonyPatch(typeof(Locker), nameof(Locker.Loot), MethodType.Getter)]
public class ChambersOverride
{
public static bool Prefix(Locker __instance, ref LockerLoot[] __result)
{
if (!LockerLoot.Instance.Config.Loot.TryGetValue(__instance.StructureType, out List<ConfigLockerLoot> loots))
return true;
__result = loots.Select(x => x.ToLockerLoot()).ToArray();
return false;
}
}
Its just the same as Config LockerLoot but that works for Yaml
Loot is a field
there's no getter
;(
๐
did you get a big error when patching?
no
no
uh
how about you patch ServerFillChambers and set Loot there

Why not peak at what an existing working implementation does
Ffs
The source code is literally right there bro
Making your life harder by doing everything except for looking at something that already works
How can I make a pickup's model invisible?
you can't
delete it 
Invisible depends how but you could set the size to 0
then you can't pick it up 
or else you make a fake one by using interactable toys
but no physics 
Explode
Instantiate the Object instead of spawning it, makes it only exist for the Server
No one can pick it up though
If I set IsAllowed to false on usingitem then it brokes the item and can't be used anymore PepeHands~1
bug moment
XD
i think it's just auto event, unless you mean the gun
no the gun
and i think i still have the src of the Counter strike event done by maro and made by Riptide
so
that one sadly is impossible to bring back
code has changed tooooo much
@celest thorn This iw aht I trying to make rn
https://www.youtube.com/watch?v=r09m7bkdpNQ
Someone in the QA team asked me to do a tourney for SL like that
still haven't decided
but neither excluded it
rn im doing another tourney that im doing
Most of the stuff is easy to do
i would say remove some weapons
and it could be cool
as an FFA type of gamemode
i still have no idea how to make the line effect like from the discruptor
without need to fire the actual one
i've never played unreal tournament so i don't know the guns
Death
Hey, how would I go about adding a custom keycard item within my plugin code?
KeycardItem wrapper
new Color()
thanks david
or Color.red
yea
or
Color.FromHex
just read it
yes
but so i lost 5 years for c# lol
you need only it
you not need learn asp net or something
i learnt so much about c# in 6 months, you can do the same in 5 years smh
there's no option to do it from a hex code ๐ญ
im also know not all 
yea use RGB
new
๐
also theres ColorUtility.TryParseHtmlString
blud is gonna learn to put new in front of everything
which id if does what you want for hex
https://stackoverflow.com/questions/46962565/how-to-convert-hex-to-colorrgba-with-tryparsehtmlstring
ye exactly
im always right
me when my enemy is a search engine
wait til they do new Class().RandomStaticMethod instead of Class.RandomStaticMethod
show types of the arguments
keycardlevels is enum?
its a struct
nw moment
you forgor

you cant use default for color
im guess
its null
or something
clear keycard 
idk
^^

HSV is good when your changing color over time
should be using oklch smh
you're*
like rainbow or smth?
@ lucid 
Mountain range picker
it's real
idk who lucid is ๐
perception
discord manager
doing some funny hint animations for gamemode xd bf6 style
Fire
where did paw go...
please increase the hint duration
i was gunna ping paw...
guh
is it brainrot time
@ discord moderators
When I use my method like that one
_animPlayer.OverrideLine(0, $"Starts in {Countdown} seconds", (oldText, newText) => new DecryptAnimation(newText, 0.2f));
It will only apply animation on text which changes
oh cool
hi
I use coroutines for this
When i start make "typing" animation i wanted to use hint animations
But it looks some weird
:(
how can i make a player can fly but not actually able to go tru objects?
waypoint 
yea
fuck
OR U CAN UPDATE PLAYER POSITION EVERY FRAME
or you can add the ensnared effect and ServerOverridePosition every frame
yes
SSSS for movement
ensared?

that's not an effect
I kinda already do that
but it still dropping me to the floor
ah
I allow to be effect for this
smarty farty
i am blind af
I already TP the player every frame so
All types of madness
typeof(Madness)
there is a effect for that
I think yes
up gravity
random gravity
hi gravity
Vector3.random
Nooo
yes
When i used vector3.random for spawn robots vacuum cleaner it was my biggest mistake of life
How does it work? Why don't configs want to appear?
show code
This is strange
how are you loading it?
*weeps in modern c#*
is it Plugin<Config>
Yes
Sometimes the config appears, but all values โโare empty
Yep
any errors in the console on startup?
No
show your DonatSetting and GroupSettings classes
DonutSetting
DonรกtSetting
-# at slejm

at this point just remove the constructors and use object initializers
arrays are mutable anyway
{ get; set; }
everything except the references are mutable in those classes
I deleted the old config but nothing changed lol
bo2 or modern warfare?
chat is so dead that none speaks
you have just spoken
the speaker
Is there a way to keep a coroutine alive even while the server is in idle?
You have to run it in fixed mode I believe
I'm pinging uptime kuma to track uptime information but when the server goes idle my coroutine also stops
uh sorry to ask it but, how exactly?
RunCoroutine should take 2 args
Real time *
oh
hey if I use the template item to get the Particle Disruptor ImpactEffectsModule and I send a ServerSendTracer, the client doesnt seem to have those tracers :(
figured it out, it was realtime thx!
for everyone else here's my example:
Timing.RunCoroutine(PingLoopCoroutine(), Segment.RealtimeUpdate);
it took a long time to figure out it was the segment I had to change, not the layer integer ๐คฆโโ๏ธ couldn't find any meaningful documentation on mec
if you guys do have a usable documentation could you link it here?
nvm done it
ofc doesnt read mkv
thats cool but WHY its on top of the head
origin is the camera position
fixed
by sending it to the position of to just the player
You can get the barrel end position
Vector3 origin;
if (BarrelTipExtension.TryFindWorldmodelBarrelTip(serial, out BarrelTipExtension ext))
origin = ext.WorldspacePosition;
else
origin = _lastArgs.Player.Camera.position;
but as you see I using other weapon for it and i dont hink it parses the origin for it
OH you mean
Just the barrel tip
Every gun should have it
Works alright even in first person
from my testing
if you have the tracer and the template, and the data
didnt worked before cus it was required the _templateShotData
Yeah I think that tracers above your head is known issue
thats been here for a while
:(
Just move it to half of the player height
me when no Player.Height
And if aiming then like 0.65
+-1f
I think
So like yea
Or you can get it from base game
Player height is 1.8u
even as scp'S?
Player Position is .96u in height
FpcModule.CharController.height
Tuff
crazy
would be cool if could make this particle slower
Laser guns are back
crazy
crazy
YO FUCKING BOT
btw david
CurrentInaccuracy can be manipulated?
Woo
Not synced with client iirc
Highly unlikely
maybe on server
Like you can make the gun super accurate
idc
but the cursor will still be normal on the client
idc
Bro you ask something and then say "idc"
Fuck around and find out
if i crank it up
Crazy
but there's a place where it can be manipulated or should i do a patch?
Well.. does it have a setter?
no
Guess then
Or you can edit the inaccuracy of some specific component
as they add/multiply each other
You will have to check that however
now this kinda same as this
I set HitscanHitregModule::BaseBulletInaccuracy
It works
I mean i will patch for sure
because i don't wanna set
Out of 16 gun "modes" (secondary and prim)
I made 5
A lot of those things can be, and it works
Just it doesn't modify client expectations so cursors or things aren't changed
Those that not really client dependent or client checks you can
None of them are afaik, bullets are always validated by the server
Bullets being shot is validated by the server
You can always change inaccuracy/spread to the best of my knowledge
Max ammo and ammo type you can't
Those aren't bullets being shot
(idk about max ammo sadly)
^
You can change max ammo
I do it
Not sure about ammotype because that's niche
It isn't synced though :(
Yes lmao
I wouldn't mention it if it wasn't synced
I think i remember ammotype is validated on client too
You're not able to modify client expectations based on the attachments (eg. it'll still display the max in the inventory as being 31) but the clip size can be shown to be well over that
There's workarounds to fix that I'm 100% confident in that
Ye give 1 ammo to that type
Closest thing you can get to differnet ammo types from my experience is fucking around with the reloading event
So you can reload
Like I did
[HarmonyPostfix]
[HarmonyPatch(typeof(BuckshotHitreg), nameof(BuckshotHitreg.BuckshotScale), MethodType.Getter)]
public static void BuckshotScalePrefix(BuckshotHitreg __instance, ref float __result)
{
if (CustomItemData.ContainsKey(__instance.ItemSerial)) __result *= 2;
}
And even though the client doesn't recognize that the spread is increased, it will affect how the server validates the spread
Bullets have to be validated by the server, so inaccuracy and spread can always be changed one way or another
One of the unreal gun requires that so
Same
I have to do like 4 patches to get max ammo to work
Every other gun: 1 patch
Revolver: 2/3 patches
Luckily the revolver validation system makes it sync max ammo the best out of any of them
Maybe I should rewrite it and send it to david
That'd be heat
The sad part is
No experience in unity
๐ญ
And no in mirror
Well ferb I know what I gonna do after my SecretTournament project
is there any XML comments on RageState enum ?
David
It's straightforward
None,
Raging,
Crying,
Sobbing,
PissingOnTheFloor,
public enum Scp096RageState : byte
{
Docile, // not raging
Distressed, // entering rage
Enraged, // enraged
Calming, // exitting rage
}
You don't need XML comments
Ok perfect i was curious about Distressed
I love the Enranged, // enranged one
You should be able to search for usages
tRUE
In rider searching for usages has never worked on enums for me
It just sends me to my own plugin
No event when the rage stop ?
I used DnSpyEx and same
Calming
Doesnt exist
There is no need to have an enum for rage stopping
Calming => Dociled (idle)
Dawg I literally just sent you the enum with Calming in it
^
not for the same purpose ๐
Yes
It is
When rage ends you go from Calming to Docile
It used to
OnRageUpdate in the 096RageController and check for docile
Stopped working in the last month
Lovely!
some random ahh update broke it
Rider skill jssue
but im also not on latest rn afaik
@obtuse spruce
Me when no Action(Prev, Now)
๐ง๏ธ๐ง๏ธ๐ง๏ธ
Well im gonna use this
Likely wasnt needed for nw devs
It doesn't matter because it's cyclical
You don't need the previous state because you don't go straight from Docile -> Enraged
What if you do
It's always Docile -> Distressed -> Enraged -> Calming -> Docile
With plugin
sync deez
- they're the same perf
- the perf of those isn't as bad as people say
as long as you don't do it 50000 times per frame, it won't matter
doing it one time per frame was too much
well you're doing something wrong then
it's about 2x the cost of a dictionary lookup
which is pretty fast
tbh might be that
Dawg
Why the fuck are you using GetComponent every frame
I don't think I can imagine a single case in which that's a good idea
it was for my Npc Monobehaviour and I wanted to check if it has walk component otherwise add it and return the monobehaviour
Add the component when you initialize the NPC
I did that
Then why are you checking if it has the component
now I just do it with my ToItem()/ToPickup()
not anymore
just that I was doing that
Why are you doing this
wdym why am I doing this
it's Item to Pickup method and opposite
Yes, why are you checking for your WalkComponent in those methods
What is the purpose
to get the walking component of Npc
Duh
I mean why do you need to get the walking component
You're doing a lot of work with using GetComponent when you could just save the component to a variable and reference that variable
I don't want to give dumb answers to you, but I don't have anything else to say
Wdym bro
There are like 50 billion questions
Why do you have ToItem / ToPickup? What are the express purposes of these methods?
Why in the methods are you getting the walking component? Why is it important that you have that component in those methods?
just use a*
First plugin i make after haitus
compound v is crazy
compound v is one of my greatest pieces of work
Yes
What i would do is create a hashlist of monobeh/ your BotComponent / components and when you add into it you call a method with the param of the component and you add into the list
The flowers will grow ๐ฅ
when
if you wanna check if the object exists, use TryGetComponent
otherwise, same performance
where did you math that
benchmark?
yeah ReferenceHub vs GetComponent
100000 lookup of getcomponent took iirc 1.8x the time
hm
Server crasher 20000
easily fixed :D
Pissing
I love the reference
But i know not many know postal
OH MY GOD THATS WHERE I GOT IT FROM
i was thinking about a game the entire time, i couldnt place my finger on what
?
Postal?
yeah
pretty sure its just postal i was thinking of
Yea the guy can piss and people will vomit
If you piss on them
You can use a cat as a surpressor
You could but you need to check how optimized it is
And there are some stuff
But give it a try
But still you cannot host a big amount of schrmatics because else the client goes behind
Are there some bugs?
MERO is buggy to an extent yes
just be careful with it and youll be fine

Btw how tf you made postal but you didnโt know what postal is
Like this crazy
i know what postal is i just didnt realize i was inspired by it
Crazy
gotta check a bit
i'm not sure if you can disable "server culling"
client-side culling would be much better with the CullingParent
Btw do โwanna sign my petitionโ



