Lite Data Structures
I made a complete copy (+more) of GameMaker's Data Structures.
I spent some 6 days making this and more than 2 hours writing this topic,
so I will suppose I did a good job
I'll go explaining through FAQ:
What is this?As you know, Data Structures are only for Pro version of game maker.
This will help you to use data structures even without Pro edition!
This way you can manage the memory much easily!
How to use it?It's simple to install.
Just create a new object called DSL_MEM and put this code in it's create event:
Or you can do this:
Create a new object with any name (ex. obj_memory) and, as above, and put this code in it's create event:
dsl_make_memory();but then before anything you do with other functions, do:
Now just use data structures as you will do in pro edition, just add that 'l' at the end of each function beginning.
Why are you using instances instead of arrays?Arrays:
- Cannot be deleted after once declared
- Cannot switch to global-local-var
- Can only go up to 32000 elements
Arrays are just tooo static to be used alone in such dynamic allocation
Also, I'm pretty sure GM too internally uses similar system to deal with this (aka classes and objects)
But wouldn't that make the game slow?Not at all. These memory objects do not have any Loop events (like ) therefor they wont get executed, and thus they wont slow the game down. They are just static object used only to store elements, not for executing commands.
Do these data structures also have the limit of 32000?No.
You see, If you fill the whole 1D array with 32000 real values, you'll end up with very small, pathetic 250KB of memory. This needs to be extended somehow.
Thus, I made a longer version of data structures. They can make an array in size of more than a billion elements, and go up to 8GB of memory!
You're not limited in size at all now!
Though, this comes with a cost. A little one. All Long data structures are 25% slower than the original, Short DSs.
All these Long Data Structures have the 'l' character at the end of the DS's name.
dsl_stackl_create(); dsl_listl_create(); ...
Are these data structures fast?Yes. Very.
All data structures have specially been improvised to work as fast as possible.
But even though, all (Short) data structures are 3 times slower than original, GM's data structures.
But you should not to be concerned. That is still very fast actually.
Which is the fastest and which is the slowest data structure?Stacks should be the fastest since they have almost no loop functions (except copy, read and write)
But Lists, (and surprisingly) Queues are almost just as fast.
Grids are fast, but still slower than Stacks,Queues and Lists.
Priority and Maps are very very slow. It's not because my scripts are slow, its because they're naturally slow as they have to search the whole array to find the match. Even internal GM's map and priority are slow.
But not to worry as there is a rescue data structures I made! They're called Fast Priorities and Maps.
Unfortunately, Fast Priorities aren't working, but anyway... At least Fast Maps are working... Barely...
Basically, I created these to improved the speed of these 2 data structures.
While GM's Maps will break down making 30000 elements, Fast Maps will make the same amount in about 1000ms (1 second) which means that Fast Maps are even faster than GM!
The FastDS's system is very complex and hard to make and that's why
What are these "Cubes" and "Space-Times"?Those are 3D and 4D data structures!
These may not only be useful to lite users, but also to Pro users!
The cubes are pretty much the same as grids, only that they have 3 dimensions.
Disks become Spheres and Grids become Blocks.
Unfortunately I didn't make much of 4D because I didn't have much time, only some basic functions.
Be careful when using these two because they are extremely memory consuming and with that, time too.
For example, imagine a cube 10x10x10. Seems small but that's actually 1000 cells and 8KB of memory.
32x32x32 box already passes the limit 32000 therefor the 3D cubes had to be extended so you can declare a box as large as 1000x1000x1000. But I doubt that you will ever make it create a cube that large.
And if 3D is that memory consuming, imagine how 4D will be.
So be careful.
When will the next update come and what will it contain?I don't know yet when, but if I find time I'll update
I will fix all the bugs and glitches, but as well fix and improve all the functions in all data structures.
Not to mention making new useful functions
How can I support?You can add me in credits of your game.
But if you really don't want to, at least +1 me
And since this is only version 1.0, it's probably full of bugs and glitches
so please HELP ME FIND ALL THE GLITCHES IN THIS LIBRARY!
Where can I download?2shared: http://www.2shared.c...Structures.html
Sorry, I have no better file host site :/
(If link is broken, please inform me!)
That's about it. if you have any questions or suggestions, feel free to post.
Edited by Experimenator, 28 June 2012 - 09:39 PM.