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.

AppGameKit Classic Chat / Atlas image performance - best practices

Author
Message
DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 5th Apr 2015 22:32
Hi All,

A question for the techies! I am going to need more than one atlas image to make the tiles (sprites) that make up the maps in my platform game. Some of the tiles will be full squares and I will set those sprites to not use transparency for performance reasons. My question is... from a performance perspective, should I group all the tiles (sprites) that will not use transparency into one atlas image and all the tiles that do use transparency into another? Would that have any benefits or would the transparency setting on a per tile basis be the only factor in determining best performance?

Whilst I'm here...is there a performance different between using sprites or an image font for displaying text? (I'm thinking score number etc)

Using Tier 1 AppGameKit V2
Started coding with AMOS (Thanks Francois Lionet)
Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 6th Apr 2015 23:52
I don't have any answers for your main questions, but they reminded me of something else I saw on these forums.

You might consider using a bitmapped font for your tile images.

So... AAABBAAA might be 3 tiles of grass, 2 tiles of trees, and 3 tiles of more grass.

A complete map might be one long string, with appropriate line breaks.

This could turn out to be very fast.

But it might not be what you need for your platformer.

Just a thought.
3d point in space
15
Years of Service
User Offline
Joined: 30th Jun 2009
Location: Idaho
Posted: 7th Apr 2015 04:06 Edited at: 7th Apr 2015 04:08
using letters like aaabbaaa is indead fast, but its even fasters if you read those letters from a file maybe, for bigger maps, or if you have a lot of maps. using this method you can have about 100 or so sprites using this system if you include all the characters on the keyboard.

Developer of Space Chips, pianobasic, zipzapzoom, and vet pinball apps. Developed the tiled map engine seen on the showcase. Veteran for the military.
DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 8th Apr 2015 10:12
It's only the transparent issue of tiles and atlas images I need to figure out. I have the time system all sorted. See my thread in the showcase part of the forum.

Using Tier 1 AppGameKit V2
Started coding with AMOS (Thanks Francois Lionet)
fog
21
Years of Service
User Offline
Joined: 5th Oct 2003
Location: Newcastle, England
Posted: 9th Apr 2015 04:02
There are several ways the quads/textures can be batched before sending to the GPU and the commands we had to control that, SetSortTransparentDepth() and SetSortTextures(), are now shown as depreciated so only Paul knows how they are sorted.

Generally though the most important thing is to avoid switching textures too often, so group all similar objects together in a single atlas where possible. (eg. have one atlas for your HUD and group all your HUD sprites together)

The best advice though is to forget all about it and only worry if you run into performance issues. Speaking from experience it's easy to get obsessed with unnecessary optimisation when your precious time could be better spent elsewhere

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 9th Apr 2015 14:47
As fog suggests I would imagine that you will get a better boost in performance by having as many images in one scene in as few atlas images as possible than from switching transparency, that's just the shader used for each sprite effectively. The image itself will not be switched from transparent to not transparent each time a sprite requires it.

Paul would certainly be best to answer something like this.

Using AppGameKit V2 Tier 1
DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 9th Apr 2015 15:53
Cheers guys for the input. Frame rate is still pretty good so I'll keep an eye on that. Have to say that I'm dead impressed with the performance so far, especially given my coding skill or lack thereof!

Using Tier 1 AppGameKit V2
Started coding with AMOS (Thanks Francois Lionet)
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 9th Apr 2015 21:19
Quote: "The best advice though is to forget all about it and only worry if you run into performance issues. Speaking from experience it's easy to get obsessed with unnecessary optimisation when your precious time could be better spent elsewhere"


Nicely said. It's called Analysis Paralysis, I'm a longtime sufferer!

Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt

Login to post a reply

Server time is: 2024-11-25 20:50:34
Your offset time is: 2024-11-25 20:50:34