Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Quality Structures

Descriptive error messages and better error handling for GameMaker data structure functions · By YellowAfterlife

Is it possible this can be adapted for arrays or structs?

A topic by Cole Beernaerts created 15 days ago Views: 32 Replies: 3
Viewing posts 1 to 3

I'm currently facing an issue with tracking down where exactly an array is being destroyed in my project and I'm wondering if this could be adapted to work with arrays or structs. 

I've tried everything I can imagine, but this array is just being reset to an empty array somehow. 

I've tried putting in checks everywhere on every type of step event, but it seemed to happen after the draw_gui_end and before the begin_step events. I'm sure I could try checking every call of deleting values or clearing an array, but that could take large amounts of time.

Developer

First, you can make sure that your variable isn’t getting re-assigned by accident. This is as simple as assigning the array into a global variable and checking that (your_array == global.also_your_array).

If it’s not that, you can use function hooking to check for your array being modified in the few functions that can reduce array length (I think that’s just array_resize and array_delete..?)

I’ve also seen some bizarre things happen after calling Steamworks functions that accept arrays of strings (mostly the workshop item tag function, I think).

I'll check those out, thanks!!

You might be on to something with steamworks, the problems I'm having only happen on the PC version of my game it seems... and one of them stops happening when steam cloud saves is turned off. I'll have to take a look at that I think. I'm using leaderboards, cloud saves, and achievements in the game. 

I've checked it out. The array IS being reassigned somehow to an empty array. I've looked through the code, and found no place where it is happening, even testing the data in it. 

I tried running without using any steam functions, but it still happened so it's probably not the steam extension -- it may still be this though, my platform options are a bit complex in the code, but it shouldn't use any steam functions on the test I did. 

really stumped with it. The array I'm currently testing holds all the keybinds in the game. I do save out the array to cache in the game which gets saved out to file, and this error is happening when I go to change one of the keybinds. However... it's only briefly possible to have this issue pop up right after starting the game. Which makes me think it's coming from an alarm/async event, or the steamworks extension. I'll have to test a bit more for this I think. 

Though there are other instances in the game where I have arrays being cleared out of nowhere. So something in the game is causing a leak somehow. It's just really hard to track it down because I can't find when or where it's happening. 

And again, it doesn't seem to be happening on consoles, just PC from what I've witnessed.