#plugins-dev-chat

1 messages · Page 38 of 1

pseudo hawk
#

So annoying to see people putting PCs on the floor in 2025

grand flower
#

Considering the amount of maintenance required on mine i don't think it'd matter

slate flume
#

Why have I never heard of this

#

What should I put my computer on

pseudo hawk
#

Keep it on an elevated surface

#

Keeping it on the ground causes it to collect more dust

grand flower
#

Doesn't matter if you maintain it often enough

heady turret
#

is there any class of SurfaceAccessPass keycard?

random scaffold
#

@harsh thorn sir

#

why with task.run server lag to 1-2 seconds each join of the player

#

bruh

#

but without it works normal

upper vapor
#

what if you used awaitables

worthy rune
# random scaffold <@448186467466870784> sir

task.run doesnt do what you think it does when you mix it with async/await, but i wouldnt of thought it would be the cause of hanging the server for 1/2 seconds. so thats abit strange

unique crane
#

Are you connecting to the DB somewhere else too?

random scaffold
#

no

worthy rune
#

you should show what you are doing in ExistsByUserId and Add

unique crane
#

^

random scaffold
#

also on joined

#

and it

worthy rune
#

that doesnt really tell us anything

upper vapor
#

did you rewind the writer to its position before reading the uint?

worthy rune
# random scaffold

you will need to show all the async code, all the way down. the issue is likely you are blocking somewhere

random scaffold
upper vapor
worthy rune
#

it will, after the first await its back on the main thread

#

thats why i said using task.run doesnt do what you think it does

upper vapor
#

ugh threadpool

worthy rune
#

not really todo with the theadpool

#

its how async/await works, with Unity specifically. see the UnitySynchronizationContext

upper vapor
#

oh no

#

noooooo

#

that's why

royal mica
#

Damn that is very obscure

upper vapor
#

yep

#

checks out

#

nvm

#

unrelated post

#

again,

Capturing a synchronization context increases the performance overhead of your application and waiting for the next frame Update to resume on the main thread introduces latency at scale. You can avoid both these issues by using Awaitable instead.

worthy rune
#

tbf unity does say this alot, in multiple places

upper vapor
worthy rune
#

the returning to main thread that is ^

#

not many people use async/await in plugins so it doesnt surprise me

royal mica
#

So, wait. If there is a Task, which runs an async function, and an await happens, the next frame it'll use unity main thread instead of the ThreadPool task thread?

worthy rune
#

yes

upper vapor
#

yyyyeaaaaa

#

weird

royal mica
#

Holy shit thats why sending discord webhooks kill the game when discord has issues icant

upper vapor
#

they do this to prevent uh

#

mishaps

#

with unity

worthy rune
#

its a reason why you dont need Task.Run just do _ = AsyncMethod(); instead

#

yeah its because you cant use the UnityAPI from another thread and this reduces the chances of devs fucking things up

random scaffold
#

so how me need do in result?

royal mica
#

yeah the problem is that we do a while loop in there, not sure if that blocks despite being asnyc

upper vapor
royal mica
#

Hmm, then I suppose I need to refactor it into a Coroutine async instead of Task.Run

unique crane
upper vapor
worthy rune
#

you can do AsyncMethod().ConfigureAwait(false) if you need to contintue on the same thread and not move to the main thread after the await

upper vapor
#

Task<T> -> Awaitable<T>
and
await Awaitable.BackgroundThreadAsync();

worthy rune
upper vapor
royal mica
#

The main motivation was we are running a while loop that is consuming queue and didn't want to lock up frames for consumption

#

but I guess this caused the ultimate failures

random scaffold
upper vapor
#
private async Awaitable<float> DoHeavyComputationInBackgroundAsync()
{
    await Awaitable.BackgroundThreadAsync();
    // here we are on a background thread
    // do some heavy math here
    return 42; // note: we don't need to explicitly get back to the main thread here, depending on the caller thread, DoHeavyComputationInBackgroundAsync will automatically complete on the correct one.
}

public async Awaitable Start()
{
    var computationResult = await DoHeavyComputationInBackgroundAsync();
    // although DoHeavyComputationInBackgroundAsync() internally switches to a background thread to avoid blocking,
    // because we await it from the main thread, we also resume execution on the main thread and can safely call "main thread only APIs" such as LoadSceneAsync()
    await SceneManager.LoadSceneAsync("my-scene"); // this will succeed as we resumed on main thread
}
worthy rune
#

that doesnt look like correct code

upper vapor
#

you go to the background thread and boom

upper vapor
#

or

#

matches

unique crane
upper vapor
#

also yeah

unique crane
#

SELECT count() returns single value

upper vapor
#

why count all entries if any match

worthy rune
#

does long get implicitly converted to bool

unique crane
#

No there is > operator after that

#

next line

royal mica
#

Also which DMBS are you using? Oh mysql

worthy rune
#

oh its the formatting

#

yeah i missed that

unique crane
#

guess

upper vapor
#

your squeal

royal mica
#

Yeah I corrected myself LULE

#

doesn't MYSQL have SELECT EXISTS() ?

random scaffold
#

bruh

royal mica
#

oh yeah it does

#

