Legacy GM Q:Objects vs Tiles

zendraw

Member
What is the difference betwean making 400 objects with unique sprites and use them as 'tiles' and
making 20 tilesets with a total of 400 tiles and tile on top of objects?

The question is about performence.

And lets say i wuld have 600 other objects (for the argument`s sake, i wont have that meny) which if i use object to act as tiles that wuld make a total of 1000 objects in the resourse tree.
 

GMWolf

aka fel666
What is the difference betwean making 400 objects with unique sprites and use them as 'tiles' and
making 20 tilesets with a total of 400 tiles and tile on top of objects?

The question is about performence.

And lets say i wuld have 600 other objects (for the argument`s sake, i wont have that meny) which if i use object to act as tiles that wuld make a total of 1000 objects in the resourse tree.
Assuming you are using GMS 1.4;
If you are going to have objects underneath each tile,+ there will be practically no performance difference (assuming all your texture pages are setup correctly in in the cases).

The biggest performance hit you will get is from the high number of objects you get. This is because of collision detection.

Now, if you want to do thing efficiently, you can strech out your objects so they cover multiple grid spaces (as many as possible), and cover those with tiles.
This will greatly reduce the number objects in your room, increasing the performance dramatically.

If you are using GMS2, don't use objects at all when using tilemaps. Just do tilemaps collision checking.
 

zendraw

Member
in the room im not worried that i will have a hit on performence, i will have around 128 active at all times. but as resourses will it hit performence?
 

GMWolf

aka fel666
in the room im not worried that i will have a hit on performence, i will have around 128 active at all times. but as resourses will it hit performence?
No. Why would It?
Just make sure your texture pages are setup correctly.

Also be careful of instance deactivation. Do it naively and it will tank your performance.
 

GMWolf

aka fel666
what is a naive way of instance deactivating/activating?
Every step, deactivating all instances and deactivating all instances in view.

In fact, any technique that will activate and deactivate istances every step will be pretty slow.

The best solution I fp u nd was to handle them in chunks. And activating /deactivating them in chunks when the view crosses the border.
 

GMWolf

aka fel666
yup, chunks is exactly what im doing.
Great! Just make sure you are not continually deactivating/reactivating chinks. Only when the camera bound crosses a chunk border. (Also, if the camera moves back and forth a lot, Its well worth having different sized activation and deactivation region. Make you deactivation region larger than your activation region to avoid continually loading and unloading a chunk)
 

RangerX

Member
Another great way for activation/deactivation is for your main character (or an object that the view follows or something) activating a region which would be the view.
Then in each of your objects, you can have an "outside view" event with the deactivation code inside. Basically, each object would handle their own deactivation.
Its might just be equivalent in performance gain as with chunks though. (if its small chunks of course)
 
Top