Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Plugins and arrays

Author
Message
Santman
12
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 15th May 2020 01:46
I'm still getting to grips with T2 and plug ins, and can now manage most of what I need. One thing alludes me though, and that's using an array between T1 and a plugin


One solution is to populate a memblock with the array data and do it that way, but is there a way to access an array directly? I.e. create it in T1 code and then get access to it in a plugin?
Qugurun
Valued Member
9
Years of Service
User Offline
Joined: 8th Dec 2014
Playing: AppGameKit
Posted: 15th May 2020 04:30
The documentation says that you can pass a string, number and float.
During initialization, create an empty array in the plugin and always clear the data before passing it to it, and then pass the string with the separator into it and then make the array in the plugin from the string, do the necessary actions with it and return the string with the separator to agk .

I did not find another way.
https://forum.thegamecreators.com/thread/225363
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 15th May 2020 06:54
Could you use JSON strings?
Santman
12
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 15th May 2020 09:05
I cant really do a string, it's a fairly large array and I need to iterate through it every frame but not actually change it. I think what I'll do is try converting the array to a memblock and doing it that way, communication between the two is seamless.
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 15th May 2020 09:28
You could store it in an image and pass it as a texture stage
Santman
12
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 15th May 2020 10:58
Not the worst idea.

It's for two reasons.....my water renders in 4 passes, and I need to change the properties of up to 64000 objects each pass (though realistically, it wouldnt ever be more than 9000, and likely far less).

I also want to move my path finding routine into a plugin for speed, and that requires access to a huge map array.

That would mean a large image, and I assume converting it to a memblock.

If i set up a global array in the plug in though, and populate it once, then it should hold in memory of i am correct, to allow it to then be accessed as many times as needed. Is that correct?

Login to post a reply

Server time is: 2024-03-29 05:49:35
Your offset time is: 2024-03-29 05:49:35