you can replace the COUNT(*) with SELECT EXISTS()

upper vapor
#

let them count the thousands of entries toomuchtrolling

random scaffold
royal mica
#

You need to do SELECT EXISTS(SELECT * FROM table1 WHERE ...)

random scaffold
#

it show same what count(*)

unique crane
#

Because exists requires a subquery

random scaffold
#

you in anyway get all lines

unique crane
royal mica
#

also with exists you do not get all lines, it stops at first line

random scaffold
unique crane
#

Thats still nothing for DB

royal mica
#

Still passable without indexes 😛

unique crane
#

😐

random scaffold
#

but easier just make separately service

#

bruh

restive turret
#

Just send a packet to 3rd party app and handle db there

random scaffold
#

why not

upper vapor
#

4th party

#

hmm

random scaffold
unique crane
#

Why are you even awaiting in seperate thread

upper vapor
#

db calls

random scaffold
#

before server have lag

#

but he have and now lol

royal mica
#

Async doesn't make it faster, it just makes it so it can do other stuff in the thread until it is complete 😄

unique crane
#

And since that thread is purely for sending db the data..

royal mica
#

Bus stop analogy. You can check your phone while waiting for the bus, you do not need to stand still looking for the bus

upper vapor
#

the illusion of multithreading

random scaffold
unique crane
#

Its not like its gonna cook TPS meanwhile

unique crane
#

Also you can combine the queries into a single call

royal mica
# random scaffold so lags doesnt must exists?

it is not that it is lag. its the problem of the game thread stops handling the database stuff instead of doing game stuff.
Async/Await makes it so it gives the database stuff to a background worker while it continues doing game stuff and then background worker says its done so it continues doing so

unique crane
#

No need to wait for exists call to return

#

DB can handle that itself

royal mica
upper vapor
#

you mean

#

MÁV Személyszállítási Zrt.

royal mica
#

oh yeah they merged in BP

upper vapor
unique crane
#

what

#

transport service isnt it

upper vapor
#

the government-owned train and bus agencies are unified in hungary

royal mica
#

yup

upper vapor
#

yea

random scaffold
random scaffold
royal mica
upper vapor
#

it makes it faster

#

by negative amounts of microseconds

#

-# state machine overhead

unique crane
#

Multiply by float instead of division moment

upper vapor
#

* 0.5

#

omg

royal mica
#

Atleast nowadays

upper vapor
unique crane
#

Idk

unique crane
#

or just SL

random scaffold
#

later will be add something

unique crane
#

Well why connecting it to DB when your not using it anywhere else?

#

Just keep it in memory trolling

random scaffold
#

because me need access to queries by hands

upper vapor
#

LA toomuchtrolling

unique crane
#

Yea

#

Just save it to a CSV or JSON

#

and load it on the server

random scaffold
#

im dont wanna download file and restart the server just for change

unique crane
#

Add cmds to LA if you need to do any modification at runtime

upper vapor
#

SLQlite

#

😭

random scaffold
#

me need 40-50 specific queries

unique crane
#

Or that yea

random scaffold
#

its stupid

random scaffold
unique crane
#

But why are you editing it manually?

random scaffold
#

im dont wanna download each time

unique crane
#

Thats not a point of DB

#

at that point just get a file as I said

random scaffold
unique crane
#

Wdym

random scaffold
#

and add something

upper vapor
#

manual migrations? despair

royal mica
#

I guess I'm at the other end of the spectrum, cause I'm parsing LocalAdmin logs for the same reason dogkek

random scaffold
#

example

random scaffold
royal mica
#

oh no

upper vapor
#

to update the database to reflect changes in the domain..?

#

oh no

random scaffold
#

why?

upper vapor
#

are you saying that your current schema will last a lifetime?

#

it won't

#

you'll have to change it at some point

#

= code changes & db changes

random scaffold
upper vapor
#

and what if you modify a table

#

or, well, the model

royal mica
#

Wait, you have auto DBMS on?

random scaffold
upper vapor
random scaffold
#

I think them through in advance

royal mica
#

Nah I do know this, this is a feature in Spring as well

#

where it auto creates all the tables

royal mica
#

BUT the caviat is that you cannot:

  • rename columns, only create new
  • delete columns
  • delete tables
upper vapor
#

they may be correct now but you don't know if they will change

royal mica
#

you can only do forward, no deleteion or revert

upper vapor
random scaffold
unique crane
#

You never know when we will change the ID system in SL trolling

upper vapor
random scaffold
#

in anyway

#

breakable change

upper vapor
#

who knows

#

you have to be prepared to modify the schema to add new features

#

it's not that difficult

#

just know that it's likely inevitable

#

no matter how much you think ahead

slender lynx
#

@flat vine thanks a TON for yesterday btw, you just saved half our projects

flat vine
#

👌

unique crane
#

Yipee

slender lynx
#

client crasher server ClassDTroll

random scaffold
upper vapor
#

how many drives have you managed to fill up (all clients)

random scaffold
#

or not you

upper vapor
#

Riptide said Task.Run had issues

#

ye

random scaffold
#

cedric said make task

#

bruh

unique crane
#

yes you can make a task

#

But we told you what to do with the async

#

