Objects vs Tilesets for terrain sprites?

LarryP

Member
I have been using terrain sprites in objects and placing them in my rooms. That can be a lot of objects when I'm done. However, I read that using objects like this is a bad thing to do in comparison to using tilesets. Is this true, and if it is, how bad is the overhead?

I'm using GM2 now, but started this project in GMS 1.4.
 
Last edited:

LarryP

Member
What about the overhead issue though, I am curious?

I am just now seeing that GM2 converted my backgrounds into Tilesets. Now I am reading about them. Thanks!
 

CedSharp

Member
I have been using terrain sprites in objects and placing them in my rooms. That can be a lot of objects when I'm done. However, I read that using objects like this is a bad thing to do in comparison to using tilesets. Is this true, and if it is, how bad is the overhead?

I'm using GM2 now, but started this project in GMS 1.4.
Think of it in a logical way:

An object has a sprite, which has a collision mask, which is then tested by gamemaker in the background logic.
It also has tons of built-in variables for physics, for movement, for input logic, drawingm etc, etc.

Even an empty object with no sprite and no code has a big impact because of how gamemaker internally works.

Then take a tile. A tile uses the sprite, but no collision checking is explicitly done unless you actually call any of the scripts for those.
They support animations now ( which they didn't in GMS 1.4 ) so there is basically no more good reason to make them an object
if they don't move and don't collide.

Unless you need pixel-perfect collision, I would recommend using a grid containing information about the terrain for your collision.
It will be a lot more effective than testing for collision against 100+ objects if you make your terrain with them.

If you need precise collision, then you can always create an invisible "collision object" which you can place where needed and check for collisions on that object only, while keeping your terrain with tiles or even a background image literally :)
 

LarryP

Member
Wow, thank you for your time in explaining this more. I appreciate it!

I am going to study more about grids. I am new to them and they have seemed a bit complicated in the past. I am used to setting collisions in Unity which are visual, easy, and fast.

I do not need precise collisions at all.

It's pretty impressive how GM2 converted my Backgrounds into Tilesets. I very much like this new GM2 so far.
 

TheouAegis

Member
Well every version of GM prior to S2 made tiles nearly pointless because they were so slow. So S2 needed a major overhaul on how backgrounds and tile maps were handled.
 
Top