Vivacity
still learning
- 6
- Posts
- 10
- Years
- Seen Jul 15, 2017
The Emerald-Style Cutscene Animation Engine... in C!
a.k.a. how to flyyyy like Rayquaza :DIntroduction
First, a quick demonstration of what I'm talking about! Skip to 3 minutes and 6 seconds to see everything really kick off...…Pretty awesome, right?
That cutscene comes from the German hack Violet, and it was made possible through the hard work of a programmer called Wodka. In order to create that cutscene and others like it, Wodka first built a powerful animation engine in C – which he then, very generously, made open-source. That C code can be found at:
https://github.com/WodkaRHR/Violet_Sources/tree/master/src/anim_engine
In an accompanying thread, Wodka also granted permission for anyone to translate and port his engine and documentation, which is what I've been trying to do over the last week or so.
Since my skill with C programming is still more or less limited to the basics of what the brilliant FBI taught us in this tutorial (which you should all go read if you haven't already), my efforts have been thus far restricted to replacing all the offsets in Wodka's BPRD.ld file with the correct offsets for a BPRE game.
Unfortunately, this doesn't seem to be enough to get the engine running; although tiles are loaded and I've managed to wipe the BG layers, most of the other functions don't work properly and I can't get the OAM commands to function.
The super-mega-awesome cutscript project
It was then that I stumbled across this on FBI's GitHub…https://github.com/EternalCode/cutscript
(A disclaimer: this code, while it looks super-mega-awesome, doesn't seem to have been published on the forums yet. I would totally wait for FBI and Touched to make their own release thread… except that the last update was two years ago and I'm not sure what happened to the project, hehe. I'm only drawing attention to it now after I saw FBI post this...
…which makes me hopeful that he's cool with me messing around and trying to get it to work. If not, please just shout and I'll pull the thread down straight away!)FBI said:if it's on my git, it's public, yes
But, anyway…
The cutscript project seems to be exactly what I'm looking for, with several advantages:
- It's built for an English version already
- The command reference is part of the source code as a .yml file, and doesn't rely on separate documentation
- It doesn't seem to rely as much/at all on laborious hex editing of tables and low-level structures
- It includes some exciting functions which the posted release of the German engine didn't
- And much more, I'm sure (it's FBI and Touched c'monnn)
After carefully reading and re-reading FBI's tutorial on C programming and the setup Windows users need to do, I was able to get the code from Touched's repository to build and then compile with only a few warning messages (in the spoiler, in case it helps)
Code:
[FONT=Source Code Pro][...]\cutscript-master>python scripts\build2[/FONT]
[FONT=Source Code Pro]./src\commands\BG_cmds.c: In function 'command_BG_move':[/FONT]
[FONT=Source Code Pro]./src\commands\BG_cmds.c:32:27: warning: type of 'arg_1' defaults to 'int' [-Wimplicit-int][/FONT]
[FONT=Source Code Pro] enum command_return_value command_BG_move(arg_1, arg_2, arg_3){[/FONT]
[FONT=Source Code Pro] ^~~~~~~~~~~~~~~[/FONT]
[FONT=Source Code Pro]./src\commands\BG_cmds.c:32:27: warning: type of 'arg_2' defaults to 'int' [-Wimplicit-int][/FONT]
[FONT=Source Code Pro]./src\commands\BG_cmds.c:32:27: warning: type of 'arg_3' defaults to 'int' [-Wimplicit-int][/FONT]
[FONT=Source Code Pro]./src\commands\BG_cmds.c: In function 'command_BG_del':[/FONT]
[FONT=Source Code Pro]./src\commands\BG_cmds.c:37:27: warning: type of 'arg_1' defaults to 'int' [-Wimplicit-int][/FONT]
[FONT=Source Code Pro] enum command_return_value command_BG_del(arg_1){[/FONT]
[FONT=Source Code Pro] ^~~~~~~~~~~~~~[/FONT]
[FONT=Source Code Pro]./src\commands\BG_cmds.c: In function 'command_BG_translate':[/FONT]
[FONT=Source Code Pro]./src\commands\BG_cmds.c:42:27: warning: type of 'arg_1' defaults to 'int' [-Wimplicit-int][/FONT]
[FONT=Source Code Pro] enum command_return_value command_BG_translate(arg_1, arg_2, arg_3, arg_4){[/FONT]
[FONT=Source Code Pro] ^~~~~~~~~~~~~~~~~~~~[/FONT]
[FONT=Source Code Pro]./src\commands\BG_cmds.c:42:27: warning: type of 'arg_2' defaults to 'int' [-Wimplicit-int][/FONT]
[FONT=Source Code Pro]./src\commands\BG_cmds.c:42:27: warning: type of 'arg_3' defaults to 'int' [-Wimplicit-int][/FONT]
[FONT=Source Code Pro]./src\commands\BG_cmds.c:42:27: warning: type of 'arg_4' defaults to 'int' [-Wimplicit-int][/FONT]
[FONT=Source Code Pro]./src\commands\BG_cmds.c: In function 'command_BG_pal_update':[/FONT]
[FONT=Source Code Pro]./src\commands\BG_cmds.c:47:27: warning: type of 'arg_1' defaults to 'int' [-Wimplicit-int][/FONT]
[FONT=Source Code Pro] enum command_return_value command_BG_pal_update(arg_1, arg_2){[/FONT]
[FONT=Source Code Pro] ^~~~~~~~~~~~~~~~~~~~~[/FONT]
[FONT=Source Code Pro]./src\commands\BG_cmds.c:47:27: warning: type of 'arg_2' defaults to 'int' [-Wimplicit-int][/FONT]
[FONT=Source Code Pro]./src\commands\OAM_cmds.c: In function 'command_oam_pal_update':[/FONT]
[FONT=Source Code Pro]./src\commands\OAM_cmds.c:76:27: warning: type of 'arg_1' defaults to 'int' [-Wimplicit-int][/FONT]
[FONT=Source Code Pro] enum command_return_value command_oam_pal_update(arg_1, arg_2) {[/FONT]
[FONT=Source Code Pro] ^~~~~~~~~~~~~~~~~~~~~~[/FONT]
[FONT=Source Code Pro]./src\commands\OAM_cmds.c:76:27: warning: type of 'arg_2' defaults to 'int' [-Wimplicit-int][/FONT]
[FONT=Source Code Pro]./src\commands\OAM_cmds.c: In function 'command_oam_rotate':[/FONT]
[FONT=Source Code Pro]./src\commands\OAM_cmds.c:81:27: warning: type of 'arg_1' defaults to 'int' [-Wimplicit-int][/FONT]
[FONT=Source Code Pro] enum command_return_value command_oam_rotate(arg_1, arg_2) {[/FONT]
[FONT=Source Code Pro] ^~~~~~~~~~~~~~~~~~[/FONT]
[FONT=Source Code Pro]./src\commands\OAM_cmds.c:81:27: warning: type of 'arg_2' defaults to 'int' [-Wimplicit-int][/FONT]
[FONT=Source Code Pro]./src\commands\OAM_cmds.c: In function 'command_oam_flip':[/FONT]
[FONT=Source Code Pro]./src\commands\OAM_cmds.c:86:27: warning: type of 'arg_1' defaults to 'int' [-Wimplicit-int][/FONT]
[FONT=Source Code Pro] enum command_return_value command_oam_flip(arg_1, arg_2) {[/FONT]
[FONT=Source Code Pro] ^~~~~~~~~~~~~~~~[/FONT]
[FONT=Source Code Pro]./src\commands\OAM_cmds.c:86:27: warning: type of 'arg_2' defaults to 'int' [-Wimplicit-int][/FONT]
[FONT=Source Code Pro]./src\commands\OAM_cmds.c: In function 'command_oam_zoom':[/FONT]
[FONT=Source Code Pro]./src\commands\OAM_cmds.c:91:27: warning: type of 'arg_1' defaults to 'int' [-Wimplicit-int][/FONT]
[FONT=Source Code Pro] enum command_return_value command_oam_zoom(arg_1, arg_2, arg_3) {[/FONT]
[FONT=Source Code Pro] ^~~~~~~~~~~~~~~~[/FONT]
[FONT=Source Code Pro]./src\commands\OAM_cmds.c:91:27: warning: type of 'arg_2' defaults to 'int' [-Wimplicit-int][/FONT]
[FONT=Source Code Pro]./src\commands\OAM_cmds.c:91:27: warning: type of 'arg_3' defaults to 'int' [-Wimplicit-int][/FONT]
The lovely guys behind the project have included an example cutscene script to show us how it works; so I ran the demo script as well, and checked to make sure it had been inserted at 0x900000.
I then compiled and ran this XSE script:
Code:
#dynamic 0xA00000
#include stdpoke.rbh
#include stditems.rbh
#include stdattacks.rbh
#include stdmove.rbh
#org @start
lock
msgbox @t1 0x6
loadpointer 0x1 0x900000
special 0x1A
waitstate
msgbox @t2 0x6
release
end
#org @t1
= Activate.
#org @t2
= Ends.
Dynamite stuff, yeah yeah shush – but I just wanted to see if I could get the engine running!
Unfortunately, all that happens is the screen fades to black and back again, with nothing happening in the middle. The script completes successfully and doesn't hang (i.e. I get the 'Ends.' message), but for whatever reason, the engine doesn't seem to want to run.
So what now?
Having exhausted my brain over the last week or two translating pages and pages of German OAM documentation, tutorials and code by myself, I've decided to do the smart thing and just ask for help this time around. If anyone else is as excited by the prospect of being able to animate cutscenes like this – please, pitch in! I'm certain we can get this running if we're resilient enough.My own skills are still fairly limited, but if there's any boring/repetitive drudgery to be done, you bet I'll help in any way, shape or form I can.
It remains only to say that this – to me, at least – is the coolest advance we've seen for Generation III bar none, and if this engine really allows us to make Emerald-style cutscenes that harness the full power of the GBA's hardware with relative ease, people will be lining up to thank Touched and FBI for all their hard work. And if they don't, I'll do it for them, and I'll keep on expressing my gratitude, because this is the kind of project that makes the programmers of this community so awesome. </gush>