tyson Posted June 14, 2013 Share Posted June 14, 2013 Hi all, I'm making a TinyWings-like game with Box2D. The Box2D portion of it works fine, and it renders barely OK on Android. However, I want to see if there are ways to optimize it! At the moment I'm using the draw functions of Cocos2d-html5, that basically extend the canvas API to draw some polys. I'm thinking a way to make it more optimized is to use a bunch of sprites with different slopes, and put them together dynamically. Does anyone else have better ideas? Is it too much to ask for the stock Android Browser to re-draw dynamic backgrounds like this?Cheers, --Tys P.Uri.Tanner 1 Quote Link to comment Share on other sites More sharing options...
rich Posted June 14, 2013 Share Posted June 14, 2013 Hmm that's an interesting challenge. I think you've two choices as I see it: 1) Forget about low-end browsers/devices and just go with what works. It excludes old phones but depending on what you want this game for, that may not matter? 2) Ditch the native canvas drawing operations in favour of bitmaps for sure. Unless I'm mistaken you'll get next to no GPU benefit from canvas draw ops. There may be ways to combine the two - like use image strips/sprites to do the texture and then use draw calls just to lay down the smooth tops of the hills? Definitely worth experimenting though. Quote Link to comment Share on other sites More sharing options...
tyson Posted June 15, 2013 Author Share Posted June 15, 2013 Thanks Rich!Yeah i might go with the hybrid approach, and dump the dynamic part or just fake it by swapping out tiles.I'm thinking standard tilemap level with an Object layer detailing the hill key points for Box2D segment bodies.--Tys Quote Link to comment Share on other sites More sharing options...
IvanK Posted June 16, 2013 Share Posted June 16, 2013 From my experience, all current mobile browsers suck have very bad performance. None of them can deliver 60 FPS animations. Javascript performance is terrible (20x slower than native apps). Binding to GPU is even worse. Calling WebGL routines is about 100x slower than calling OpenGL ES from native apps. Maybe it is because of needless complexity of Webkit. Maybe it's because of high-level programming to support many CPU architectures. I still can not believe, that there was no progress during the last 5 years. I have had the best experience with Dolphin Beta https://play.google.com/store/apps/details?id=com.dolphin.browser.lab.en&hl=cs but it has several bugs. Maybe browser developers don't have much money. I hope there will come some new browser that will "show how to do it", like Chrome did on desktops few years ago. Quote Link to comment Share on other sites More sharing options...
tyson Posted June 17, 2013 Author Share Posted June 17, 2013 This is probably as fast as I can get it working. I used strips of sprites to draw the terrain, plus Chipmunk instead of Box2D. The mass and gravity is all still a bit wonky, but rendering seems OK. http://tysonross.com/temp/tinywingsclone/index.html --Tys Gio 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.