PDA

View Full Version : Development: Cutscenes


knizz
June 5th, 2010, 02:38 PM
Is it possible to make "cutscenes" (like in the intro) in a 3rd gen game using the ASM-command? As far as I know the asm-command stops the music- and graphic-updates. The code for the cutscene would have to call the correct parts of the main loop. (How can they be found?) And does backuping the graphic-memory guarantee that there are no glitches afterwards? (Or is there a function the refills the graphic-memory, so there's no need to do a backup)

I hope you understand what I mean.

knizz

Full Metal
June 5th, 2010, 03:23 PM
well, idk about everyone else, but i'm fairly certain that there isn't an asm command 'cutscene' or anything like that...

knizz
June 5th, 2010, 03:26 PM
well, idk about everyone else, but i'm fairly certain that there isn't an asm command 'cutscene' or anything like that...

That's not what I meant. I thought about using the ASM command to start a ASM-Program that shows some animations while continuing playing the music.

btw On the standard theme your text is unreadable (black on gray)

Full Metal
June 5th, 2010, 03:30 PM
well, i use 'seeds of platinum' and it reads fine (which is also black on gray)
ontopic: ohhh that asm command 'callasm' :P
yea...that should be doable, just long and tedious and not fun

colcolstyles
June 5th, 2010, 03:53 PM
Yes, I'm sure it's manageable. Though I don't think you have to go so far as calling the game's main loop just to get it to work. I would guess that remaining "inside" a callasm command for more than one frame might de-sync the game and screw things up but when I did something similar to this a while ago, I did it by returning from the "ASM level" to the "script level" each frame. So yeah, it's totally possible but you're going to need knowledge of ASM and a good chunk of time in order to pull it off.

Also, does the callasm command really stop the music? I thought that the sound data was copied over via DMA so that it would continue playing, which explains why people often describe the game freezing as "the screen goes black but I can still hear the music." :\

Darthatron
June 5th, 2010, 04:12 PM
Yes, I'm sure it's manageable. Though I don't think you have to go so far as calling the game's main loop just to get it to work. I would guess that remaining "inside" a callasm command for more than one frame might de-sync the game and screw things up but when I did something similar to this a while ago, I did it by returning from the "ASM level" to the "script level" each frame. So yeah, it's totally possible but you're going to need knowledge of ASM and a good chunk of time in order to pull it off.

Also, does the callasm command really stop the music? I thought that the sound data was copied over via DMA so that it would continue playing, which explains why people often describe the game freezing as "the screen goes black but I can still hear the music." :\

I was thinking the same thing about the music. I've never experienced the music stopping or skipping. At least, not by accident. >_<

altariaking
June 5th, 2010, 04:20 PM
by cutscenes do you mean lije the rayquazza one in emerald?

knizz
June 5th, 2010, 10:02 PM
Yes, I'm sure it's manageable. Though I don't think you have to go so far as calling the game's main loop just to get it to work. I would guess that remaining "inside" a callasm command for more than one frame might de-sync the game and screw things up but when I did something similar to this a while ago, I did it by returning from the "ASM level" to the "script level" each frame. So yeah, it's totally possible but you're going to need knowledge of ASM and a good chunk of time in order to pull it off.

Also, does the callasm command really stop the music? I thought that the sound data was copied over via DMA so that it would continue playing, which explains why people often describe the game freezing as "the screen goes black but I can still hear the music." :\

How did you switch to script-level in every frame?
In my case that's not useful because I want to draw something entirely different onto the screen.

Also the DMA alone can't be responsible for the music to continue.
1) The DMA-Buffer only holds enough samples for maybe half a second.
2) New samples have to be created from the notes in the same interval.

Probably it's because of a timer... (what else does this timer trigger?)

colcolstyles
June 5th, 2010, 10:25 PM
How did you switch to script-level in every frame?
In my case that's not useful because I want to draw something entirely different onto the screen.

Instead of waiting for the next frame by continually checking the VCount register until it enters the VBlank in a callasm routine, you can just return to the script and the use "pause 0x1" in order to utilize the game's built-in "wait x frames" function. If you're animating something or need to move something over the course of multiple frames, you can use a loop in the script and at each pass, use callasm to call a routine that changes the location or graphic of a sprite or something.

I believe I used something like this:

...

setvar LOOP_COUNTER 0x0
call @loop

...

#org @loop // Moves a sprite to the left 1px per frame over 30 frames (~0.5 sec)
callasm 0xXXXXXX // Moves sprite 1 pixel to the left or whatever

addvar LOOP_COUNTER 0x1
pause 0x1 // Wait for next frame
compare LOOP_COUNTER 30
if B_< goto @loop
return

