A
Ariak
Guest
Hello!
With the complete revamp to tiles I thought i'd have a look at a demo and see how to work with the new set of functions. I noticed the collision in the platformer-demo checked against an invisible tile layer with the tilemap_get functions. These functions return the number of a tile within a given tileset - think image_index. For example in the demo the collision tileset entry 2 is used for ladders.
This method enabled direction collision checking with tiles. For performance reasons with GM:S 1.x+YoYoCompiler I used to loop all tiles in a create event and add them to a ds_grid, and then perform all collision checks with that grid. However, when designing larger overworlds you notice how much memory grids require, as they do not have an option to only save integers like buffers. For my purposes I only require ~10 different integer entries. So these fit perfectly in a fast buffer : buffer_u8.
I've also tested the performance of the tilemap_get functions and they are quite fast.
My grid method was 15-20% slower. Im fairly certain that the introduction of the YoYoCompiler to GMS2 at some point will tip the scales once again as it mostly speeds up direct game logic, and not the performance of functions directly (right?).
Since tilemaps can effectively store x,y positions of individual tiles and even return a handy number akin to the image_index for collisions they have the capactiy to replace grids! I think it would be really handy to save memory with tiles - as you need them anyway for your backgrounds - and offer a possibility to not only replace grids for player collisions, but also for AI pathfinding.
Mp_grids only store boolean entries. Assuming we have a collision tile-layer it would be intuitive to also assign a tilemap to AI pathfinding grids: mp_grid_tile_layer("collision_layer") // or tile_map.
I'm aware this is a really minor feature. But it seems obvious to me, and is really accessible for beginners, as you can essentially just draw with tiles in the room editor and have your enemies behave just as you'd expect them to.
Tile layers are also (probably) highly optimized and should thus use less memory compared to grids from the get-go!
Let me know what you think
With the complete revamp to tiles I thought i'd have a look at a demo and see how to work with the new set of functions. I noticed the collision in the platformer-demo checked against an invisible tile layer with the tilemap_get functions. These functions return the number of a tile within a given tileset - think image_index. For example in the demo the collision tileset entry 2 is used for ladders.
This method enabled direction collision checking with tiles. For performance reasons with GM:S 1.x+YoYoCompiler I used to loop all tiles in a create event and add them to a ds_grid, and then perform all collision checks with that grid. However, when designing larger overworlds you notice how much memory grids require, as they do not have an option to only save integers like buffers. For my purposes I only require ~10 different integer entries. So these fit perfectly in a fast buffer : buffer_u8.
I've also tested the performance of the tilemap_get functions and they are quite fast.
My grid method was 15-20% slower. Im fairly certain that the introduction of the YoYoCompiler to GMS2 at some point will tip the scales once again as it mostly speeds up direct game logic, and not the performance of functions directly (right?).
Since tilemaps can effectively store x,y positions of individual tiles and even return a handy number akin to the image_index for collisions they have the capactiy to replace grids! I think it would be really handy to save memory with tiles - as you need them anyway for your backgrounds - and offer a possibility to not only replace grids for player collisions, but also for AI pathfinding.
Mp_grids only store boolean entries. Assuming we have a collision tile-layer it would be intuitive to also assign a tilemap to AI pathfinding grids: mp_grid_tile_layer("collision_layer") // or tile_map.
I'm aware this is a really minor feature. But it seems obvious to me, and is really accessible for beginners, as you can essentially just draw with tiles in the room editor and have your enemies behave just as you'd expect them to.
Tile layers are also (probably) highly optimized and should thus use less memory compared to grids from the get-go!
Let me know what you think