Variables vs calculate everytime

Jupix
Scavenger
Posts: 2
Joined: 25 Sep 2016, 08:10

Variables vs calculate everytime

Postby Jupix » 03 Apr 2018, 16:50

Hi,

first, I'd like to thank all dev team for your hard work on this project. This game is one of my few safe harbors when I need to clear my mind from everyday stress, sometimes I even have dreams about being stalker :lol: and all and it's thanks to you.

Now for my question. I'm messing with whole gulag logic and I wonder...well, let's say I need to store 20 or more variables for every NPC in game. Is this safe for game memory or should I rather possibly sacrifice some little FPS by calculating needed vars everytime? Don't mind my particular case, this is just theoretical question, but as it may be silly question, I'd like to know what is generally better approach here? Naturally, I don't know much about X-Ray engine properties and tricks.

Thank you

User avatar
DoctorX
Trespasser
Posts: 57
Joined: 10 Mar 2016, 00:36

Re: Variables vs calculate everytime

Postby DoctorX » 03 Apr 2018, 17:56

Basically, if you're dealing with data that remains static and doesn't need to be re-calculated, it's best to use storage. There's plenty of memory available for such things. Script functions are weighty and lead to lag. Most of the jitters and lag spikes you notice in Stalker are when a bunch of script functions are being called at the same time.

Jupix
Scavenger
Posts: 2
Joined: 25 Sep 2016, 08:10

Re: Variables vs calculate everytime

Postby Jupix » 04 Apr 2018, 12:46

Thanks for the answer. At first I thought the same, but then I remembered how I heard of those "too many weapons on ground all over map" crashes so I guessed I should be careful about memory. Thanks.


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 1 guest