The Daily Click ::. Forums ::. Klik Coding Help ::. Global Variables?
 

Post Reply  Post Oekaki 
 

Posted By Message

infinitum3d



Registered
  03/03/2012 22:18:24
Points
  66
27th March, 2012 at 27/03/2012 21:29:49 -

I'm sure this topic has come up before, but Search didn't retrieve it (lots of Global Domination references though -LOL-).

I want to set scores and stats as Global variables so that ALL frames (levels) are consistent. Is that the best way to do it in TGF2? Should each Level be its own Frame, or should I just modify ONE frame after each level, and keep going back to it?

Thoughts, opinions, even flames welcome.

Thanks!

 
n/a

The_Antisony

At least I'm not Circy

Registered
  01/07/2002
Points
  1341

VIP MemberStarSnow
27th March, 2012 at 27/03/2012 22:30:12 -

That depends on how you want to organize the rest of your game data.
Personally, I like to use a binary array because the game data stays secure without having to include other encryption extensions. However, a binary array isn't nearly as easy to use as, say; the INI++ object.

If you don't need to save any other game data, global values aren't a bad idea but it's really easy to hack global values with utilities like Cheat Engine. Using other "global array" objects would make that a bit trickier, but not impossible. Question is, how important is game security to you?

 
ChrisD> Employer: Say, wanna see a magic trick?
ChrisD> Employee: Uhh… sure, boss.
ChrisD> Employer: Your job! It just disappeared! Pack your things and leave! Pretty good trick, huh?

infinitum3d



Registered
  03/03/2012 22:18:24
Points
  66
27th March, 2012 at 27/03/2012 22:42:53 -

Thanks Grim-

I'm not worried about Hackers. I'm doing a simple Tower Defense game, kinda like Plants vs. Zombies. The screen looks the same for all levels, but the attackers and defenders will change. So I figure either I have -ONE- frame, and I keep editing its variables depending on 'level', or I have several frames and use Global Variables...

The single frame option seems easiest. My advanced attackers/defenders can stay invisible until needed, and I just call Visibility\Make Object Reappear as needed.

I'm sure the Events editor will be really messy, so I'll have to Comment the heck out of it, and be really good about my Groupings, but in the long run, it still seems easier...

I'm still (always) open to suggestions, comments, criticisms, and yes even flames.

Thanks!

 
n/a

The_Antisony

At least I'm not Circy

Registered
  01/07/2002
Points
  1341

VIP MemberStarSnow
30th March, 2012 at 30/03/2012 18:29:57 -


Originally Posted by infinitum3d
Thanks Grim-

I'm not worried about Hackers. I'm doing a simple Tower Defense game, kinda like Plants vs. Zombies. The screen looks the same for all levels, but the attackers and defenders will change. So I figure either I have -ONE- frame, and I keep editing its variables depending on 'level', or I have several frames and use Global Variables...

The single frame option seems easiest. My advanced attackers/defenders can stay invisible until needed, and I just call Visibility\Make Object Reappear as needed.

I'm sure the Events editor will be really messy, so I'll have to Comment the heck out of it, and be really good about my Groupings, but in the long run, it still seems easier...

I'm still (always) open to suggestions, comments, criticisms, and yes even flames.

Thanks!



Good idea. Just stick with object alterable values / alterable strings / and flags. Save your globals for game settings and current score. You could use INI for a local high-scores table, or just skip local data and upload high scores.

 
ChrisD> Employer: Say, wanna see a magic trick?
ChrisD> Employee: Uhh… sure, boss.
ChrisD> Employer: Your job! It just disappeared! Pack your things and leave! Pretty good trick, huh?

Muz



Registered
  14/02/2002
Points
  6499

VIP MemberI'm on a BoatI am an April FoolHonored Admin Alumnus
31st March, 2012 at 31/03/2012 08:06:20 -

Lol, never realized you could hack global variables. I mean, yeah, when you have everything in the same memory area, it's easy to find, but didn't think someone would bother finding it.

If you can do it in a single frame, I'd recommend that you do. A lot easier to code. And yeah, you can toss them into groups. Also consider doing a little scripting, like Lua for some functions you usually use, if you want to keep it more readable.

 
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.

Image
   

Post Reply



 



Advertisement

Worth A Click