Author Topic: Sonic Z-Treme  (Read 24300 times)

LackofTrack

  • Newbie
  • *
  • Posts: 25
  • Karma: +6/-0
    • View Profile
Re: Sonic Z-Treme
« Reply #195 on: April 06, 2018, 12:38:22 am »
Burning Rangers uses ADX audio which is able to play multiple tracks at once. How many I don't know.
Looking at the files it seems most of the music in BR is definitely not "Redbook Audio" quality. Most of them are only 22500hz which is also the sample rate for speech used in the game.
The sample rate's probably low to reduce the CPU workload. There are however some 44000hz (RedBook) songs in there. They seem to be only used for non CPU intensive areas (Menus, Title screen, etc).

Thanks.
But if anyone wants to do it, it would be more than welcome for the whole community!
I need to finish the model converter I promised and continue working on the engine for a long overdue update.

Edit : Just added an image of PCM-ADPCM CPU overhead. Note that playing small sounds from memory is less expensive since you don't need to transfer data from the CD, but it still requires DMA and hogs the B-Bus.

I know this table data. :)

But I have a doubt. The overhead are for 1x SH2, for 2x. For the M68000? For all?

And more. The formula use it to calculate this value % is this: R = (100 X Ttask) / Tplay

Whit this, really not know, which CPU refer, or quantity of cycles used for DMA transfers or decompress the ADPCM data... And another doubt is, use it DMA transfers via SCU or directly SH2 to 68EC000 or SCSP. Or both.


Last. ADX form CRI, is possible better implementation of ADPCM for SS. Burning Rangers or Deep Fear, play BGM all time, and use it also for speech or dialogues. I don’t know if is possible play more than one stream or more, play directly from RAM and mix "like" PSX. I cant find the SS library functions form ADX in the web.

Greetings!

Corvusd is definitely right. The data chart doesn't really do a good job at explaining what's happening to what.
Although I assume when it refers to CPU overhead it refers to the M68000. This is just a guess though.

XL2

  • Sr. Member
  • ****
  • Posts: 341
  • Karma: +72/-1
    • View Profile
Re: Sonic Z-Treme
« Reply #196 on: April 06, 2018, 04:27:30 am »
The overhead is, I guess, for the main SH2, since it get decompressed by the SH2, then it's no different from uncompressed audio once it's transfered to the audio RAM.
It could be that the SBL library isn't super efficient, but even for uncompressed audio it's still expensive to use PCM (even if it's "just" 5%.
And more importantly it hogs the B bus, which is the same bus used for the vdp1 and vdp2.
For the DMA, it's always SCU DMA on the b bus.

CD audio goes straight to the DAC, so it doesn't consume cpu power (the SH1 can't be used for anything else than loading). It's the easiest option.

Then sequence audio is great as well, you have the SCSP and the M6800 just for doing that, it has it's own RAM, it can playback PCM data (from its own memory), so it doesn't consume cpu power except for transfering the play commands. It's a bit tricky to use, but for fx sounds it's a no brainer.

PCM audio from CD is good to play voices or play music while loading data, but it should be avoided as much as possible.

PCM audio from memory is easy to use and convenient for that, but it really should be avoided.

I don't know if it's possible to keep data in the CD buffer, so that you could store 512 KB of PCM data in that RAM, but it would be a good option (if possible) to at least save some main RAM if you have to use PCM memory playback.

I would really like to use MIDI audio as it's the more flexible option and keep the CD available, but it's also the hardest to use.

EDIT : The program I mentionned which converts sequences to MIDI. Now we need to figure out how to do the other way around!
https://github.com/mistydemeo/seq2mid/find/master?q=
« Last Edit: April 06, 2018, 04:41:18 am by XL2 »

corvusd

  • Jr. Member
  • **
  • Posts: 81
  • Karma: +8/-0
    • View Profile
    • Personal Web Portfolio
Re: Sonic Z-Treme
« Reply #197 on: April 07, 2018, 11:29:08 am »
Hello community!

[EDIT] For Overhead in sound stuff, From: ST-166-R4-012395
Quote
Overhead During Data Transfer

Since the PCM playback slot is fixed at 44.1 KHz, 1 sample is played back every 22.68 μs from the start of playback. Therefore when Vint is used, 735 samples (16,666 μs ÷  2.68μs) need to be rewritten (transferred) every 16 ms for one stream playback channel.

During DMA burst writes:
1 word transfer = 4 clock cycles (1 clock cycle = 35 ns)
Assuming 1 word transfer = 6 clock cycles to allow a margin of safety, then 6 clock cycles x 735 words = 4410 clock cycles (= 154.35 μs).
The SH2 requires approximately 154 μs to transfer 735 words (1,470 bytes).


However, if other sounds are being generated, or if the DSP is being used, the sound chip can only access the sound memory 20% to 30% of the time per one sound chip cycle (22 μs). This requires extra wait time, and since only 16 words can be transferred in one cycle (22 μs) of the sound chip, about 1 ms is required to transfer 735 words.

