Page 1 of 1

Complex user-defined types

Posted: Thu Jul 29, 2010 9:18 pm
by Rado1
Would be nice to have the type representing models and model instances (clones of models). For instance, to have a variable keeping a reference to model instance or an array of model instance references. Of course, it should be possible to access values of model instances from expression language (ZExpression).

One possibility is to define just one common type representing any model instance independently on model. Another possibility is to have a different type for each model defined.

Is there any way to find instantiated models and access their properties in the current ZGE?

Another improvement would be to support also structures. E.g. in the form of new component "DefineStructure" having "DefineField" (or existing DefineVariable component) as tree elements (sub-components). Variables in the expression language as well as DefineVariable components should use structural types. Accessing of structure fields from expressions: <variable>.<field>.<field>...

Posted: Thu Jul 29, 2010 9:41 pm
by Kjell
Yea,

Both ( especially the first ) are features that would be warmly welcomed.

The most convenient way to access clones right now is by writing all properties you need to a 2D Array. Give each clone a unique identifier OnSpawn and use that as index.

K

Posted: Fri Jul 30, 2010 9:16 am
by Rado1
Kjell wrote:The most convenient way to access clones right now is by writing all properties you need to a 2D Array. Give each clone a unique identifier OnSpawn and use that as index.
That's exactly the "technique" I'm using now, however it makes the code cumbersome and static size of arrays is also quite a limiting factor.

Posted: Fri Jul 30, 2010 11:00 am
by Kjell
:)

It's not ideal, but you can ease the pain by writing some functions to read / write / sort / etc the array. The static size isn't all that bad ( just set them to the maximum size you want to support ), it's pretty rare you need separate arrays to be large in different parts of a game ( re-using memory ). If worse comes to worst you can always use a single general purpose array to write all of your data to ( ASM style ) :wink:

K

Posted: Fri Jul 30, 2010 11:16 am
by VilleK
I've said it before but I'm amazed with the clever techniques you guys come up with to circumvent the shortcomings in ZGE :)
I wish I could wave a magic wand to improve the type system instantaneously but it will take a lot of work. However nothing is impossible, a few years ago I would not have thought I'd ever add string support (or even "int"-support) so hopefully these kind of features will appear too.