| View previous topic :: View next topic |
| Author |
Message |
Rado1

Joined: 05 May 2010 Posts: 20
|
Posted: Thu Jul 29, 2010 9:18 pm Post subject: Complex user-defined types |
|
|
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>... |
|
| Back to top |
|
 |
Kjell

Joined: 23 Feb 2008 Posts: 854
|
Posted: Thu Jul 29, 2010 9:41 pm Post subject: |
|
|
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 |
|
| Back to top |
|
 |
Rado1

Joined: 05 May 2010 Posts: 20
|
Posted: Fri Jul 30, 2010 9:16 am Post subject: |
|
|
| 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. |
|
| Back to top |
|
 |
Kjell

Joined: 23 Feb 2008 Posts: 854
|
Posted: Fri Jul 30, 2010 11:00 am Post subject: |
|
|
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 )
K |
|
| Back to top |
|
 |
VilleK Site Admin

Joined: 15 Jan 2007 Posts: 962 Location: Stockholm, Sweden
|
Posted: Fri Jul 30, 2010 11:16 am Post subject: |
|
|
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. |
|
| Back to top |
|
 |
|