SRB2 Message Board

SRB2 Message Board (https://mb.srb2.org/index.php)
-   Editing Help (https://mb.srb2.org/forumdisplay.php?f=64)
-   -   Can a big Lua script cause problems in a game? (https://mb.srb2.org/showthread.php?t=41826)

Rapidgame7 08-15-2016 03:32 AM

Can a big Lua script cause problems in a game?
 
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?

People's Elbow 08-16-2016 12:41 AM

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.

fickleheart 08-16-2016 12:59 AM

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.

Rapidgame7 07-11-2020 07:21 AM

(Replying to now deleted reply authored by carlrev)
Are you aware this is a 4 year old thread?

carlrev 07-15-2020 09:58 PM

As soon as I realized that. I felt so stupid.

Rafael44642 07-16-2020 02:25 AM

Quote:

Originally Posted by carlrev (Post 829424)
As soon as I realized that. I felt so stupid.

Yeah, me too lol. It's like, almost nobody looks at the dates.


All times are GMT. The time now is 08:28 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.