Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / Fastest tile map display

Author
Message
krid
9
Years of Service
User Offline
Joined: 2nd Dec 2014
Location: Almaty / Kazakhstan
Posted: 29th Feb 2016 17:53
Any idea how I can get the fastest way in AGK2?
For now I use setSpriteFrame() method with a 256x256 px sprite as atlas map.
then I modify it as one whole sprite framed by 32x32 frames
is it the fastest way to work with tiles in AGK2 or there is something more efficient?
Because for now I have 4 layers 16x16 tiles each and it kinda slow ( 38fps for my 1.5 GHz Dual-core + Adreno 225 smartphone ) and it drops my plans to make 20x11 tile map for each of 6 layers + dynamic sprites and music.
Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 29th Feb 2016 20:24
There is a way... use text

Seriously... if you setup your tileset as a font, and build the map with ascii characters, then I think you'll find it scarily fast

I have an old example for AGK1, I'll see if I can convert it later. I think the demo has at least 4 layers of parallax scrolling... but I think the main benefit is that it will draw the spritesheet really quickly - quicker than sprites which might have to be sorted into texture arrays, with text, AppGameKit will optimise the render so all text is drawn in a single pass. I am sure that TGC have a decent optimisation when the same image is used, but text means that the texture assignment is assumed. Text characters can be coloured and adjusted of course, and the text string changed to adjust tiles or change the whole map.

Anyway, will dig out that old demo.
krid
9
Years of Service
User Offline
Joined: 2nd Dec 2014
Location: Almaty / Kazakhstan
Posted: 1st Mar 2016 15:42
Wow, tile as ascii character in text is something
I load my level from tiled exported map, so it seems to use "tile as text" method I need some calculations after I load my level in memory. Interesting. Will dig into that in future for sure
As for now, I found out that I didnt use REF keyword while passing layers to my render function. Thats why it was slow. Now it boosted up to 70 fps which is good, because I draw whole map 32x20. Now I need to show only tiles that need to be shown + extra for smooth scroll.

Thanks
JLMoondog
Moderator
15
Years of Service
User Offline
Joined: 18th Jan 2009
Location: Paradox
Posted: 8th Mar 2016 18:39 Edited at: 8th Mar 2016 18:40
Hey, take a look at my Santa Chimney Drop game. I've come up with a cool little tile system that loads an ascii text file for levels and than only displays tiles that are within a certain range of the player, or in this demo the mouse cursor. Run the exe first so you can see it in action and than take a look at the code. If anything seems a bit confusing, just let me know and I"ll try to explain it as best I can. I always comment my code, so hopefully you can understand it.

Screenshot:



Video:



Attachment download included...

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-04-19 22:44:08
Your offset time is: 2024-04-19 22:44:08