Change table value or change attribute?

stefdelecstefdelec Member, PRO Posts: 146

Hi,

(sorry I am asking several question at the time, but they are not related)

Change table value or change attribute, what is the best to optimize processing?

Comments

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273

    It depends on what you're doing - You can only use the Change Table Value Behavior if you're changing a table value. A Change Attribute Behavior cannot change a table value. Likewise, a Change Table Value Behavior cannot change a regular game attribute.

  • stefdelecstefdelec Member, PRO Posts: 146

    Tks but that is not my question. I am asking wether I should use tablecellvalue+change table value or change attribute in order to get everything work faster.

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273

    So I guess your real question is whether to use tables or not? Tables are more powerful and can be easier to use depending on the situation. It's also easier on processing, though you're not going to notice a difference between game attributes or tables unless you have a huge and complicated game.

  • HopscotchHopscotch Member, PRO Posts: 2,782

    @stefdelec, there is no noticeable difference in speed between using ChangeTable/TableCellValue and ChangeAttribute. Both store values in memory and there is hardly any difference in accessing them.

    Things to consider:

    Attributes are more straight forward to use if you only need a few values to keep track of.

    Your question implies to me that you need quite a few values to be stored and updated. In this case Tables give your code more structure and give you more flexibility and power through the table functions.

    However, don't add or remove table rows too often, this does impact performance quite a bit as memory needs to be reallocated.

  • stefdelecstefdelec Member, PRO Posts: 146

    Tks both of u!

Sign In or Register to comment.