#plugins-dev-chat
1 messages · Page 56 of 1
i have the entire code to be done in a way
that if nw adds a toy
or changes something i can replace it in 30s
the problem is now updating colliders and client
without exploding the client
yea
Did hubert pushed it?
this is me
Yea I have access
like its years i ask for that and now someone listened to me
No shit (i mean ye ofc)
yesterday i slept really well knowing none will endure my same pain
working with mirror its a pain
without editor or anything
ye reversubg ut us sgut
the problem rn
is just making calls lower
i could pull of 2 things
making parents primitives
and just say to the client attach them
or i could actually pack them
if for the LateUpdate they don't have anything more send the data
and sync the collider
I guess i cannot
Or you don't send it that often and apply movement smoothing
i just said that in vc lol
i made a whole ass town with primitives and had 120 fps
tps explodes
it just made me think
its already so optimized that if i touch the code im just destroying a temple
about the difference between primitives and the rest of the game
so if your schematics are so poorly made it tanks your players fps, just delete the regular map
thats how code can feel
ye cus you sending 20k primitive pos update
Crazy
It works but I added so it sets the position of the object with the bounds position
i love you hubert
Otherwise you would have to add offsets for the child gameobject toys
or spawn it with position applied already
didn't michal add this already
it's client-side culling this time
Made me remember about culling issues with players and their light sources
Players behind you with a lantern wont render, nor will their light
Probs same with a flashlight
MEROptimizer destroys each toy i think
with network messages
yeah I remembered michal adding client side culling some months ago
not in mer
oh in SL?
in basegame
for primitives?
at michal 
public PlayerDeathEventArgs(ReferenceHub player, ReferenceHub? attacker, DamageHandlerBase damageHandler,
RoleTypeId oldRole, Vector3 oldPosition, Vector3 oldVelocity, Quaternion oldCameraRotation)
{
Player = Player.Get(player);
Attacker = Player.Get(attacker);
DamageHandler = damageHandler;
OldRole = oldRole;
OldPosition = oldPosition;
OldVelocity = oldVelocity;
OldCameraRotation = oldCameraRotation;
}
why
need old velocity
and old camera rotation
slejm moment
use the dying event
i guess
also the velocity is in the damage handler
-# for the ragdoll
Had to use the dying event to store that data
Nice that it's a part of SL now
Granted I store a bit more but that's still cool
public Vector3 Scale
{
get
{
if (ReferenceHub.roleManager.CurrentRole is not IFpcRole fpcRole)
return Vector3.zero;
return fpcRole.FpcModule.Motor.ScaleController.Scale;
}
set
{
if (ReferenceHub.roleManager.CurrentRole is not IFpcRole fpcRole)
return;
fpcRole.FpcModule.Motor.ScaleController.Scale = value;
}
}
hard system taken more than 1 month
An event round where you move the person to the other team when killed
and want to respawn them instead of forceclass
Want to spawn a statue where you can revive dead people for a gamemode
idk
AA?
hey, does anyone know where i can find documentation on labapi?
ye in github wiki
last time i checked there wasnt a lot
ye
https://github.com/northwood-studios/LabAPI/wiki
If you have any question check the game files or ask here
im faster you

