• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Development: The Emerald-Style Cutscene Animation Engine... in C!

Vivacity

still learning
6
Posts
9
Years
  • Age 29
  • Seen Jul 15, 2017

The Emerald-Style Cutscene Animation Engine... in C!

a.k.a. how to flyyyy like Rayquaza :D

Introduction

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...
FBI said:
if it's on my git, it's public, yes
…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!)

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)
So I'm now hoping I can successfully get the cutscript engine working instead! The trouble I'm facing is this…

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>

tl;dr

tl;dr… please please please let's get this working, it's insanely cool and even if I'm the only one who ever properly uses it, I'll still consider that a massive win :D
 

Blah

Free supporter
1,924
Posts
11
Years
Cutscript was a project Touched had started and we ended up working on it together a long time ago. I don't think the project builds and works fully as intended yet. We hadn't gotten to writing all the commands, but it was going to be hype if we did! It's basically a scripting system for graphics, which is what Wodka's project seems to be.

The reason why I'd be hesitant to use a scripting engine for game graphics is because programming game graphics directly is much less limiting, faster and customizable. So since the cutscript days, I prefer to code my graphics than limit myself to use a scripting engine.

That said, I think I'll be coding some animation core for my battle engine, I'd be happy to share whatever I make with anyone else as it's being made. If you have suggestions on how you'd like to see something like this work, you can offer them to me here :)

Edit: While I'm here I should plug my C teaching project that's going on right now :P
 
Back
Top