r/CreateMod • • 12d ago • Mindblown 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() and CoasterCartPlotScan.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::onPrePhysicsTick and CoasterCartTrackSnap::onPrePhysicsTick - runs at every physics step (Sable's ticking) and checks for every loaded Sublevel. Fix it by never running scanBearingCells at 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!

370 Upvotes

35 comments sorted by

96

u/Shoddy_Bumblebee_398 12d 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.

65

u/mario12323 11d ago edited 11d 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 7d 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 12d 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

u/mario12323 11d ago

A new patch is coming out tonight hopefully

25

u/DarkIcedWolf 11d 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 12d ago

every tick? jesus christ

23

u/Saidai_V 12d ago

5 times every tick actually.

4

u/Kinster- 11d ago

Holy shit

20

u/Sascha_T 12d ago

https://imgur.com/a/oBBNf76

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 12d 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 12d ago

So does everyone else also use the mod just for the rivets?

6

u/Ghyro 11d ago

It is the best feature of the mod after all, by far

2

u/WheatleyBr 11d ago

Sideways chutes are just another level of convenience

6

u/certainlystormy 12d ago

how simple it would be to create a list of references to locations of the rivet blocks lmfao

6

u/CaptainNakou 11d 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 11d 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/LLoadin 12d ago

Dang it

4

u/thebe_stone 11d ago edited 11d 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 12d ago

Coasters simulated is terribly optimiser whether it be a server or solo, it's a shane because the bolts are super useful

3

u/Garry-Love 12d ago

Well done. Good investigation and potential fixes

3

u/NoImNotADogLicker 12d ago

I had a similar thing with a mod called "create: connected blaze burners". Gave me multiple headaches on my single-player world

1

u/matteo_fay 11d ago

Ever since sable 2.4 sable has been lagging my server to death

1

u/SoraLee7 11d ago

Wow, ive been getting hit with alot of lag from sublevels and thats probably why. Thanks sm for this

1

u/Ok_Journalist3899 11d ago

What do you use for debugging?

0

u/PTMR2 11d ago

I (well, my friend) noticed that it also increases ping, for some reason. Also, happy cake day!

-1

u/meutzitzu 12d ago

Who could have seen this coming?

-14

u/Dadamalda 12d ago

Idk how you got 2mspt. That's too little lag even for an empty world.

-15

u/Meiseside 12d ago edited 11d 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

u/Egbert58 11d ago

Not there mod

3

u/Meiseside 11d ago

I mean that he reported it to the modmakers so that they fix it hopefully.

-9

u/Kakjung124 12d ago

i hope Create :Steam n Rails use Sable Engine

-14

u/LucAAAgamer 12d ago

Mod name (oh dang ty)

-31

u/wizard_brandon 12d ago

yeah no shit?