Or well riptide explained it

frail orbit
#

Is there a channel where I can hire developers to create plugins for LabAPI?

mild ice
random scaffold
mild ice
unique crane
random scaffold
#

rty524t4ht4rht

#
public override void OnPlayerJoined(PlayerJoinedEventArgs ev)
{
    if (ev.Player.IsNpc || ev.Player.IsHost) return;

    string userId = ev.Player.UserId;

    Task.Run(async () =>
    {
        if (!await UsersModule.Repository.ExistsByUserId(userId))
        {
            await UsersModule.Repository.Add(new(userId));
        }
    });
}

just say how i can make it better then

unique crane
#

Understand it more

slender lynx
unique crane
upper vapor
#

dammmmm

unique crane
#

I would report your server for that kekw

slender lynx
#

technically not a verified server

#

proxied 🛫

random scaffold
#

im just wanna handle on join

frail orbit
upper vapor
#

good one

slender lynx
upper vapor
slender lynx
random scaffold
slender lynx
#

it would spam this, but i believe that it dosen't contain this log anymore

slender lynx
#

its because we faked primitives for the client

#

to make everything fully client side

#

even updating/changing primitives

#

the client didnt know how to update packets that was technically not spawned for it

unique crane
upper vapor
#

millions of primitives

harsh thorn
#

(drop sync messages for primitives that arent there)

slender lynx
slender lynx
#

to now

harsh thorn
#

i created server log files like that once

slender lynx
harsh thorn
#

when working on cmac

slender lynx
#

our la logs used to be so bad when we first started working that we had to disable it

#

i allocated 40gb to storage and it would fill in ~ 5 minutes of server uptime

harsh thorn
#

😭

slender lynx
#

thank god its fixed now

#

so much trial and error though

harsh thorn
#

time to performance test the wallhack fucker upper 9000

slender lynx
#

we were thinking of just adding a huge invis player always in front of the cheater

#

the wallhack will only render the cham of the one player

harsh thorn
#

theyd just filter it out though

slender lynx
#

they could ig yeah

harsh thorn
#

they already do this

slender lynx
#

sunrise is cool but it definetly gives too many false positives

#

especially on anyone above 50ms

#

hoping to get something more consistent

harsh thorn
#

ive worked on cmac to specifically account for that

#

but its hardto test

#

it processes teslas individually per player based on their ping

slender lynx
#

yeah teslas are wierd for that

upper vapor
harsh thorn
slender lynx
harsh thorn
#

i aint running midnight on my pc

#

😭

slender lynx
#

its just a hwid stealer

#

then resell that

#

russian technology

#

the first proccess it does is checking hardware info

#

if no vm then check hwid

harsh thorn
#

did you know, when i released the first bit of cmac and sentinal data stuff

#

i added something that crashed midnight uppon spawn

slender lynx
#

thats amazing

upper vapor
#

lmfao

harsh thorn
#

they fixed it like a day after, but it was still funny

#

now midnight detects cedmod and disabled noclip (for pickup through wall) and harmless tesla

#

albeit i dont actually see any record of it doing so

#

cuz their users are either dumb and are ignoring the "you will get banned"

#

or its not working

slender lynx
#

it works, but its optional

#

theres a warning next to the toggle

harsh thorn
#

surely if your cheat client tells you you will get nuked you should not enable it

slender lynx
#

nice red letters "dont use this, cedmod will detect"

#

and they still do

harsh thorn
#

i wonder when i finish the sentinalsimulator to do aimbot and shit, will they disable that too

slender lynx
#

always loved how they choose to cheat in the game with no ranking

#

thats neat

upper vapor
#

what a great way to spend your time

harsh thorn
#

yeah they did it already

#

their playerlist bypass was just cache if its filmmaker

#

so i make it send spectator now

#

sometimes overwatch

unique crane
#

What are you doing with them

slender lynx
#

pvp server, parkour server, and just general limit testing

hearty shard
#

😭

slender lynx
#

the main thing is getting the updating components to work client side

#

thats what caused the client logs

#

out of the ~ 65k primitives say 5k of them are constantly updating

#

client shits itself bc most of them werent loaded

harsh thorn
#

i would say performance is quite decent

#

ignore my serverside wallhack that isnt actually a wallhack™️

slender lynx
#

hows the perf impact of that with ~ 60 players though

#

i feel like that would start to stack fast

harsh thorn
upper vapor
#

couldn't you parent objects?

slender lynx
#

all with spinners, keys, client objects, teleporters, damage blocks, etc

upper vapor
#

oh like

#

oh

#

omgggg

harsh thorn
#

hm i need to get a better tps metric

upper vapor
slender lynx
#

if you spam it enough it works

unique crane
slender lynx
unique crane
#

I dont deny that

#

but

#

that is craaazy

upper vapor
random scaffold
#

your method freeze the server to 2-3 secodns

slender lynx
#

yeah

upper vapor
#

ye good

harsh thorn
random scaffold
#

task.run in on player joined

harsh thorn
#

works fine for me

random scaffold
slender lynx
harsh thorn
#

cedmod is litterally the largest plugin that has most task usage of any plugin

#

and has no such issues

random scaffold
#

