Miscellaneous Forums > Scripting and Reverse Engineering
[FF7] camdat files
Akari:
--- Quote from: NFITC1 on 2010-07-06 22:18:21 ---
--- Quote from: Bosola on 2010-07-06 21:16:26 ---Slightly off-topic, but what do we know about the camera data for attacks in battle? Do the camera angle indeces refer to camdat files, or are they just parameters for camera movement (the former seems far more likely)?
--- End quote ---
I think all that's definite is that battle type determines which camdat to use. After that it's the camera index that determines which camera set (position and focus) to use.
There's over 1000 scripts in each camdat file, but like Akari mentioned I believe the game will sometimes pick one at random. Imagine that each camera index is multiplied by three. Then the game chooses between that result and the next two. So if the camera index is 100, then the game will select either 300, 301, or 302. In some cases, this is sort of unrandomized by listing those three indexes the same. Camera set 300, 301, and 302 will use position script 517 and focus script 518 (for example). I'm not sure how the camera value translates into actual camera set data. Camera data gets bounced around a lot before it gets used.
--- End quote ---
Try look at some scripts I reversed. For example here http://q-gears.svn.sourceforge.net/viewvc/q-gears/trunk/reversing/ffvii/ffvii_battle/camera/camera_script_export_attack_normal.lua?revision=413&view=markup
Every reverse related to thing related are here - http://q-gears.svn.sourceforge.net/viewvc/q-gears/trunk/reversing/ffvii/ffvii_battle/camera/
How it works:
1) Camera id selected acording to actions (idle or some action camera ot victory camera).
2) 2 actual camera sequences randomly selected one for camera position and one for camera directions.
Note: camera seted based on this two points. They stored in two structures and camera updates every frame based on this structures. So script just need to update this points positions. Script rarely set camera position directly. more often it call transition functions that update position or direction of camera each frame.
3) Scripts actually runned. For example one of script:
set static view of attacker for 0xf frames
set_transition("static_attacker_view", "attacker_joint0", 0x0000, 0xff88, 0x0000, 0xf); --E8 00 0000 88FF 0000 0F
set script to wait 0xf frames before continue.
set_wait(0x0f); --F5 0F
actual wait
wait(); --F4
next set linear transition to next point related to attacker joint 6
set_transition("direct_transition", "attacker_joint6", 0x0000, 0x0000, 0x0000, 0x8); --E4 06 0000 0000 0000 08
wait again
set_wait(0x08); --F5 08
wait(); --F4
next move to target joint 0
set_transition("direct_transition", "target_joint0", 0x0000, 0x0000, 0x0000, 0x8); --E5 00 0000 0000 0000 08
and wait
set_wait(0x08); --F5 08
wait(); --F4
remain here until next camera id is set
loop();
dangarfield:
Sorry for absolutely bringing this post back, but I had a question for nfitc1 regarding battle cameras:
Context: I'm building a from scratch game engine (kind of like q-gears). https://github.com/dangarfield/ff7-fenrir/ Fields are generally working, now I'm working on battles. Things are going well, but I can't figure out the F8 op position code.
Example (from camdat0.bin - victory cam[2]):
`F8 DE FF FC 03 00 0A F1 FF 00 00 2D 00`
The visual effect is that of an spiral.
In game, this goes from:
`START arg3: -5881 y: 606 z: 2931`
`FINAL arg3: 2879 y: 606 z: -1973`
I initially thought that it started from the previous operation eg, F9 (sets XYZ) in this case, but playing with camdat0.bin in game, shows me that it's not at all. The starting positions are 'calculated' from the operation arguments (eg, changing the arguments changes the starting position). I feel as though there each step creates a vector and applies it to the next position and so on, but I can't seem to work out what the first 4 parameters actually refer to and how they are used in the position update loop.
eg `cameraSpiral({arg1: -34, arg2: 1020, arg3: 2560, arg4: -15, arg5: 0, arg6: 45, })`
Your notes above seem to say: `Store These values in six words starting at 0xBFCE0C (not in order)` (I believe you documented this as F7, but actually I think the doc mixed up F7 <-> F8)
Would it be possible to help identify the source function that performs these stepping updates?
My current process is amending the camdat0.bin file with specific F8 arguments, watching the memory for battle camera position changes when the script is triggered, analysing the result and coding a matching algorithm to emulate it, this has been fine for the vast majority of battle camera op codes so far, but this one is eluding me!
I'm confident that:
ARG 5 - Each step increment Y (eg, always linear) - doesn't affect x or z
ARG 6 - Duration in frames
It's also worth noting, that the initial camera and victory camera movements use the frame duration set in the op codes, but for the main scripts, this duration is actually halved, very strange.
nfitc1:
You necro’d one of my topics from before my oldest daughter was born. I say you can claim the title of the camera expert if you want to. To be honest, most of the “work” I did around the camera was guess work. I didn’t find code that did the stepping, I just knew it existed. It’s possible that a center to an ellipsis is defined somewhere and the camera follows that.
dangarfield:
I'm not really sorry! It's a shame that I'm 15 years late to the party I guess.
I've generally figured it out. It's quite interesting, simple and convoluted at the same time.
It's an Archimedean spiral where:
--- Code: ---F8 - Op code
DE FF - zoom - not quite fully worked this out yet but it essentially relates to how 'zoomed in' but also how many frames to step through as well as direction (+-)
FC 03 - initial radius - Distance to first 'turn'
00 0A - rotation - where 4096 is a full rotation
F1 FF - spiral growth rate (+-) - Where positive: spiral contracts, negative: spiral expands
00 00 - y adjust (+-) - linearly adjust y per frame
2D 00 - frames
--- End code ---
This is then added on to the focus position so that it also moves as the focus point moves also.
I can imagine the creators adding a spiral on, resizing, rotating it etc. It's interesting as it can account for a whole plethora of curves. Simple, yet convoluted.
I'm sure there is probably no one else in the world who would ever care, but that's it from me.
Navigation
[0] Message Index
[*] Previous page
Go to full version