[project1dev] Re: global variables

  • From: Alan Wolfe <alan.wolfe@xxxxxxxxx>
  • To: project1dev@xxxxxxxxxxxxx
  • Date: Thu, 25 Jun 2009 13:53:06 -0700

there aren't any limits i know of.

if we start hitting slowdown from variable name lookups etc we can re-write
the system to be faster.

bools are secretly ints under the hood, and lua treats them to same too so
i'd like to not add a bool type if possible

mess with it if you want, the only thing that is up in the air is the
organizational layout of vars.

After this milestone we are gonna figure out the official organization for
everything I think (:
On Thu, Jun 25, 2009 at 1:13 PM, Kent Petersen <kentkmp@xxxxxxxxx> wrote:

> Yeah totally understandable. Variables can get real messy if the names and
> such are not clear.
>
> Is there any limit to global variables we can have? Are we going to have
> true/false bools or just use ints with 1s and 0s? I would expect there to be
> a ton of those to determine what the player has and hasn't done.
>
> I probly won't mess with it too much until there is a format in place.
>
>
> On Thu, Jun 25, 2009 at 1:03 PM, Alan Wolfe <alan.wolfe@xxxxxxxxx> wrote:
>
>> go ahead and use em but here's what i have planned for the future:
>>
>> 1) Make a seperate file where all global variables have to be defined.
>> 2) In that file, you'll have to specify a type (number or string etc), a
>> starting value, and a comment describing what it does
>> 3) If you try to read the variable of a non-existant value, the game will
>> toss an error, and you can't set the value of a non existant variable
>> either.
>> 4) Have "read only" global variables that you can read from script but not
>> write to directly but they are affected by other things - the Strength stat
>> for instance would be an example where you could read it but not change it
>> directly.  You could use script to change a StrengthBonus variable, but the
>> read only strength stat will be player bonus + equipment bonus + whatever
>> magical spells etc.
>> 5) Be able to define some variables as "don't save" so that the exist
>> while the game is running, but they arent saved with the player data.
>>
>> Also, we'll have to come up with a scheme for organizing game variables
>> like we do (and will) with maps, scripts, art and sounds.
>>
>> The above stuff is mostly just to make sure we dont get into global
>> variable hell where we have tons of variables that we dont know what they do
>> cause it's a big mass of spageti logic.
>>   On Thu, Jun 25, 2009 at 12:57 PM, Kent Petersen <kentkmp@xxxxxxxxx>wrote:
>>
>>> I was wondering what our plans are with the global variable system.
>>> Should I start using them or do they require more tech?
>>>
>>
>>
>

Other related posts: