[Reverse engineering] DDP Daioujou Black Label

This is the main shmups forum. Chat about shmups in here - keep it on-topic please!
User avatar
BarfHappy
Posts: 160
Joined: Fri Jan 14, 2011 11:20 pm
Location: In a CAVE

Re: [Reverse engineering] DDP Daioujou Black Label

Post by BarfHappy »

Udderdude wrote:Is there any information on bullet hitbox sizes, or if the bullets that change sizes during their animation also change their hitboxes?
In CAVE engine standard implementation (excluding esp galuda series), enemy bullets are only checked for they center, even big ones, and so only once every 2 frames. So they can go right through you when you move. Don t bother escaping lines of large bullets, because they are only 6-8 dots to pass, imagine that each bullet is just a point at their center, you ll fare much better at the games xD .
Saws and other special bullets are made as enemies and are checked like enemies (and spawned like ones).

And how to i know so much ? ahaha long story. It dates way back to ibara PS2. And i dug much more when i got the full AC code thanks to mame.

Anyway, many question on the engine i should be able to answer, i spent weeks in mandays on cave engine. xD
st5ex0boss/st5ex0boss.cpp, st5ex0boss/st5ex0b_appear.cpp, st5ex0boss/st5ex0b_disp.cpp, st5ex0boss/st5ex0b_move.cpp, st5ex0boss/st5ex0b_anime.cpp, st5ex0boss/st5ex0b_check.cpp

And there shall be TTLB... <3 Muwohohoho
User avatar
rtw
Posts: 1960
Joined: Wed Jan 26, 2005 6:46 pm
Location: Norway
Contact:

Re: [Reverse engineering] DDP Daioujou Black Label

Post by rtw »

austere wrote:Yeah sure. The main loop of DOJ does a few things:

- update game counters
- update inputs/input deltas
- a mystery update routine
- a sprite related routine I don't fully understand
- slowdown routine (wait for vblank routine completion basically)
- run all 'slots'.

The slots are basically routines with their own memory space and called on with fixed parameters. The game adds slot 8 before running the loop. In-game the only slot change happens during the score tally screen as far as I can tell.
So what you saying is that the slots are really function pointers in an array which are setup by the main code and executed ?

@BarfHappy
Could you please explain the bullet slot system in a bit more detail ?

All this is very interesting :D
http://world-of-arcades.net
The future of ST-V rests upon our work and your work
User avatar
austere
Posts: 680
Joined: Mon Mar 22, 2010 10:50 am
Location: USA

Re: [Reverse engineering] DDP Daioujou Black Label

Post by austere »

Yeah kind of, actually "function pointers" are obviously very common in 68k code. The reason why I call them slots is because you can reorder them, queue up other tasks from within them and they'll still have their own independent area in memory. It's really a neat system, though you have to be careful with the upper address registers.
<RegalSin> It does not matter, which programming language you use, you will be up your neck in math.
User avatar
Frederik
Posts: 2554
Joined: Sun Nov 06, 2005 7:14 pm

Re: [Reverse engineering] DDP Daioujou Black Label

Post by Frederik »

BarfHappy wrote: In CAVE engine standard implementation (excluding esp galuda series), enemy bullets are only checked for they center, even big ones, and so only once every 2 frames. So they can go right through you when you move. Don t bother escaping lines of large bullets, because they are only 6-8 dots to pass, imagine that each bullet is just a point at their center, you ll fare much better at the games xD .
So basically if the hitboxes of the bullets were visible it would look like this?

Image
THE BULLETS ARE NOW DIAMONDS!
User avatar
BarfHappy
Posts: 160
Joined: Fri Jan 14, 2011 11:20 pm
Location: In a CAVE

Re: [Reverse engineering] DDP Daioujou Black Label

Post by BarfHappy »

Yup i can see the imagz now and yes that s it :p


