Optimization and Attributes

My app relies upon a world map that contains many cities (50+). Each city has roughly a dozen attributes that are not constantly updated, but enough to keep track of the city's status, income, etc. Since the attributes are not constantly updating, would there be an optimization issue with the amount of attributes that would be in the app?

Secondly, would there be an optimization issue when saving/ loading that many attributes?

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    This is the perfect setup to use tables with, but it sounds like you already have it set up with individual attributes. In a table, you would have 50+ rows and ~12 columns each and you would save with a single Save Table command. Tables automatically load at game start.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • I was going to try to transition over to tables as much as possible, but a rule cannot refer to a cell value for a condition. I know you can update an attribute with a cell value by change attribute, interpolate, etc, but that wouldn't solve the issue as most, if not all the city data is referred to when the game's "day" changes over to the next.
  • Is anyone aware of problems that would occur from having several hundred attributes? I realize it may not be ideal to have that many. I'm just trying to determine if there will be a performace hit for having that many.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    I was going to try to transition over to tables as much as possible, but a rule cannot refer to a cell value for a condition. I know you can update an attribute with a cell value by change attribute, interpolate, etc, but that wouldn't solve the issue as most, if not all the city data is referred to when the game's "day" changes over to the next.
    I don't see how this would prevent you from using tables. The idea is that you do a Change Attribute self.income (or game.income) to tableCellValue(tableName, row, col) where row is the city number and col is the column that holds the value for income. And then for that actor, you use the same rules you have now with respect to self.income or any other attributes.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • The logic isn't coming across to me. I'll give you examples of related city attributes I use and please let me know how tables would enable me to work with all of my cities. I'm sure it could be a lot easier and cleaner...if I understood the method. Currently, the only piece I use tables for is keeping track and compiling the various revenues and expenses for each city service for each city.

    Philadelphia-Airport: (text) open/closed
    Philly-Railway: "
    Philly-Seaport: "
    Philly-Hospital: "
    .... For all city services

    Philly-research-prog: (real) range .001 to 2
    Philly-Military: (text) active/inactive


    Those are most of the attributes for one city. Being that a service has to know when to shut down or open...and to know the causes of the action, I figured the only way to go would be to have attributes for each city. There can be multiple changes for multiple cities on any given "day". Given that, I can't wrap my head around how I could make it all work with tables. I'm fine using attributes...as long as I don't take a performance hit from having several hundred attributes. Keep in mind that constrain and interpolate behaviors are hardly used in my app. I know it'll take a lot longer working in save/load features with so many attributes.

    Thank you for your input thus far.
  • I gave this another attempt tonight, but I could be missing something. As listed above, each city has a number of services that can be started or stopped at the press of their relating button. Easy enough if this was all within one play through, but the game is designed for saving and loading...and I can't think how (in this example) the individual service statuses would be kept as they were upon save. I don't know how we'll it would work (and it'd certainly be tedious), but I could check ALL the relating cell values and update the services accordingly.

    I wish having so many attributes wouldn't potentially bog down the system. Otherwise, I would be able to finish this easily.
Sign In or Register to comment.