use ide
and classes?
Everything
in source code ye
someone checking source code for make the plugins
oh
Use VS
Yeah i think
is pl. the player?
It is a object
Player
what object
Like object that was created for the player class idk how to say that
thanks
np
exiled has done it
at least for the category limits
8.1. A Server Owner and their Sta must respect the privacy of any user that has connected to the
Game Server, and are responsible for keeping their IT Infrastructure secure and compliant with
local privacy laws and regulations
why this rule need
bruh
why me need ammo
1 line above
because they want you not to break the law 
items drop it client side?
you are client side
what
no
does the server throw out the items or does the game itself initiate it?
nw moment
client also chaning the SyncList for getting the accurate limit
if you faking the limit
can have multiple
I guess
since server doesnt check for it or something
check yoself
@spring swan Yo. DM'ing you with the killer script
Is it possible to set or get Player ammo in FirearmItem?
Hello, we do dot have firearm wrappers yet. But you can use the base game classes
get the Base of it
The Firearm
and get the MagazineModule
Or similar based on the firearm type
oh i must checking it for every firearm type ?
FirearmItem is a wrapper but has no such important things?
as I said, they are in the making ofc
But not merged yet
okay
Yo, how can I spawn a gun that already has Ammo inside of it?
cust this doesnt work
if (pickup is FirearmPickup firearm && firearm.Base.Template.TryGetModule(out IPrimaryAmmoContainerModule primaryAmmoContainerModule) && primaryAmmoContainerModule != null)
{
primaryAmmoContainerModule.ServerModifyAmmo(
primaryAmmoContainerModule.AmmoMax
);
}
ServerSetInstanceAmmo(serial, amount)
how to mute Cassie for specific players?
Hello, you will have to manually send rpc message to specific players
Hi, What is rpc?
thanks that works
we are moving systems to Messages (lower level than method attributes)
Uhhh
@restive turret Do you know how to call ClientRpc manually
wat
david im going to kill you
ye kind of
Can you show this guy how to do it for cassie
U can choose who to send it to easily when you dont have TargetRpc xd
fair enough
RpcCassieAnnouncement
RpcCassieAnnouncement
Yea that
ye its sending to every player
Time for Fake
@humble haven Are you using Exiled or no
if not you need another DLL for it to able to call these
I had used the patches, but I saw that there is an event on exiled so I'm trying first on exiled and then with the patches
lol you dont need patches
What you require yes, I delete the cassie
oh mute not play announcement
Oh in that case you can do 2 things
How i should do?
Yea if you want only for specific
I would patch RespawnEffectsController.ServerPassCassie(...) so it sends the rpc only to players you dont want to mute it for.
It's been at least 207 days since these guys invaded my beautiful reload / unload code

