Unit class: minor optimizations

Development directions, tasks, and features being actively implemented or pursued by the development team.
Post Reply
TBeholder
Elite Venturer
Elite Venturer
Posts: 753
Joined: Sat Apr 15, 2006 2:40 am
Location: chthonic safety

Unit class: minor optimizations

Post by TBeholder »

We still have installed upgrades in cargo list. This generally works incorrectly, which creates inconveniences at least for indication, repair and carriers. Also, every time code needs only cargo or only upgrades (which is most of the time) it have to go over the whole list and check, which can't be good for performance.
There's a reasonable workaround for bugs part, but if the single list remains, irrelevant items still get iterated and checked all the time (such as damage, repair and kill functions), and everything added to upgrades or cargo still will be added to both.

Proposal: data (CSV) already half-supports "Upgrades" column present in units.csv, so change internals in the same way.

Changed places: CSV unit loading/saving, anywhere cargo list is iterated only to check for "upgrades/" or ("&& faction != upgradesfac") before doing anything else.
Separate lists should be slightly faster to use, since engine won't need to check each item and won't need to iterate over wrong ones.
And it shouldn't be very different memory-wise since the same items are split into two lists, so there's only small overhead of the list itself - until you'll start to add fields to upgrades (such as placement) or cargo (destination?), at which point it may save some.
"Two Eyes Good, Eleven Eyes Better." -Michele Carter
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: Unit class: minor optimizations

Post by klauss »

I agree, add this as a ticket in SF's task tracker, so we can keep track of it. Forum threads tend to get lost when they die out.
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
charlieg
Elite Mercenary
Elite Mercenary
Posts: 1329
Joined: Thu Mar 27, 2003 11:51 pm
Location: Manchester, UK
Contact:

Re: Unit class: minor optimizations

Post by charlieg »

Or the code review tool?

Edit: http://dev.vega-strike.org/
Free Gamer - free software games compendium and commentary!
FreeGameDev forum - open source game development community
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: Unit class: minor optimizations

Post by klauss »

Well, of course, if there was a patch for it, all the better! ;)
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
Post Reply