Author Topic: PCE projects  (Read 1044 times)

Charles MacDonald

  • Newbie
  • *
  • Posts: 14
PCE projects
« on: April 09, 2010, 02:15:10 PM »
Here's some recent stuff I did:

http://cgfm2.emuviews.com/temp/bonk.pce

This shows how to do "true" transparency on the PCE using the "Jackie Chan" sprite priority trick. The transparent stars are sprites and while I didn't add any movement to the program, they can be freely positioned anywhere on the screen and the transparency effect will continue to work.

The trick works like this: The background image is a blue-tinted Bonk made of tiles, and the foreground is a normal colored Bonk made out of high priority sprites. The stars are low priority but placed first in the sprite list, ahead of the Bonk foreground sprites. This means that when the stars overlap Bonk, the Bonk sprites aren't shown and the blue-tinted background image is forced to the front. That's how the transparency on Bonk works.

The background is a gradient done by changing the color every scanline. The graphics data for the low priority star sprites is also a gradient and the colors for each line are changed as the sprites move vertically (though they don't move in this program).

The only catch there is that the sprites are 32x32, but only have 15 colors. So lines 0-14 are palette #0, lines 15-30 are palette #1, line 31 is palette #2, etc. You need 2 or 3 palettes per star shown, so there is an upper limit.

In terms of CPU power the only work you do during VBlank is to load a new animation frame for the rotating star, and update 31 sprite colors, per star, so the star gradient order matches the background gradient order. If the vertical position doesn't change you can skip the palette update.

Note: If using YAME crank up the CPU speed to make the gradient visible. Or if you want to see the effect without the gradient, use the lower CPU speeds.

Special thanks to Fragmare for converting and color-correcting the Bonk image!

http://cgfm2.emuviews.com/temp/SloMoCompoEntry.zip

Designed to make your ears and eyes bleed, just an April Fools joke. But sources are included! ;D
Sit close to the TV and turn the sound up before you turn on your PC Engine!


Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: PCE projects
« Reply #1 on: April 09, 2010, 06:55:48 PM »
awwww! This again!  I Remember this! ..... only because it didn't work in Ootake that one day :D

but it works in Mednafen and looks great!  Now I know how they did that stuff.  This is like for the water, and stuff in Bonk 1?




seizure didn't load up in Mednafen though.   :(  Though maybe its a good thing that it didnt :)
[Fri 19:34]<nectarsis> been wanting to try that one for awhile now Ope
[Fri 19:33]<Opethian> l;ol huge dong

I'm a max level Forum Warrior.  I'm immortal.
If you're not ready to defend your claims, don't post em.

ParanoiaDragon

  • Hero Member
  • *****
  • Posts: 4619
Re: PCE projects
« Reply #2 on: April 09, 2010, 07:13:34 PM »
Awesome Charles!  Maybe we'll use this trick if'n somebody wants to make Turbo versions of the other Bonks someday :D

Anyhoo, I'm pretty sure this isn't how it was done in Bonk's 1-3.  I'm fairly certain that in those, once Bonk is about halfway into the water, it switches Bonk to a new set of frames that are blue.  I could be wrong, since, I don't code.  Impossamole does the same thing, & I'm sure other games as well.  But this demo is much nicer, I wonder if it really could be used for something like a Turbo version of Super Bonk 1 & 2(SB1's water area's are almost always entirely water, with no transition except in one or 2 area's, so, this trick wouldn't be needed for water, but, maybe for transparent clouds?).

touko

  • Hero Member
  • *****
  • Posts: 957
Re: PCE projects
« Reply #3 on: April 09, 2010, 09:27:58 PM »
Excellent, but have you some glishes due to color changing on every scanline on true hardware ????

shubibiman

  • Hero Member
  • *****
  • Posts: 1832
Re: PCE projects
« Reply #4 on: April 09, 2010, 11:26:41 PM »
I tried on real hardware but it wouldn't work ;(
Self proclamed Aldynes World Champion

esteban

  • Hero Member
  • *****
  • Posts: 24063
Re: PCE projects
« Reply #5 on: April 10, 2010, 12:06:08 AM »
Sounds kool, Charles. :)

ASIDE: Now, who will be kind enough to make a video of this for me?
  |    | 

Charles MacDonald

  • Newbie
  • *
  • Posts: 14
Re: PCE projects
« Reply #6 on: April 10, 2010, 10:02:35 AM »
Excellent, but have you some glishes due to color changing on every scanline on true hardware ????

Uh oh! Thanks for the bug report. I will try to get it fixed up and release an update with sources included.

touko

  • Hero Member
  • *****
  • Posts: 957
Re: PCE projects
« Reply #7 on: April 10, 2010, 11:03:58 PM »
Uh oh! Thanks for the bug report. I will try to get it fixed up and release an update with sources included.