rtw wrote: @BarfHappy
Could you please explain the bullet slot system in a bit more detail ?
All this is very interesting :D
I think you wonder how bullets work, there you go (that s all based on my memory of it i may be a little off depending on game implementations):
The bullets are all properly cleared at the start of a level. (zeroed for all but Y value which is FFed).
When an enemy fires a bullet, it creates a spawn entry which in turn translates to the copy of the master values from the bullet type table (in CPU area) to the definitive bullets entry in memory at the proper location (at the first available space).
It starts its life as a spawning bullet, which is in fact the plumet you can see when en ennemy fires some types of bullets. A plumet does not collide.
Luckily i have an old description table at hand here :p
The bullet has:
status byte (plumet, active, destroyed) with the 4th bit indicating if the bullet collides or not.
type byte
Y value (CAVE float,word, 1 byte for int value and 1byte for decimal value)
X value
Y conv. parameter, word, used to convert gamespace to screenspace iirc
X C.P
sprite offset, dword
sprite format, word
bullet cancel sprite offset end, dword
bullet cancel sprite to sprite max, dword
speed manipulation counter, byte
speed manipulation counter max, byte (0 for infinite)
byte: ?
1A
Y speed, cave float (updated from a precalc table for elyptic moves)
X speed, cave float (updated from a precalc table for elyptic moves)
pointer to the sprite frame handling
user counter byte
user counter max (0 for infinite) byte
entry trace A+B 2 words (i don't remember what it is used to diagnose sorryyyy, i just remember it is a slight alteration of the original speed reading)
user counter 2 byte
user counter 2 max byte
working value 1 byte
working value 1 byte
Initial Speed Y cave float
Initial Speed X cave float
Looping count A
Looping count B
user counter 3
user counter 3 max
user counter 4
user counter 4 max
bullet speed, cave float
0000

Aaanyway, once the creation is done, after exhausting the plummet animation, the bullet transforms into a real bullet, the 4th bit is flipped.
at each frame, some key positions are checked (Y value iirc) and if they are set, the number of bullets entries available increase accordingly.
At each frame, the bullet position (center) is checked against gameworld boundaries, if they are outside, the status is set to 0, the type to 0 and the Y position to FFFF.
at each frame if the bullet is set to be collision detected it is checked against the player collision box through successive testing (i put a description in the development part of the forum somewhere with the exact code), if collision happens, tough luck, you die.
at each frame the collision bit is flipped.
at each frame the sprite frame is changed, the change of frame and looping are handled by the routine at the pointer contained in the bullet structure.
The bullets Y and X positions are altered with the Y speed and X speed values. These values depending on the bullet type is either fixed or changing. When they are changing, their value is read from a table of Y+X speed entries. The various user counters are used to control the way speed values are read.

I don't know if that answers your question xD
Last edited by BarfHappy on Thu Mar 31, 2011 4:27 pm, edited 2 times in total.
st5ex0boss/st5ex0boss.cpp, st5ex0boss/st5ex0b_appear.cpp, st5ex0boss/st5ex0b_disp.cpp, st5ex0boss/st5ex0b_move.cpp, st5ex0boss/st5ex0b_anime.cpp, st5ex0boss/st5ex0b_check.cpp

And there shall be TTLB... <3 Muwohohoho
User avatar
Jockel
Posts: 3073
Joined: Tue May 20, 2008 5:15 pm
Location: Berlin, Germany
Contact:

Re: [Reverse engineering] DDP Daioujou Black Label

Post by Jockel »

Bullet spawns. Serious business.

(Honestly though, insane write-up!)
User avatar
Udderdude
Posts: 6338
Joined: Thu Feb 16, 2006 7:55 am
Location: Canada
Contact:

Re: [Reverse engineering] DDP Daioujou Black Label

Post by Udderdude »

This is starting to look like it belongs in Development .. (j/k)
User avatar
yosai
Posts: 274
Joined: Wed Jun 11, 2008 9:37 pm
Location: London

Re: [Reverse engineering] DDP Daioujou Black Label

Post by yosai »

Great work on the hacking! Some very useful information in there and thanks for sharing it. :D
Image
User avatar
austere
Posts: 680
Joined: Mon Mar 22, 2010 10:50 am
Location: USA

Re: [Reverse engineering] DDP Daioujou Black Label

Post by austere »

Cool shit BarfHappy. I almost don't want to read it in detail because I'll be dragged back into it again (and I'm really behind on my studies)! I won't be able to help myself though.
<RegalSin> It does not matter, which programming language you use, you will be up your neck in math.
User avatar
rtw
Posts: 1960
Joined: Wed Jan 26, 2005 6:46 pm
Location: Norway
Contact:

Re: [Reverse engineering] DDP Daioujou Black Label

Post by rtw »

@BarfHappy, thank you very much for this detailed information :D

To recap:
A bullet is instantiated from a master type, initialized according to the current situation and then put on a runlist which is processed by a function (BulletProcessor) ?

When a bullet is no longer visible does the BulletProcessor remove it from the list or mark the slot as empty ?

Is this bullet algorithm used on the newer SH3 boards as well ?

I have heard that this bullet algorithm was first conceived at Toaplan. Has anyone had a look at Batsugun to see if it behaves in a similar fashion ?
http://world-of-arcades.net
The future of ST-V rests upon our work and your work
User avatar
BarfHappy
Posts: 160
Joined: Fri Jan 14, 2011 11:20 pm
Location: In a CAVE

Re: [Reverse engineering] DDP Daioujou Black Label

Post by BarfHappy »

Yep you got it. I had some fun changing bullets for others, give them faster speed (and changing enemies counters so they release more of them xD ). I had fun altering the levels playlists as well, but that s another story.

back to the bullets.
only the first 4 bytes are modified to deactivate a bullet slot, 0000 FFFF, the rest remains, the big cleanup only occurs at the beginning of a stage but that s not of a big use except debugging readability.

And yep they kept it the same throughout afaik, it is easy to struct a bullet entry rewriting to C so that it acts the same way.
At least for ibara/mushihime+f :) There s a bit more information in there, but the basics remain.

To be frank, I don't really know for deathsmiles, MMP, PS and DFK, i ll tell you more in a couple years when i can see their code :p
Esp Galudas are a different beast, i never studied them.

There was a picture in here somewhere, where in the background of a picture of some big shot (IKD perhaps, don t remember) we could see a portion of code from deathsmiles, and it was clear that the engine was not really overhauled xD

I would be surprised if the code came from toaplan, could you imagine, the same engine spanning from batsugun to DFK ?
I ll have a look at batsugun and see if indeed there are common chunks.
Last edited by BarfHappy on Fri Apr 01, 2011 12:35 pm, edited 1 time in total.
st5ex0boss/st5ex0boss.cpp, st5ex0boss/st5ex0b_appear.cpp, st5ex0boss/st5ex0b_disp.cpp, st5ex0boss/st5ex0b_move.cpp, st5ex0boss/st5ex0b_anime.cpp, st5ex0boss/st5ex0b_check.cpp

And there shall be TTLB... <3 Muwohohoho
User avatar
Despatche
Posts: 4292
Joined: Thu Dec 02, 2010 11:05 pm

Re: [Reverse engineering] DDP Daioujou Black Label

Post by Despatche »

It'd probably go back to Grind Stormer/V-V at least.
Rage Pro, Rage Fury, Rage MAXX!
User avatar
austere
Posts: 680
Joined: Mon Mar 22, 2010 10:50 am
Location: USA

Re: [Reverse engineering] DDP Daioujou Black Label

Post by austere »

Doubt it, DonPachi is probably quite different to DoDonPachi for example.
we could see a portion of code from deathsmiles, and it was clear that the engine was not really overhauled xD
Why overhaul perfection. ;)
<RegalSin> It does not matter, which programming language you use, you will be up your neck in math.
User avatar
BarfHappy
Posts: 160
Joined: Fri Jan 14, 2011 11:20 pm
Location: In a CAVE