The 735 samples referred to by the equation above is for mono playback at 44.1 KHz. Overhead can be reduced to half if playback at 20 KHz is acceptable (equivalent to 368 samples).

When using DMA, avoid long, continuous transfers so that the sound CPU can operate. The sound CPU cannot operate during DMAs if data is transferred continuously.

For the ADPCM by CRI, the only stuff that exist in the web is this links:
https://wiki.multimedia.cx/index.php/CRI_ADX_file
https://wiki.multimedia.cx/index.php/CRI_ADX_ADPCM
https://en.wikipedia.org/wiki/ADX_(file_format)

If you see the principal part of code in examples decoder:
Code: [Select]
#define M_PI acos(-1.0)
 double a, b, c;
 a = sqrt(2.0) - cos(2.0 * M_PI * ((double)adx_header->highpass_frequency / adx_header->sample_rate));
 b = sqrt(2.0) - 1.0;
 c = (a - sqrt((a + b) * (a - b))) / b; //(a+b)*(a-b) = a*a-b*b, however the simpler formula loses accuracy in floating point
 
 // double coefficient[2];
 coefficient[0] = c * 2.0;
 coefficient[1] = -(c * c);

Are a lot the operations, that the SCU can be process really well. The theory that Burning Rangers uses the SCU-DSP is give a push, that whit this need it the SCU can be process this data.

Greetings!
« Last Edit: April 07, 2018, 02:03:16 pm by corvusd »
David Gámiz Jiménez

XL2

  • Sr. Member
  • ****
  • Posts: 341
  • Karma: +72/-1
    • View Profile
Re: Sonic Z-Treme
« Reply #198 on: April 07, 2018, 12:02:21 pm »
Good idea for the SCU DSP.
If that's what Burning Ranger does, the entire code could be retrieved with Yabause.
But I thought they used it for lightning.
You can see when there is voice audio playback if the SCU DSP gets a program change.

corvusd

  • Jr. Member
  • **
  • Posts: 81
  • Karma: +8/-0
    • View Profile
    • Personal Web Portfolio
Re: Sonic Z-Treme
« Reply #199 on: April 07, 2018, 02:00:27 pm »
Well, I will try.

But I think that SCU-DSP can be process the two task in parallel. In my analysis table data you can see that are free memory and registers for that.

 ;)
David Gámiz Jiménez

XL2

  • Sr. Member
  • ****
  • Posts: 341
  • Karma: +72/-1
    • View Profile
Re: Sonic Z-Treme
« Reply #200 on: April 07, 2018, 02:49:50 pm »
You can issue program change commands, but I highly doubt it can process programs in parallel.

corvusd

  • Jr. Member
  • **
  • Posts: 81
  • Karma: +8/-0
    • View Profile
    • Personal Web Portfolio
Re: Sonic Z-Treme
« Reply #201 on: April 07, 2018, 03:13:06 pm »
You can issue program change commands, but I highly doubt it can process programs in parallel.

[EDIT] Well, is a fact the SCU-DSP are capable to process at 6 process per cycle. A program well design and using concrete types of RAM and DMA, could be possible make two parallel task.
« Last Edit: April 07, 2018, 10:28:59 pm by corvusd »
David Gámiz Jiménez

XL2

  • Sr. Member
  • ****
  • Posts: 341
  • Karma: +72/-1
    • View Profile
Re: Sonic Z-Treme
« Reply #202 on: April 10, 2018, 11:55:57 pm »
Haha, just using the SCU DSP would be a great start!
It has really limited memory, so it can't do that much.

Update on the project, I've now moved from 16 colors Lookup tables to 16 color bank (CRAM). That means no more gouraud shading...but I will be able to use transparency, which is better.
I'm not sure if you can do color calculation over the back screen, but if you want the same effect as depth gouraud shading you can just put a black background and use the VDP2 transparency to have the same effect.
It also offloads work from the VDP1.
The only issue is that the color RAM is really limited, but so far it seems all the maps I tested got everything within about 1000 colors, and if it can't fit in CRAM I put a "safety" measure where it just uses CLUT.

I haven't made much progress on Sonic Z-Treme yet, so the game is currently improving only on a technical level, but I hope to be able to integrate everything in the game soon.


corvusd

  • Jr. Member
  • **
  • Posts: 81
  • Karma: +8/-0
    • View Profile
    • Personal Web Portfolio
Re: Sonic Z-Treme
« Reply #203 on: April 11, 2018, 09:10:18 am »
Haha, just using the SCU DSP would be a great start!
It has really limited memory, so it can't do that much.

Update on the project, I've now moved from 16 colors Lookup tables to 16 color bank (CRAM). That means no more gouraud shading...but I will be able to use transparency, which is better.
I'm not sure if you can do color calculation over the back screen, but if you want the same effect as depth gouraud shading you can just put a black background and use the VDP2 transparency to have the same effect.
It also offloads work from the VDP1.
The only issue is that the color RAM is really limited, but so far it seems all the maps I tested got everything within about 1000 colors, and if it can't fit in CRAM I put a "safety" measure where it just uses CLUT.

