Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

I am using GM:S 1.4, which does not have functions. I can change your code into script-like, but just to be sure: I shall change the "draw_flush()", and calling the new scipt I shall set the "quads" equal to 

(image_xscale + image_yscale + image_xscale*image_yscale)*2

for blocks and walls?

(2 edits)

Yes, just having a script asset with the same name should work too

  • change "quads" to "argument0" in the script
  • if draw_flush doesn't exist (it was added late in 1.4) overwriting the world matrix (e.g. by d3d_transform_set_identity or matrix_set) should also force a flush of the geometry buffer

Blocks/walls should use that formula, yes (they do indeed add that many triangles). Maybe slap a ceil() around the expression for stability so it always becomes an integer even if a block is e.g. 1.5x its base size. (If you never stretch things out in the room editor it gets easier, then you can just use the hardcoded number 12 for blocks and 4 for floors)

hey! didn't help :[

What exactly does the updated code look like? Are you using draw_flush or d3d_set_identity?

I find it a bit weird that it still tries to allocate a giant buffer of 1/6th of everything else it's rendering when it's totally fine with thousands of smaller ones, are you sure you didn't miss adding the safety code anywhere?

Perhaps it was an error on my side; then I need your help with the code.

I've added this line in the beginning of draw event in every wall or block:

triangles_break_batch((image_xscale + image_yscale + image_xscale*image_yscale)*2)

And this line in the beginning of draw event in every floor and ramp:

triangles_break_batch(image_xscale*image_yscale*2)

Then, I've created a script (still uisng gms 1.4) named "triangles_break_batch" containing this code:

global.triangles_so_far += 2*argument0
       if(global.triangles_so_far >= 1000)
            {
              global.triangles_so_far -= 1000 
              d3d_transform_set_identity();       
            }

Finally, I've added this to the create event of CONTROL object:

global.triangles_so_far = 0

Weird, everything looks like it should... does draw_flush exist in your version of GM? If it exists you should call that alongside d3d_transform_set_identity in triangles_break_batch (and maybe in draw_self_enemy as well) just to make sure the draw pipeline gets flushed.

my version does not have draw_flush. is there anything else I could do, or should I try to get the greater version of GMS?

I would recommend looking into it if it's an option, GMS1 hasn't had official support in years and it's only a matter of time before its old graphics APIs will stop working entirely... :(

Currently the free license lets you export games to desktop platforms if the game's not sold, so there's basically nothing to lose just trying it out. (And I'd recommend getting GMS2 from the official download page since it's literally free)

updated gml to the 1.4.9999999, where draw_flush() exists. didn't fix the error

The issue might just be that GMS1 uses a too old graphics API, it's not had official support in years... not much I can do about that :(