Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync at round preparing? #9

Open
Binerax opened this issue Jul 10, 2024 · 4 comments
Open

Sync at round preparing? #9

Binerax opened this issue Jul 10, 2024 · 4 comments

Comments

@Binerax
Copy link

Binerax commented Jul 10, 2024

Hi, absolutely love this wardrobe system. My only problem is when people request a change the server lags for a second. This could be quite annoying doing rounds. Is there any way to only have models synced during the preparing phase? Before a round starts? Thank you again!

@CaveeJohnson
Copy link
Owner

CaveeJohnson commented Jul 11, 2024

Unfortunately not possible without significant (but relatively simple) changes, since you would need to add this factor into the client recieve code. The recieve code already deals with NULL players due to PVS dormancy, so you'd be complicating it quite a bit and maybe introducing bugs around it that it existed to solve.

https://github.com/CaveeJohnson/wardrobe/blob/master/lua/wardrobe/wardrobe.lua#L465

You want to put the wardrobe.getAddon call (everything after the 'already requested' shortcut) into a closure, and then store that closure in a table representing a queue, then when you're ready to deal with them (gamemode changes to prepare phase?) fire a function which processes the queue (pop each closure, execute it, could be parellelized but gmod makes that non trivial).

This should be relatively simple if you have familiarity with Lua, but I've also not tested it, so keep in mind the issues i mentioned.

@CaveeJohnson
Copy link
Owner

This is probably the simplest way, but technically the lag spike is the MOUNT not the DOWNLOAD, so this would just be delaying the downloads until round prep, if its a large file it could take into an ongoing round, then cause the lag when the MOUNT occurs.

Doing it the other way would probably be even messier.

@CaveeJohnson
Copy link
Owner

TL;DR

Not possible, but if you know lua you can probably do it without too much effort by queuing part of the process and processing the queue on the round change.

@Binerax
Copy link
Author

Binerax commented Jul 11, 2024

Understood, If I had any lua experience I might've taken a jab at it but I don't really know lua. Thank you for the quick replies!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants