NESST Metasprite Help

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

Post Reply
User avatar
Lucradan
Posts: 101
Joined: Wed Sep 21, 2016 12:08 pm

NESST Metasprite Help

Post by Lucradan »

I've seen many people using NESST to Metasprite builder to create a sprite. I, however, have never been able to get it to work. I've tried dragging tiles from the tileset to the metasprite control, but nothing happens. Tried Copy/Paste. Nothing. Tried dropping it into the Sprite list. Nothing.

I'm doing exactly what the guy in this video is doing but the cursor never changes. I'm using Windows 7 and NESST version 2.32. Any one have an idea why? And yes, I DID use the right mouse button so it can't be that simple.

https://youtu.be/BtV_NCwWAqs?t=671
User avatar
FrankenGraphics
Formerly WheelInventor
Posts: 2064
Joined: Thu Apr 14, 2016 2:55 am
Location: Gothenburg, Sweden
Contact:

Re: NESST Metasprite Help

Post by FrankenGraphics »

This took me a year to figure out how to properly use it, so i recognize the struggle. ^^

This is how:

-On your nametable field, mark a group of tiles by shift-dragging.
-(optionally) switch to metatile view
-ctrl-m to place selection as meta-sprite in your currently active metasprite slot
-delete redundant tiles
-happy meta spriting!


when editing metasprites, be careful not to mistake the delete key for sprite deletion - it still deletes the currently selected tile from chr, and whenever a sprite is selected, its tile is also selected!
User avatar
Kasumi
Posts: 1293
Joined: Wed Apr 02, 2008 2:09 pm

Re: NESST Metasprite Help

Post by Kasumi »

Could you record a video or something? Because there really isn't more to it. Here's a gif from boot:

Image
All I did was right click and drag after switching to metasprites mode.
Last edited by Kasumi on Wed Jan 31, 2018 12:27 pm, edited 1 time in total.
User avatar
FrankenGraphics
Formerly WheelInventor
Posts: 2064
Joined: Thu Apr 14, 2016 2:55 am
Location: Gothenburg, Sweden
Contact:

Re: NESST Metasprite Help

Post by FrankenGraphics »

Actually, i never understood how drag n drop worked either. I've always used ctrl-m for initial placement and from there duplicated sprites, replaced them and reassigned tiles

oh, right-click/drag. got it. thanks. It's pretty odd that i've tried click-dragging, shiftclick-dragging, altclick-dragging but not right click dragging.

plausible reason for my personal failure, except not being methodical about it: right clicks are less intuitive than command key clicks on many laptops.
Last edited by FrankenGraphics on Wed Jan 31, 2018 12:37 pm, edited 1 time in total.
team_disposable
Posts: 129
Joined: Sat Oct 15, 2016 8:52 am

Re: NESST Metasprite Help

Post by team_disposable »

I was puzzling over this for a good half hour the other day, so I can second that its pretty non intuitive. The key is that you HOLD DOWN the right mouse button when you drag.

