Can a big Lua script cause problems in a game?

amperbee

thunderdome denizen
Retired Staff
Sorry for the bunch of questions in a row.

I'm making a script and I keep adding features.
I use custom functions to make the file smaller, but as I add more things to the script, the filesize gets larger.

Will this cause any problems in the game because of the size?
 
Sometimes too much lua can cause lag, but usually not. Lua causing lag, at least for me would be from a file 1 GB in size, so you're fine. Just keep bug testing the lua and try keeping track of the changes or addons you make.
 
It depends on the script. A Big script could cause problems if your map doesn't have anywhere to go fishing in, and a script that runs a lot of code every tic (or manages a fuckton of data) could get really laggy, particularly if you combine them with a huge map, but the size of the script itself doesn't affect much after the initial parse and load.

Generally, the key to avoiding laggy scripts is to avoid running anything that doesn't have an immediate use, and create caches for data that needs parsed often from static information. Try not to overuse expensive functions like P_TryMove and thinkers.iterate, as well. If you have a crusty old computer around, fire it up and use it for performance testing; ideally your framerate in something like THZ1 with your scripts loaded should be about as good as your framerate in CEZ2 without them, but the hard line of acceptable performance is really up to you.
 
(Replying to now deleted reply authored by carlrev)
Are you aware this is a 4 year old thread?
 
Last edited:

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top