Re: [Reverse engineering] DDP Daioujou Black Label

Post by BarfHappy »

OK i quickly checked batsugun, and quickly this IIIIIIIIIIISSSSSSSSSS a quite surprisingly similar beast in some aspect.

However, there is one thing to note, not for bullets... it uses the same header for active bullets, except the active and colliding bit are 3 and 1 instead of 4 and 2. but other wise bullets operation is much more rudimentary and quite different.

at first glance float operations and transformation from gamespace to screenspace seem to be comparable.
it uses the same level playlist system:
a table gives gives the appearance of ennemies:
frame, offset, type, move table entry
then the move table which is the offset into the motion description table
and finaly the motion description table
motion description is: Y appearance value; X appearance value; and the actual move coded in several bytes(depending on the enemy types the move structure is different).
enemies motion handling is similar, i have not yet checked the enemies structure to see the way they fire if it is counters based like cave engine.

so, suprisingly, the level setup is a cave-engine style. If you want my opinion, cave used toaplan level designer tool, i see no other explanation.
st5ex0boss/st5ex0boss.cpp, st5ex0boss/st5ex0b_appear.cpp, st5ex0boss/st5ex0b_disp.cpp, st5ex0boss/st5ex0b_move.cpp, st5ex0boss/st5ex0b_anime.cpp, st5ex0boss/st5ex0b_check.cpp