what here can be wrong?

harsh thorn
#

if your tasks use too much cpu it will bleed over into the actual main thread

random scaffold
#

cpu stable

harsh thorn
#

idk then, it works fine for me

slender lynx
#

oh hey it does embed

harsh thorn
#

hm i wasnt expecting my tps counter to be moved off screen

unique crane
#

Am I crazy or is this from roblox

slender lynx
#

it is

#

jtoh in scpsl

hearty shard
#

Roblox obby in sl

slender lynx
#

what you think of it tho

slender lynx
#

thats what happens when everything is client side

unique crane
#

Or more of seconds per frame

slender lynx
#

the vid compresses itself so much on this host

#

i gotta change it eventually

#

the client fps is fine though

#

103 fps with ~ 60k prims

celest thorn
#

I love black magic

slender lynx
#

black magic parkour

#

btw zero when the thing i sent you is fixed can you merge everything to main

celest thorn
#

This server is powered the shadow organization

slender lynx
#

bc ive tested everything else

#

thx

harsh thorn
slender lynx
harsh thorn
#

albeit it could be as simple as it detecting if its killing tps and just turning itself off

slender lynx
#

those 1% dips to less than 40tps is gonna be noticeable

harsh thorn
celest thorn
#

so you randomly decided who is a spectator

harsh thorn
#

no

#

anyone out of range is spectator

random scaffold
celest thorn
#

in round start?

harsh thorn
celest thorn
#

because in round start everyone should be spawned

harsh thorn
#

yeah but the clients dont receive that

celest thorn
#

so if you see already spectator is likely people outside

#

wait

#

im confused

harsh thorn
#

anyone out of range (30 units) will appear as spectator

#

that includes as soon as the game spawns everyone

celest thorn
#

Ok but

#

if the client doesn't know they are spectator whats even the point?

random scaffold
#

ignore cedric AmeliaWatson_Stare

harsh thorn
#

because everyone out of their range shows up as spectator for them

celest thorn
#

about their role?

harsh thorn
#

and if the raycast pos checker cant obtain a LOS on the player it will send them to 0 0 0 for the receiver

celest thorn
harsh thorn
#

the PLAYER themselves will know what their role is

#

they wont know what OTHERS are unless they are close to them

celest thorn
#

honestly

#

i kinda like it

#

but tps

#

is main concern

harsh thorn
#

that isnt the tps part

#

thats the raycasting

#

albeit i need to test if it really is

#

or if its just sl not liking that many dummies

celest thorn
harsh thorn
#

this just makes it straight up impossible

#

lmao

celest thorn
#

i just wanna leave it annoying

slender lynx
#

test it out after 10

#

each dummy drops tps by 2

harsh thorn
#

im gonna run it without the raycast

#

and see if my tps also shits itself

#

because in my console you can see the avg of how much MS the method takes

#

for syncing the entire server

celest thorn
#

in most of the test we did on AM for maps and stuff that happend

#

always dummies lowering down tps

harsh thorn
#

was that the case for you aswel?

slender lynx
#

we were testing dummies for our pvp server

#

60tps until 10 dummies

#

at 11 its 58

#

12 is 56

#

etc

harsh thorn
#

ok yeah its not my patch

#

gaming

#

with 10 dummies and the sync stuff the tps stays at 60, drops to 59 for about 0.2s every 10-20s

#

i call that success

slender lynx
#

someone has to look into why dummes cause such an issue

harsh thorn
#

im not sure whatit could even be

#

uh

slender lynx
#

before dummies the npcs didnt cause this kind of drops

unique crane
#

Its the server position distributor

slender lynx
#

it was only after dummies were officially implemented

celest thorn
unique crane
#

: trollface:

upper vapor
#

at Cyn

harsh thorn
celest thorn
harsh thorn
#

cuz thats what im patching and i have a benchmark on it printing evert 300 frames

unique crane
harsh thorn
slender lynx
harsh thorn
#

cuz im patching that in cm

unique crane
#

ServerPositionDistributor was number 1

harsh thorn
#

well yeah it loops through every player for every player every frame

unique crane
#

Yeah

celest thorn
harsh thorn
#

what did you expect

celest thorn
#

so its like mega laggy

#

for that

#

each player counts for 2

harsh thorn
#

well i mean thats nanoseconds were talking about

#

lmao

celest thorn
#

so 60 players are like = 120

#

because of the sync of position

harsh thorn
#

it doesnt even hit a ms other than when its raycasting

unique crane
#

Whats this patch

upper vapor
harsh thorn
celest thorn
#

let me find the messages

upper vapor
#

yes that one

unique crane
#

Im talking Distributor overall

#

Not your patch

upper vapor
#

it re-evaluates it for every player to every player instead of caching

harsh thorn
unique crane
#

Hmm

harsh thorn
#

so it should be my stuff + game stuff

celest thorn
#

Here

harsh thorn
#

well how does it cache

upper vapor
#

create a dictionary

harsh thorn
#

cuz it has to eval the entire playerlist ^2 still

upper vapor
#

get players' positions in one pass

#

and tryget

upper vapor
#

players won't move between passes

#

that's the point of caching

harsh thorn
#

