Im trying to make a roblox drawing game, all of the features are pretty much implemented, but the server gets overloaded so easily from all the parts that is generated to make up the strokes. Im not sure if it is due to my code in the server, the parts themselves taking up space on the server or what, but around 60k parts it becomes almost unplayable when Spray Paint can easily have over 300k with no problems. So I guess Im wondering how do I achieve performance like this with a part based system? Does spray paint use decals instead or something else? Any help is appreciated. I can't really post all my code in here because its thousands of lines at this point but if you want to see a snippet just ask.
#Trying to optimize my Drawing Game, I need help.
1 messages · Page 1 of 1 (latest)
most likely decals
it depends if you have code looping through all of the parts
that would cause lag
consider learning how to read and use the microprofiler
yes I do use a lot of for loops. So you are saying the parts themselves are not the problem, but since the total amount of parts accumulates, the for loops running through them are taking longer and longer thus leading to poor performance?
and i will look into the microprofiler
e.g if you are checking ALL parts every time a new part is created for some reason, i.e check limits, distance check, or doing something every frame for all of them, yep that's a recipe for lag. parts on their own don't cause cpu lag, they just consume memory.
spatial query like raycast is better at the scale of 10k's+
hmm the way my code is set up is that whenever a player draws, they only create new parts per brush stroke, they dont loop through all of the already existing parts, yet when a player has over 100k parts for their drawing, it is definitely a lot less responsive
the server kinda lags a lot, but I will look into it and see if a for loop is getting called where it shouldnt be
i'd expect 100k to be the total for like 30 people, not 1
one of the tools is a spray can, generates a dot for every pixel
every line takes a lotta parts
but spray paint handles 300k with no problem, but mine dies at like 100k
im definitely gonna put a part limit on players, but I want it to be able to handle 200-300k total in the server without slowing down too noticeably
** You are now Level 1! **
i swear i saw smhtn about editable decals in roblox studio
ima check it out and see if I am remembering correclty
ill come back
Developer Forum | Roblox
Hi Creators! We’re happy to announce that EditableImage support for SurfaceAppearance is now available in Studio! You can now use the EditableImage API to create your own custom Color, Metalness, Roughness, and/or Normal maps to create a SurfaceAppearance using the new runtime AssetService.CreateSurfaceAppearanceAsync method. EditableImag...
that sounds interesting
ah
my bad homie
youre good
im just tryna get this optimized without converting everything into mesh
currently tinkering with the microprofiler
im not seeing anything on the microprofiler. It seems like this is for frame rate issues. The issues im having are frame rate related, its more just reduced responsiveness. Like the server just takes longer to respond. Unless im wrong?
dont forget to check it from server perspective in studio
but yea its more for cpu lag
wouldnt it be better to just replicate everything on the client
i think there's memory tools in it too
how would u go about doing this pyro
reducing the need for 100k parts for one person is probably first thing i would do
true
I think I figured it out
the microprofiler showed me that a streaming solver v2 was taking 80 ms to run, so I disabled it streaming enabled and now it runs perfect
theres no way that was it
you wouldnt understand unless you played the game, there is a need unfortunalely
would be simple to understand with a screenshot showing 100k parts
hold up, I got you
this whole thing is a canvas for players to draw on as they please
what you see rn is about 10k parts
the other tools are a lot more optimized
i'd still suggest making those parts slightly larger
anyway i'd suggest reduce your min streaming radius
and again make sure nothing looping over all parts, make sure they're all anchored etc
and make sure you aren't spawning duplicates
yeah, every attribute that can affect performance is disabled and set to false, and the parts themselves are controlled with a slider, so they can make the parts bigger or smaller if they choose. And disabling streaming enabled seems to have completely fixed my server lag...
** You are now Level 2! **
even though its only a client side thing
some performance affecting things will do more work when disabled or false
i would suggest you keep instance streaming on
oh really?
yes, such as instance streaming
yes I have instance streaming still on
i just disabled shadows, made the material smooth plastic, made them anchored
namely turning it off will make mobile phones pain when trying to run this
keeping it on shouldn't have much cpu cost on server
oh streaming enabled?
idk its being weird
as soon as I disabled it my game is now running perfectly
but its not really intended for phones in the first place, maybe ipads though
tbh nothing stopping you making this entirely clientsided
bit of work to do it but, it's plausible
idk up to you
if I do everything client side then it wont appear for other players
its supposed to be a community thing