Unit class: minor optimizations

Development directions, tasks, and features being actively implemented or pursued by the development team.

Unit class: minor optimizations

Postby TBeholder » Thu Dec 08, 2011 5:30 am

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
User avatar
TBeholder
Elite Venturer
Elite Venturer
 
Posts: 732
Topics: 38
Joined: Fri Apr 14, 2006 7:40 pm
Location: chthonic safety

Share On:

Share on Facebook Facebook Share on Twitter Twitter Share on Digg Digg

Re: Unit class: minor optimizations

Postby klauss » Thu Dec 08, 2011 4:43 pm

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
User avatar
klauss
Elite
Elite
 
Posts: 7243
Topics: 55
Joined: Mon Apr 18, 2005 7:40 am
Location: LS87, Buenos Aires, República Argentina

Re: Unit class: minor optimizations

Postby charlieg » Thu Dec 08, 2011 6:09 pm

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
User avatar
charlieg
Elite Mercenary
Elite Mercenary
 
Posts: 1328
Topics: 56
Joined: Thu Mar 27, 2003 4:51 pm
Location: Manchester, UK

Re: Unit class: minor optimizations

Postby klauss » Thu Dec 08, 2011 6:14 pm

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
User avatar
klauss
Elite
Elite
 
Posts: 7243
Topics: 55
Joined: Mon Apr 18, 2005 7:40 am
Location: LS87, Buenos Aires, República Argentina


Return to Engine Development

Who is online

Users browsing this forum: No registered users and 1 guest