either the receivers position changes requiring you to check if the receiver moved

#

or the hub moved

#

so you need to check if the receivers cache is invalid

#

and if the player its going to receive is invalid

upper vapor
#

you cache it in the method itself

#

just for one WriteAll call

harsh thorn
#

im confused

upper vapor
#
static Dictionary<ReferenceHub, RelativePosition> Positions = [];

bool WriteAllPatch()
{
    Positions.Clear();
    foreach (var hub in allhubs)
    {
        var position = Positions.TryGetValue(out var existing) ? existing : hub.pos();
        foreach (var receiver in allhubs)
        {
             // if visibilitycontroller hides then send 0,0,0 or something, otherwise the position
         }
    }
}
#

something like that

#

also update the dictionary

#

wait

#

no

#

you don't need the dictionary

#

just put the position variable outside the 2nd foreach

harsh thorn
#

ok so basically, you are saying to cache the syncinfo call

upper vapor
#

just the position

harsh thorn
#

it doesnt have a position though

#

this is the position, this object is sent to clients

#

unless you create your own

upper vapor
#

righttttt

#

then cache it there

#

the position at least

#

actually

#

yea

harsh thorn
#

you might break something with that now that i think about it, unless actually no you can just update the previouslysent one manually so the game doesnt implode

upper vapor
#

clear the dictionary in writeall

#

tryget in getnewsyncdata

harsh thorn
#

im talking about FpcServerPositionDistributor.PreviouslySent

#

cuz getnewsyncdata adds what it retrieved

upper vapor
#

yeah that should not be touched

harsh thorn
#

but you can just write to it manually

#

because if you cache the syncdata

#

youre going to be skipping a bunch of calls

#

cuz first player will eval
and everything (in range) would be cached

then for the second player, all the in range players for 1 would already be cachedm so getnewsyncdata wouldnt be called for them

#

thus previouslysent isnt updated for them

#

hm i wonder, let me just spawn some of my old type dummies and see if it also fucks tps like dummies do

#

the answer is yes

#

wtf

celest thorn
#

lovely sl performance

harsh thorn
#

to save allocing a new dict every frame

#

lol

upper vapor
slender lynx
#

god we fucked this game so much

harsh thorn
# upper vapor

hm, im confused what the relativeposition is actually used for there

#

because that isnt sent to clients at all

#

cuz thats in FpcSyncData and thats still done by FpcServerPositionDistributor.GetNewSyncData

#

oh you just patched both i see

#

lol

upper vapor
#

ye

harsh thorn
#

hm lemme pull something like that off

celest thorn
#

thank you :3

#

(im joking)

harsh thorn
#

imo you could save some more by caching the syncdata itself

#

cuz your still instantiating a bunch

celest thorn
#

Next update fix?

harsh thorn
#

although

#

it wants the prevsync

#

im not sure what for

#

seems like to check if the position has changed

#

but that shouldnt matter if you make sure the prevsyncs are always in-sync and would work just fine

unique crane
#

It only serializes the data if they changed

harsh thorn
#

you can also do

#

so you dont make a new one each time

#

not sure how much overhead it is

#

i suppose a little cookery cant do harm

upper vapor
#

we'll see about that

harsh thorn
#

well he still syncs

#

so thats a good thing KEK

celest thorn
harsh thorn
#

i dont work on the game unless i abaolutely have to

celest thorn
#

Oh forgot

#

yea so please random nw programmer fix it :3

harsh thorn
#

this is for programmers or any bored labapi maintainers

upper vapor
#

david

celest thorn
#

i love making transpilers

harsh thorn
#

i dont if the transpiler is in my code

#

cuz i cant change it then

celest thorn
harsh thorn
#

and i basically lobotomize the entire method

celest thorn
#

if you give me how and what you changed

#

Lol

#

i could rewrite the entire method

harsh thorn
unique crane
celest thorn
#

Nah i will see what i can do to actually make it

#

work with a transpiler

hearty shard
#

omg david!!!

unique crane
#

eve!!!!

celest thorn
upper vapor
unique crane
#

haiii :3

celest thorn
#

haii

harsh thorn
#

god i need to make a bunch of cmd binds to control dummies with

harsh thorn
#

ok cool the random dips to 59tps also happen in the waiting for players menu, so its not from the patch either

#

gaming

slate flume
#

Even Cedric is fed up with this shit

restive turret
#

Lel

fair rain
#

Hey guys, new to this disc but anybody have tips for managing player Effects with LabAPI? I'm migrating an old plugin from Exiled to LabAPI and everything is much better, except for effects... seems difficult to enable/disable effects by name

grand flower
#

Not 60*2

#

(even worse)

#

@harsh thorn caching relative positions in GetNewSyncData got us 4/7 tps back on 48 player servers

harsh thorn
grand flower
#

Hmmm I'll have to recheck but I'm pretty sure the rest isn't of much consequence

#

I just allocate the cache dictionary once with a capacity of 128

#

So we never reallocate that

harsh thorn
#

not sure how much impact a unbound dictionary would have vs a static size one tbh

grand flower
#

Round robin is also a nice boost but heavily dependent on the amount of resources you're giving to the machine

harsh thorn
#

