New SNES game in development: Furry RPG (working title)

Discussion of hardware and software development for Super NES and Super Famicom. See the SNESdev wiki for more information.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
User avatar
Ramsis
Posts: 341
Joined: Sun Jul 01, 2012 6:44 am
Location: Lion's den :3
Contact:

Re: New SNES game in development: Furry RPG (working title)

Post by Ramsis »

Thank you for your valuable input, KungFuFurby, I got it all to work – stereo sound, only one copy of the sound driver in ROM, and no more random freezes when loading a song. :D

Image

Download:
http://manuloewe.de/snestuff/projects/f ... d_00198.7z

BTW KungFuFurby, is there any "recommended" way for loading and playing a song? Because I noticed that unless I issue another SCMD_INITIALIZE to the sound driver after feeding new data to it, it won't play the song correctly (if at all).

Here's how I'm doing it in this build (in pseudo code):

Code: Select all

jsl music_stop

issue SCMD_LOAD command
feed 6 bytes (pointer data)

issue SCMD_LOAD command
feed sample pack data

issue SCMD_LOAD command
feed notes data

issue SCMD_INITIALIZE command         ; this is crucial
issue SCMD_STEREO command
set volume
issue SCMD_MUSIC_PLAY command
BTW, to track down what caused the freezing in the previous builds, I traced the song loading using Geiger's debugger and noticed that an NMI occurred during a - lda $2140 | beq - loop. Turns out that NMI and IRQ were not disabled in the spc_command_asm subroutine (but only in spc_load_data). So thankfully, this was an easy fix. :)
Some of my projects:
Furry RPG!
Unofficial SNES PowerPak firmware
(See my GitHub profile for more)
KungFuFurby
Posts: 275
Joined: Wed Jul 09, 2008 8:46 pm

Re: New SNES game in development: Furry RPG (working title)

Post by KungFuFurby »

That initialize command is required each time you change the pointer to either the ADSR table or the SFX (you currently don't use SFX). Otherwise, the main thing that seems to be going wrong in your playback is related to wrong ADSR envelopes. Since changing sample packs changes the ADSR and SFX pointers, that's a required command.

The initialize command messes with the stereo option by zeroing it out, thus also making the Stereo command required. If there's an option to make the sound mono, you can take advantage of this situation by simply checking for stereo being activated in the game and simply not use this command if the sound is set to mono.

If you use matching sample packs (and ADSR/SFX tables, too), then both commands are not required when switching songs (Stereo only needs to be called once in this case, since that's when the entire code is loaded in the first place).

Either that, or instead of sending those three pointers to $0208 and then calling those two commands above, you can instead send two of them to direct page using the load command. This takes three loading commands instead of one (since now they're two bytes each and not bunched up together), and you have to send the pointers to $0004 (ADSR table pointer), $0014 (SFX pointer), and $020C. The last one is $020C because the play music command automatically reads from that memory location instead of direct page (and sending it to its direct page location will mean it gets overwritten anyways).

Be careful, though: you'll still have to load the same set to $0208 if you ever have to call the initialize command again.
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: New SNES game in development: Furry RPG (working title)

Post by tepples »

The flute in song 05 is hitting a lot of wrong notes. Given the name "buskers", is it supposed to represent an in-game inexperienced musician?
User avatar
Ramsis
Posts: 341
Joined: Sun Jul 01, 2012 6:44 am
Location: Lion's den :3
Contact:

Re: New SNES game in development: Furry RPG (working title)

Post by Ramsis »

Hey, KungFuFurby, thanks! Now that I got it working though (and my song loading routine seems complete), I think I'll stick with sending the pointers to $208. :)

@tepples, the full title of the song is, "Three Buskers and One Buffoon." It's said buffoon is playing the flute. Note however that he's actually a virtuoso musician, and positively annoyed by the buskers' rather unsophisticated tune ... which, all in all, will result in a funny little cutscene. :lol:

BTW, I've updated the song, the buffoon is now a lot more gleeful towards the end. ;) (Yes, the flute being totally off-center, and staying there, is intentional.) Also, there is another new track, also intended for a cutscene/flashback/whatever. Be sure to listen to it in full length (~5:15 min.). :)

Image

Download:
http://manuloewe.de/snestuff/projects/f ... d_00199.7z
Some of my projects:
Furry RPG!
Unofficial SNES PowerPak firmware
(See my GitHub profile for more)
ThunderZ
Posts: 6
Joined: Wed Feb 04, 2015 2:47 am

Re: New SNES game in development: Furry RPG (working title)

Post by ThunderZ »

I've a little question.

How did you setup/compile your file ???

You're one of the indie demo/games that seem to be correctly setup compiled and that work for me on my SNES + SUPER UFO 8 Linker.
Lots of demo/compiled programs don't want to load (bad dump of rom too but the same rome with correct dump/header load without problem)

I'm new in SNES assembler, i try some test with WLA-DX, the SNES-SDK and PVSNESLIB.
All code generate work on emulator but won't load on SUPER UFO 8.

Your demo load perfectly and work without any problem.
I'll apreciate a lof if you can tell me how you setup your rom.

PS: Your work on the current engine demo is really impressive :)
User avatar
Ramsis
Posts: 341
Joined: Sun Jul 01, 2012 6:44 am
Location: Lion's den :3
Contact:

Re: New SNES game in development: Furry RPG (working title)

Post by Ramsis »

Hey!
ThunderZ wrote:How did you setup/compile your file ???

(...)

Your demo load perfectly and work without any problem.
I'll apreciate a lof if you can tell me how you setup your rom.

PS: Your work on the current engine demo is really impressive :)
Thanks! :D

No idea what's wrong with your setup, though. :| Maybe test your ROMs on bsnes/higan before loading them onto your copier? :?:

Anyway, here's a new build:

Image

Image

Image

Download:
http://manuloewe.de/snestuff/projects/f ... d_00213.7z

Have fun, and feel free to report bugs/glitches! :)