I managed to workaroudn this by putting it on SSS
Put the ammo you want
Select nothing, wait 1 frame and select the gun back
well uhh, that still doesnt access player nor the connection
Until I fig this
Yes cause ClientRpc send it to all
And you need to send it only to specific
Its ClientRpc it generates something no?
what
:Cinema:
what inside it calls SendRPCInternal which foreach on all observers and send rpcMessage
1984
I finally found the exact gravity vector for the old jump, it's not perfect but I was able to use a lot of math to get the air time. As far as I'm aware the map actually got 28% smaller hence (-19.6) - 28% = -14.112
lmao
Feel free to use this knowledge gamers, took me a bit longer than I thought
Also crazy lol
well
What is this magic you're talking about
Get this man a 
I mean I'm gonna keep testing this, if you're looking for just jump height I think -18 is fine but I think this was the old parameter so you actually jump the same heaight as always
?
That's the new jump though
eve moment
Yeah thats new jump lol
Old SL jump
Old as n
prob
Pre parabellum
you could jump high af
I think
Oooooooh
before you worked at NW
Yeah definitely
You could have just asked me
I can look into git history
Ah yes, let david see back 2 years
I'm pretty sure gravity was decreased becuase the map got way too small
But because models (I'm pretty sure) are the same hieght and whatnot it feels like hitting a ceiling
🎶 can we get much higher
I imagined you doing this
NO AX DONT SING THAT SONG
smh
In old SL technically you'd reach roughly the same height it just felt higher since camera I think was lowered or smth idk
Whenever I jump in old SL, I feel like I've been in air for like 4 seconds
I honestly couldn't tell you why everything was exactly 28% smaller or something but yeah now you know
I believe the air time was actually around half a second which is wild considering jumping now is like a tenth of a second or smth
I can see the initial commit from 2019
So yeah you can pretty quickly the map got smaller
how much git commit?
like
count
Looking at gitlab its almot 5,7K
If you were to copy and paste the parameters for the scrapped lighting like I have the lights would be outside the map, but set scale to 0.72 and boom it's back inside
What are ya'll talking about tbh
.
SCP SL Git repo
I actually wanna know if I was right though if the parameter changed or it's something else
wouldn't it be 0.75?
I'm right about gravity being lower regardless since you can't jump to the sameheight as before but still
No
Because the places for the lights would be wrong
If you did 0.7 the lights would be going to the middle of the stair well, whereas 0.75 would make the lights be directly on top of the fence
In Unity on the old SL version (being MPII) the scraped lights are halfway down 079's camera)
I did use 0.7 and 0.75 but after looking at everything I realized that the lights were infact the same place not scaled however it's all the same it's just 28% smaller for some reason
There's also a used light on Surface Zone that directly shines on Escape Room but as I said it's only in the correct position if scaled down to 28%
It's fucking bizzare
using HarmonyLib;
using Exiled.API.Features;
using Respawning;
namespace BetterMuteCassie.Patches
{
[HarmonyPatch(typeof(RespawnEffectsController), "ServerPassCassie")]
public static class ServerPassCassiePatch
{
public static bool Prefix(
RespawnEffectsController __instance,
string words,
bool makeHold,
bool makeNoise,
bool customAnnouncement,
string customSubtitles)
{
Log.Debug($"BetterMuteCassie: Intercepted announcement: {words}");
foreach (var player in Player.List)
{
if (!EventHandler.EventHandlers.IsCassieMuted(player))
{
// Riproduci Cassie solo per questo player
Cassie.Message(
message: words,
isNoisy: makeNoise,
isSubtitles: true
);
}
}
return false;
}
}
}
?
Can it work?
I dont think this will work cause you will just loop over and over again

Oh it might not be that hard
This is what is generated
You just have to send it to specific clients
one sec
Oh so like
NetworkWriterPooled writer = NetworkWriterPool.Get();
writer.WriteString(words);
writer.WriteBool(makeHold);
writer.WriteBool(makeNoise);
writer.WriteBool(customAnnouncement);
writer.WriteString(customSubtitles);
SendTargetRPCInternal("System.Void Respawning.RespawnEffectsController::RpcCassieAnnouncement(System.String,System.Boolean,System.Boolean,System.Boolean,System.String)", -31296712, writer, 0);
NetworkWriterPool.Return(writer);
@humble haven
Try this?
Instead of Cassie.Message
thank you ❤️ , now i try
what is your definition of SendTargetRPCInternal?
You will have to publicize Mirror assembly for it
as its part of NetworkBehavior
(protected method)
no this still doesnt work
you doing the exact same thing
as in the rpc
No its TargetRpcInternal
so it sends only to the target connection
Underlying message structure is same (?)
NetworkWriterPooled writer = NetworkWriterPool.Get();
writer.WriteString(words);
writer.WriteBool(makeHold);
writer.WriteBool(makeNoise);
writer.WriteBool(customAnnouncement);
writer.WriteString(customSubtitles);
__instance.SendTargetRPCInternal(player.Connection, "System.Void Respawning.RespawnEffectsController::RpcCassieAnnouncement(System.String,System.Boolean,System.Boolean,System.Boolean,System.String)", -31296712, writer, 0);
NetworkWriterPool.Return(writer);
Put this inside the if "EventHandler.EventHandlers.IsCassieMuted"
also
david
are you planning to use any other SyncObject other than SyncList?
others are:
if the answer is no then i dont make unneccessary things for making FakeSyncSet, FakeSyncDictionary
@unique crane when client desyncs, whats the condition to resync ?
like position
desync
when does server tell client thats its desynced and corrects the position
does anyone know if you can use client side parenting on a players camera transform rather than their ReferenceHub transform?
you can't
No
best you can do is offset the position
I really need to handle the rotation of a players cam, does strangled work now for that now that skele is back?
cuz then I could lock a players rotation
is strangled basically only server side? As in all checks are on server not client?
I think that it disabled camera movement client side too
yeah so I'm wondering if I just fake that strangled is active for a player if the client will just accept it and freeze camera
nah I think it wants a ReferenceHub as a target
or maybe that's just local player stuff
I'm really struggling with this code lol
honestly I don't see anything networked in the strangled effect
set player.LookRotation every frame
troll
it won't prevent them from trying to look away but eh
but like, maybe skeles StrangleAbility sync the target, then Strangled effect gets it from there
I just don't like the jank
but I'll give it a shot
¯_(ツ)_/¯

yeah but where does it get _strangleTarget
I don't wanna be throwin client side NRE's cuz I don't understand what's going on
decompile it 
they no longer strip that much client code
well it seems like the client tries to find a player with a skele strangle subroutine, then checks if that subroutines target is itself, if so, cache it and keep checking that subroutine every tick
so I'd need a fake skeleton to strangle the client
you can scale them to 0
yeah but I need the client to think the dummy is in front of them
will do
part of me almost wants to fake the dummies tho cuz the thing I'm doing entails the players be alive
so if I hide the dummies from spectators, it should be fine
fake the dummies
just don't fake the entire player gameobject 😭
well I'm thinking of just spawning them in, then destroying them on spectator clients
Try it and seeee
honestly the entire fake strangle thing could be a full plugin 😭
side effect: scary auduio
tru
wtf am i supposed to do about this
yeah make sure you only have the refs from SL folder
you can add an alias
i aliased mscorlib
don't 😭
well
that's gonna make it horrible
global is the default alias
aliasing it as mscorlib but also global lets u basically qualify the assembly
thanks it worked
i ran into another issue, when I do AudioTransmitter.Play(samples, true) to queue a sound, it seems to end up just playing the sound immediately, skipping any of the other sounds? i feel like i might be doing something wrong.
or if i even just enqueue the sounds
directly
queue = true
if you read into the same array, ofc it won't work
hence the required array reallocation
i did do queue = true
i dont really understand what youre saying, but what did work for me was making my own queue, and sampling 800 samples instead of 480
because 800 is 1/60th of 48000
and then i run the sample groups into the speaker
the issue is if you reuse thze array
i feel like what im doing is reallocating the array
i dont know
how does your code look liek
new array every time you read n samples?
i think it does
yea
isn't that looping
bru
i thought looping meant what i thought it did, but maybe it means something different
ye im a fuckin idiot then
nah never mind wtf
maybe its time to go back to the 800 sample thing
Bro is spirit box
yeah you need to buffer it ahead by a bit
read like a thousand samples and every frame 48000 * Time.deltaTime
can i do that in MEC?
New server crash method or smth.
Local Admin log looks:
[NM] DataReceived: bad!
[NM] DataReceived: bad!
...
for million time
well
cant even know the IP
to literally just skip that
or to visit all datacenters and send a nuke to them
ive never seen those logs
once
surprisingly
usually my host would legit just slow or completely halt the connection before the ddosing gets to the server, but on my past hosts they halted all connections LOL
well ye "DDoS Protection" my ass
anyway it happens here
NetManager.OnMessageReceived
distributed donkey of shrek
have fun whoever wanna patch it
doom day of paks
XDDDDDDD
THat is not really new sadly
We had that multiple times
Earliest log is 2024-08-03
Happened literally 5 or 10 min before my message
Yo how did this go. Was I right about gravity?
roblox simulator
I'd just print out the state every so often and see what it is when it blinks
ServerCycleAction
use dnSpy or dotPeek to find usages
though firearms use animators so there are a number of events that are called from the animator (no visible code usage)
firearm.trygetmodule
in decompile
where implementation
is it possible patch interface?
Implementations yes
also if static yes
interesting thing i learned today
if i parent an interactabletoy to a pickup, interacting with the toy grants me the pickup
i havent tested with 0 interaction duration but i assume its the same way.
doesnt found
typical nw moment
i think the searchcompletor checks for the root object, hence getting the pickup and not the interactable toy from the collider directly
^
public static bool Prefix(WaveAnnouncementBase __instance)
{
Log.Debug($"[BetterMuteCassie] Patch {nameof(SubtitlePreventionPatch)} triggered");
MethodInfo sendTargetRpc = typeof(NetworkBehaviour).GetMethod(
"SendTargetRPCInternal",
BindingFlags.Instance | BindingFlags.NonPublic);
if (sendTargetRpc == null)
{
Log.Error("SendTargetRPCInternal not found!");
return true;
}
foreach (var player in Player.List)
{
if (!EventHandler.EventHandlers.IsCassieMuted(player))
{
var conn = player.ReferenceHub.networkIdentity.connectionToClient;
NetworkWriterPooled writer = NetworkWriterPool.Get();
try
{
sendTargetRpc.Invoke(__instance, new object[]
{
conn,
"System.Void Respawning.Announcements.WaveAnnouncementBase::RpcSendSubtitles()",
-31296712,
writer,
0
});
Log.Debug($"BetterMuteCassie: Sent subtitles to {player.Nickname}");
}
catch (Exception ex)
{
Log.Error($"BetterMuteCassie: Exception sending subtitles to {player.Nickname}: {ex}");
}
finally
{
NetworkWriterPool.Return(writer);
}
}
}
return false;
}```
[2025-06-29 10:27:05.700 +02:00] [ERROR] [BetterMuteCassie] BetterMuteCassie: Exception sending subtitles to Shodan: System.Reflection.TargetException: Object does not match target type.
at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00024] in <13c0c460649d4ce49f991e2c222fa635>:0
at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <13c0c460649d4ce49f991e2c222fa635>:0
at BetterMuteCassie.Patches.SubtitlePreventionPatch.Prefix (Respawning.Announcements.WaveAnnouncementBase __instance) [0x0008a] in <873d851353734910a0d406b33eab2f73>:0
can someone help me?
You do not need to use reflection
Use Assembly publicizer and publicize Mirror assembly
then use the new reference for it
It will make every method public
=> easier
Also enable unsafe code if you use publicized methods
Yeah that too
__instance.SendTargetRPCInternal(
conn,
"System.Void Respawning.Announcements.WaveAnnouncementBase::RpcSendSubtitles()",
-31296712,
writer,
0
);
like that?
thank you
Severity Code Description Project File Line Suppression State
Error (active) CS1061 'WaveAnnouncementBase' does not contain a definition for 'SendTargetRPCInternal' and no accessible extension method 'SendTargetRPCInternal' accepting a first argument of type 'WaveAnnouncementBase' could be found. Possibly missing a using directive or an assembly reference.
Yeah well WaveAnnoucementBase inst gonna have it
Its in RespawnEffectsController
you need instance of that
I yearn for the days where publicized is the past of the ages
Never going to happen
its just part of modding
Someone will always want to change that one very specific thing that isnt public
Just make private thing to public
Hey it's me
Cheaters always be cheating no matter what
aye
How often does map generation get updated
i.e. how often should I expect a singular seed to start generating a different map after an update
After adding a new map element
For example the pipe room, or 127 added the gen changed
Guessing they don't modify map generation itself often right
Outside of when those elements are added
Idk, they reworked at it in 14 i think
But probably will not be much in this 14.x
I see
You can make a git and check the decompiled versions (or ask david)
Eh that's fine, I'll just add a version block to my stuff if a new update changes map generation
pretty much renders older files incompatible
and it'll be noticed very fast by users hah
things going through walls
but why i cant just patch it?
because client exists ?
its reset each connection or each respawn?
@grand flower in #195 you mean something like this?
The latter would be better yes
what if it wasn't out and the caller supplied the list
Gives control to the modders - they can handle renting
we could have extension methods so the player class doesn't get too cluttered
like this?
idk or use ref 
GetAll(ItemType, List<Item> results) => items.AddRange(List.Where(...)))
we could return the original list even
though not necessary
public static void GetAll(ItemType type, ref List<Item> items)
{
items.AddRange(List.Where(n => n.Type == type));
}

Tf does in do
get all items
immutable pass for structs
ahhhh
so you can't modify the parameter in the method
5 am stupidity nvm
bru
for large structs it can improve performance, but in most cases it just creates overhead
-# yes i benchmarked it
not my head
i love downloading 78 gb on steam and 42 gb on browser so my whole pc is slow
Vote!
For use ref: 
For use out: 
For not use any modifier: 🔥
Large structs as...
how much
we talking
1440 byte in memory
bc c++
say, 10 members or more
i can't say an exact number, though 4 members had about 1.5x worse performance with in
Okay
Huh
immutability and less GC overhead
like a big context
hai Riptide
you have to talk to dll in some cases
that, too
I'm just gonna go to sleep I can't follow the conversation anymore hahahaha
I'll check on it once I'm not sleep deprived
gn
Me when i make the mistake of letting VS try to find symbols for the 500+ assemblies loaded
Gn

gn
don't do that with vs 
I don't use VS for game dev work
99% of the time
1% is when Rider's debugger doesn't cut it
rider fun
good answer 
when i attach the debugger to unity and after hitting a breakpoint, unity freezes completely
-# on rare occasions
like, it's not "not responding" but it doesn't react at all
#202 or smth
for a commission i should relase source code too?
Depends on agreement
but usually if someone paid money, they arent asking for it to be open source

I mean, I make a plugin for him, and he wants the source code.
then yes give him source
no but depends
i usually delete source codes after
Probably room not getting removed from there
theres a bug currently where rooms are added back in the generator wrapper remove method
oh lol
not fun :<
hey uh has anyone encountered this error message before and knows how to fix it?:
[2025-06-29 14:39:41.992 +00:00] Exception while handling encrypted message on channel RemoteAdmin (server, running a handler). Exception: Object reference not set to an instance of an object
[2025-06-29 14:39:42.002 +00:00] at PlayerRoles.PlayerRoleManager.PopulateDummyActions (System.Action`1[T] actionAdder, System.Action`1[T] categoryAdder) [0x00019] in <d9731e675e55453197cf28cd60eed3f2>:0
at NetworkManagerUtils.Dummies.DummyActionCollector+CachedActions.UpdateCache () [0x00016] in <d9731e675e55453197cf28cd60eed3f2>:0
at NetworkManagerUtils.Dummies.DummyActionCollector+CachedActions.get_Actions () [0x00008] in <d9731e675e55453197cf28cd60eed3f2>:0
at NetworkManagerUtils.Dummies.DummyActionCollector.ServerGetActions (ReferenceHub hub) [0x00006] in <d9731e675e55453197cf28cd60eed3f2>:0
at RemoteAdmin.Communication.RaDummyActions.AppendDummy (ReferenceHub dummy) [0x0001e] in <d9731e675e55453197cf28cd60eed3f2>:0
at RemoteAdmin.Communication.RaDummyActions.GatherData () [0x0003a] in <d9731e675e55453197cf28cd60eed3f2>:0
at RemoteAdmin.Communication.RaClientDataRequest.ReceiveData (CommandSender sender, System.String data) [0x00032] in <d9731e675e55453197cf28cd60eed3f2>:0
at RemoteAdmin.Communication.RaDummyActions.ReceiveData (CommandSender sender, System.String data) [0x00095] in <d9731e675e55453197cf28cd60eed3f2>:0
at RemoteAdmin.CommandProcessor.ProcessQuery (System.String q, CommandSender sender) [0x0005d] in <d9731e675e55453197cf28cd60eed3f2>:0
at RemoteAdmin.QueryProcessor.ServerHandleCommandFromClient (ReferenceHub hub, EncryptedChannelManager+EncryptedMessage content, EncryptedChannelManager+SecurityLevel securityLevel) [0x0002d] in <d9731e675e55453197cf28cd60eed3f2>:0
at (wrapper delegate-invoke) <Module>.invoke_void_ReferenceHub_EncryptedChannelManager/EncryptedMessage_EncryptedChannelManager/SecurityLevel(ReferenceHub,EncryptedChannelManager/EncryptedMessage,EncryptedChannelManager/SecurityLevel)
at EncryptedChannelManager.ServerReceivePackedMessage (Mirror.NetworkConnection conn, EncryptedChannelManager+EncryptedMessageOutside packed) [0x00071] in <d9731e675e55453197cf28cd60eed3f2>:0```
it just really annoys me lmao
known and fixed next update
k
Known
Do not confirm anything until me/riptide or someone else say it 😭
Its 2 line fix so I hope we dont forgot about it
i thought you
said it was
merged
IM GOING TO STRANGLE YOU
no it isnt yet
(yea the bug exists since the first version lmao)
daid
Thats not labapi bug
its base game one
And not game breaking
just annoying
i dont think ive ever seen you be nice to people
i could be

i didnt know you were a she
@celest thorn next tournament
throwing hot honey buns at homeless people
NO
that was to you
@lament niche tf you lurkin here
@lament niche what are you doing here???
dude heard "next tournament" and INSTANTLY knew
6th sense
im probably gonna start doing 3 tourneys a year
instead of 2
is it reset after respawn or only after rejoin?
this year included?
🙏
unlikely though
🙏 x3
someone big brain 
She's evil
she never is
at what point is it worth it to use in
i have a semi large struct
high-performance scenarios, like asp.net
anything that has to be maximally optimized
hold on i might be stupisd
like struct size
When your API requires that the argument be passed by reference, choose the ref readonly modifier instead of the in modifier.
idk, 12 members i guess
Methods that are defined using in parameters potentially gain performance optimization. Some struct type arguments might be large in size, and when methods are called in tight loops or critical code paths, the cost of copying those structures is substantial. Methods declare in parameters to specify that arguments can be passed by reference safely because the called method doesn't modify the state of that argument. Passing those arguments by reference avoids the (potentially) expensive copy. You explicitly add the in modifier at the call site to ensure the argument is passed by reference, not by value. Explicitly using in has the following two effects:
oh ik
i thought i misunderstood the concept myself but nvm
i benchmarked a struct with 4 members and it was about 1.5x slower with in
i could be wrong but i think the tipping point is anything over the size of a native pointer is when ref/in is worth it
nah
ref, maybe, but that allows mutation which is often not what's desired
are they not the same performance wise (in and ref) in the context of passing a struct?
hes talking about performance not the semantics
not in all cases
The in modifier allows the compiler to create a temporary variable for the argument and pass a readonly reference to that argument. The compiler always creates a temporary variable when the argument must be converted, when there's an implicit conversion from the argument type, or when the argument is a value that isn't a variable.
i guess then you also can't use ref
let's benchmark
i didnt know the in keyword was a thing for parameters until today, i only knew about it for generic args and even then i rarely used that
i think it is basically just for big structs
what does it does for generic args

kinda wished they had separated the concept of const from reference like the way c++ does it
in is a terrible keyword, i guess they didnt want to make a new one
X<object> can be implicitly converted to X<string>
if X<in T>
heh
useful for delegates
you.
public record struct Amongus(int A, int B, int C);
public record struct Amongus2(int A, int B, int C, int D, int E, int F, int G, int H, int J, int K, int L, int N);
[MemoryDiagnoser(false)]
public class RefAndIn
{
[Benchmark]
public int ByRefSmall()
{
var small = new Amongus(1, 2, 3);
return ComputeRefSmall(ref small);
}
[Benchmark]
public int ByInSmall()
{
var small = new Amongus(1, 2, 3);
return ComputeInSmall(in small);
}
[Benchmark]
public int ByRefLarge()
{
var large = new Amongus2(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
return ComputeRefLarge(ref large);
}
[Benchmark]
public int ByInLarge()
{
var large = new Amongus2(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
return ComputeInLarge(in large);
}
private static int ComputeRefSmall(ref Amongus small) => small.A + small.B + small.C;
private static int ComputeInSmall(in Amongus small) => small.A + small.B + small.C;
private static int ComputeRefLarge(ref Amongus2 large) => large.A + large.B + large.C;
private static int ComputeInLarge(in Amongus2 large) => large.A + large.B + large.C;
}
huh
in is slightly faster
prob not
cuz it requires spawn data
thats well within the error so
Wdym
@restive turret do oyu have fake role sync
things like spawn position etc
So how do I give it these things
Do I
Not use RoleSyncInfo?
u can prob check the asm
not sure how exactly, i wrote the sync message manually when faking 079
check exiled
this is probs more optimized on newer .NET
Let me see if I can find out lol
ran it on framework 4.8
ref and in generate the same instructions
What exiled function employs fake role sync?
Not finding jack
idk 😭
i am shocked by how it takes 10x longer
are you comparing the right rows
yeah cuz more members, larger ctor
i cant do math

I've got no options here cause I have no way to do this shit
MirrorExtensions...
is there anyway to exclude that from the benchmark
paislee can i kill you
then i'd have to allocate the struct on the heap
i can try ig
@upper vapor thank you for the info 🙏🏼
np
mirrorextensions is done so poorly
reál
ah yes get every single serialize sync vars method at once
don't do it lazily
and the classic fuckNorthwood variable
if it was called on startup i'd excuse it but this is horrible
even then
there's someone who has that discord id
me when
t(rue)
public record struct Amongus(int A, int B, int C);
public record struct Amongus2(int A, int B, int C, int D, int E, int F, int G, int H, int J, int K, int L, int N);
[MemoryDiagnoser(false)]
public class RefAndIn
{
private Amongus _small;
private Amongus2 _large;
[GlobalSetup]
public void Setup()
{
_small = new Amongus(1, 2, 3);
_large = new Amongus2(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
}
[Benchmark]
public int ByRefSmall() => ComputeRefSmall(ref _small);
[Benchmark]
public int ByInSmall() => ComputeInSmall(in _small);
[Benchmark]
public int ByRefLarge() => ComputeRefLarge(ref _large);
[Benchmark]
public int ByInLarge() => ComputeInLarge(in _large);
[Benchmark]
public int ByValueSmall() => ComputeSmall(_small);
[Benchmark]
public int ByValueLarge() => ComputeLarge(_large);
private static int ComputeRefSmall(ref Amongus small) => small.A + small.B + small.C;
private static int ComputeInSmall(in Amongus small) => small.A + small.B + small.C;
private static int ComputeRefLarge(ref Amongus2 large) => large.A + large.B + large.C;
private static int ComputeInLarge(in Amongus2 large) => large.A + large.B + large.C;
private static int ComputeSmall(Amongus small) => small.A + small.B + small.C;
private static int ComputeLarge(Amongus2 large) => large.A + large.B + large.C;
}
yeah
passing a small local variable struct by value is the fastest as it seems
pov GC time
hmm?
im confused
so if we have a local variable that is a small struct, passing it by value is fastest
huh
if you have a field, in is the fastest
your refering to this, i see
ye
not sure if you can compare them
i mean true
for some scenarios you need a local variable, in
others you refer to a field
the joys of optimizing c# code
How can i register event single? Like in Exiled - Exiled.Events.Handlers.Player.Verified += ...
rule of thumb: benchmark whether it's faster
how can i say lapi he shouldn't add this values to the config if they are empty?:
you cant
i dont think yaml supports this
thats kinda anoying ngl...
i might be able to pr it IF yaml supports it
would be nice
@unique crane i think they left the balls on the gun
😐
seems like someone has more balls than the other.
yes
sob
// ignore

thats labapi code
your code looks the same
is this decompiled or raw code?
if it was decompiled that would make sense but ye
no
only lumi would do that
its not meant to ignore
is the thing
it is meant to throw but seeing it catch and then throw it again is weird
yea idk does anyone have an quick solution how i can enable an effect via its name as an string?
public static StatusEffectBase GetEffect(this Player player, string name)
=> player.ReferenceHub.playerEffectsController.TryGetEffect(name, out StatusEffectBase? effect) ? effect : null!;
ssomething like that
Where the fuck is that, i need to add a negative review
Balls
i made pr fixing it
or
changing
i might be schizo
redundact
Hi barely functioning
alright chat what do i reply
What could cause the client to fall behind and to desync like on the movement only
by just sending primitives and thats it
Cant process message fat enough
*fast
yea that was what i was thinking
but even calculating with TPS and Ping still its not enough
And it send a Delta
it happens only on higher pings tho
private IEnumerator<float> _SpawnRoutine(Player player)
{
var all = ClientSide
.OrderBy(p => p.priority)
.ToList();
int total = all.Count;
int spawned = 0;
#if LABAPI || EXILED
int ping = LiteNetLib4MirrorServer.GetPing(player.Connection.connectionId);;
Logger.Info(ping);
#endif
while (spawned < total)
{
float tpsRatio = 1f;
#if LABAPI || EXILED
if (Server.MaxTps > 0)
tpsRatio = Mathf.Clamp((float)(Server.Tps / Server.MaxTps), 0f, 1f);
#endif
int dynamicChunk = Mathf.Clamp(Mathf.RoundToInt(DefaultChunkSize * tpsRatio), 1, total - spawned);
int thisBatch = dynamicChunk;
// spawn [spawned .. spawned+thisBatch)
for (int i = 0; i < thisBatch; i++)
all[spawned + i].SpawnClient(player);
spawned += thisBatch;
#if LABAPI || EXILED
float ratio = Mathf.Max(tpsRatio, 0.01f);
int pingFrames = Mathf.CeilToInt(ping / 125f);
int waitFrames = Mathf.Clamp(Mathf.CeilToInt(1f / ratio) + pingFrames, 1, 8);
for (int i = 0; i < waitFrames; i++)
yield return Timing.WaitForOneFrame;
#else
yield return Timing.WaitForOneFrame;
#endif
}
if(!PlayersLoaded.Contains(player))
PlayersLoaded.Add(player);
}
Rn this is the logic
why do you #if LABAPI || EXILED
Sending packets
Wait 1sec
Send packef
Wait 2 sec
Continue vig logic
because old version i used that
When inside a Unity Engine
and this comes from a old build
i do this as you can see by the code i sent
but i still don't quite understand why its happening
You should wait more then
Well check on your client
should be changed
i can check for network request??
What
Oh uh idk if NW has a function for re-enabling dev messages like that for litenetlib
so yea i should make it higher i guess if you have higher ping lovely
is there a way to refrence a default human player model(not view model but whole class model) head transform(it can be rig or something like that)
int pingFrames = Mathf.CeilToInt(ping / 125f); its time to change this :yippe:
Try idk less
get role template
Or more
yea i should
wdym?
public static bool TryGetRoleBase<T>(this RoleTypeId roleTypeId, [NotNullWhen(true)] out T? role)
=> PlayerRoleLoader.TryGetRoleTemplate(roleTypeId, out role);
get role base
then use that to get the default
of ur role
roling on my base
or if you have a player ur trying to get the model of, just use the players role
I honestly tried everything and im loosing it
Even if i delay it myself manually it still not enough
😭
anyone here do commisions
Why when I give the Pocket Corroding effect it doesn't take the player to the pocket dimension but sends him and then sends him back?
give Corroding not PocketCorroding
thanks
labapi have ready method for send fake sync vars?
no
but what it?