my thought was doing this, so it only create the entire object once for every player

grand flower
#

i.e. 17 tps to 33 tps on a 100 player server if you're not starving it

harsh thorn
#

oh yeah and using a static one for invis

grand flower
#

Wasn't sure either but decided to just do it anyway, can't be worse

harsh thorn
#

with what i did so far i cant really tell any negative performance impacts

#

but dummies causing 20 tps when you have 70 of them makes it hard to tell

#

unsure why that happens

#

maybe because they are considered a local player or something

grand flower
#

Had 33 tps at 99 dummies so idk

harsh thorn
#

i had 20, with and without patches that could impact tps

#

but cpu does make a difference so

grand flower
#

Odd

#

Ah yeah I have a 7950X

harsh thorn
#

i was testing on a 3600

grand flower
#

Fair enough

harsh thorn
#

im sure if i tested it on my 7950x itd hit higher aswel pepeLaff

#

but the point is to test on more common hardware as not every host has a cpu of that caliber

grand flower
#

Was mostly targeting optimizations @ 2 cores per server

#

Since it's what we use

#

Round robin does help a little but a lot less with those constraints

harsh thorn
#

i mean tecnically speaking sl is singlethread
but hyperthreading stretches it a little

grand flower
#

Compared to my 17 -> 33 tps increase on my end

#

Yeah

#

Tbf I did see a huge drop between giving it all my CPU and starving it at 2 cores

harsh thorn
#

or what

grand flower
#

Odd players one frame, even players the next

harsh thorn
#

i guess that works

grand flower
#

Minimal gameplay impact

harsh thorn
#

i think the game might not even care if you just dont include players in the fpcsync buffer

grand flower
#

173 looks a tiny bit jittery but who cares, and players at hyper speeds teleport a little too

#

(but who cares)

#

Hitreg still works perfectly fine

harsh thorn
#

at most youd be skipping 1 frame

grand flower
#

It's enough to add a bit of jitter to 173 and players with > 150% movement speed

#

But nothing that kills gameplay

#

173 stops when you look as always

harsh thorn
#

well obviously youd me missing about 0.3f of velocity

#

may be a bit more than 0.3

#

but around that range

grand flower
#

It's just that it seems SL doesn't interpolate players over a certain distance

harsh thorn
#

the game tries to lerp so its not that noticable unless the gap becomes too obig

grand flower
#

I think?

#

Yeah

fair rain
# hearty shard

Thanks for that, yeah I saw those methods, but the problem is I need a way to search for ANY active effects on the player. I see StatusEffectBase but can't find a list of classes that subclass that anywhere. Am I looking in the wrong place? Or is this base game code that I'm unfamiliar with

harsh thorn
#

i believe lerping is limited to a certain range

grand flower
#

Guessing that's clientside right?

harsh thorn
#

yeah

#

as otherwise it becomes weird

#

cuz people go fast slow fast slow when going out and in of lerp range

hearty shard
#

StatusEffectBase is all effects

#

well

grand flower
#

Yeah I've seen players lerp through an elevator door if you teleport them to you at the right time

#

Kek

hearty shard
#

its what every effect inherits from

#

Scp207 inherits ColaBase which inherits StatusEffectBase

fair rain
harsh thorn
#

im debating whether or not to add some autistic system that will make my fpc movement patch detect if its impacting tps and disable itself

fair rain
# hearty shard its what every effect inherits from

exactly lol I was seeing all these methods with <T> where T is StatusEffectBase but I was looking for something that actually lists all of those classes. BUT i think ActiveEffects will work for now thank you! ❤️

harsh thorn
#

(its a patch thatl do some raycasts every X to fuck with wallhack users), i cant get any performance impact, but its hard to test because dummies fucking kill the server tps

#

but the method itself generally stays under the 1 ms from what i can see, occasion 3-7ms every few s

hearty shard
fair rain
hearty shard
#

i meant above 0

#

my bad

fair rain
#

ok cool lmao just making sure

#

❤️ thx

fair rain
#

orrrrrr if those classes have an effectName field that is compatible with the screenshot you sent earlier then i guess i could try using that

hearty shard
#

its the unity name

fair rain
#

omfggggg that makes so much sense

#

tytyty

hearty shard
#

but yeah NW doesnt have enum for it

#

i dont know if there ever will be

severe cave
#

How can I spawn a schematic that I made with a plugin?

#

or whatever it is called

severe cave
#

it takes days for them

fair rain
# hearty shard but yeah NW doesnt have enum for it

I think that makes sense here. Sometimes its kinda nice (like in Exiled you can apply an effect on a player with just the enum which is super easy), but other times it gets wayyy too excessive when EVERYTHING has an enum

hearty shard
fair rain
fair rain
#

bet than ya what EVE said

main zenith
#

i need help how can i get item as fiream and how can i edit attachment of this firearm and ammo in mag.?

unique crane
main zenith
hearty shard
unique crane
#

And ammo is dependant on the type of the weapon, but generally it is
firearm.Base.TryGetModule(out IPrimaryAmmoContainerModule magazineModule)
magazineModule.AmmoStored = value

#

if check for the try get reccomended

main zenith
# hearty shard cast it

