0 Favourites

Creating "instance arrays"

  • Hi,

    I'm trying to setup a small routing simulation in Construct 2 which will in a casual (not truly like the way it works in reality) simulate the the way internet routing works. The user is able to create networks with nodes/routers. Each router object will need a routing table where for example net addresses and cost values will be stored.

    So what I would need is to create arrays for each instance of the router object. Of course it would be possible to create one really huge multi-dimensional array where all routing tables will be stored. Though this will not be a "pretty" solution and it would not represent what it looks like in reality. So I'm wondering if there is any way you can programatically create array which you tie to an instance by for example giving it the instance UID name?

  • Create the Router object as a Container, with an Array object in it. The array object will be spawned for you when you spawn the Router object. If you need to you can associate the array and router objects somehow, like with router UID or something.

  • Using a container there is no need to associate UIDs whatsoever. Picking any object in a container also picks all other objects in the same one.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • Using a container there is no need to associate UIDs whatsoever. Picking any object in a container also picks all other objects in the same one.

    True, which is why I said, if he needs to. There should probably be no need.

  • Thank you codah! Should work just fine Haven't worked much with containers earlier though so didn't think about that. Thanks!

  • Yeah it's pretty handy in the right circumstances.

    Btw I'll be interested to see your simulation

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)