• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker Asset layer too slow (Isometric Tiles)

S_Kleer

Member
Hi all!
I decided to do a small test between GMS 1 and GMS 2.
In GMS 1 I made simple isometric tileset and wrote this code to create it in room:
Code:
for (var i=0; i<256; i++)
{
    for (var j=0; j<256; j++)
    {
        var xx = (i - j) * 32;
        var yy = (i + j) * 16;
        tile_add(background0, 0, 0, 64, 32, xx, yy, 0);
    }
}
It is work fine with ~700 real fps.

In GMS 2 I wrote this code:
Code:
for (var i=0; i<256; i++)
{
    for (var j=0; j<256; j++)
    {
        var xx = (i - j) * 32;
        var yy = (i + j) * 16;
        layer_sprite_create(layer_get_id("Assets"), xx, yy, s_grass);
    }
}
But it is work too slow! About ~ 120 real fps. It is so sad.

I really hope, that YoYo adds "normal" isometric grid for GMS 2. I really want make some iso-games, but not want use another engine, because I like GML.

Also I have my own not completed isometric project, that use Vertex Buffer to draw and update tiles, but it very hardcoded and not friendly to use :(
And I don't like draw it as sprite in view, because it have many hard formules and not work fast as Vertex Buffers.

Somebody has some tricks to work with isometrics in GMS 2?
 

Simon Gust

Member
It should be made clear that "real" tiles are heavily optimized opposed to just drawing a lot of sprites.
Maybe you could try it with the layer_tilemap functions if that works for you.
 

S_Kleer

Member
Tilemap layer will works fine only with "flat" tiles like ground, grass, water etc, but it is not working for "tall" tiles like trees, buildings, stones etc. :(
 

Simon Gust

Member
oh right, GMS 2 is strict with that.
The only way I see this happening is to reduce draw calls then.
Maybe you can half your resolution, make larger tiles and so on.

You can also try drawing these sprites from a controller object, this way you can draw only the sprites in the view just like a tile layer would.
Make sure all tile graphics go on the same texture page to reduce texture swaps and such.
 

S_Kleer

Member
Thank you! But I know all this tricks...
Honestly, I was hoping to learn something new. Or I just think of myself a problem.
Just I really want know, how to render large map without fps drop. (Like game open TTD) If it possible with GMS.
 

CMAllen

Member
Thank you! But I know all this tricks...
Honestly, I was hoping to learn something new. Or I just think of myself a problem.
Just I really want know, how to render large map without fps drop. (Like game open TTD) If it possible with GMS.
Multiple tile map layers with larger tiles broken up into parts.

Like a tree exist as multiple pieces. You have the base of the tree. You have the trunk. Then you have the branches and foliage. This can be all part of a single tile set, but the parts are on different layers, allowing you to control what overlaps and where.
 

S_Kleer

Member
This way have very big minus:
- You MUST have lots of separate tile layers for EACH type of tiles.
You must have 2 tile layer for grass, because grass size is 1x1 cell (64x32 for example)
If tree have size 1x2 (64x64) you must have + 4 tile layers. (if trees not intersected)

Unfortunately, I have not found anything better yet than using vertex buffers, because with it, you can see the whole map. But it have big minus too:
- A LOT OF WORK with the code.
 
F

Felipe Rybakovas

Guest
From my experience with GM1.4 and doing an isometric game, the vertex buffer option is the best.
I know is not easy to code/use it, but only with that I was able to run my game above 1000 fps in 1.4 (that including lighting, enemies, a bunch of particles and blood decals).

even objects in my test were faster than tiles.... could not believe on that too.
 

S_Kleer

Member
Ok. Thank you for your answers.
It is mean, that i need more organisation in my code, that it will be easy to use XD (but i will hope, that isometric tile grid will be done someday)
 
Top