Hello all!
I have found myself stumped on a problem and can't seem to figure it out via google.
I am trying to figure out why tile engines usually use multiple layers for things like: the ground, the entities, dither tiles and so on. why not create an array of tiles in a way that each tile contains all the data in one object. for example the sprite image, any possible entities on the tile, check it's neighboring tiles to calculate if it needs to dither, is the tile walkable and so on.
i may just be looking at this all wrong =P
if anyone knows of a good source code i can study for tile implementations i would love to see it!
my end goal one day is to be able to make a 2d top down rpg-like minecraft using a tileset similar to Danc's Flexible tiles. but if im limited to a defined number of layers, that makes building upwards a problem.
any help would be awesome!
thanks
Kam
2d Tiles question
Page 1 of 11 Replies - 569 Views - Last Post: 07 August 2012 - 01:23 AM
Replies To: 2d Tiles question
#2
Re: 2d Tiles question
Posted 07 August 2012 - 01:23 AM
You could in fact hold a lot of data in each tile but the multiple layers also add to the graphical touches. I'll try to give an example.
Let's say we have this map:

And we now want to add a nice path through it. We have these tiles to choose from:

As you can see, these tiles have an alpha channel (it is a PNG). If I was to directly add these tiles to this map I would get this:

But with a new layer I will get something like this:

Much better
Also what if we want a layer above the characters that comprises things such as treetops or behind building, if these were on the same layer they would always be behind the character. For example, say a character is supposed to walk behind this tree:

If it was on the same layer as the ground tiles then this wouldn't be possible. Whereas if we were to split the map into layers then we could draw the background tile layer then draw the character and only then draw the top layer to give the illusion of depth. This of course doesn't stop you from adding attributes to tiles such as whether they are passable or not.
Hope that helps somewhat
Let's say we have this map:

And we now want to add a nice path through it. We have these tiles to choose from:

As you can see, these tiles have an alpha channel (it is a PNG). If I was to directly add these tiles to this map I would get this:

But with a new layer I will get something like this:

Much better

If it was on the same layer as the ground tiles then this wouldn't be possible. Whereas if we were to split the map into layers then we could draw the background tile layer then draw the character and only then draw the top layer to give the illusion of depth. This of course doesn't stop you from adding attributes to tiles such as whether they are passable or not.
Hope that helps somewhat
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote



|