Script effeciency question.

Advanced OpenGL source port fork from ZDoom, picking up where ZDoomGL left off.
[Home] [Download] [Git builds (Win)] [Git builds (Mac)] [Wiki] [Repo] [Bugs&Suggestions]

Moderator: Graf Zahl

Locked
User avatar
chopkinsca
Posts: 183
Joined: Thu Dec 29, 2005 8:09

Script effeciency question.

Post by chopkinsca »

Suppose I want to make a script that controls mutiple timed events such as item respawning. I'm not asking how to make the script, but which way would be more effecient.
1) Have each event in it's own script with a delay.

or

2) have one script that goes through a list of possible events each game tic (or every couple of them) and checks which ones to activate?
User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany
Contact:

Post by Graf Zahl »

It mostly depends on the logic you use to maintain your events. If that is simple the difference is minimal. But if you have to do complex maintenance stuff in your script it'd be better to use one script per event.
User avatar
Nash
Developer
Developer
Posts: 1226
Joined: Sun Sep 25, 2005 1:49
Location: Kuala Lumpur, Malaysia
Contact:

Post by Nash »

(2) would drop GZDoom's performance.

Best to go with (1)!
User avatar
solarsnowfall
Persecution Complex
Posts: 363
Joined: Fri Aug 05, 2005 8:51

Re: Script effeciency question.

Post by solarsnowfall »

In terms of something like item respawning, it isn't really necessary to check every tic. Unless you need near instantanious item replacement, have it loop every second or few. It doesn't sound like anything terribly resource hungry to me.
User avatar
chopkinsca
Posts: 183
Joined: Thu Dec 29, 2005 8:09

Re: Script effeciency question.

Post by chopkinsca »

solarsnowfall wrote:In terms of something like item respawning, it isn't really necessary to check every tic. Unless you need near instantanious item replacement, have it loop every second or few. It doesn't sound like anything terribly resource hungry to me.

I know, when I actually did it, if I did it that way, I planned on working out the longest intervels that I could check each condition.

Anway, I guess I'm just a bit paranoid about making something that will run fine on my computer but slow for other people. Probably because the topic of doom mods that are too slow to be playable for some people has come up often. I want to try and limit the people who I'm excluding from playing the maps, although I'm more doing it for myself.
Locked

Return to “GZDoom”