Back to the Vavoom Forum Archives


Forum

Global variables

Sun, 16 Apr 2006 09:53:25

Crimson Wizard

<!-- m --><a class="postlink" href="http://vavoom-engine.com/forums/viewtopic.php?p=3572#3572">http://vavoom-engine.com/forums/viewtop ... =3572#3572</a><!-- m --> [quote="Janis Legzdinsh":v5sfn69k]Global variables are not allowed anymore From which version it is true? In 1.19.1 they worked. I guess you meant some future version? Then, how will these global variables work then? Are they all moved to classes? And finally. Are STATIC class members possible in VavoomC? I suppose this must be included, because sometimes you may need to share one variable between all existing class objects. At least, I have such necessity in my mod once.
Sun, 16 Apr 2006 15:06:51

Firebrand

From the next version, there have been some changes in how progs work. They were moved to client and server game info classes respectively, there are other changes as well, Janis might know better than me what's changed.
Sun, 16 Apr 2006 19:52:01

Janis Legzdinsh

As of version 1.20 they are not supported anymore.
Mon, 17 Apr 2006 08:04:43

Crimson Wizard

And can static type modifier be supported by VavoomC ? (back to my second question above)
Mon, 17 Apr 2006 12:03:56

Janis Legzdinsh

Not for variables. Per-level shared variables should be put in level info class. Constant data should go into game info class. Basicly the reason why there's no static variables in UnrealScript applies to Vavoom too. From UnrealScript reference:
While C++ supports static (per class-process) variables for good reasons true to the language's low-level roots, and Java support static variables for reasons that appear to be not well thought out, such variables do not have a place in UnrealScript because of ambiguities over their scope with respect to serialization, derivation, and multiple levels: should static variables have "global" semantics, meaning that all static variables in all active Unreal levels have the same value? Should they be per package? Should they be per level? If so, how are they serialized -- with the class in its .u file, or with the level in its .unr file? Are they unique per base class, or do derived versions of classes have their own values of static variables? In UnrealScript, we sidestep the problem by not defining static variables as a language feature, and leaving it up to programmers to manage static-like and global-like variables by creating classes to contain them and exposing them in actual objects. If you want to have variables that are accessible per-level, you can create a new class to contain those variables and assure they are serialized with the level. This way, there is no ambiguity. For examples of classes that serve this kind of purpose, see LevelInfo and GameInfo.

Back to the Vavoom Forum Archives