Transparency on the same Plane, via Tiles

SGDK only sub forum

Moderator: Stef

Post Reply
teemo
Newbie
Posts: 2
Joined: Mon Dec 04, 2017 10:26 pm

Transparency on the same Plane, via Tiles

Post by teemo » Mon Dec 04, 2017 11:51 pm

Hello,

I have searched a lot, but couldn't find a definitive answer: is it possible to have, *on the same plane*, two transparent tiles? From my current experiments, it doesn't seem to be the case :(

Here's a sample program:

Code: Select all

        VDP_setPalette(PAL1, tileset.palette->data);
	VDP_loadTileSet(tileset.tileset, TILE_USERINDEX, TRUE);

	VDP_setTileMapXY(PLAN_B, TILE_ATTR_FULL(PAL1, 0, 0, 0, TILE_USERINDEX + 1), 0, 0);
	VDP_setTileMapXY(PLAN_B, TILE_ATTR_FULL(PAL1, 0, 0, 0, TILE_USERINDEX + 1), 1, 0);
	VDP_setTileMapXY(PLAN_B, TILE_ATTR_FULL(PAL1, 0, 0, 0, TILE_USERINDEX + 2), 0, 0);
	VDP_setTileMapXY(PLAN_A, TILE_ATTR_FULL(PAL1, 0, 0, 0, TILE_USERINDEX + 2), 1, 0);
Basically, we draw the grass (second tile) on (0,0) and (1,0), and then above them we draw that piece of brown. B + A works fine (second tile from sample), but B + B doesn't work.

LE: While writing this post (doh) it occurred to me that since we set the index on the same position, it's kind of logical that it *overwrites* the previous state.

My issue stems from the fact that I would need 3 planes-likes things, but we only have the A & B ones + Sprites. Is then the sprites the only way to go forward w/r/t transparency?
Attachments
tileset2.png
Tileset
tileset2.png (226 Bytes) Viewed 6705 times
sample.png
Current output
sample.png (2.63 KiB) Viewed 6705 times

Miquel
Very interested
Posts: 514
Joined: Sat Jul 30, 2016 12:33 am

Re: Transparency on the same Plane, via Tiles

Post by Miquel » Tue Dec 05, 2017 3:15 am

In mathematics often you have an unique solution (or a group of) and an exact methodology to arrive to that conclusion.
Frequently in life you don't have this situation, but you have to chose your own framework to reach to a misty success.

Since there are no solid parameters is clearly a personal quest, for example if you want to know why you studied mathematics in your youth you should read Plato and his "The Republic" book, don't expect anything because is probably not what you think. The really important is your choosing: you will opt to read that book or not. Both paths offer you a solution well described on the "Allegory of the Cave", both are good enough depending on your choosing framework.

So going back on the original question, you have to do a choice:
a) Are you going to do what everyone else does?
b) or are you going to search for a deeper understanding?

Selecting A means security in numbers, but also means that if this is the middle ages you will believe in a flat Earth. While taking B implies to waste a lot more time, but also a potential personal grow.

What everyone does is put into several tiles all combinations of transparencies, unless there is an scroll implied in which situation you use another layer (to do the scroll obviously).

In most cases this is the clearly the wining solution but since making videogames is not an exact science, is not mathematics, perhaps you want to experiment with other answers. Your choice.
HELP. Spanish TVs are brain washing people to be hostile to me.

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Re: Transparency on the same Plane, via Tiles

Post by Chilly Willy » Tue Dec 05, 2017 10:14 pm

I don't think philosophy fits in the question. :D

A and B are different planes, so writing one type of tile to A and another to B and having both show is just how dual-plane graphics work. Writing one tile to B, and then another tile to the same place in B is merely setting B to the second tile. There's no way that that could work as this is a single plane. If you want both tiles in one plane, you need tiles that have both tiles' content in a single tile.

Miquel
Very interested
Posts: 514
Joined: Sat Jul 30, 2016 12:33 am

Re: Transparency on the same Plane, via Tiles

Post by Miquel » Wed Dec 06, 2017 3:52 am

Chilly Willy wrote:
Tue Dec 05, 2017 10:14 pm
I don't think philosophy fits in the question. :D
It was a veiled question in that text. Anyway I don't see in the rules that we are forced to speak only about MD, and I answered the(both) question(s). Yes: it's not a common answer, agree. But I'm not a robot with predefined paths.

