Is it possible to 'mirror' the screen easily?

SGDK only sub forum

Moderator: Stef

POLYGAMe
Very interested
Posts: 151
Joined: Sun Apr 14, 2013 1:19 am
Location: Auckland, New Zealand
Contact:

Is it possible to 'mirror' the screen easily?

Post by POLYGAMe » Mon Jan 18, 2016 8:51 am

For my racing game I'm using a textured road. Obviously I'd like to save as much memory as possible so cutting the road in half and mirroring the other side would be awesome. Is this easily achievable? I haven't seen anything obvious in the various VDP functions I've been playing with.

Thanks in advance!

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: Is it possible to 'mirror' the screen easily?

Post by Stef » Mon Jan 18, 2016 10:44 am

You have vertical and horizontal flip support on a tile basis. Rescomp is able to generate and optimize automatically you tilemap data given a image which use flipped tiles.

POLYGAMe
Very interested
Posts: 151
Joined: Sun Apr 14, 2013 1:19 am
Location: Auckland, New Zealand
Contact:

Re: Is it possible to 'mirror' the screen easily?

Post by POLYGAMe » Mon Jan 18, 2016 1:44 pm

Cool thanks! I'll look into rescomp :)

alko
Very interested
Posts: 172
Joined: Thu Aug 07, 2014 9:31 am
Location: Russian Federation

Re: Is it possible to 'mirror' the screen easily?

Post by alko » Mon Jan 18, 2016 5:14 pm

:D :) :( :cry:
strangely, why I have totally mirrored tiles so obtained...

Image

Image
Image

r57shell
Very interested
Posts: 478
Joined: Sun Dec 23, 2012 1:30 pm
Location: Russia
Contact:

Re: Is it possible to 'mirror' the screen easily?

Post by r57shell » Mon Jan 18, 2016 6:43 pm

alko
That means that program you use sux :D
Image

alko
Very interested
Posts: 172
Joined: Thu Aug 07, 2014 9:31 am
Location: Russian Federation

Re: Is it possible to 'mirror' the screen easily?

Post by alko » Mon Jan 18, 2016 7:38 pm

I use only VDP_drawImageEx(..)
as assures Stef, it should automatically optimize mirrored tiles...
or not?
Image

troudki
Interested
Posts: 18
Joined: Sun Dec 20, 2015 10:31 am

Re: Is it possible to 'mirror' the screen easily?

Post by troudki » Mon Jan 18, 2016 8:09 pm

hi,
where i can find this "vdp ram " windows tools ?
thx

alko
Very interested
Posts: 172
Joined: Thu Aug 07, 2014 9:31 am
Location: Russian Federation

Re: Is it possible to 'mirror' the screen easily?

Post by alko » Mon Jan 18, 2016 9:07 pm

troudki wrote: where i can find this "vdp ram " windows tools ?
http://elektropage.ru/publ/programmy_dl ... 38-1-0-122
Image

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: Is it possible to 'mirror' the screen easily?

Post by Stef » Mon Jan 18, 2016 10:10 pm

alko wrote:I use only VDP_drawImageEx(..)
as assures Stef, it should automatically optimize mirrored tiles...
or not?
VDP_drawImageEx(...) just draw an image given a specified tileset and tilemap. What matter is the tool used to convert your image to internal binary format. Rescomp should take care of it, normally it detects duplicate / flipped tiles and arrange tileset/tilemap for that.
I forgot to reply in the appropriate topic but i tested rescomp on your image and it works as expected, I obtain 135 uniq tiles over the 240 base tiles which is expected given the input image.

POLYGAMe
Very interested
Posts: 151
Joined: Sun Apr 14, 2013 1:19 am
Location: Auckland, New Zealand
Contact:

Re: Is it possible to 'mirror' the screen easily?

Post by POLYGAMe » Mon Jan 18, 2016 11:51 pm

So rescomp is part of the sgdk... do I need to do anything to utilise it or is it always used when I import resources? Am I right in assuming that if my image is symmetrical it will handle it for me? That sounds better than trying to work out how to fill empty tiles with flipped matching tiles :)

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: Is it possible to 'mirror' the screen easily?

Post by Stef » Tue Jan 19, 2016 9:12 am

As long you image is symmetric on tile basis (8x8 pixel block) it will work.
And yeah, rescomp is used automatically when you use .res file to declare your resources.

POLYGAMe
Very interested
Posts: 151
Joined: Sun Apr 14, 2013 1:19 am
Location: Auckland, New Zealand
Contact:

Re: Is it possible to 'mirror' the screen easily?

Post by POLYGAMe » Tue Jan 19, 2016 9:27 am

Awesome :D Pretty sure I can finish the road "engine" this weekend :) Thanks for all your help, Stef!!!

alko
Very interested
Posts: 172
Joined: Thu Aug 07, 2014 9:31 am
Location: Russian Federation

Re: Is it possible to 'mirror' the screen easily?

Post by alko » Tue Jan 19, 2016 8:04 pm

What matter is the tool used to convert your image to internal binary format.
rescomp which comes complete with SGDK.
I obtain 135 uniq tiles over the 240 base tiles which is expected given the input image.
As well as in my case .
Only RLE- algorithm .
No mirroring optimization .

8*16+6=134 tiles.
Image
Image

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: Is it possible to 'mirror' the screen easily?

Post by Stef » Tue Jan 19, 2016 9:03 pm

Hmm sorry you're right, i forgot to count about the blank tiles, it's why we obtain 135 uniq tiles (counting 1 blank) :-/ Ok i will check that in deep ! It seems that flipped tiles are definitely not optimized (they should !)

alko
Very interested
Posts: 172
Joined: Thu Aug 07, 2014 9:31 am
Location: Russian Federation

Re: Is it possible to 'mirror' the screen easily?

Post by alko » Tue Jan 19, 2016 9:07 pm

Thanx :oops:
Image

Post Reply