And there shall be TTLB... <3 Muwohohoho
User avatar
austere
Posts: 680
Joined: Mon Mar 22, 2010 10:50 am
Location: USA

Re: [Reverse engineering] DDP Daioujou Black Label

Post by austere »

So if you reverse engineer one Cave game, you've reversed engineered them all!

What about the hitboxes? I'm almost dead certain there's something strange going on in DonPachi.
<RegalSin> It does not matter, which programming language you use, you will be up your neck in math.
User avatar
BarfHappy
Posts: 160
Joined: Fri Jan 14, 2011 11:20 pm
Location: In a CAVE

Re: [Reverse engineering] DDP Daioujou Black Label

Post by BarfHappy »

austere wrote:So if you reverse engineer one Cave game, you've reversed engineered them all!

What about the hitboxes? I'm almost dead certain there's something strange going on in DonPachi.
Nha, esp galuda is not part of the normal tree, that s why i set it apart.
Donpachi, to be honest, i have forgotten about it, I ll check it at home, i don t have it here xD i just happened to have batsugun on my phone (i have a mame setup on it so i can plug it to whatever computer as USB drive and play for some minutes, but i automatically enable debugger xD i love seeing the code behind my games)

Anyway, you know they add code, change bits and pieces, but when you steprun the games for hours on hand to debug, you get quite an eye for similarities :)
I love that kind of stuff, i guess i am abnormal, heck, i even debugged RAID pci BIOS for American Megatrends Japan (-of the AMIBIOS fare- they ran out of business, i hope this is not my fault :x ).
st5ex0boss/st5ex0boss.cpp, st5ex0boss/st5ex0b_appear.cpp, st5ex0boss/st5ex0b_disp.cpp, st5ex0boss/st5ex0b_move.cpp, st5ex0boss/st5ex0b_anime.cpp, st5ex0boss/st5ex0b_check.cpp

And there shall be TTLB... <3 Muwohohoho
User avatar
austere
Posts: 680
Joined: Mon Mar 22, 2010 10:50 am
Location: USA

Re: [Reverse engineering] DDP Daioujou Black Label

Post by austere »