like that?

 Item item = player.AddItem(ItemType.GunE11SR);
 FirearmItem firearmItem = item as FirearmItem;
unique crane
#

Yes

icy knoll
teal junco
#

does anyone know how to reverse engineer the CASSIE jam?

icy knoll
#

ik

#

im just saying, you could also do that and have 1 less line

#

which i like lol

teal junco
main zenith
upper vapor
#

Fuck around and find out

teal junco
#

damn

#

I know the syntax, Im just worried about recreating the effect 1:1

teal junco
#

Hold on let me see something

upper vapor
#

Uh

#

You need to stretch the samples

slate flume
#

Is there a way I can get the default fuse time for a grenade?

#

When spawning a grenade, I need to specify fuse time in order to make it not explode instantly, but I can't seem to figure out where to do this

restive turret
#

.Base._fuseTime

#

Or the last arg

#

(the -1)

slate flume
#

I don't mean I need to change fuse time

#

I mean I need to figure out what it is by default

#

Because when you spawn one it defaults to -1 and instantly explodes

#

I'm just looking to circumvent it

hearty shard
#

TimedGrenadeProjectile.SpawnActive(player.Position, ItemType.GrenadeHE, player, 3);

#

3 is the fuse time

teal junco
upper vapor
#

uh

#

math magic

#

:3

#

interpolation

#

2x or 0.5x speed is rather simple in theory

#

arbitrary speeds get complicated

slate flume
teal junco
#

Samples are a byte[] right?

slate flume
#

That's all I needed haha thank you

teal junco
slate flume
#

Well unless there's a way to get the default fuse time so I don't have to worry about it if fuse time changes

upper vapor
#

or the base

upper vapor
teal junco
#

hm do you think that theres a library which has a method to do that

upper vapor
#

never heard of this

#

basically if you can resample audio then you can tell the resampler that it's a different rate

harsh thorn
#

info and libraries for audio stuff like this are surprisingly rare

upper vapor
#

found this

upper vapor
teal junco
#

Then I can take that audio and add it to the AudioClipStorage (using VorbisReader)

upper vapor
#

load it using the storage, get the data, process it and set the data back

#

or

#

modify the data

#

nvm

teal junco
#

Well I'm planning to add it myself

#

let me take a look

upper vapor
#

if you wanna read a file then use the storage to read it

#

i mean you already need NVorbis so you can read it yourself

random scaffold
#

bybygaga

main zenith
unique crane
#

With each index being power of 2

#

so 0^2+1^2+2^2

#

Of the active attachments

#

I reccomend getting the attachments base game and then printing the current value

#

Via a plugin

upper vapor
#

use the forceatt command

main zenith
upper vapor
#

to show what attachments you have on the gun in-game

main zenith
upper vapor
#

in-game

main zenith
main zenith
upper vapor
#

np

unique crane
#

Oh it shows you the current attachment combination

main zenith
main zenith
unique crane
#

Oh right

#

Get the implementation

#

MagazineModule

#

or

#

CylinderAmmoModule

#

(for revolver)

#

And then there is ServerSetInstanceAmmo(ushort serial, int amount)

#

@main zenith

main zenith
#

ServerSetInstanceAmmo(ushort serial, int amount) its can be called by NetworkServer or what?

unique crane
#

Wdym?

#

Its meant to be called on server

#

and then it syncs data to the client automatically

main zenith
# unique crane Wdym?

like for example i have this code and how i can call the ServerSetInstanceAmmo?

       public void AddCutomItem(CustomItemsData CustomItem,Player player,int amount)
        {
            Item itemplayer = player.AddItem(CustomItem.BasicItem);
            FirearmItem firearmItem = itemplayer as FirearmItem;
            Firearm gun = firearmItem.Base;
            
            MothCustomItemsMain.Instance.CreateCustomWeapon(itemplayer.Serial, CustomItem.CustomItem);
ServerSetInstanceAmmo(itemplayer.Serial, amount);


        }
unique crane
#

gun.Base.TryGetModule(out MagazineModule magazineModule);
magazineModule.ServerSetInstanceAmmo(gun.Serial, yourAmmoAmount) ;

#

preferred safer way

unique crane
#
if(gun.Base.TryGetModule(out MagazineModule magazineModule))
{
    magazineModule.ServerSetInstanceAmmo(gun.Serial, yourAmmoAmount);
}
#

There are firearms wrappers coming eventually

#

to make this easier

slate flume
upper vapor
#

grenade.Base._fuseTime

#

wait no

restive turret
#

Why did you what

slate flume
#

itemBase.PickupDropModel is not TimeGrenade grenade returns true

upper vapor
#

there's a projectile prefab in the uh

#

uh

restive turret
#

Why you need what

slate flume
restive turret
#

TimedGrenadeProjectile flash = (TimedGrenadeProjectile)TimedGrenadeProjectile.SpawnActive(player.Position, ItemType.GrenadeFlash, player);
flash.Base._fuseTime = 1;

upper vapor
#

they want the original fuse time

slate flume
#

^

restive turret
#

Oh

slate flume
#

Also you can set fusetime in the SpawnActive method

#

No need to .Base._fuseTime

restive turret
#