I haven't made much progress on Sonic Z-Treme yet, so the game is currently improving only on a technical level, but I hope to be able to integrate everything in the game soon.

You not said that is possible use gouraud whit palleted color like chrome demo? You are check? I can't because I don't  have compiled and mastered iso the demo, and I don't know make it, for analysis in Yabause for see how work it.

In other hand, you can make also liike sonic R. Use gouraud whit lut from near clip to medium distance and change to whitout gouraud whit paleted to make fog fade to foreground vdp2.

Greetings!
David Gámiz Jiménez

XL2

  • Sr. Member
  • ****
  • Posts: 341
  • Karma: +72/-1
    • View Profile
Re: Sonic Z-Treme
« Reply #204 on: April 11, 2018, 03:08:26 pm »
The way they did it in the Chrome demo is that they use a palette of different luminances.
The VDP1 does the gouraud shading processing, but when it's using paletted sprites it just offsets an index instead of the actual RGB color.
So the result is that by using only red gouraud processing you will exactly offset +- 1 to 16 in each direction for each verticle.
You could do it with 16 colors banks, but then you could only do it with one color and only 7-8 different luminances, else it will overflow.

I could do like Sonic R, but I could also just put static lightning on the textures.
The issue with Sonic R is that you have gouraud on quads close to the camera, then you lose that luminance as it starts disappearing.
I have enough VRAM left to generate other textures for luminance.
From the videos of Saturn Shenmue, it seems to be what they did.
Speaking of Saturn Shenmue video, I noticed lots of triangles in the background (they get clipped out). So I'm not sure if it's running on a real Saturn or if it's using software rendering for backgrounds.

XL2

  • Sr. Member
  • ****
  • Posts: 341
  • Karma: +72/-1
    • View Profile
Re: Sonic Z-Treme
« Reply #205 on: April 12, 2018, 03:12:18 pm »
I just did a small video (it's not public as there isn't much to show) for the split screen mode and the removal of gouraud shading/use of CRAM sprites.

https://youtu.be/jHaXoe9lfMc

itsstillthinking1999

  • Jr. Member
  • **
  • Posts: 84
  • Karma: +5/-0
    • View Profile
Re: Sonic Z-Treme
« Reply #206 on: April 13, 2018, 09:12:10 pm »
Love it! Models kinda remind me of Wolf from VF

corvusd

  • Jr. Member
  • **
  • Posts: 81
  • Karma: +8/-0
    • View Profile
    • Personal Web Portfolio
Re: Sonic Z-Treme
« Reply #207 on: April 14, 2018, 10:52:32 am »
I just did a small video (it's not public as there isn't much to show) for the split screen mode and the removal of gouraud shading/use of CRAM sprites.

https://youtu.be/jHaXoe9lfMc

Really nice improvements!! Congratulations.

We can see source lighting in models no? Yo are calculate level of luminance or brightness, by VDP1 CC or change color palette for this face??

For calculate lighting use SH2 or SCU-DSP?

And finally. You can apply this lighting to scenery faces?

If you can all this without use CC, is possible you can use Full HiRes mode in VDP1 and VDP2.

Greetings!
« Last Edit: April 14, 2018, 02:48:07 pm by corvusd »
David Gámiz Jiménez

XL2

  • Sr. Member
  • ****
  • Posts: 341
  • Karma: +72/-1
    • View Profile
Re: Sonic Z-Treme
« Reply #208 on: April 14, 2018, 05:24:09 pm »
The flat shaded quads in SGL can use flat lightning both in RGB and palette format.
I'm not using the SCU DSP yet, so it's SH2 only.
I can't do realtime light with color bank sprites, but I'm now doing like in Sonic R and Bulk Slash.

I can't use the high res mode, it's super hard to setup, so I don't want to waste time on it.

corvusd

  • Jr. Member
  • **
  • Posts: 81
  • Karma: +8/-0
    • View Profile
    • Personal Web Portfolio
Re: Sonic Z-Treme
« Reply #209 on: April 14, 2018, 10:42:01 pm »
The flat shaded quads in SGL can use flat lightning both in RGB and palette format.
Perfect! :D

I'm not using the SCU DSP yet, so it's SH2 only.
Not mention SCU in the next two years. I promise XD

I can't do realtime light with color bank sprites, but I'm now doing like in Sonic R and Bulk Slash.
Why not? What refer exatly that doing like this games?

I can't use the high res mode, it's super hard to setup, so I don't want to waste time on it.
It is possible, the requirements are many and both VDPs. It is normal that you choose not to get involved in this. But is very attractive, have it full resolution SS in a Sonic game. :)
David Gámiz Jiménez

 

Sitemap 1 2 3 4 5 6 7 8 9 10 
SMF spam blocked by CleanTalk