tomph Posted October 28, 2014 Share Posted October 28, 2014 Hi guys, I'm really new to Phaser (and HTML5 games actually), but I've been developing games for other platforms for a while now. I have noticed considerable slowdown when rendering a tilemap (20px tiles, 2540 width/height map) and moving the camera on iOS (4S and 5S). I have tried in both WebGL and Canvas. From what I gather, this is generally down to the world size and the fact that when the camera moves, the map gets re-drawn. If this is a limitation to the platform, then so be it. I'm actually here to discuss how I'd go about optimising my large tilemap for mobile. I am considering building a sprite grid that is one row/col bigger than my camera viewport and dynamically setting textures/physics to sprites (outside of camera view) as I move around my level. Before I go about doing this, I just wanted to make sure whether it would actually be worth my while? Is this the correct way of gaining some extra FPS?I did actually see that someone has created a Tiled Plugin that offers considerable performance gains - however, I'm using Haxe and porting over this plugin will probably take me more time. Any advice on how I could get this game 'moving' would be great! Cheers! Link to comment Share on other sites More sharing options...
xerver Posted October 28, 2014 Share Posted October 28, 2014 You don't need to port the plugin over, just write a definition file. http://old.haxe.org/doc/js/extern_libraries Link to comment Share on other sites More sharing options...
tomph Posted October 28, 2014 Author Share Posted October 28, 2014 Yeah, I might try this. I guess i'd only need to point to those functions that are 'exposed' in your API. I've tried writing externs before, but have failed due to my lack of JS knowledge. Also, your plugin doesn't currently handle collisions right? How are you going about this in your games? Cheers, Link to comment Share on other sites More sharing options...
tomph Posted October 28, 2014 Author Share Posted October 28, 2014 On a side note. What's the basis of your optimisations? How are you achieving better results? If I can grasp the limitations of Canvas, I may be able to roll my own (if the externs don't work out) Link to comment Share on other sites More sharing options...
xerver Posted October 28, 2014 Share Posted October 28, 2014 It doesn't do physics, yet; but it will if I can find time to finish it (or someone helps me out so I'm not writing it myself). The optimizations have to do with how the sprites are drawn, very similarly to what you describe in your first post. Link to comment Share on other sites More sharing options...
tomph Posted October 28, 2014 Author Share Posted October 28, 2014 ok cool. i guess I'd have to raycast, rather than actually use physics. Thanks for your help. Link to comment Share on other sites More sharing options...
xerver Posted November 4, 2014 Share Posted November 4, 2014 ok cool. i guess I'd have to raycast, rather than actually use physics.Thanks for your help. FYI, I just release v1.2 which adds physics support (p2 specifically) Link to comment Share on other sites More sharing options...
Recommended Posts