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 Studio Chat / Larg(ish) 2d Array crashes

Author
Message
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 25th Nov 2019 01:07
So i have a 2d type array which is 8000x8000. It is big because i't can grow in any direction. Is that too large? (I have a 16GB system)
Anyway it crashes with a blank message window.

Btw: If i make it an integer array it is ok

fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 25th Nov 2019 02:21
8000 * 8000 is huge
are you sure you don't mean 8000,2
anyway it crashes on classic too just says error and has an ok button
5000 * 5000 works
fubarpk
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 25th Nov 2019 03:34
It's odd though. I can have an integer array up to 20000x20000. I guess i'll just have to make it dynamic
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 25th Nov 2019 04:58
what I don't understand why you need so many
8000,4 kinda confusing in keeping track of all the possibilities
unless your doing it for simplicity of finding array elements
fubarpk
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
Qugurun
Valued Member
9
Years of Service
User Offline
Joined: 8th Dec 2014
Playing: AppGameKit
Posted: 25th Nov 2019 04:58 Edited at: 25th Nov 2019 05:24
Would that suit you?
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 25th Nov 2019 05:07
That's a good idea qugurun.

My problem is my map can grow in any direction. So i have that very large array and when i create a level it starts in the center of the map [5000, 5000].

You can see the array at top left. The ones and dots







Attachments

Login to view attachments
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 25th Nov 2019 05:10
Well effectively Qugurans solution is the same as 8000,2
0to8000,1 for x
0to8000,2 for y

I like the map editor is that for a game like that pac thingy you did
fubarpk
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 25th Nov 2019 06:22 Edited at: 25th Nov 2019 06:23
Quote: "Well effectively Qugurans solution is the same as 8000,2"

i think he meant

Which works ok


Quote: "I like the map editor is that for a game like that pac thingy you did"


Yes. The outlines are drivin' me nuts

you have given me an idea though.
Loktofeit
AGK Developer
15
Years of Service
User Offline
Joined: 21st Jan 2009
Location: Sarasota, FL
Posted: 25th Nov 2019 13:48 Edited at: 25th Nov 2019 13:49
"My problem is my map can grow in any direction. So i have that very large array and when i create a level it starts in the center of the map [5000, 5000]."

What MMOs do is load the game world in smaller segments/chunks and then load the chucks as needed. For example, DAoC's NetImmerse engine (an early incarnation of gamebryo) would watch the direction a player is heading and then load the sections ahead and to the side. Later MMO engines would load larger sections of surrounding areas earlier and then populate them with the objects only as players get closer to them (ex: Lineage 2). Some engines wait until last minute and only pass the player the entirety of the next segment/chunk when the player crosses over into it. (ex: Vanguard: Saga of Heroes).


Also, look at how you use your data. If the data at 6000,2 and the data at 4,5000 is never being referenced at the same time, there's no need for it to be loaded at the same time. If you find the data you are using is in a 200x200 block, then maybe that should be your arrays size.
Raven
19
Years of Service
User Offline
Joined: 23rd Mar 2005
Location: Hertfordshire, England
Posted: 25th Nov 2019 17:10
256MB Array... well that seems a tad overkill.
One of the big issues with AppGameKit is that you're basically restricted to a 4 Byte Value (Float / Integer)… which is quite restrictive in terms of Data.

In any case., all you want to do is have a Data Buffer System; where you're Reading / Write Data Chunks.
How big said Buffer is... eh that's really down to you.

But I'd say you probably don't need one larger than say 32x32.
So like:

Type MapChunk_Struct
ChunkID As Integer
ChunkData As Integer[31,31]
EndType

You also want to have a Secondary Type., that Associates the Chunks by ID... meaning that even if you rebuild the Array you're keeping all the Data in, the Unique ID will remain the same and thus so will the position.
Type MapChunkAssoc_Struct
ChunkID As Integer
ChunkAssociations As Integer[7]
EndType

// Enum (why AppGameKit doesn't have this basic programming tool remains a mystery)
#Constant CHUNK_N 0
#Constant CHUNK_NE 1
#Constant CHUNK_E 2
#Constant CHUNK_SE 3
#Constant CHUNK_S 4
#Constant CHUNK_SW 5
#Constant CHUNK_W 6
#Constant CHUNK_NW 7
// EndEnum

I mean you can name them differently., it's just to have a more natural way to access them without trying to remember what each of the indexes mean.
As a result you can keep a much smaller Buffer Array that's always going to be the same size (i.e. MapBuffer As MapChunk_Struct[8] and MapBufferAssoc As MapChunkAssoc_Struct)
Then your Dynamic Array (that is storing the "Final Result" so-to-speak) can Expand and Contract as a New Chunk is Created in the Buffer; and Updated when new Associations are made.

I mean you might want to also want to expand it for Empty Associations., to know if you need to update or not; but that's really just a performance optimisation, which frankly probably won't matter much.
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 25th Nov 2019 19:56
Thanks guys. All very helpful. I appreciate your input

Login to post a reply

Server time is: 2024-04-26 18:22:20
Your offset time is: 2024-04-26 18:22:20