Well check how the.SpawnActive does it and you can do that there

slate flume
#

It doesn't

restive turret
#

Cant you redo all that to get the pickup stuff?

#

*time?

slate flume
#

SpawnActive doesn't set the proper fusetime

upper vapor
#

at this point just copy the spawning code from labapi

slate flume
#

Is what I'm saying

slate flume
#

Otherwise i would've stolen that code

slate flume
upper vapor
#

remove the fuse time setting thing

#

🤯

restive turret
#

Wdym proper fusetime?

#

If you edit or patch the method it will not set the fusetime

slate flume
restive turret
#

Ye that's what I would do, or just copy paste to my own

upper vapor
#

if you use that method
you can just copy the code
without patching

slate flume
#

Yeah but

upper vapor
#

what Slejm said

slate flume
#

I don't wanna worry about fixing it when it updates

#

If it updates

upper vapor
#

well

#

there's this refactoring called

#

"inline method"

restive turret
#

Well, only update we get this point is either 14.2 or 14.1.1 which i think will be months away

upper vapor
#

so you can just replace your SpawnActive call with the LabApi method when it gets fixed

slate flume
#

If I patch it it gives me an excuse to actually learn how to do transpiler BS

upper vapor
#

good luck

restive turret
#

Have fun

restive turret
upper vapor
#

but what if they wanna fix it

#

and not just remove the fuse time setter

#

but check for -1

#

lot of nerding required

#

-# not bad

slate flume
#

It's really just:
Check for -1, skip instruction if true
Which means for IL you need to insert a label after the code and run a conditional jump before the code to the label if true

upper vapor
#

use CodeMatcher

#

highly recommended by others

slate flume
#

CodeMatcher?

#

Lemme check it out

upper vapor
#

ye it's uh

#

pretty cool

#

i gotta use it sometime

#

leaving behind exiled-style patches:

wheat flower
fair rain
#

Is this the right LabAPI-way to Spawn a new item (Pickup) at a given position?

Pickup pickup = myItem.DropItem();
pickup.Position = myVector3;
hearty shard
#

why r u dropping item

#

Do you already have an item?

#

Or r u creating it

#

for this

#

Cuz then Pickup.Create

tough ivy
#

skibidi

fair rain
static meteor
#

You'll also need to spawn it for it to be visible

hearty shard
#
        {
            Pickup pickup = Pickup.Create(Type, position)!;
            OnCustomItemCreated(pickup.Serial);

            if (shouldSpawn)
                pickup.Spawn();
grand flower
#

Does SL use a custom interest management system for Mirror

#

or am I free to make my own

worthy rune
#

nope

#

i tried using it in the past from a plugin and it causes all sorts of problems

#

not to discourage you, it could of been entierly my fault

grand flower
#

what kind of problems are we talking

grand flower
worthy rune
#

null character controllers

#

when one of them breaks, movement for most players breaks(they get stuck in place on the server)

grand flower
#

fun

#

I'll try not to touch players then

#

Even though it would've been cool for another plan I had with it heh

grand flower
#

kinda surprised SL doesn't

#

this is the kind of stuff you'd use to stop networking players when they're invisible/in other zones or w/e

worthy rune
#

game isnt really made to work with it

grand flower
#

fair

worthy rune
#

since it would "disconnect" players outisde the range

#

not to say they could make it work, it just would require reworking alot of stuff

grand flower
#

fair enough

worthy rune
#

i could see it working well for pickups/ragdoll(maybe ?) tho

grand flower
#

just used to the unreal way which does that by default, the default "interest management" solution is distance based

#

yeah perhaps

#

but don't pickups/ragdolls get culled anyway

#

or are they still costly to clients even when culled

worthy rune
#

not really

#

the culling from what i see is only visual, which doesnt impact fps that much since the gameobjects are still enabled

grand flower
#

so you're telling me there's another avenue I can explore to squeeze performance out of servers & clients too this time?

worthy rune
#

maybe, although not sure how much of an impact you can make from just plugins

grand flower
#

if I can stop networking of pickups and ragdolls that's already good in my books

#

did notice clients retained some hefty fps drops when we had a ton of them, even in different zones/culled

worthy rune
#

im pretty sure the networking for both of those is extremely low, any gains would probably be in fps

grand flower
#

yeah that's the goal

grand flower
#

but if I can get the latter done too, that's just gravy

worthy rune
#

yeah im reading that now, i dont think it will happen mostly because it would require the game to be reworked to use AOI

grand flower
#

would it though

#

can just go with the default outside of the admin toys

#

default seemingly being "just add to observers lol"

worthy rune
#

unsure myself, typically for this kind of thing you would just send your own spawn messages to the clients you wanted to see it. but i understand why that would be unoptimal due to the way mirror works

#

its been awhile but i dont think custom interest management is very performant on the server side

grand flower
#

should be fine as long as you're careful with the checks you do

worthy rune
#

i could be wrong by i think you need to rebuild all observers everytime something spawns, and that involved looping over every connection/network id combo

grand flower
#

i'll take a look

#

if that's the case, then Mirror's a little dumb for that

worthy rune
grand flower
#

well that sucks

slate flume
#

Yo

#

Dumb question