Adam's Lair Forum

game development and casual madness
It is currently 2017/04/25, 12:23

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: 2016/04/05, 15:56 
Newbie
Newbie

Joined: 2016/04/05, 15:51
Posts: 4
Role: Hobbyist
Hey there, I just started using Duality and figured this may be a good 'How To' for fellow beginners.

I have a tile sheet of about 50 tiles that are used to make up a room (a 320x160 png image). How would I tell the editor to only use the first 32x32 tile at the very top left of this image.

Is there a way to do this in the editor or will I have to do it programmatically somehow?


Top
 Profile  
 
PostPosted: 2016/04/05, 16:07 
Forum Adept
Forum Adept
User avatar

Joined: 2015/03/15, 02:49
Posts: 351
Location: Out there
Role: Hobbyist
There's a couple projects to integrate tilesheet support into duality.

So, for the time being, you can just build the most recent version by Adam, or just wait.

_________________
Hello there! Nice to meet you!
I have github. Apologies in advance for bad coding practices.


Top
 Profile  
 
PostPosted: 2016/04/05, 16:47 
Newbie
Newbie

Joined: 2016/04/05, 15:51
Posts: 4
Role: Hobbyist
Ah, another search of the forum and I found out about the tilemap-wip branch. To be honest, I've not always been keen on trying out less (potentially) stable code/versions in order to get certain features. But I might actually try it out in this case.

As an aside though, if I were to go 'old school' and just seperate the sheet out into separate images and display it all as a couple of hundred singular sprites - would that be an issue in this engine in terms of framerate or memory consumption?


Top
 Profile  
 
PostPosted: 2016/04/05, 17:38 
Site Admin
Site Admin
User avatar

Joined: 2013/05/11, 22:30
Posts: 1948
Location: Germany
Role: Professional
ExplosiveBiscuit wrote:
Ah, another search of the forum and I found out about the tilemap-wip branch. To be honest, I've not always been keen on trying out less (potentially) stable code/versions in order to get certain features. But I might actually try it out in this case.

Just a word of warning: While I encourage anyone to take a look into in-development features, the tilemap-wip branch is definitely not stable territory. Feel free to use it (and provide feedback!), but be aware that most things in there might change and break your project. So, in short:

"Do experiment with it. Don't rely on it. (yet)"

Edit: If you're interested, you can follow progress in this thread, where I'll most certainly announce when the first stable release is out.

ExplosiveBiscuit wrote:
As an aside though, if I were to go 'old school' and just seperate the sheet out into separate images and display it all as a couple of hundred singular sprites - would that be an issue in this engine in terms of framerate or memory consumption?

Having a single Texture for each tile works, but will definitely have a negative performance impact. Have you considered configuring your Pixmap Atlas by specifying column and row count? That way, you get an "Atlas Texture", which you can index to get the UV coordinates for individual tiles.

_________________
Blog | GitHub | Twitter (@Adams_Lair)


Top
 Profile  
 
PostPosted: 2016/04/05, 19:07 
Newbie
Newbie

Joined: 2016/04/05, 15:51
Posts: 4
Role: Hobbyist
Thanks so much for the quick reply ^^

I think I see in the editor how to specify the atlas. I'm guessing now I need to write code to access the List of Rects that it's referring to.

Are there any code examples on how to render it anywhere.


Top
 Profile  
 
PostPosted: 2016/04/05, 19:23 
Site Admin
Site Admin
User avatar

Joined: 2013/05/11, 22:30
Posts: 1948
Location: Germany
Role: Professional
Quote:
I'm guessing now I need to write code to access the List of Rects that it's referring to.

Yep ^^

For a single sprite, you could simply use the AnimSpriteRenderer (rather than writing code) and specify a texture atlas index, but if you're aiming to create a medium-sized to big tilemap, you're likely going to run into a performance problem here. (Doing a 100x100 tilemap? That's 10000 objects.) For really small tilemaps this can still work, but be aware of the limits.

A much more efficient approach would be to write your own renderer that, as a single object, renders your entire tilemap. Duality's builtin renderers are here, which you can use for reference. Or take a look at the experimental / alpha code on the tilemap-wip branch which does happen to have a TilemapRenderer implemented. It does a lot more (Z offset generation, various optimizations, actual Tileset Resources) than what you asked for, but maybe you can create a custom, stripped down version for your own purposes.

_________________
Blog | GitHub | Twitter (@Adams_Lair)


Top
 Profile  
 
PostPosted: 2016/04/05, 23:46 
Newbie
Newbie

Joined: 2016/04/05, 15:51
Posts: 4
Role: Hobbyist
Adam wrote:

A much more efficient approach would be to write your own renderer that, as a single object, renders your entire tilemap. Duality's builtin renderers are here, which you can use for reference. Or take a look at the experimental / alpha code on the tilemap-wip branch which does happen to have a TilemapRenderer implemented. It does a lot more (Z offset generation, various optimizations, actual Tileset Resources) than what you asked for, but maybe you can create a custom, stripped down version for your own purposes.


Thanks for the links - I'm going to try and implement my own renderer as you suggested. :)

Failing that though, the other idea will be a possible fall back option.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group