... where the routine called only changes something small before quickly returning to the script. If you really want to see an example of something that uses that idea, you can take a look at this video (http://www.youtube.com/watch?v=BEKFsyd30ZY). It's pretty crude as it was just a test to see if I had the basic concept right for a project I was working on for this one guy's hack. However, things like the text fade-in and the expanding, semi-transparent bar use the above code more or less.


Also the DMA alone can't be responsible for the music to continue.
1) The DMA-Buffer only holds enough samples for maybe half a second.
2) New samples have to be created from the notes in the same interval.

Probably it's because of a timer... (what else does this timer trigger?)

Hm, interesting. I honestly haven't looked into sound hacking so I really wouldn't know. I'll take a look at it tomorrow but I'm gonna go to bed now, seeing how I've got final exams this upcoming week.

knizz
June 6th, 2010, 12:44 AM
Thanks a LOT! That was exactly what I was looking for.

Team Fail
June 6th, 2010, 10:56 AM
... where the routine called only changes something small before quickly returning to the script. If you really want to see an example of something that uses that idea, you can take a look at this video (http://www.youtube.com/watch?v=BEKFsyd30ZY). It's pretty crude as it was just a test to see if I had the basic concept right for a project I was working on for this one guy's hack. However, things like the text fade-in and the expanding, semi-transparent bar use the above code more or less.

I'd like to be able to do that, unfortunately I have no knowledge of ASM or how to do it :(. That's pretty cool! But, was there sound with that? That would be interesting to see.

colcolstyles
June 6th, 2010, 11:40 AM
I'd like to be able to do that, unfortunately I have no knowledge of ASM or how to do it :(. That's pretty cool! But, was there sound with that? That would be interesting to see.

Yes, there was sound but my screen capture program doesn't capture sound because apparently it doesn't work with Intel Macs. Anyways, I didn't change the music when transitioning from the map to the cutscene. It was probably still playing Pallet Town's music. If different music was needed in a cutscene, you could just use 'playsong' to change the song. Again, there's no need to do anything in a 'callasm' routine that you can't do in a script. In fact, if you really wanted to, you could simply create a map with the image that you wanted to display in the tileset and then use Overworlds to create moving objects. Though that would probably be a lot less efficient.

kittopian
June 9th, 2010, 09:31 PM
This whole concept is exiting! Adding new cutscenes will allow hacks to become more unique... Good luck!

Funfat.
August 9th, 2010, 05:43 PM
Hm... You could stop the music and play different music...

Xenesis
August 10th, 2010, 07:30 AM
Also the DMA alone can't be responsible for the music to continue.
1) The DMA-Buffer only holds enough samples for maybe half a second.
2) New samples have to be created from the notes in the same interval.

Probably it's because of a timer... (what else does this timer trigger?)

A subroutine (or nested subroutine) from the main loop at some level should call what is essentially the 'music engine'. You'll find that the game should (through every loop) update the buffer to include the audio data in a timely fashion.

Regardless of anything else, whenever you run a script the main loop is still occurring at a fundamental level every frame that the game runs. If you want to control what audio is playing, the most direct method would be to send commands to the game's sound engine. (Which is basically what any music change commands in scripts, etc. would do anyhow)

U.Flame
October 15th, 2010, 06:55 PM
Argh! Why can't I understand scipting!? Cutscenes like in that video would be so perfect with my hack! But then again, DestinedJagold created a cutscene using titles to form an image, that can work too.

Shiny Quagsire
October 15th, 2010, 07:16 PM
Argh! Why can't I understand scipting!? Cutscenes like in that video would be so perfect with my hack! But then again, DestinedJagold created a cutscene using titles to form an image, that can work too.

It would be easier and faster just to use ASM. With a script, the event would be laggy and slow, and you'd be limited to what you can do.

And about the music, even during the ASM, the music plays. When I executed my signpost, it loops until a key is pressed, and I never modified anything in the music. I think it has to do with the IO registers that hold the location of the music.

colcolstyles
October 18th, 2010, 11:02 PM
It would be easier and faster just to use ASM. With a script, the event would be laggy and slow, and you'd be limited to what you can do.
I'm not so sure about this. I don't know why the event would be "laggy" and I can't think of any ways in which the hacker would "limited". Plus, though I haven't tested it, I'm fairly certain that remaining in a 'callasm' command for longer than one frame will at least have some minor ramifications.

And about the music, even during the ASM, the music plays. When I executed my signpost, it loops until a key is pressed, and I never modified anything in the music. I think it has to do with the IO registers that hold the location of the music.

Sorta. I didn't understand this completely the last time I visited this thread but since then, I've learned a thing or two about music hacking. The gist is that the game uses DMA1 and DMA2 to continuously copy over music data to the I/O registers. knizz was correct in that the DMA buffers can only hold enough data for a split second. However, DMAs 1 & 2 have a special setting for music that will copy over a new byte once the "sound buffer" has been emptied. Basically, it's complicated.