BarfHappy wrote:Anyway, you know they add code, change bits and pieces
Oh of course, of course, I was exaggerating a little bit.
BarfHappy wrote:but when you steprun the games for hours on hand to debug, you get quite an eye for similarities
So that's your methodology. :) I tend to use interactive disassemblers these days, though a decade ago I was known for my SoftICE-skills, heh. I cheated a little to figure out standard rank for DOJBL though...
<RegalSin> It does not matter, which programming language you use, you will be up your neck in math.
User avatar
Dave_K.
Posts: 4571
Joined: Wed Jan 26, 2005 5:43 am
Location: SF Bay Area
Contact:

Re: [Reverse engineering] DDP Daioujou Black Label

Post by Dave_K. »

So all bullets in these Cave games discussed use a single point for their collision detection? I find this rather hard to believe given the variety of bullet sizes, and my personal observations playing. I can see larger obstacles being entities with real hitbox dimensions, but was sure that bullets had varying size centers. Perhaps the code is tracking the center location, but bullet square size is factored in when computing the collision against the player's hitbox?
User avatar
BarfHappy
Posts: 160
Joined: Fri Jan 14, 2011 11:20 pm
Location: In a CAVE

Re: [Reverse engineering] DDP Daioujou Black Label

Post by BarfHappy »

Dave_K. wrote:So all bullets in these Cave games discussed use a single point for their collision detection? I find this rather hard to believe given the variety of bullet sizes, and my personal observations playing. I can see larger obstacles being entities with real hitbox dimensions, but was sure that bullets had varying size centers. Perhaps the code is tracking the center location, but bullet square size is factored in when computing the collision against the player's hitbox?
Nope, all bullets without exception are only checked on the center.
when they check larger (like big flame balls, saws etc) they are in fact enemies not bullets.
that is ONLY for non-espgaluda games hey :p

i went back to the dev forum:
here is the exact algorithm of cave engine (version DOJ). deltaY1,deltaY2,deltaX1,deltaX2 give the hitbox of the player

if(bullet flagged as non colliding) skip to next bullet
deltaY1=0x100
deltaY2=0x80
deltaX1=0x80
deltaX2=0x80
D0=YShip+deltaY1
D1=YShip-deltaY2
D2=XShip+deltaX1
D3=XShip-deltaX2
D4=YBullet
if(D4>D0) skip to next bullet
if(D1>D4) skip to next bullet
D4=XBullet
if(D4>D2) skip to next bullet
if(D3>D4) skip to next bullet
Set bullet as collided with ship
if(not invincible) go to ship destroyed
process next bullet
st5ex0boss/st5ex0boss.cpp, st5ex0boss/st5ex0b_appear.cpp, st5ex0boss/st5ex0b_disp.cpp, st5ex0boss/st5ex0b_move.cpp, st5ex0boss/st5ex0b_anime.cpp, st5ex0boss/st5ex0b_check.cpp

And there shall be TTLB... <3 Muwohohoho
User avatar
rtw
Posts: 1960
Joined: Wed Jan 26, 2005 6:46 pm
Location: Norway
Contact:

Re: [Reverse engineering] DDP Daioujou Black Label

Post by rtw »

BarfHappy wrote:i went back to the dev forum:
Thanks for the update!

May I ask which dev forum you are referring to ?
http://world-of-arcades.net
The future of ST-V rests upon our work and your work
User avatar
BarfHappy
Posts: 160
Joined: Fri Jan 14, 2011 11:20 pm
Location: In a CAVE

Re: [Reverse engineering] DDP Daioujou Black Label

Post by BarfHappy »

I just meant the dev subforum ;) i already explained it to soneone in need. Btw nice to see you here (i m mikeneko from cave ;)
st5ex0boss/st5ex0boss.cpp, st5ex0boss/st5ex0b_appear.cpp, st5ex0boss/st5ex0b_disp.cpp, st5ex0boss/st5ex0b_move.cpp, st5ex0boss/st5ex0b_anime.cpp, st5ex0boss/st5ex0b_check.cpp

