Chunk system splitting map into a grid

I want to make chunk system
I have general idea how to do it i just don’t quite have idea how to do it in gdevelop

Right now all i need is how would i 1st create some kind of virtual grid
Add to it IDs and based on that display grid ID based on position of player
I do get checking position of player and grid X and Y + Width/Height
I do not get how to make grid alone

Any idea would be helpful
Or even part of idea cause i think i could figure out some stuff if i just had little info on what to do

I am perfectly aware i would need to go with arrays

I found this GDevelop OpenWorld Example Using Static Chunking by danogster
It is chunk system more or less
But only thing i need from it is chunk grid system
And i can’t deduce which part is generating grid itself
Or is it even what i am asking for since this is loading stuff from pre made json file
So i have no idea if it even is what i am asking for

Why not use a big disk object (or custom object,square, …custom object defeined in behavior) around the player and check to whatever things are inside its diameter.
U can even go outside the camera bounding box where things aren-t visible anyways.

I think you miss the point
You offer me exact same crap as with culling
Where each array child would be checked if it matches cords and being created or deleted depending on what you suggest

And goal here is to create ares give them ID or just X and Y value
And now you check X and Y or ID of chunk and ALL objects in it would be created/deleted
Instead of checking all objects X and Y

Now we would go for creating/deleting group of objects at once
And not 1 object by 1 individually

lol…understood …sry about it.
I thought you were inhdeed checking the xy pos of objects.

How about a tiled map with the new tile system as proxy?
Can’t you check the IDs of each tile there?..i mean the new feature.
…since,.you are using the shape painter…to creat the grid…

it would probably not fit the chunk method since you can’t check the whole map…but maybe is something you can adapt tro get the IDs …wel the IDs are already there…

(there should be even an extension that create the grid…and if i’m not wrong it allows to check each grid tile)…

Justt trying to help with some inputs since noone answered… :+1:

Yeah but anything that will involve some kind of proxy is not a solution

You see tilemape object could work
But then imagine setting it up

Imagine adjusting it after you set it up
Now imagine how limited you would be with it

With that grid system from my message above
I could edit it on the fly

I get you are trying to help it is good thing to do i am grateful
But i was thinking about this crap for a long time already
I did consider all pros and cons
Where not only this but generally in game making
Either you do some system right
OR you will be constrained by whatever option B you will choose

I could come up with at least few workarounds
But they all involves something for something
And answer i need is most likely more simple than any workaround we can think of

Yeah …i understand.
But consider too that you’re at the moment limited cos i don’t think it’s a featuire available rite now…especially if you use the shape painter.
I don’t think is the right choice to use the shape painter…due to how it works…
i mean when u draw with shape painters…lines are not physically there…i mean …to check what is inside at the moment i don’t think is doable…i remebre to have tried something like this in a Snake kind game…and have tried something ridiculuous like the read pixel colour… :sweat_smile:
…but it is just my oipinion.

Have u already tried this?

i mean can’t u use this as reference?..and create a single tile as object…

edit:…mmm…i understand that you may not want objects or proxy …cos probably they’re havy in terms of performance…htaz why trhe shape painter…but i don’t think you have many choices…even if i think that a little suqared box…shouldn’t be that heavier if you eg use one of 100x100px.
in a 1920x1080–there will be probably around 200 inside…i think is manageable…mmm.or maybe not?.. :thinking:…let’s do 250x 250… :smile: :smile:

In the end i think is doable if you have acces to the tiled system IDs code so you can use it in the scene…but it’s a GD’s devs thing…
edit2:…i think a workourond could be to use the marching squares system where everything outside the field is culled/deleted…marching squares use the shape painter to define the field…maybe you can have a look at it …(if u haven’t already done)…

wel…u’re rite…on this matter…only devs don’t need workarounds…you’re on your own if u re making something from scratch…if you’re a user it alkways worked like this…

Maybe you do not get what and why i need it because you assume i need it for myself

Nah i need to create system any1 can use for whatever reason
It have NOTHING to do with draw grid
Draw grid is just example to prove i have part of puzzle
I could use it to create chunk system same way i can use chunk system to create grid
Actual grid would not be used in chunk system if you get impression that i want to create chunk system and draw grid for it

Trust me i am glad you are coming up with some ideas to solve this problem any way possible cause you are repeating ideas i already have

But i know only way to do it is to do it
Not look for workarounds cause it will generate problems later

BTW i think i just realized another part of puzzle

Like basically all i need is create array which i knew i will need
Problem is how to store chunk data in it based on position
And i guess one way to do it is to
From origin point lets say x 0 y 0
Repeat 2 times * grid cell size (since they would be squares to simply)

And that would create 4 square grid cells like
image

And that is all i need
Now at the same time i would also dynamically distribute ID numbers
Maybe for X and Y for each cell
Or if possible just single value ID instead of two
And rest is simply checking IF X and Y of cell + its size is outside or inside of camera

And now instead of checking each object inside grid cell i just check grid cell itself
And load all its children or delete them when i need to

So as you see i just realized i have logic
i do not have actual equations and events
Where i still need idea for ID distribution

And i am very bad with arrays
So before i go to get help from someone who is good with arrays
I 1st need all puzzles of logic
And that is why i came here
For a way to do it
Not a workaround

1 Like

Hello, the minecraft template has a chunk system, it is suitable for any project (2D or 3D)

1 Like

Thx but don’t get me wrong
I am not making money out of it i am gonna to release this for free for any1 to de lag their object filled games

So kinda paying for something sooner or later i will figure out misses the point for me

BUT i seen some ppl asking for how to do minecraft this minecraft that
Now that i know about your template i will provide link to it to any1 who will have minecraft related needs

1 Like