I am just curious about about Arrays

Hi team, have taken a look at previous chats to make sure I am not doubling down on something already discussed. I didn’t see anything that covered my question so decided to go ahead.

I have used GDevelop a while now and was aware of the Array tools extension for a bit. I have just recently got the handle on using an array in my games, although I can add children to my array without the extension, to get the functions I wanted (shuffle and Pop) I had to use the extension.

My questions are -
To use Arrays is the extension a basic requirement?
Are there functions for using arrays without the extension? What are they can you give any cases and explain (surface level the method)
Is the Extension is a requirement and if having Arrays is a standard why is it not built in (not needing the extension?)
(I ask this as lots of new people may take time to find and get confident using extensions.

I am just beginning to use and trying to understand it fully to help me build my knowledge.

1 Like

You don’t need the extension to use arrays, there are many actions available without it.

Some examples:

While I prefer to use arrays and structures from the built in actions and conditions do not worry about using extensions for additional functions. Extensions are a big part of Gdevelop.

2 Likes

A LOT of stuff in gdevelop is just bare bones of what you need
Not cause someone was lazy but cause no one would know for what you need them

Think like when you go to buy pizza (where you need to wait for them to make that pizza)
They don’t have ready pizza you want to buy
They have ingredients to make one you want

Same story here

Simple example
Shuffle in array tool is cool but i never needed it
Cause what i do is make 2nd array and like read values from 2nd one to decide which child to choose from 1st one
And bam i have random without repeating

Where many of us don’t even need that neither never will need array tools
I am 4 years here and never used array tools
Not cause its bad but i really never needed it for anything
Where i do see other ppl use them

Wanna make something like solitaire?
Array tools for sure will help with that

1 Like

Thanks for the responses and shares of code and explanation, I see there were some options I didn’t find when I was experimenting.

I Probably should share my use case example too. I am making a simulation type game and wanted to draw 8 characters from a possible 28. It was important to not have them repeat so I needed an array.

I probably fudged it a little as I am not super skilled, but basically chucked each count 1 - 28 as a array entry at the start.

As it is my first time I needed to be able test and check was working and thankfully I found through the forums the ToJson function (I had no idea exists)

image

This allowed me to see the children and also as I made it a constant, when the names (well numbers) were assigned I could see random numbers removed from the array - Yay!

From there I had and event that checks number variable >1 and from there assign the Name and other stats and info to each character.

I am sure lots of things I am not doing right or best practice and hope to learn - I would love to make a card game in the future.

Thanks everyone for taking the time to offer advice and respond :slight_smile:

When I started to use GD, I avoided extensions because I wanted to learn how to do it myself. It’s good to learn the basics, the fundamentals. Once I learned the basics, I weighed the benefits of using an extension versus using my own events. Sometimes, you might only need 1 function and it doesn’t make sense to add an entire extension.

Popular extensions like Array Tools are maintained and updated. Although, it’s still a community made extension which means there are no guarantees about its future support or features. Although, a useful extension like this has a high probability of having someone maintain it if the original creator(s) were no longer willing or able to.

Extensions, even built-in ones, are nice because they can keep the event sheet less cluttered and make it possible to use the same events in multiple locations instead of copying an entire event group multiple times. Why use the same 10 events in 5 locations when you can just use a single function 5 times to call the 10 events inside a function.

Now, that doesn’t explain why GD doesn’t have more built-in array tools or the Array Tools extension itself. I think it’s because arrays are more advanced and less of a priority to the developers especially when there’s already an excellent community made extension. I’m hopeful that eventually more array tools features will be built into GD. Arrays and variables as a whole are more of a mystery to a lot of people because they’re not as “no code” as most events. They require more handling not just a click or two.

To incorporate the Array Tools extension into GD would require a lot of work but I’m hopeful that it will eventually happen.

As for doing everything yourself. It’s completely doable but some functions would require either a lot of events or the use of Javascript. One of the biggest challenges would be sorting text. GD doesn’t have comparison condition for text like for numbers. You can’t use greater or less than for text. So, you couldn’t create even a simple Bubble Sort routine.

There are multiple ways of picking random, non-repeating items. I prefer using Array Tools shuffle. Once an array is shuffled you can just cycle through the list with a counter variable.

Now, you could also use

Screenshot_20260303_091951_Chrome

The downside of this is that if you wanted to reuse the list then you would need to recreate the list or use a copy. Also, removing random items is slightly less efficient than just taking or Popping the last item. Think of it like a stack of pizza boxes. It’s easier to take the last box than 1 in the middle. If you take a box from the center than all the other ones need to drop to take it’s place. The 6th becomes the 5th, the 7th thr 6th and so on.

Learn the fundamentals but make your own judgment as when to use an extension. You might know how to change your car’s oil or make a cup of coffee but sometimes it’s easier to have someone else do it for you.

1 Like