And there shall be TTLB... <3 Muwohohoho
User avatar
rtw
Posts: 1960
Joined: Wed Jan 26, 2005 6:46 pm
Location: Norway
Contact:

Re: [Reverse engineering] DDP Daioujou Black Label

Post by rtw »

BarfHappy wrote:I just meant the dev subforum ;) i already explained it to soneone in need. Btw nice to see you here (i m mikeneko from cave ;)
Hello mikeneko, awesome discoveries :D
http://world-of-arcades.net
The future of ST-V rests upon our work and your work
User avatar
mjclark
Banned User
Posts: 1384
Joined: Fri Aug 22, 2008 10:04 pm
Location: UK Torquay

Re: [Reverse engineering] DDP Daioujou Black Label

Post by mjclark »

Really getting captivated by this now! Love the guide to DOJ hyper rank (especially the flow chart!) but where can I find a brief summary of standard rank mechanics? Looked in Strategy section first but there it says "Rank is increased only by using hypers" :?:
Image
User avatar
KNTain
Posts: 153
Joined: Sun Jun 03, 2007 11:29 pm

Re: [Reverse engineering] DDP Daioujou Black Label

Post by KNTain »

This is such a baller thread.

Thanks, austere and BarfHappy.
User avatar
austere
Posts: 680
Joined: Mon Mar 22, 2010 10:50 am
Location: USA

Re: [Reverse engineering] DDP Daioujou Black Label

Post by austere »

mjclark wrote:where can I find a brief summary of standard rank mechanics?
I'll explain it more thoroughly in the guide when I get time to look at it more carefully (and that time should be briefer thanks to BarfHappy/Mikeneko's description of the bullet structure) but basically:

- Standard rank goes up by 1 every 256 (0x100) effective frames. I say effective because when there is slow down, vertical blanks are actually consumed by the slow down routine (but the vertical blank routine is still run since it's triggered by interrupt 6, obviously).
- When not in hyper mode, it tops off at 240 (0xF0) in the first loop, 248 (0xF8) in the second loop.
- When in hyper mode, your hyper rank multiplied by 16 (0x10) is temporary added to the standard rank and capped off at 255 (0xFF) regardless of the current loop.
- Your standard rank reaches its height at 1-4, assuming you beat the bosses fairly quickly. In fact the game pushes you up to the upper limits when you enter the second loop regardless of what the frame counter is.
- Your starting rank is not zero, in fact, there is a base rank at the beginning of each stage. For normal mode, this base rank is:
Stage 1-1 52 (0x34)
Stage 1-2 68 (0x44)
Stage 1-3 84 (0x54)
Stage 1-4 100 (0x64)
Stage 1-5 100 (0x64)
Stage 2-1 onwards: N/A

The standard rank affects bullet density and firing rate but like I said, I need more time to distill any other effects.
<RegalSin> It does not matter, which programming language you use, you will be up your neck in math.
User avatar
mjclark
Banned User
Posts: 1384
Joined: Fri Aug 22, 2008 10:04 pm
Location: UK Torquay

Re: [Reverse engineering] DDP Daioujou Black Label

Post by mjclark »

Thanks again austere! So is standard rank affected by dying and bombing also (when not in hyper mode)- guess I can just look at the SR counter in DOJ+ and work that one out for myself :D
I also noticed from that previous DOJ strategy thread that there was a (rumoured) ROM hack for Battle Garegga that displayed a rank meter. Does anyone know any more about that?
Image
User avatar
austere
Posts: 680
Joined: Mon Mar 22, 2010 10:50 am
Location: USA

Re: [Reverse engineering] DDP Daioujou Black Label

Post by austere »

Dying will not reduce the standard rank (except of course, through taking you out of hyper mode which will reduce the temporary increment). There's really nothing you can do about it, the frame counter is not reset when you continue either. The only way you can reduce the standard rank is to kill the bosses faster.
<RegalSin> It does not matter, which programming language you use, you will be up your neck in math.
Post Reply