RFC - Array vs Dictionary vs Obj Vars vs Global Vars

Discuss game development design and post your game ideas

Post » Sat Mar 18, 2017 10:51 pm

Apologies if this is in the wrong topic.

Background: I'm new to Construct, but I have enough programming to cause myself headaches.

Scenario: Lets say I have five data values I'd like to store and access

Can anyone give me a informed opinion on why to use an Array vs a Dictionary vs Object with Instance Vars vs Global Vars to store these values?

Since variables in Construct are all "public" or "globally accessible" (with the except of local variables) it isn't obvious to me why I should or would pick one over another, other than personal preference?

Global Vars = Seems most programmer friendly and expedient unless I need to iterate over them, but a little voice says "global" that's bad?

Array = Least programmer friendly but best for iteration?

Object with Instance Vars = Lets say I create an object with those five instance vars, and then reference "Object.VarName". I could see the advantage if those vars were private and using a public interface, but they are globally accessible, so how is that preferable to Global Vars? Global Vars seem like less overhead.

Dictionary = A Dictionary is an Object right? How is it different from an Object with Instance Vars? How is a "key" different than an "var name"?

Does the answer change if I'm dealing with 25 values vs 5 values?

I hope this makes sense and doesn't come across as negative, I'm very impressed with Construct and I'm just asking for my own improvement.
Posts: 1
Reputation: 327

Post » Sun Mar 19, 2017 4:03 pm

Or you can just use JSON and @Yann 's JSON plugin?
I don't check the forums much anymore, but I will receive an email for PMs.

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
Posts: 1,419
Reputation: 4,867

Return to Game Development, Design & Ideas

Who is online

Users browsing this forum: No registered users and 0 guests