Ramsis
Some of my projects:
Furry RPG!
Unofficial SNES PowerPak firmware
(See my GitHub profile for more)
User avatar
Ramsis
Posts: 341
Joined: Sun Jul 01, 2012 6:44 am
Location: Lion's den :3
Contact:

Re: New SNES game in development: Furry RPG (working title)

Post by Ramsis »

Now it's finally possible to do turns on the Mode 7 map. I achieved this by pre-calculating no less than 1024 HDMA tables -- four for each one of the 256 rotation angles. :)

Image

Download:
http://manuloewe.de/snestuff/projects/f ... d_00220.7z

Unfortunately, you can't "fly" forward on any rotation angle yet as the BG is apparently scrolled relative to the northern edge of the Mode 7 GFX, not the first scanline or X/Y center coordinates. :roll: But I'll definitely make that possible somehow, too. :D
Last edited by Ramsis on Sat Jun 13, 2015 8:11 am, edited 1 time in total.
Some of my projects:
Furry RPG!
Unofficial SNES PowerPak firmware
(See my GitHub profile for more)
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: New SNES game in development: Furry RPG (working title)

Post by tepples »

Second try now:
How long does each table take to calculate? I seem to remember Super Mario Kart calculating a bunch of HDMA tables into $7F0000-$7FFFFF at power-on using the DSP. Or are they precalculated into ROM using an algorithm that would use excess real time if implemented on the S-CPU?
User avatar
Ramsis
Posts: 341
Joined: Sun Jul 01, 2012 6:44 am
Location: Lion's den :3
Contact:

Re: New SNES game in development: Furry RPG (working title)

Post by Ramsis »

Indeed, the SNES CPU is too slow (or rather, Vblank is too short) to calculate matrix values for all 224 scanlines in real-time, so I had the SNES subsequently pre-calculate all necessary sets of matrix parameters into WRAM, then dumped each set to a file and included the dumps in the ROM. :)

Due to how the rotation math is implemented, there are 256 possible angles and 224 16-bit values per Mode 7 rotation/scaling parameter (4), so the matrix data currently amounts to a whopping 1024 HDMA tables or 256 * 448 * 4 = 458.752 bytes (though technically, registers M7A and M7D share the same values, so it's "only" 344.064 bytes, all in all). The current angle value ($00-$FF) is merely used as an index into the set of matrix parameters. During Vblank, the appropriate 4 tables of 448 bytes each are copied to the WRAM locations accessed by an indirect HDMA transfer.

I'll have to calculate even more tables though, as I would like to be able to change the "height" during flight. :D

BTW, the rotation math in my implementation is fundamentally based on bazz' Mode 7 tutorial, although enhanced by my own discoveries, ridden of quite a few bugs, and simplified in several ways (e.g. you don't need to change your calculations for a clockwise rotation -- just decrease the angle value instead of incrementing it). :wink:

In any case, I wouldn't know of any other recent homebrew demo/game for the SNES featuring a working Mode 7 rotation with perspective, so I tend to be a tiny bit proud of my achievement. :lol:

Lastly, here's a build that eliminates any and all scrolling glitches present in #00220 and earlier, and shows the current angle using a sprite-based VWF:

Image

