PCEngineFans.com - The PC Engine and TurboGrafx-16 Community Forum

Tech and Homebrew => Turbo/PCE Game/Tool Development => Topic started by: Black Tiger on September 14, 2007, 04:28:52 PM

Title: How'd they do that? Explaining PC Engine tricks.
Post by: Black Tiger on September 14, 2007, 04:28:52 PM
If you're wondering how a particular crazy effect is achieved in a PC Engine game, post it here and hopefully the resident programming experts will unravel them for us. :)


One thing I'd like explained is vertical scrolling/overlapping of background sections. In that other thread, I pointed out the third stage of Magical Chase.

Jackie Chan and Bravo Man have some simple overlapping vertical 'scrolls', but one in particular that got me thinking about this the other day is the elevator bg 5 minutes into Toneman's video.
Title: Re: How'd they do that? Explaining PC Engine tricks.
Post by: malducci on September 14, 2007, 05:11:18 PM

 Riot zone: elevator part.

 The effect is a single hsync break in the screen to divide the elevator floor and the wall. The columns that fake the see through layer are dynamic tiles (animated in this case). The game even animates, or pauses the animation, of the column tiles to be in sync with the elevator floor when it shakes or rumbles.

 Some pics:

The normal screen:
(http://pcedev.net/pce_howto/riot_zone/elevator.html)

Minus Sprites:
(http://pcedev.net/pce_howto/riot_zone/elevator1.html)

Just sprites:
(http://pcedev.net/pce_howto/riot_zone/elevator2.html)

Here's a view of the PCEs memory when view in tile mode. See the single tile, halfway down the window/block and to the left (16x16 block)? That single tile is used for the whole column(s). When you animate that single tile, the whole column animates.

(http://pcedev.net/pce_howto/riot_zone/elevator3.html)

;)

Title: Re: How'd they do that? Explaining PC Engine tricks.
Post by: Keranu on September 14, 2007, 05:26:01 PM
Excellent thread and excellent respond by malducci! I'm sure I have a bunch of questions as well, but I'll have to go back and look for them.
Title: Re: How'd they do that? Explaining PC Engine tricks.
Post by: akamichi on September 14, 2007, 06:01:03 PM
I don't remember Batman being a hidden character in riot zone!  hehehehehe.  :-"

- akamichi
Title: Re: How'd they do that? Explaining PC Engine tricks.
Post by: Keranu on September 14, 2007, 06:22:54 PM
Haha, that was some hack malducci made awhile back :D . At least I'm pretty sure malducci made it.

Mal you should replace the sprite with Cody from Final Fight (if possible) ;) .
Title: Re: How'd they do that? Explaining PC Engine tricks.
Post by: Turbo D on September 14, 2007, 06:27:43 PM
I think he made that hack already
Title: Re: How'd they do that? Explaining PC Engine tricks.
Post by: malducci on September 14, 2007, 06:30:00 PM
The cody sprite is already in there (the 2 frames for punching), I just had the batman frame in as the stance frame. I lost the motivation to finish it since I got more exciting projects to work on ;)


Quote from: akamichi
I don't remember Batman being a hidden character in riot zone!  hehehehehe.  Whistle

- akamichi

Akamichi! The man  :wink:
Title: Re: How'd they do that? Explaining PC Engine tricks.
Post by: Keranu on September 14, 2007, 06:46:25 PM
Ahh, yeah I wasn't sure if he made a hack of that or not. I'd still like to see a stage of the arcade Final Fight ported to the PCE ;) . There was some programmer who was working on a cool Strider demo for PCE (or SGX?), but I don't know what happened to it. He was working on some other way cool things too!
Title: Re: How'd they do that? Explaining PC Engine tricks.
Post by: Arjak on September 15, 2007, 08:40:38 AM
In the intro of Lords of Thunder, there's this moment in the intro as Landis takes off and the background has this neat rotating like effect, it looks weird, like a backdrop falling down at a play. Looks cool though. How did they do that one?
Title: Re: How'd they do that? Explaining PC Engine tricks.
Post by: malducci on September 15, 2007, 09:15:03 AM
That's an Hsync effect. Spriggan Mark 2 also does this in the intro.

 You can stretch or sine warp an image vertically by using hsync interrupts to change the BG position on every scanline. You know that cool effect in Axelay that looks sort of mode-7? It's not. It's an hsync effect just like intro to LOT. Check out Chris Covell's page as he has a demo showing this effect on the SGX (and it has some PCE versions bundled in with it). He also has some vertical warping demos on the same page.

 The effect work like this:

