It is currently Tue Jul 16, 2019 5:09 am

All times are UTC - 7 hours





Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 11 posts ] 
Author Message
PostPosted: Mon Apr 29, 2019 7:04 am 
Offline

Joined: Wed Sep 19, 2018 8:21 am
Posts: 1
Hi All!

When it comes to move the character left and right, is it better to rotate each 8x8 tile with code? or is it better to have this as a animation and you just update the tiles information based on pre-set data?

I am starting to learn how to move the character in the screen


Top
 Profile  
 
PostPosted: Mon Apr 29, 2019 7:49 am 
Offline
User avatar

Joined: Thu Aug 13, 2015 4:40 pm
Posts: 411
Location: Rio de Janeiro - Brazil
I assume it's a top down game, because if it was a side scroller you wouldn't rotate it, you'd flip it, which is simple.
No, generally you don't rotate tiles by code, you have each version ready as data or chr.

_________________
https://twitter.com/bitinkstudios <- Follow me on twitter! Thanks!


Top
 Profile  
 
PostPosted: Mon Apr 29, 2019 8:11 am 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7720
Location: Chexbres, VD, Switzerland
No matter whether the graphics are in top-down view or in side view, usually the left and right views are made so that one is the horizontal flip of eachother. Note that it's a flip, NOT a rotation. Using a separate animation is extremely wasteful of your 256 precious sprite tiles. If you need some suble difference (for example the hero holding the weapon in the correct hand), then you can draw only the tiles where this change is significant twice in memory, and the rest once. Even then, 90+% of games didn't care and made those details incoherant - that is the hero would change hands when changing sides.


Top
 Profile  
 
PostPosted: Mon Apr 29, 2019 12:12 pm 
Online
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 11375
Location: Rio de Janeiro - Brazil
When we talk about character flipping, there are 2 things to consider: the tiles graphics themselves, which you may or may not need to draw multiple versions of depending on the symmetry of your characters and whether the correct representation of asymmetry is important to you, and the metasprite definitions, which can be flipped on the fly by the engine or manually mirrored in the ROM beforehand, occupying twice the space. I personally prefer to implement dynamic flipping in my metasprite engines, but I've heard of duplicated definitions in ROM before, which is fine if you have the ROM space to spare and would rather have a simpler/faster metasprite engine.


Top
 Profile  
 
PostPosted: Mon Apr 29, 2019 1:41 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 7526
Location: Canada
So, the difference between a routine that draws horizontally flipped metasprites vs. regular metasprites:

1. Add 8 to the base X location.* (Only need to do this once for the whole metasprite.)
2. SEC+SBC instead of CLC+ADC to position the X coordinate for each tile.
3. XOR with the attribute byte to set the flip bit. (+2 cycles per tile)

This is a very small change in efficiency, IMO. Actually that step 3 can be used to do other things (palette reassignment, etc.) so the XOR of the attribute byte is something I might do in the unflipped sprite routine too, which makes them essentially equivalent in speed.

Having two metasprite routines costs maybe 50 extra bytes or so. That can very quickly be overcome by the savings from metasprites you don't have to have duplicate left/right versions for.


Just having extra metasprites is a valid approach too, though. Less code, more data. Can be quite appropriate if you have the space.


* This assumes the 0,0 coordinate ("pivot point") of your metasprite is in the horizontal centre of the character. The +8 is to account for the width of a single tile, which when flipped should shift by 8 pixels to remain the same distance from the centre point. If your metasprites put 0,0 somewhere else, e.g. the top left corner, you might need a different offset than +8 for each character to keep them appropriately centred. Keeping the pivot in the middle makes this simpler.


Top
 Profile  
 
PostPosted: Mon Apr 29, 2019 8:22 pm 
Offline

Joined: Fri Feb 24, 2012 12:09 pm
Posts: 935
Just in case it wasn't clear: That x-flip thing is a hardware fearure, you do only need to set a bit in the sprite attributes, and the hardware will automatically apply horizontal mirroring to each 8 pixels.
One major issue would be sprites with light/shadow on left/right sides, in that case you may need to use separate sprites instead of mirroring.

_________________
homepage - patreon


Top
 Profile  
 
PostPosted: Tue Apr 30, 2019 5:09 am 
Offline

Joined: Tue May 28, 2013 5:49 am
Posts: 1177
Location: Hokkaido, Japan
RPGs like DQ don't need to use so many sprites so they usually don't mind having separate facing sprites for left and right facing. But action games generally uses more sprites and usually use the hardware flip. Link suddenly becomes right-handed whenever he faces right.

Character rotation would probably be wasteful unless CHR-RAM is used. But most games uses CHR-ROM.


Top
 Profile  
 
PostPosted: Wed Jun 26, 2019 10:05 am 
Offline

Joined: Tue Jun 25, 2019 8:18 am
Posts: 2
Pokun wrote:
RPGs like DQ don't need to use so many sprites so they usually don't mind having mcdvoice separate facing sprites for left and right facing. But action games generally uses more sprites and usually use the hardware flip. Link suddenly becomes right-handed whenever he faces right.

Character rotation would probably be wasteful unless CHR-RAM is used. But most games uses CHR-ROM.

yeah thats right


Top
 Profile  
 
PostPosted: Sun Jul 07, 2019 11:53 pm 
Offline

Joined: Fri Feb 24, 2012 12:09 pm
Posts: 935
gandrew wrote:
Pokun wrote:
...But most games uses CHR-ROM.
yeah thats right
yeah...?

_________________
homepage - patreon


Top
 Profile  
 
PostPosted: Mon Jul 08, 2019 2:17 am 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7720
Location: Chexbres, VD, Switzerland
That's probably a spammer.
Also the OP might be a spammer too, and made a random sentence from often-used words in this forum. Or maybe not. That's though to say.


Top
 Profile  
 
PostPosted: Mon Jul 08, 2019 12:01 pm 
Offline

Joined: Fri Feb 24, 2012 12:09 pm
Posts: 935
I guess so, too. This whole thread is dubious (as far as I remeber there was also a now deleted post saying "I had the same problem, before I learned the essentials" or something like that).

_________________
homepage - patreon


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 11 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 1 guest


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
You cannot post attachments in this forum

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