data structure

  1. O

    Global Inventory System

    So i should start off by saying ive looked up almost every inventory tutorial and have tried to learn all the data structure types but im still struggling to adapt something into what i need. From what ive seen Structs seem to be the best method for when items have alot of variables and info...
  2. Toulhane

    Problem saving and loading data structures with json

    Hi, I followed this Shaun Spalding tutorial to try to implement a saving system in my game while adapting it a bit : My game being a card game, I wanted to save my card inventory which is a ds map (I should probably have made it as a ds list instead but I don't think that's the problem here)...
  3. Jam373

    SOLVED Help with Structuring Data for Chess and Structs Question

    So currently I'm storing the id's of all my chess pieces into an 8x8 ds_grid representing the chess board. Instance variables such as has_moved are referenced and changed to deal with castling and double pawn moves ect. This worked perfectly fine until I started to work on the ai. Only after...
  4. A

    ds_grid_read() seems to always consume memory

    My game currently has a memory leak and will slowly crash. The following code is causing the leak, I've stiped down the code as much as possible to simplify the problem. I realize the code block below serves no functional purpose. I just want to understand it and why its consuming so much...
  5. Slothagami

    GMS 2 best way to store item info?

    I am making a game that will eventually have about 100 items or so (probably not that many) and I don't know the best way to store and access that information If possible, I want a script or other easy way to add and change items, and keep them all in the same place / script. Is it better to...
  6. MCHLV

    [SOLVED] cleaning temp data structure ?

    Hello all, Quick question, but I was not able to solve this... In a script like /// include_item_in_master_map() var _item_name = argument0; var _item = ds_map_create(); _item[? "attribute"] = argument1; _item[? "power"] = argument2; ds_map_add(master_map, _item_name, _item)...
  7. Jam373

    Legacy GM Drawing Priority Queues and other data structures

    So I started prototyping a turn based shooter and needed a way to store actions that take mutiple turns to complete. I thought Priority Queues would work for this, but am now running into trouble using them. My question is, how would I easily draw to the screen every entry of my priority queue...
  8. hughrock18

    GMS 2 [SOLVED] ds_list_mark_as_ behavior question

    Hello fellow devs! I am building a complicated save system (will be so much fun when done), and part of my system relies on the use of ds_list_copy (ex. copy the "char_data_list" to "var _temp_list". Grab one of the many ds_maps held by the list. Change values of said map, and then save to...
  9. deathzero021

    Legacy GM <Solved> Console "out of bounds" error

    The error: Grid 0, index out of bounds writing [-1,0] - size is [4,4] Now this implies that I am trying to write to a grid in a position that doesn't exist. I used the debugger and set many break points, going one step at a time until I found the culprit. // Left side if (bx-1...
  10. P

    GMS 2 Generating multiple ds_grids and stringing them together visually

    I'm trying to create an infinite world using chunks. Currently, I'm using a noise function to generate terrain on a ds_grid that is the same size as the room. It looks like this: Now I'm trying to have the world generate in 16 by 16 chunks so I can make the game infinite. My plan was to...
  11. P

    Legacy GM ds_exists argument 1 incorrect type (undefined) expecting a Number (YYGI32)

    I'm getting a strange error when using "ds_exists(ind,type)". https://docs.yoyogames.com/source/dadiospice/002_reference/data%20structures/ds_exists.html Here's the snippet of code: Here's the error message I'm getting, in full: The "type" argument is typed in exactly as the documentation...
  12. P

    Legacy GM ds_grid_add not recognizing 0 as a number

    I'm trying to code a 3-dimensional grid structure for Game Maker Studio version 1.4.1804, and I've hit a bit of a snag. Every time I test the code to add a value to the data structure, it gives me this: Here's the script that encounters the error: ///ds_3d_add(id,val,x,y,z) //Initialize the...
  13. Phil Strahl

    GMS 2 [SOLVED] Remove Duplicates from ds_list

    Hey, I am just wondering if there's an easy way to go through a ds_list and remove duplicate entries other than picking a candidate entry and going through the whole list looking for matches.
  14. L

    GML Advice on Large Data Structures and Memory

    I'm building a management game that works with quite large ds_grids (20x100) and I'm not sure how they are handled when leaving and entering rooms, especially in trying to prevent memory leaks. Also some of the ds_grids will need to be looped through during step events. In an object's create...
  15. T

    Legacy GM Lists of Arrays and Deactivation of Persistent Instances

    Hi, So I have this dynamic data structure (say a list) of arrays in my game. And for whatever reason the accessors cannot stack on each other: myVar = myDS[| listIndex][arrayIndex]; // does not work I have to instead use this alternative strategy to access the data: //strategy 1 var myArray...
  16. M

    Saving & loading a whole bunch of tiles (and maybe a bunch of instances)?

    In my current project, I am trying to do procedural level generation using tilemaps. I want to be able to define a list of "sections" (these would be like "rooms" that are parts of a larger level, not a room in GMS terms) with entrance and exit tiles, and then pass that list to a generator that...
  17. M

    Legacy GM returing a boolean for ds_list_find_index

    I'm trying to check and see if I already have an objects ID in my data structure list. My code follows this logic tile = ds_list_find_index(list, obj to checking); if variable tile does not find anything { somebody=1 toucha=1 my=1 spaghe=1 } what number will...
  18. S

    Legacy GM DS_grids - non reproducible bug

    I have been getting this bug with my DS_grids that seems random when it shouldn't be and I highly suspect it is a bug on game maker's side. at the start of the game I have this object creating global ds_grid's in Game start event global.invT = ds_grid_create(0,3) //item id, modifier, upgrades...
  19. M

    Legacy GM [SOLVED] If a ds_list_find_index() doesn't find a value...

    I might just be dumb again, but i'm having trouble with reading values from a ds_list. Currently experimenting with a simple inventory system i thought of, and the part that i can't figure out is how the ds_list_find_index() function handles finding no free space when "picking up" an item. The...
  20. P

    GML Saving Nested Data Structures

    What's the best way to save nested data structures specifically ds_grids
Top