Eh, thanks for source code, this will help me for resolving my own problem :wink:

I have the same problem, on a copper effect, but for the moment, i have no time to spend for resolve it .
I've  been thinking that the problem was due to my ASM code who's not speed enought.

Same bug seems to be appears in fade_in fade_out effects, same kind of technic (palette changing) ..
« Last Edit: April 10, 2010, 11:17:18 PM by touko »

Charles MacDonald

  • Newbie
  • *
  • Posts: 14
Re: PCE projects
« Reply #8 on: April 11, 2010, 10:11:23 AM »
Quote
Same bug seems to be appears in fade_in fade_out effects, same kind of technic (palette changing) ..

Oh! I think I know what you mean.

When you change the palette during the active display period (e.g. outside of VBlank or HBlank) the VCE has flickering output for the duration of the CPU write to $0404 or $0405. This looks like horizontal lines of solid color on the screen.

To fix it, you just need to make sure you always update the palette within VBlank or HBlank. In the Bonk demo, the raster interrupt code takes too long before it writes the new colors, and that causes the flicker you are seeing.

For your palette fade-in/out problem, maybe you can do this:

1. Ensure the fade routine is running during VBlank. Maybe it should be the first thing you do in your VBlank handler instead of later. Often VBlank routines run too long, and the code at the end is actually running at the 'top' of the screen in the active display area.

2. Rewrite the code to make it faster in case it is taking too long.

It can be helpful to keep a copy of the palette in work RAM so that during fades, you don't have to read the palette data from the VCE, modify it, and write it back. Also you may be able to get away with only fading some palettes or palette entries instead of all of them.

It's a really easy mistake to make, because I developed the Bonk demo in an emulator I totally forgot. ;D
For your palette fade, are you using HuC functions or your own?

touko

  • Hero Member
  • *****
  • Posts: 957
Re: PCE projects
« Reply #9 on: April 12, 2010, 12:22:23 AM »
Thanks for your help charles ..

Yes i have already tried to do palette changing after a vsync, but nothing was changed ..
 
Quote
It can be helpful to keep a copy of the palette in work RAM so that during fades, you don't have to read the palette data from the VCE, modify it, and write it back. Also you may be able to get away with only fading some palettes or palette entries instead of all of them.

It's a really easy mistake to make, because I developed the Bonk demo in an emulator I totally forgot. ;D


I use a custom function based on aramis's fade_in fade_out for huc,with some asm in it ,and some optimisations too .
Only used palettes are faded ..

Quote
For your palette fade, are you using HuC functions or your own?

Yes i'am using get_color() and set_color() for read and write colors in VCE ..


« Last Edit: April 19, 2010, 08:40:11 AM by touko »

touko

  • Hero Member
  • *****
  • Posts: 957
Re: PCE projects
« Reply #10 on: April 21, 2010, 11:07:38 PM »
I have tried to make copper effect in full ASM, and the result was good, without artifacts ..
The same program in HUC shown glishes on screen.

I suppose that HUC is very bad (to slow) for this trics.

The question is, how to make a scd overlay with magickit ??  :mrgreen:

and is it possible to mix some huc an magickit overlays ??  :pray:
« Last Edit: April 21, 2010, 11:09:59 PM by touko »

Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: PCE projects
« Reply #11 on: April 22, 2010, 02:20:26 AM »

The question is, how to make a scd overlay with magickit ??  :mrgreen:

and is it possible to mix some huc an magickit overlays ??  :pray:

You can mix em IIRC.

And you make them the same way you do with HuC, :D  but its -over instead of -ovl
[Fri 19:34]<nectarsis> been wanting to try that one for awhile now Ope
[Fri 19:33]<Opethian> l;ol huge dong

I'm a max level Forum Warrior.  I'm immortal.
If you're not ready to defend your claims, don't post em.

touko

  • Hero Member
  • *****
  • Posts: 957
Re: PCE projects
« Reply #12 on: April 22, 2010, 03:30:47 AM »
Thanks arkhan  :wink:

But for the moment, i don't know how ta make a scd executable with mkit ..

because : pceas.exe -scd toto.asm don't work (can not open file "cdstart.asm")  :evil:
« Last Edit: April 22, 2010, 03:42:41 AM by touko »

shubibiman

  • Hero Member
  • *****
  • Posts: 1832
Re: PCE projects
« Reply #13 on: April 22, 2010, 03:47:47 AM »
Is there a new version of this demo that would work on real hardware? It seems my previous post has been overlooked.
Self proclamed Aldynes World Champion

touko

  • Hero Member
  • *****
  • Posts: 957
Re: PCE projects
« Reply #14 on: April 22, 2010, 04:03:57 AM »
Non !! :mrgreen: