Welcome!

Final Burn Neo => FBN Development => Topic started by: el_rika on May 17, 2022, 04:50:15 PM

Title: Cv1000 slowdown accuracy tweaks
Post by: el_rika on May 17, 2022, 04:50:15 PM
(this post is a bit lenghty, so skip to the numbers for instant fun)

So, for shmup fans that love last gen Cave shmups, i want to share my 2 years long endeavour of making cv1000 emulation as close to pcb speeds, in terms of slowdown, as possible.
These games are fantastic and they also have more slowdown than one might probably think  :smilie: (especially when played for score).
We are talking single digit framerates and hud/ship/bullets completely vanishing when things get out of hand!

The games/modes that were possible to work on through observation and reproduction,  are those with more or less fixed rank, or with a more linear approach to rank management (thankfully most of them).
Some modes, like Futari original, are so wildly different at low and high rank, that they're nearly impossible to tackle, without owning the pcb.

Another issue, regarding current state of emulation vs how accurate it can be tweaked (via only CPU speed and Blitter Delay), is that a certain ship's shot/laser blending mode (Palm Abnormal in Futari) will simply mess with the overall blitter settings, so that particular ship's numbers can not be improved, unless:
The dev Trap15, suggested some 10 years ago that different blitter sliders for different blending modes would be an improvement, and that would certainly fix a few issues, like Palm Abnormal and a couple of others (like the, atm, unavoidable slowdown in the menus in some games, too much slowdown in certain areas ex. the first pattern of boss No3 in Futari BL God mode).

All in all however, the current state of the emulation is actually pretty good and with the CPU and Blitter combo, the slowdown accuracy that can be achieved is very good, and in many instances better than the 360 ports (which are great ports).

In emulation, some elements are CPU related (mainly bullets) and their speed responds first to CPU underclock, while others (effects, explosions, lasers, overlaping effects) are Blitter affected first.

Concrete example:
Mushihimesama's lvl1 boss 1st pattern in Ultra is CPU bound, and once you fine-tune it for just that pattern, you have your CPU value for the rest of the game, for a pretty good accuracy. However, satisfactory Blitter value was only decided at the stage 5's boss in Ultra, as those patterns are Blitter dependant.
Similar story in Futari BL God mode.

The main logic was to find a few elements for each scenario in pcb, recreate that scenarios in emulation and fine-tune them to be as close as possible. Once a few key moments (ex. boss patterns, stationary enemy bullet swarms) were reproduced, most of the rest of the game would fall into place nicely, though some moments would slow down a tad more in emulation, it's usually in the single digits %.

Some games/modes like Futari Ultra or Pink Sweets (damn that game) are stil wip. Maybe thanks to dink's incredible work on the driver, i'll make faster progress in those.

A quick note:
All these tests were made using ume2014, based on mame 0.155. The FBNeo driver is also based on mame 0.155 so everything should be identical in terms of CPU and Blitter (from the little i tested since the driver was released last week, all is good).

Some games need different values for different modes/ships. What works in Ultra, is not good for Maniac. Also Deathsmiles characters have so different shot/laser effects, all needing slightly different values.

Ok, so the values (CPU/Blitter):

(Edit: added actual % value for CPU. The math is: game mhz x 100 /102.4)

Daifukkatsu:
43.62 (42.6%) / 59

Espgaluda 2:
49.76 (48.6%) / 62

Daifukkatsu Black Label:
42.4% / 57 (All ships Strong)
41.4% / 57 (All ships Bomb/Power)

Mushihimesama:
42.3 (41.6%) / 57 (ultra)
48.02 (46.8 %) / 57 (maniac)

Mushihimesama Futari:
47.7 (46.6%) / 57 (Reco N maniac)
48.5 (47.3%) / 56 (Palm N maniac)
42.5 (41.6%) / 55 (Palm Ab maniac)
40.6% / 56 (RecoN + Palm Ab Ultra)

Futari Black Label:
45.26 (44.2%) / 54 (Reco maniac)
46.08 (45.0%) / 56 (Palm maniac)
44.54 (43.5%) / 56 (Reco god)
44.54 (43.5%) / 56 (Palm god)


Deathsmiles:
52.53 (51.3%) / 59 (Windia, Casper)
53.04 (51.8%) / 58 (Follet)
53.35 (52.1%) / 57 (Rosa)

Deathsmiles MBL:
53.35 (52.1%) / 54 (Windia)
53.04 (51.8%) / 56 (Follet)
52.53 (51.3%) / 58 (Casper)
52.53 (51.3%) / 58 (Sakura)
53.35 (52.1%) / 55 (Rosa)

Ibara:
49.04 (47.9%) / 53

Ibara Black Label:
49.04 (47.9%) / 53

Akai Katana:
48.32 (47.2%) / 63 (C ship)
47.00 (45.9%) / 68 (B ship)
46.08 (45%) / 72 (A ship)

Muchi Muchi Pork:
53.55 (52.3%) / 53

Sdoj:
43.0 (42.0%) / 59 (Expert all)
44.3 (43.2%) / 57 (Shot/Laser all)


In games that have power-ups i sometimes use infinite lives, as losing a power-up or continuing with full power earlier than normal, messes with the slowdown. Never used God mode...not fair ;)

Here are quite a few vids i made (some are good quality, some potato quality as i made so many of them i kept running out of memory):

https://youtu.be/qf75S_iG7aY
https://vimeo.com/476652165/description

Thanks so much dink, barbu and everyone involved in bringing these woderfully addictive games to FBNeo!  :biggrin:

Important: when using the old blitter method (manual blitter), be sure to set Clip Margin (test) - off.

edit: as i further analyse and test the accuracy, i will post slight modification to some values.
Title: Re: Cv1000 slowdown accuracy tweaks
Post by: dink on May 17, 2022, 08:27:38 PM
Hi el_rika, Thanks for your help with testing, I admire your dedication to these games :) 

Sometime I'll explore some sort of different rates based on blit type, as trap15 mentioned.  and also explore in the blit dma (copy) mode - which is totally ignored by the blitter at this time.  I think that once this is figured out and implemented properly all games will use the same setting which share the same blitter version.  Another thing I noticed is that the sh3 dma transfers don't eat any cycles, this could possibly be another point of slowdown that isn't implemented which would make a difference.

best regards,
- dink
Title: Re: Cv1000 slowdown accuracy tweaks
Post by: el_rika on May 17, 2022, 11:56:15 PM
Great ideas dink!

If anyone is dedicated enough to make things work, that person is definitely you  :biggrin:
Title: Re: Cv1000 slowdown accuracy tweaks
Post by: Harpuia on May 27, 2022, 02:37:07 PM
How do you see the exact CPU values, rather than just the percentage? Using FBneo on Retroarch windows
Title: Re: Cv1000 slowdown accuracy tweaks
Post by: barbudreadmon on May 28, 2022, 03:06:31 AM
How do you see the exact CPU values, rather than just the percentage? Using FBneo on Retroarch windows

You mean how to set the decimals ? They are part of the dipswitches.
Title: Re: Cv1000 slowdown accuracy tweaks
Post by: el_rika on May 28, 2022, 04:02:59 AM
How do you see the exact CPU values, rather than just the percentage? Using FBneo on Retroarch windows

This is a good question that needs a bit of clarification.
The numbers i posted are the exact CPU numbers, as mame shows them.
In FBNeo, you have to round that number, from say: 41.77 to 41.8
Title: Re: Cv1000 slowdown accuracy tweaks
Post by: dink on May 28, 2022, 09:06:49 AM
Simple math:

percent * 102400000 / 100

56 * 102400000 / 100  =  56,320,000hz

best regards,
- dink
Title: Re: Cv1000 slowdown accuracy tweaks
Post by: el_rika on June 20, 2022, 02:44:47 PM
Added in the original post, the actual % that the CPU must be set at, so that it matches the actual mhz value from mame.
Title: Re: Cv1000 slowdown accuracy tweaks
Post by: PrincessMonaco on August 29, 2022, 11:05:43 AM
So, someone walk me through this like I'm an idiot:

Ibara:
49.04 (47.9%) / 53

Does this mean that if I'm running through Retroarch, I go into Quick Menu>Options and set CPU speed to 47%, and then set [Dipswitch]el_rika's CPU Rate tenth-percent adjust to .9?
Title: Re: Cv1000 slowdown accuracy tweaks
Post by: el_rika on August 29, 2022, 12:11:16 PM
So, someone walk me through this like I'm an idiot:

Does this mean that if I'm running through Retroarch, I go into Quick Menu>Options and set CPU speed to 47%, and then set [Dipswitch]el_rika's CPU Rate tenth-percent adjust to .9?

Precisely
Title: Re: Cv1000 slowdown accuracy tweaks
Post by: PrincessMonaco on August 29, 2022, 02:12:11 PM
Yay!
Title: Re: Cv1000 slowdown accuracy tweaks
Post by: keikojoe on September 29, 2022, 09:29:42 AM
HI el-rika is it possible to apply these settings on Finalburn Neo or do you need to use fbn on retroarch? Thankyou
Title: Re: Cv1000 slowdown accuracy tweaks
Post by: el_rika on September 29, 2022, 11:20:11 PM
HI el-rika is it possible to apply these settings on Finalburn Neo or do you need to use fbn on retroarch? Thankyou

Yes, of course.
Title: Re: Cv1000 slowdown accuracy tweaks
Post by: skykid on November 07, 2022, 02:23:28 AM
Super sorry to revive this, but I've been tinkering with the Pi4B and I'd love to be able to tweak CAVE games accordingly to improve their accuracy. But I'm not quite sure I understand how to use the info in the OP and was hoping someone could help me.

I reached this page from a post that specifically targeted the Pi4, but said the info was out of date and to come here. I'm not sure how to apply the settings per game as specified. I'm using FBneo for everything, and when I go into the RA menu -> options -> CPU clock, it only lets me specify in increments of 5%s (so 100/105/110 etc). and not the decimals listed.

Additionally, I don't know what the second numbers are for or how to set them:

"Mushihimesama:
41.98 (41.0%) / 57 (ultra)
48.02 (46.8 %) / 57 (maniac)"

In this case, '57'.

I don't see any info for Donpachi/DDP/DDP DOJ/DOJ BL etc, so I'm assuming they don't need adjustment?

Thanks for the help!
Title: Re: Cv1000 slowdown accuracy tweaks
Post by: barbudreadmon on November 07, 2022, 02:48:14 AM
it only lets me specify in increments of 5%s (so 100/105/110 etc). and not the decimals listed.

You might be using some very old version of the core then, recent versions allow fine tuning from 25 to 55.
The decimals need to be set in dips.
The last number (so the 57 from your example) is the blitter delay (from dips too).
Title: Re: Cv1000 slowdown accuracy tweaks
Post by: skykid on November 07, 2022, 03:19:49 AM
You might be using some very old version of the core then, recent versions allow fine tuning from 25 to 55.
The decimals need to be set in dips.
The last number (so the 57 from your example) is the blitter delay (from dips too).

Thanks for the fast reply. That's weird, because I'm using Batocera as a frontend and it's the latest Pi4 image (Batocera 35) and FBneo was part of the package. The FBneo core version is v1.0.0.03 3cbdf40. Is it possible to update the core through RA without losing my current settings (as I've done a fair amount of configuring)?

And sorry for being an idiot. I think I understand tabbing to blitter delay using a keyboard, but what are 'dips' exactly? Not Dipswitches right?
Title: Re: Cv1000 slowdown accuracy tweaks
Post by: barbudreadmon on November 07, 2022, 06:28:01 AM
v1.0.0.03 3cbdf40

That version is from july and should include both the fine tuning of cpu clock below 55 and the decimals + blit delay through dips, however i can't guarantee batocera is using our unmodified source code.

Dips = Dipswitches indeed.
Title: Re: Cv1000 slowdown accuracy tweaks
Post by: skykid on November 07, 2022, 09:27:37 AM
That version is from july and should include both the fine tuning of cpu clock below 55 and the decimals + blit delay through dips, however i can't guarantee batocera is using our unmodified source code.