If it fits or not, well... what to do next in an uncertain environment it's quite a philosophical question, is it not?

Cheers! :D
HELP. Spanish TVs are brain washing people to be hostile to me.

ob1
Very interested
Posts: 463
Joined: Wed Dec 06, 2006 9:01 am
Location: Aix-en-Provence, France

Re: Transparency on the same Plane, via Tiles

Post by ob1 » Thu Dec 07, 2017 7:21 am

Miquel wrote:
Tue Dec 05, 2017 3:15 am
In mathematics often you have an unique solution (or a group of) and an exact methodology to arrive to that conclusion.
Frequently in life you don't have this situation, but you have to chose your own framework to reach to a misty success.

(...)

In most cases this is the clearly the wining solution but since making videogames is not an exact science, is not mathematics, perhaps you want to experiment with other answers. Your choice.
Robin wrote:Lasagna. Just get the lasagna!
Spoiler alert, How I met your mother (3x08)


Thanks Chilly for the quick and precise answer.

teemo
Newbie
Posts: 2
Joined: Mon Dec 04, 2017 10:26 pm

Re: Transparency on the same Plane, via Tiles

Post by teemo » Sat Dec 09, 2017 2:12 pm

Miquel, at first I thought you were a spam bot or something, but after I checked your posts on the forum, I had to re-read your post 3-4 times to understand what you meant :D

I was afraid I'll get that answer. So basically, I have to craft manually each tile to yield the wanted results. I hoped that I don't need to do that, perhaps via the virtual bitmap? - i.e., render via alpha masking two different tiles and get the merged one.

So if my level is more complicated, and the 3 layers won't fit, I have to figure out smarter ways, right?

The reason I reached this issue, is that I'm working on an isometric game, so I can't use square tiles to draw the objects. At the beginning I hoped I could just draw the object images and be done, but it seems I need to merge some images in one :)
Last edited by teemo on Fri Dec 15, 2017 6:31 pm, edited 1 time in total.

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Re: Transparency on the same Plane, via Tiles

Post by Chilly Willy » Sun Dec 10, 2017 4:04 pm

If you need three layers, a common technique is to use some sprites as one of the layers. Depends on what else you're using the sprites for, and how many.

Miquel
Very interested
Posts: 514
Joined: Sat Jul 30, 2016 12:33 am

Re: Transparency on the same Plane, via Tiles

Post by Miquel » Fri Dec 15, 2017 9:25 am

teemo wrote:
Sat Dec 09, 2017 2:12 pm
I was afraid I'll get that answer. So basically, I have to craft manually each tile to yield the wanted results. I hoped that I don't need to do that, perhaps via the virtual bitmap? - i.e., render via alpha masking two different tiles and get the merged one.
Correct, that's what most successful games did. Even today is a good technique for other reasons... but yeah is a pain in the ass merging all them. It's not the easiest way but it's what makes games coherent.
teemo wrote: So if my level is more complicated, and the 3 layers won't fit, I have to figure out smarter ways, right?
Unless there is scroll involved, or the player can squeeze in between doesn't matter how many layers you need... but it will increment the number of tiles used exponentially.
teemo wrote: The reason I reached this issue, is that I'm working on an isometric game, so I can't use square tiles to draw the objects. At the beginning I hoped I could just draw the object images and be done, but it seems I need to merge some images in one :)
I don't know how you are designing the game but you only have squared tiles to work with by hardware design so you need to transform those isometric tiles into square somehow.
In fact you have 4 "psedo-layers", the priority bit makes 2 more non-scroll layers, hope this helps.
HELP. Spanish TVs are brain washing people to be hostile to me.

Miquel
Very interested
Posts: 514
Joined: Sat Jul 30, 2016 12:33 am

Re: Transparency on the same Plane, via Tiles

Post by Miquel » Fri Dec 15, 2017 11:16 am

ob1 wrote:
Thu Dec 07, 2017 7:21 am
Robin wrote:Lasagna. Just get the lasagna!
Spoiler alert, How I met your mother (3x08)
I already have eaten lasagne and "smurf food" before, but you must be right: it's not enough since Earth land is such a tasteless place.

Edit:
I also tasted French food, and was completely unsuccessful. So may be, for your own good, do something about it, you too.
HELP. Spanish TVs are brain washing people to be hostile to me.

Post Reply