Page 1 of 1

Support for dynamic data structures

PostPosted: Fri Jul 30, 2010 5:44 pm
by zygoth
If I am going to be doing complex programming, I absolutely need some sort of dynamic list at the least, and I would really like a hash map and some other structures as well. Would it be possible to just copy and paste a linked list library into the global code and have it work? I have thought about how you could make a linked list using actors, but that seems like it would have a whole lot of unnecessary overhead. Easy access to some data structures would make things so much easier. The main problem I have run into is that GE doesn't let you allocate non-temporary memory during the game except when you are creating or destroying Actors. Has anybody gotten something to work? Any thoughts?

Re: Support for dynamic data structures

PostPosted: Fri Jul 30, 2010 7:06 pm
by makslane
zygoth wrote:If I am going to be doing complex programming, I absolutely need some sort of dynamic list at the least, and I would really like a hash map and some other structures as well. Would it be possible to just copy and paste a linked list library into the global code and have it work?


Sure. The code must not depends of any external library.

Re: Support for dynamic data structures

PostPosted: Fri Jul 30, 2010 8:00 pm
by zygoth
That solves part of my problem, but what if I want to have several different actors that all have their own linkedlist (of targets or whatever)? I can't make new actor variable types. I could map a linked list to each actor's clonename in a hash map, which would work pretty well. But I don't know of a way to create new linked lists on the fly...should I write a global function that uses malloc and then returns a pointer to the new linked list? I hope these aren't obvious questions...I'm more used to Java to be honest.

Re: Support for dynamic data structures

PostPosted: Sat Jul 31, 2010 1:43 pm
by makslane
You can use the hash and linked list functions available on the net to control what you want.