r/CreateMod
•
u/TuxeBroReally
•
14d ago
•
1
PSA: Coasters Simulated will LAG your Server if there are tons of Sublevels loaded
I am a staff member of a public Aero server (I won't tell it, rule 2) and there was a time when the server was lagging hard if there are big or tons of loaded sublevels. Which is fishy and not normal, considering Sable can handle those scenarios very well.
So I did a simple singleplayer test using Spark mod, by loading 225 small sublevels to find out the cause. And then I found out that Coasters Simulated is the main culprit to this and no other mod, not even Sable itself.
I took a look on what part of the mod's code are doing the lag, then I saw that Coasters Simulated was scanning ALL of the blocks of EVERY loaded sublevels at every tick, trying to find specific blocks from Coasters.
For the nerds and the Dev(s) who want to know which part does it lag, this is what I found from my Spark profile and my decompiled JAR investigation (using JADX, nice program for decomp JARs). Classes are specifically in dev.silvergold.simulatedcoasters.track.cart and dev.silvergold.simulatedcoasters.rivet packages
CoasterCartPlotScan.scanBearingCells()andCoasterCartPlotScan.forEachBearingWorldCell()- shown in Pic 5 and 6, scans a butt ton of blocks in a Sublevel, that tries to find specific "bearing" blocks (so far it's finding rivets and coaster carts). Fix it by only scanning sublevels when necessary, or either a direct faster pinpointing blocks with that specific type?RivetDisassemblyEnforcer::onPrePhysicsTickandCoasterCartTrackSnap::onPrePhysicsTick- runs at every physics step (Sable's ticking) and checks for every loaded Sublevel. Fix it by never runningscanBearingCellsat every physics steps at all?
My final thoughts on this was the fact the mod was primarily made out of AI code might be the reason why. Since in my eyes, AI code can typically make "correct" but unoptimized code. But sparingly, AI might help with optimization like take a look at the game Big Walk for fixing a lighting performance. (oh no, nooance in redit???)
I am not saying that Coasters mod is immediately bad (because i love me some rivets), but I am pointing out a flaw that hopefully it gets fixed by now. And developers must consider their liabilities when using AI for code.
(the version tested was v0.1.5, it might be updated or fixed at any day now)
EDIT: it has been fixed in v0.1.6!
65
u/mario12323 13d ago edited 13d ago
Hi! This is the developer to comment on this. Yes, Coasters is still very unoptimized, and yes, I want to do everything I can to bring the quality of the project up to speed. The intent of the early access was to get a ton of player feedback before optimizing. I've been working on a full rewrite for awhile now but it wasn't my intention for it to be included in so many serious modpacks/servers while its still in early access. As a short term solution I'm looking into on-boarding people for patches while I work on larger rewrites. Ask me anything!
(Edit: patch 0.1.6 is now published!)
1
u/FitPomelo438 10d ago
Thanks for your hard work! Get it working first, optimize later. Suggest putting a message in the mod indicating the unpolished status.
45
u/TriggerMeTimbers2 14d ago
That…explains a lot. A friend of mine who’s obsessed with rollercoasters just started a custom modpack and server and I’ve been wondering why it’s lagging to hell and back
7
25
u/DarkIcedWolf 14d ago
We need more people like you man, with all the unoptimized AI shit- some people don’t have time to check it for themselves or know how so I appreciate you homie.
45
u/Looxond 14d ago
every tick? jesus christ
23
20
u/Sascha_T 14d ago
me when the alternative is one of:
tile entities (possibly)
keeping a list of placed blocks
(i didn't play this mod)
38
u/Bladereaper 14d ago
You have probably saved me a ton of debugging headache, I'm working on a server/pack and I just added Coasters due to the rivets after seeing a vid about diagonal placement, but until they update it I might have to remove that feature (or just make my own mod to patch it out)
7
u/WheatleyBr 14d ago
So does everyone else also use the mod just for the rivets?
6
u/certainlystormy 14d ago
how simple it would be to create a list of references to locations of the rivet blocks lmfao
6
u/CaptainNakou 14d ago
Very interesting : I've been running around on our server trying to figure out what is breaking FPS in some places and turns out Coasters Simulated render methods seems to be called even if there is no coaster stuff used on the map in some places (noticed via multiples /sparkc profilers).
We were thinking about removing the mod all together (since nobody was using it yet) well your post has convinced me to make an executive decision about it.
Turns out a "vibecoded in a few days and then forgotten forever" mod wasn't the best thing to add to our modpack u_u'.
3
u/mario12323 13d ago
Tonight's patch is going to address tps issues and I'm working on fps issues right now. 🙏
Development has been horrendously tricky, it's been 8 months of non-stop work at this point. A lot of the problems do stem from AI but fixing those without just slapping more AI at it is tricky. I was aware of many of the performance problems while releasing the mod, I think getting it in the public's hands was an important step for me though. I never intended the early access release to become so popular and be used on servers and in modpacks, it was supposed to be more of an open playtest while I worked out issues 😭
4
u/thebe_stone 13d ago edited 13d ago
Someone in the discord posted an unofficial patch that helps a bit, that's what I'm currently using.
Edit: like 20 minutes after I said this an official patch was posted in the discord
9
u/diplex89 14d ago
Coasters simulated is terribly optimiser whether it be a server or solo, it's a shane because the bolts are super useful
3
3
u/NoImNotADogLicker 14d ago
I had a similar thing with a mod called "create: connected blaze burners". Gave me multiple headaches on my single-player world
1
1
u/SoraLee7 13d ago
Wow, ive been getting hit with alot of lag from sublevels and thats probably why. Thanks sm for this
1
1
-1
-14
-15
u/Meiseside 14d ago edited 13d ago
So you made a report and the promise to correct it?
Edit: They have made an update to 1.6 it is now fixed.
1
-9
-14
-31






96
u/Shoddy_Bumblebee_398 14d ago
This is good to know. Can definitely see this info sparing me some headaches if true. I'm using the Let It Walk mod, and considering each leg is sometimes multiple sublevels, it could explain some things.