Download:
http://manuloewe.de/snestuff/projects/f ... d_00221.7z
Some of my projects:
Furry RPG!
Unofficial SNES PowerPak firmware
(See my GitHub profile for more)
Near
Founder of higan project
Posts: 1553
Joined: Mon Mar 27, 2006 5:23 pm

Re: New SNES game in development: Furry RPG (working title)

Post by Near »

Very clever idea to pre-compute the values for mode 7 rotation! :D

No sense making the game suffer, just to pretend like it's the mid-'90s when ROM was expensive. It seems so obvious, but I've seen fan translations that prided themselves on packing everything into unexpanded ROMs, like some sort of demoscene challenge.
Sik
Posts: 1589
Joined: Thu Aug 12, 2010 3:43 am

Re: New SNES game in development: Furry RPG (working title)

Post by Sik »

byuu wrote:It seems so obvious, but I've seen fan translations that prided themselves on packing everything into unexpanded ROMs, like some sort of demoscene challenge.
In the case of SNES games, banking could have made it painful to expand those ROMs, depending on how the game handled that.

Also I seriously can't believe there isn't a feasible way to do this when many other games probably did it without a ton of precalculated tables (possibly precalculated operations, but not the full thing). Heck, how did F-Zero do it? (and F-Zero isn't using any coprocessors). Because I can't imagine the fully precalculated table method scaling well in the long term.
lidnariq
Posts: 11429
Joined: Sun Apr 13, 2008 11:12 am

Re: New SNES game in development: Furry RPG (working title)

Post by lidnariq »

The tables (having looked inside the ROM) really look like there should be some simple math to convert each table from six 224×128 arrays of int16s to six (224+128)×1 arrays of int16s and six multiplies for each scanline... maybe can't be done in vblank, but caching the current angle and the adjacent ones should be doable. In fact, adding the extra dimension of altitude might require it...

On the other hand, you can get new 5V DIP EEPROMs up to 512 KiB, and new 5V TSOP/BGA EEPROMs up to 2 MiB, all for roughly the same price, so ... I really doubt it's worth caring yet.
93143
Posts: 1715
Joined: Fri Jul 04, 2014 9:31 pm

Re: New SNES game in development: Furry RPG (working title)

Post by 93143 »

Why does the calculation have to fit in VBlank?
User avatar
Ramsis
Posts: 341
Joined: Sun Jul 01, 2012 6:44 am
Location: Lion's den :3
Contact:

Re: New SNES game in development: Furry RPG (working title)

Post by Ramsis »

byuu wrote:Very clever idea to pre-compute the values for mode 7 rotation! :D
Thanks! :) And I agree about the sometimes pointless efforts to save ROM space.
Sik wrote:Also I seriously can't believe there isn't a feasible way to do this
Belief is one thing. Research, coding, and finally having stuff work is another. :P
Sik wrote:Because I can't imagine the fully precalculated table method scaling well in the long term.
Pun intended? :lol: Anyway, sorry, but I don't see your point.
93143 wrote:Why does the calculation have to fit in VBlank?
You need to do 16×8 bit signed math, so you are restricted to PPU ports $211B/$211C and $2134-$2136 for your calculations.

From nocash's Fullsnes on these:
The registers are also used for rotation/scaling effects in BG Mode 7. In BG Mode 0-6 they can be used freely for multiplications. In Mode 7 they are usable ONLY during V-Blank and Forced-Blank (during the Mode 7 Drawing & H-Blank periods, they return garbage in MPYL/MPYM/MPYH, and of course writing math-parameters to M7A/M7B would also mess-up the display).
I can confirm that this is true: In an earlier build, I had a V-IRQ fire after each scanline to calculate Mode 7 parameters for the next one, and quickly set the ports accordingly. Turned out there wasn't enough time in Hblank to calculate and set all four parameters, but even when I reduced it to compute and set only the two scaling ports, the display was no more than a complete pixel mess. :wink:
Some of my projects:
Furry RPG!
Unofficial SNES PowerPak firmware
(See my GitHub profile for more)
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: New SNES game in development: Furry RPG (working title)

Post by tepples »

byuu wrote:No sense making the game suffer, just to pretend like it's the mid-'90s when ROM was expensive.
Last time I checked, really big parallel 8-bit 5.0 V ROM was still expensive. This is why you get 27C322 multiplexer mods, TSOP adapters, level shifters, and the like. If you're translating a game that was already 32 Mbit, ExHiROM donors were hard to find, and people might not have taken the availability of 64 Mbit ExHiROM boards from infiniteneslives.com into account. Or you might be making an original game that fits in the 262144 byte limit listed in the rules of a competition that seeks to produce a collaborative multicart.
Post Reply