Dips = Dipswitches indeed.

EDIT: Ok ignore that. I think I understand how it works now. The decimal point is actually in options > dip switches > el_rika?s tenth percent adjust. So to get 42.6% in Daiifukkatsu I set CPU overclock to 42% and then the tenth percent adjust to .6 for 42.6%, then the blitter delay to 59.

Does that sound right?
Title: Re: Cv1000 slowdown accuracy tweaks
Post by: dink on November 07, 2022, 10:02:12 AM
The cpu overclock decimal section is in the pcb's dip's section, because fbneo doesn't have a way to change the cpu clock in decimals.  If you think that's frustrating, try changing the cpu decimals in mame standalone ui version, it took me 3 days and several explanations from el_rika before I got it right.


best regards,
- dink
Title: Re: Cv1000 slowdown accuracy tweaks
Post by: skykid on November 07, 2022, 10:06:43 AM
The cpu overclock decimal section is in the pcb's dip's section, because fbneo doesn't have a way to change the cpu clock in decimals.  If you think that's frustrating, try changing the cpu decimals in mame standalone ui version, it took me 3 days and several explanations from el_rika before I got it right.


best regards,
- dink

I trust you on that. :)

So the way I?m doing it in my previous post is correct then?
Title: Re: Cv1000 slowdown accuracy tweaks
Post by: barbudreadmon on November 07, 2022, 10:49:00 AM
So the way I'm doing it in my previous post is correct then?

Yes :)
Title: Re: Cv1000 slowdown accuracy tweaks
Post by: skykid on November 07, 2022, 10:56:02 AM
Amazing, thanks so much to el-rika and dink for all your hard work, I can already see the difference.

As an aside (ish) since there are no settings for CAVE PGM titles, should I assume the likes of Ketsui are fine at defaults? Because the CPU setting defaults to 100% and sometimes I feel like it might be running a tad too fast. Could be my imagination though.
Title: Re: Cv1000 slowdown accuracy tweaks
Post by: barbudreadmon on February 18, 2023, 02:22:43 AM
It seems there are some interesting news about cv1k blitter delay : https://github.com/mamedev/mame/pull/10849
Title: Re: Cv1000 slowdown accuracy tweaks
Post by: dink on February 18, 2023, 09:36:11 AM
I've been keeping an eye on it :)
Title: Re: Cv1000 slowdown accuracy tweaks
Post by: Tatsuya79 on April 02, 2023, 06:16:20 PM
It's been merged.
Title: Re: Cv1000 slowdown accuracy tweaks
Post by: dink on April 16, 2023, 09:54:42 AM
I havn't forgotten - just certain things preventing me from doing anything at this time.

best regards,
- dink
Title: Re: Cv1000 slowdown accuracy tweaks
Post by: dink on May 16, 2023, 09:17:03 AM
buffi's new blitter code is in, and the old in-accurate method is still available via a DIP selection for testing (Blitter Timing: Accurate or not).

best regards,
- dink
Title: Re: Cv1000 slowdown accuracy tweaks
Post by: SirHenrythe5th on May 17, 2023, 02:17:58 AM
Awesome!, can?t wait to update and test the Cave-SHMUPs in the evenning.
Thanks a lot!
Title: Re: Cv1000 slowdown accuracy tweaks
Post by: Tatsuya79 on May 17, 2023, 01:07:28 PM
Thanks!

I played mushi futari black and saidaioujou, it had slowdowns.   :biggrin:
I'm not sure how accurate it is but seems close to real arcade gameplay I compared it too (with the cpu at 50%).
Title: Re: Cv1000 slowdown accuracy tweaks
Post by: el_rika on July 15, 2023, 08:13:37 AM
Fine ​tunned some values (Mushihimesama Ultra, Daifukkatsu BL) and finally properly analysed Futari 1.5 Ultra for the past month or so. This is probably top 5 hardest games ever made.

Actual pcb footage of Futari Ultra is hard to find, but with some help, i managed to find a couple of amazing superplays with Reco Normal and Palm Abnormal. The slowdown is 'very' close to pcb now. Try it at your own risk :)