Mercutio

Optimizing my game... tilemap vs giant images

Recommended Posts

I am making a platformer, using Tiled and it occurred to me that I could make the tile layer just a collision layer and invisible.

then I could export the image of my level then draw on top of it in gimp.

then I can just load said paint over image into the game...

Now my question is: is this wise? I basically have a giant png loaded in the game(i suppose i can break it up a little). This way I can make a potentially prettier less tiling images as my level.

 

I made a quick test of the gigantic image and it didn't seem it affected much but then again its not like i measured fps or anything like that.

 

Also can I tell specific tiles to only check for collisions from their top? Kind of like mario platforms you can jump up to from directly below.

 

Thanks in advance

Share this post


Link to post
Share on other sites

I spent a long time in Phaser 2 working with your aproach because the tilemap renderer was very much inferior in Phaser 2. I was batching the png level to the vram using texture priority and it worked very well performance wise but I was constantly running into limits with the upper limits of texture sizes for the GPU. That coupled with the massively increased development time for not using tilemaps (re-exporting pngs every time a change was made, handling all the groups, objects, etc), I came to the conclusion that this was a ton of work when I was essentially optimizing my game in early development which is a big mistake.

Then I tested Phaser3's tilemap rendering and was blown away at how good the performance was. I came to the conclusion that it would be much better to use tilemaps in Phaser 3 and focus on developing the game and then swing back and worry about FPS close to the end. So far I found that Phaser3 can handle quite a complex scene with a good size tilemap and still performs great. Of couse a lot of this is dependent on your code and how big your tiles and map are.

 

In terms of one way collisions I haven't gotten that far in Phaser3 but it was fairly easy to do in phaser 2 with arcade physics. It looks like the functionality is there for arcade in Phaser 3:

https://photonstorm.github.io/phaser3-docs/Phaser.Physics.Arcade.Body.html#checkCollision

 

So I would look at this Phaser 2 example and see if you can replicate it using Phaser3's API:

https://phaser.io/examples/v2/arcade-physics/one-way-collision

 

If you do get it working make sure you share your code. 😃

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.