Incidently, is anyone using this to store negative values? I had a bit of a mess around with it and the table it generated had both positive and negative values ( I presume you'd use twos compliment).

How are people setting g their x and y relative to the metasprite? I'm always using top left hand corner and offsets.
User avatar
Kasumi
Posts: 1293
Joined: Wed Apr 02, 2008 2:09 pm

Re: NESST Metasprite Help

Post by Kasumi »

team_disposable wrote:Incidently, is anyone using this to store negative values? I had a bit of a mess around with it and the table it generated had both positive and negative values ( I presume you'd use twos compliment).
If you're working with 8bit (your game doesn't scroll)
-1 is the same as 255. ($FF)
0-1=255 (because of wraparound)
0+255=255
You can do

Code: Select all

clc
adc table,x
regardless of if it's positve or negative and it'll just work.
If you're working with 16bit
-1 is the same as 65535 ($FFFF)
Since you only have one byte of $FFFF you do what's called a sign extension.

Code: Select all

ldy #0;Y contains the high byte of the offset
lda table,x;Get the offset's low byte
bpl skipsignextend;If the number was positive, $00 is the correct high byte
dey;If the number is negative, the high byte must be $FF so we adjust Y
skipsignextend:
clc
adc poslow
sta poslowresult

tya;getting the high byte into A
adc poshigh
sta poshighresult
edit:
How are people setting g their x and y relative to the metasprite? I'm always using top left hand corner and offsets.
Top Left, AND bottom middle... for different objects in the same game. But don't be me.
User avatar
FrankenGraphics
Formerly WheelInventor
Posts: 2064
Joined: Thu Apr 14, 2016 2:55 am
Location: Gothenburg, Sweden
Contact:

Re: NESST Metasprite Help

Post by FrankenGraphics »

Top Left, AND bottom middle... for different objects in the same game. But don't be me.
These are very sensible. If NESST has another update anytime, one of the features i'd like to see is being able to move the origin of the grid (in other words the anchor point) independently for each metasprite. No additional bytes required; it just manipulates all sprites' relative position and you get visual feedback on the placement/grid screen. You sort of can do this as far as exports go, but your metasprite will be viewed off-centre of that narrow window which sometimes poses a problem.
team_disposable
Posts: 129
Joined: Sat Oct 15, 2016 8:52 am

Re: NESST Metasprite Help

Post by team_disposable »

More questions on this!

With regards to the offsets as minus numbers, how are people storing these?

It seems that with CA65 at least, you would need to convert them in to their positive (2s compliment) equivalent -

After this discussion, I have just attempted to store an (unrelated to NESST) array for a bounce offset of an item* and CA65 throws up range errors if I try and use minus numbers.

So it would seem that the code generated by NESST for metasprites still wouldn't work, as although you could use it in sbc, adc etc, you couldn't store it. Unless I'm missing something? Is there a signed byte size label or equivalent?** Or are people using C and is CC65 converting it for you?

*I'm experimenting with using a flat physics model for my latest game with fixed LUTs for gravity, acceleration, recoil, etc.
** In fact,I quickly tried copying a pasting in a metasprite and NESST auto generated the byte labels and caused the same issues.

Code: Select all

cut and pasted from NESST:

metasprite:
	.byte -16,- 8,$00,0
	.byte - 8,- 8,$01,0
	.byte -16,  0,$10,0
	.byte - 8,  0,$11,0
	.byte   0,  0,$12,0
	.byte -16,  8,$63,0
	.byte -16, 16,$73,0
	.byte - 8,  8,$64,0
	.byte - 8, 16,$74,0
	.byte   0, 16,$75,0
	.byte   0,  8,$65,0


Errors in the assembler:

twin_ships_asm.s(1721): Error: Range error (-16 not in [0..255])
twin_ships_asm.s(1721): Error: Range error (-8 not in [0..255])
twin_ships_asm.s(1722): Error: Range error (-8 not in [0..255])
twin_ships_asm.s(1722): Error: Range error (-8 not in [0..255])
twin_ships_asm.s(1723): Error: Range error (-16 not in [0..255])
twin_ships_asm.s(1724): Error: Range error (-8 not in [0..255])
twin_ships_asm.s(1726): Error: Range error (-16 not in [0..255])
twin_ships_asm.s(1727): Error: Range error (-16 not in [0..255])
twin_ships_asm.s(1728): Error: Range error (-8 not in [0..255])
twin_ships_asm.s(1729): Error: Range error (-8 not in [0..255])

User avatar
rainwarrior
Posts: 8732
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: NESST Metasprite Help

Post by rainwarrior »

Put this at the top of your code to eliminate those errors:

Code: Select all

.feature force_range
At some point ca65 added a feature for range checking that is on by default, but it makes all use of signed numbers range errors, which I think is kinda stupid but here we are. Alternatively you can put < before each signed byte value to convert it to an unsigned byte and suppress the error for that one value in particular.

What I'd really like instead is range checking, but also a signed version of .byte and maybe a signed version of the # immediate prefix that makes the range check a signed one. Until all my dreams become a reality, though, I just disable range checking with that .feature directive in any files that use signed values.
team_disposable
Posts: 129
Joined: Sat Oct 15, 2016 8:52 am

Re: NESST Metasprite Help

Post by team_disposable »

Makes sense!

I'm on a linux automated update of ca65 releases and I've noticed a few switched of syntax. One day I couldn't compile as I had to change the order of the switches! It's great to have an assembler/compiler that's being so actively developed though.

Since it seems like the switch is limited to auto-changing stored and used values, it seems safe enough to switch on. It would be if it stopped telling me about branching overflows I'd be worried!

Thanks rainwarrior!
User avatar
rainwarrior
Posts: 8732
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: NESST Metasprite Help

Post by rainwarrior »

Yes, branch limits are still an error with or without force_range. It is an unrelated check (and not possible to disable, AFAIK).

Yeah, they did add GCC-style command line argument ordering constraints in one version but I think that later got reverted? Can't recall.
team_disposable
Posts: 129
Joined: Sat Oct 15, 2016 8:52 am

Re: NESST Metasprite Help

Post by team_disposable »

Just checked, yes was reverted. Was refusing optimisation (Oi) and add debug (g) as a single -Oig on CC65 (insisting instead on them separately as -Oi and -g). I've just reverted it back to -Oig in my makefile to check and it looks like it accepts them together again now.

The dangers of life at the cutting edge!
Post Reply