frame one:

 scanline 120: set BG to position 60
 scanline 121: set BG to position 60
 scanline 122: set BG to position 60
 scanline 123: set BG to position 61
 scanline 124: set BG to position 61
 scanline 125: set BG to position 61

frame two:

 scanline 120: set BG to position 60
 scanline 121: set BG to position 60
 scanline 122: set BG to position 61
 scanline 123: set BG to position 61
 scanline 124: set BG to position 62
 scanline 125: set BG to position 62

frame two:

 scanline 120: set BG to position 61
 scanline 121: set BG to position 62
 scanline 122: set BG to position 63
 scanline 123: set BG to position 64
 scanline 124: set BG to position 65
 scanline 125: set BG to position 66

That's simplifying it though, as LOT didn't stretch ever pixel to the same width but instead gave it a skewed look.

Title: Re: How'd they do that? Explaining PC Engine tricks.
Post by: Black Tiger on September 16, 2007, 07:52:40 AM
Final Fantasy IV on Wonderswan color used that Axelay effect for the world map when flying the airship.

It worked pretty good and is one way that a 'warping' world map could be done in a Turbo RPG or Final Fantasy port.


Now that I know that sections of background can push over the rest, the HP bar in SFIICE and the Neo Geo ports makes sense. :)
Title: Re: How'd they do that? Explaining PC Engine tricks.
Post by: Keranu on September 16, 2007, 08:19:33 AM
Final Fantasy IV on Wonderswan color used that Axelay effect for the world map when flying the airship.

It worked pretty good and is one way that a 'warping' world map could be done in a Turbo RPG or Final Fantasy port.
That's cool, I didn't know about that! Might be something to look into for any PCE coders out there making an RPG or something.
Title: Re: How'd they do that? Explaining PC Engine tricks.
Post by: ParanoiaDragon on September 17, 2007, 08:08:21 PM
Yeah, we just gotta find some PCE coders that are working on any RPG's.....now where to find them :-"
Title: Re: How'd they do that? Explaining PC Engine tricks.
Post by: Joe Redifer on September 30, 2007, 12:49:06 AM
In games like Gate of Thunder or many others where the Turbo actually shows graphic scaling, is there a scaling subroutine written in to the programming, it is it just animated tiles?
Title: Re: How'd they do that? Explaining PC Engine tricks.
Post by: ccovell on September 30, 2007, 05:31:17 AM
The scaling of the enemy ships and the moving blocks in Stage 2, etc, are just animations.

The PCE hardware can't scale any sprites or backgrounds, but by changing the scrolling at each scanline, vertical scaling of backgrounds can be achieved -- a common trick on many game systems.
Title: Re: How'd they do that? Explaining PC Engine tricks.
Post by: nat on September 30, 2007, 08:06:56 AM
So does Star Parodia just use animations like that, too? There is some scaling in that game so smooth you'd swear the hardware was doing it.
Title: Re: How'd they do that? Explaining PC Engine tricks.
Post by: Joe Redifer on September 30, 2007, 10:55:00 AM
So the Super CD Screen flying away is just animated tiles?  I'm sure the TG could scale small things if the software had a scaling routine written in. 
Title: Re: How'd they do that? Explaining PC Engine tricks.
Post by: Keranu on September 30, 2007, 01:47:55 PM
Here's one for 'ya!

(http://img406.imageshack.us/img406/103/cdf032b9d4001nb4.html)

This screenshot is taken from Hyaku Monogatari with Magic Engine with only the sprite layer showing. There are over 100 sprites on that screen, since there are one hundred candles. From what I know, the PCE can only display 64 sprites on screen at max, so how are so many sprites on the screen in this image? My guess is that each candle isn't it's own sprite, but multiple candles grouped in one sprite box of whatever size. I should menton though that after viewing the story for each candle, the candle is blown out, which makes me wonder how they grouped the blown out candles with the lit ones.

Also this game uses a lot of wavy effects and there is one in particular I'd like to know more about where it shows the flame of a candle up close shifting left and right with invisible horizontal lines through it. I'll have to capture a video of that or something later, it looks really good on a TV.
Title: Re: How'd they do that? Explaining PC Engine tricks.
Post by: ccovell on September 30, 2007, 02:56:53 PM
So does Star Parodia just use animations like that, too? There is some scaling in that game so smooth you'd swear the hardware was doing it.
Can you specify or post a pic of the parts you're referring to?

Yes, the Super CD screen is a large animation.  The PCE can do scaling in software (well, any system can), but it's very slow -- take a look at Metamor Jupiter.

Keranu most likely answered his own questions about Hyaku Monogatari.  A 160x160 area of sprites on-screen isn't impossible by any means.
Title: Re: How'd they do that? Explaining PC Engine tricks.
Post by: malducci on September 30, 2007, 04:39:22 PM
So the Super CD Screen flying away is just animated tiles?  I'm sure the TG could scale small things if the software had a scaling routine written in. 

 The system card has quite a few math routines, but a developer is better off using their own (faster code or with LUT aids). Either way, it's not realistic to try to scale image data in real time. One of the biggest reasons is that console systems don't use linear bitmap style displays, so you have even more overhead of converting the scaled or rotated image into a planer tile format. I know two really fast scaling and rotation methods (no cos/sin or multiplication or add/subs used), too bad the format conversion to planar tile negates the process.

 One method is to pre-scale all the frames in realtime (during a break or low cpu resource part) and then store them in memory for later use. This saves  memory, if you think of it as a form of compression (just more CPU intensive than most compression methods), and can cut down on loading times.  The other method of course is just to have them already prep'd as frames, stored on the CD.

 Funny thing about the PCE; it would have benefited more from the scaling/rotation chip like in the SegaCD, than the SegaCD did, since the PCE is free to write to VRAM during active display unlike the Genesis (or SNES). They could very easily added such a chip to the system card.

Title: Re: How'd they do that? Explaining PC Engine tricks.
Post by: Joe Redifer on September 30, 2007, 04:51:56 PM
About the converting to a planer tile format, does the Genesis work like this as well?  I ask because of the MASAYA logo at the beginning of Target Earth.  The game allows the user to stretch and rotate the logo in real time.  I can't imagine them creating tiles for all of that in advance, it would be unreasonable for such a thing with memory what it was back in those days.  When the logo gets bigger, the adjustments get slower.  It must have a scaling/rotation routine in the software which then converts it to tiles.

I agree about the possibility of a scaling chip for the PCE system card.  That would have rocked!
Title: Re: How'd they do that? Explaining PC Engine tricks.
Post by: malducci on September 30, 2007, 06:13:34 PM
About the converting to a planer tile format, does the Genesis work like this as well?  I ask because of the MASAYA logo at the beginning of Target Earth.

 No, the Genesis uses 4bit linear (packed) format for both tile and sprites - which is easier (and faster!) for doing "pixel plotting" on a tile based system. Yeah, that's real time in Target Earth, you can tell when it slows to a crawl as it gets bigger than normal (in the test) and other rotated angles.

 There was talk of doing another system card (4.0?). It'd be possible to add a coprocessor to it. Maybe an NEC 32bit RISC chip (to keep in the spirit of things) :D  ..one can dream
Title: Re: How'd they do that? Explaining PC Engine tricks.
Post by: Kitsunexus on September 30, 2007, 06:36:10 PM
About the converting to a planer tile format, does the Genesis work like this as well?  I ask because of the MASAYA logo at the beginning of Target Earth.  The game allows the user to stretch and rotate the logo in real time.

So does the Rocko's Modern Life game for SNES. :P
Title: Re: How'd they do that? Explaining PC Engine tricks.
Post by: Black Tiger on October 02, 2007, 09:09:29 AM
I assumed that the 4-in-1 intro was animation, but just for the hell of it, I ran it using the PC Engine System 3 card as soon as I got one.
Title: Re: How'd they do that? Explaining PC Engine tricks.
Post by: Joe Redifer on October 02, 2007, 10:37:36 AM
Yeah, it has to be animation for the 4-in1 since the words "PC Engine" go away when I use the mighty arcade card.
Title: Re: How'd they do that? Explaining PC Engine tricks.
Post by: Keranu on October 02, 2007, 11:40:52 AM
The PCE hardware can't scale any sprites or backgrounds, but by changing the scrolling at each scanline, vertical scaling of backgrounds can be achieved -- a common trick on many game systems.
So is this how they did the scailing in the Arcade Card port of Art of Fighting? I was examining the game recently and I noticed when it scales in, the width seems to remain the same and just the height increases.
Title: Re: How'd they do that? Explaining PC Engine tricks.
Post by: Black Tiger on October 02, 2007, 12:05:04 PM
The PCE hardware can't scale any sprites or backgrounds, but by changing the scrolling at each scanline, vertical scaling of backgrounds can be achieved -- a common trick on many game systems.
So is this how they did the scailing in the Arcade Card port of Art of Fighting? I was examining the game recently and I noticed when it scales in, the width seems to remain the same and just the height increases.

From what I understand, AoF actually switches resolutions, I'm guessing from 256 x 240 to 336 x 240.

The vertical scaling trick would be more like the Lords of Thunder intro when the hero takes off.
Title: Re: How'd they do that? Explaining PC Engine tricks.
Post by: Keranu on October 02, 2007, 12:13:20 PM
The PCE hardware can't scale any sprites or backgrounds, but by changing the scrolling at each scanline, vertical scaling of backgrounds can be achieved -- a common trick on many game systems.
So is this how they did the scailing in the Arcade Card port of Art of Fighting? I was examining the game recently and I noticed when it scales in, the width seems to remain the same and just the height increases.

From what I understand, AoF actually switches resolutions, I'm guessing from 256 x 240 to 336 x 240.
Actually when I checked, the resolution remained at 256x224. Maybe it changes in the actual playing area, but I'm not sure.

Quote from: Black_Tiger
The vertical scaling trick would be more like the Lords of Thunder intro when the hero takes off.
Or my favorite, the opening of Spriggan Mark 2 :) .
Title: Re: How'd they do that? Explaining PC Engine tricks.
Post by: Joe Redifer on October 02, 2007, 12:54:40 PM
Check again.  Art of Fighting changes resolutions.  Count the pixels one by one on your TV screen.   Don't make me post screenshots (in order to do so I think I'd need an Arcade Card image for Magic Engine).
Title: Re: How'd they do that? Explaining PC Engine tricks.
Post by: Keranu on October 02, 2007, 12:58:38 PM
I took screenshots in Magic Engine and the resolution appeared the same, and the screen didn't change while I was playing it either. Probably just a problem with ME then. By the way Joe, you can just use the Super System Card 3.0 ROM to play Arcade Card games in ME.
Title: Re: How'd they do that? Explaining PC Engine tricks.
Post by: malducci on October 02, 2007, 01:41:06 PM
The PCE hardware can't scale any sprites or backgrounds, but by changing the scrolling at each scanline, vertical scaling of backgrounds can be achieved -- a common trick on many game systems.
So is this how they did the scailing in the Arcade Card port of Art of Fighting? I was examining the game recently and I noticed when it scales in, the width seems to remain the same and just the height increases.

From what I understand, AoF actually switches resolutions, I'm guessing from 256 x 240 to 336 x 240.

The vertical scaling trick would be more like the Lords of Thunder intro when the hero takes off.

You called it! That's exactly what it is. The game switches between mid to low res and it uses scanline BG repositioning to scale it vertically. The sprites are changed out in the middle of the process.

Title: Re: How'd they do that? Explaining PC Engine tricks.
Post by: ccovell on October 02, 2007, 07:19:59 PM
Mednafen's emulation isn't perfect, but it does emulate the resolution change mid-screen in Art of Fighting. Here's a little animation I made to show the change:

(http://www.disgruntleddesigner.com/chrisc/images/aof.gif)

The playfield resolution changes from 256 to 304 horizontal pixels.  Of course, on a TV, the pixel aspect is wider in the 256 resolution, so the screen is filled up.
Title: Re: How'd they do that? Explaining PC Engine tricks.
Post by: Black Tiger on October 03, 2007, 06:47:24 AM
I've got another question about horizontal scrolling.

Can a background horizontally scroll into itself, kinda like the vertical scrolling discussed earlier?

Today I played through Lords of Thunder and in a few places some of the horizontal scrolls hit a vertical wall where the bg transitioned to fully flat.
Title: Re: How'd they do that? Explaining PC Engine tricks.
Post by: malducci on October 03, 2007, 01:44:35 PM
I've got another question about horizontal scrolling.

Can a background horizontally scroll into itself, kinda like the vertical scrolling discussed earlier?

Today I played through Lords of Thunder and in a few places some of the horizontal scrolls hit a vertical wall where the bg transitioned to fully flat.

 No. But that would be cool if it could. Lords of Thunder uses dynamic tiles to simulate hsync scrolls, but they're not. Dynamic tiles are either rendered on the fly or pre-rendered, and then sent to the display. This allows you more freedom when mixing tiles, lifting some of the restrictions of just hsync scrolls on a single plane system. You know that large enemy at the beginning of the desert level? That's mostly made of BG tiles. It looks like another layer because the tiles surrounding it, and the whole of the parallaxing tiles, are dynamic tiles.

 I'll post some pics if you need.
Title: Re: How'd they do that? Explaining PC Engine tricks.
Post by: Black Tiger on October 03, 2007, 04:13:53 PM
What I don't get is, if animated tiles are used for bg scroll effects so much, why did developers only use them to simulate such simple effects?

Why not give the bgs a more 3D animation like the SFII floors or have more overlapping pieces of parallax or something?
Title: Re: How'd they do that? Explaining PC Engine tricks.
Post by: Black Tiger on January 14, 2008, 12:29:41 AM
Can anyone tell me if the in-game menu windows of Popful Mail use real wire frame/"vector" graphics or are simply animation?

The shadow 'transparency' effect in this game also looks cool since the screen frame doesn't change.
Title: Re: How'd they do that? Explaining PC Engine tricks.
Post by: ceti alpha on January 14, 2008, 03:05:17 AM
This thread is the bees knees.

Quote
There was talk of doing another system card (4.0?). It'd be possible to add a coprocessor to it. Maybe an NEC 32bit RISC chip (to keep in the spirit of things) Very Happy  ..one can dream

...and dream I will...  :pray:
Title: Re: How'd they do that? Explaining PC Engine tricks.
Post by: Necromancer on January 14, 2008, 04:32:43 PM
Here's a question for the programming geniuses: towards the end of the second level in Sapphire, how is the castle wall warped to look like the perspective is shifting as you fly over?  Is it just animated sprites, or what?
Title: Re: How'd they do that? Explaining PC Engine tricks.
Post by: Black Tiger on January 15, 2008, 12:06:25 AM
Here's a question for the programming geniuses: towards the end of the second level in Sapphire, how is the castle wall warped to look like the perspective is shifting as you fly over?  Is it just animated sprites, or what?

I believe thats an Hsync effect, which Malducci explains on the first page of this thread.
Title: Re: How'd they do that? Explaining PC Engine tricks.
Post by: Necromancer on January 15, 2008, 01:37:51 AM
I believe thats an Hsync effect, which Malducci explains on the first page of this thread.

Thanks.
Title: Re: How'd they do that? Explaining PC Engine tricks.
Post by: nat on January 15, 2008, 02:58:18 AM
Here's a question for the programming geniuses: towards the end of the second level in Sapphire, how is the castle wall warped to look like the perspective is shifting as you fly over? 

That also happens during stage 1 as you fly over the skyscraper. It might happen elsewhere in the game too, I can't remember.
Title: Re: How'd they do that? Explaining PC Engine tricks.
Post by: malducci on January 15, 2008, 04:25:54 AM
Here's a question for the programming geniuses: towards the end of the second level in Sapphire, how is the castle wall warped to look like the perspective is shifting as you fly over?  Is it just animated sprites, or what?

 Yeah, it's the same type of effect that Chris did in his Axelay demo. You can scale or distort the background on the Y axis, pretty easily actually.

Quote
Can anyone tell me if the in-game menu windows of Popful Mail use real wire frame/"vector" graphics or are simply animation?

The shadow 'transparency' effect in this game also looks cool since the screen frame doesn't change.

 Where in the game is the transparency part?
Title: Re: How'd they do that? Explaining PC Engine tricks.
Post by: ParanoiaDragon on January 15, 2008, 08:52:08 AM
I think he's talking about one of the first area's in the game.