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

Tech and Homebrew => Turbo/PCE Game/Tool Development => Topic started by: soop on May 15, 2012, 01:12:34 AM

Title: A few quick (stupid?) questions
Post by: soop on May 15, 2012, 01:12:34 AM
I have a few basic questions I'd appeciate answers to :)

1.  How possible is Sunset Riders on a PC Engine?  And what format is going to be the best balance (like I doubt it would need an arcade card, but a Hucard may be too small)
2.  I guess this is dependant on the format too, but how many distinct tiles could you get away with in a game?  Does it depend on the level?  Can you get away with loading a single level in sections?
3. Wikipedia says the PCE can handle 482 colours on screen out of 512 - is that correct?  And is that in all circumstances?

I'm just reading through Old Rover's excellent HuC guides :D  They're really really good.  I haven't downloaded HuC yet though, I've just been reading through at work.

More questions:

4.  I found this http://pcengine.freeforums.org/pc-engine-colour-palette-for-artists-t60.html - does this mean when I make a 16x16 sprite, I have to use one of these set palettes?
5.  Am I right in thinking a 32 x 32 sprite is made of 4 16 x 16 sprites?
6.  Is there a tool to take a picture and automatically convert it into the PCE's palette?
Title: Re: A few quick (stupid?) questions
Post by: Black Tiger on May 15, 2012, 01:26:18 AM
The PCE can do any kind of 2D game like Sunset Riders. Arcade Card is best if you aren't going to use the biggest HuCard the game could fill. Even if the Arcade Card's load space isn't completely filled, it's worthwhile if a section exceeds 2mb.

Many PCE CD games load stages in section in ways that feel natural, even when porting arcade games that didn't.

16-bit consoles use 16-color palettes for sprites and tiles, with one color invisible (like a GIF). Each system can use up the following number of palettes at once:

Mega Drive: 2 x sprites + 2 x tiles

Super Famicom 8 x sprites + 8 x tiles

PC Engine 16 x sprites + 16 x tiles


It would be hard to display the max number of colors in a regular style games. The best way to approach it would be having a detailed background with variety and tinted sections (transparent lighting, myst, etc effects) and then a 16 uniquely colored sprites, like maybe 8 enemies in an RPG fight made from two+ sprites each.
Title: Re: A few quick (stupid?) questions
Post by: Arkhan on May 15, 2012, 02:13:04 AM
I have a few basic questions I'd appeciate answers to :)

Theres no such thing as a stupid question

Quote
1.  How possible is Sunset Riders on a PC Engine?  And what format is going to be the best balance (like I doubt it would need an arcade card, but a Hucard may be too small)

This has CD game written all over it.  

Quote
2.  I guess this is dependant on the format too, but how many distinct tiles could you get away with in a game?  Does it depend on the level?  Can you get away with loading a single level in sections?

With a CD, infinite, theoretically here.  If you use chip music and save the CD, you could stream tiles to VRAM on the fly.  IIRC, Dynasty Wars does this:

http://pcengine.co.uk/HTML_Games/Dynasty_Wars.htm

If you take the CD out and keep playing, the background starts to disappear as you scroll, lol

Quote
3. Wikipedia says the PCE can handle 482 colours on screen out of 512 - is that correct?  And is that in all circumstances?

You have

Background: (16 palettes * 15 colors) + 1 shared color that every palette uses  = 241
Sprites: (16 palettes * 15 colors because 1 of them is transparent) = 240

So, 481 colors.  

I guess you could say 482, but transparent is not visible, so what the hells the point.  :)

Quote
4.  I found this http://pcengine.freeforums.org/pc-engine-colour-palette-for-artists-t60.html - does this mean when I make a 16x16 sprite, I have to use one of these set palettes?

No, you define your palettes yourself, usually by using a library function that reads the image you are using.  it extracts the palette from it.  This means you could have one palette that is blues (for water maybe?) and another that is green (for grass stuff), and then one that is a mix of some greens and blues, maybe for a robot?  

This is not to say that a sprite can use multiple palettes.  It can't.  You can just duplicate colors within various palettes.  Each sprite can still only use 1 palette... so if you want red and blue on a sprite, you had better put red and blue in the palette you assign to it.


Quote
5.  Am I right in thinking a 32 x 32 sprite is made of 4 16 x 16 sprites?

Not exactly.   a 32x32 sprite is ONE sprite.  It is just loaded in 16x16 chunks.  The hardware treats it as one single sprite.

you can have 16×16, 16×32, 16×64, 32×16, 32×32, and 32×64


Quote
6.  Is there a tool to take a picture and automatically convert it into the PCE's palette?


Just use a paint program that supports PCX.  I prefer NeoPaint, or Grafx2

you then can just include the image in your code and let a library function create a palette for you, easy.

As long as you make sure the colors you use in the paint program are 9bit (RGB values in steps of 36)

Note: Photoshop saves PCX palettes backwards.  You can use GIMP to flip it back to normal.
Title: Re: A few quick (stupid?) questions
Post by: Nando on May 15, 2012, 02:30:19 AM

Note: Photoshop saves PCX palettes backwards.  You can use GIMP to flip it back to normal.

Oh...well that's good to know.


Soop are you going to try and emulate the game or do a conversion?
Title: Re: A few quick (stupid?) questions
Post by: Arkhan on May 15, 2012, 02:36:49 AM
Yes, in GIMP just view the color map, and right click and click the reverse button, shazam! no more backwards bullshit!
Title: Re: A few quick (stupid?) questions
Post by: Nando on May 15, 2012, 02:50:39 AM
Kick ass, thanks for the tip!
Title: Re: A few quick (stupid?) questions
Post by: soop on May 15, 2012, 03:02:21 AM

Note: Photoshop saves PCX palettes backwards.  You can use GIMP to flip it back to normal.

Oh...well that's good to know.


Soop are you going to try and emulate the game or do a conversion?

I am on a flight of fancy.  I get those kind of like bipolar people have happy days.
I'm thinking of going back through the tutorial after and following it to the letter, then making a really simple game of another type, maybe try a super sprint clone with just one level and no AI (and come back to it after).

I think it would be very presumptuous for me to start writing Sunset Riders, but it's a lovely pipe dream to have, so maybe if I get good enough I'll attempt it one day (although this could very well all go nowhere).  It's just nice to know that it's possible.  In fact, just by ripping the sprites from (say) the Megadrive version, it would probably be much easier today than it ever would have been then.

Anyway, thanks very much for the answers Arkhan and Black Tiger, that's perfect!
Title: Re: A few quick (stupid?) questions
Post by: Arkhan on May 15, 2012, 03:04:46 AM
Write games.

Kill whitey.

It's the law around here.
Title: Re: A few quick (stupid?) questions
Post by: Nando on May 15, 2012, 03:16:46 AM

Note: Photoshop saves PCX palettes backwards.  You can use GIMP to flip it back to normal.

Oh...well that's good to know.


Soop are you going to try and emulate the game or do a conversion?

I am on a flight of fancy.  I get those kind of like bipolar people have happy days.
I'm thinking of going back through the tutorial after and following it to the letter, then making a really simple game of another type, maybe try a super sprint clone with just one level and no AI (and come back to it after).


Right on man! DO IT; and what Ark said :D


Title: Re: A few quick (stupid?) questions
Post by: soop on May 15, 2012, 03:59:22 AM

Note: Photoshop saves PCX palettes backwards.  You can use GIMP to flip it back to normal.

Oh...well that's good to know.


Soop are you going to try and emulate the game or do a conversion?

I am on a flight of fancy.  I get those kind of like bipolar people have happy days.
I'm thinking of going back through the tutorial after and following it to the letter, then making a really simple game of another type, maybe try a super sprint clone with just one level and no AI (and come back to it after).


Right on man! DO IT; and what Ark said :D




Might have to wait for part 8 of that tutorial - it's very, very good, but there's still some important stuff coming!
Title: Re: A few quick (stupid?) questions
Post by: soop on May 16, 2012, 03:59:37 AM
At the moment, in my mind, I'm preoccupied considering how possible various parts of Sunset Riders is, and the one I'm having trouble with is the train section (level 2)  The enemies don't really come thick and fast, but thanks to the horses, the amount of sprites is increased significantly.  Also, thankfully, the speed of the bullets going back increases quite significantly, so the chance of slowdown would be decreased from a gun crazy player.

I'm fairly certain 4 player would be off the cards, since we're potentially looking at... 4 extra 32x32 sprites on screen per player (on horseback) and then  let's say an average of 10 bullets each on screen at one time... makes a total of 56 of 64 sprites just for player characters.  

Actually, this is assuming that the 64 onscreen sprite limit is not adjustable depending on the size of the sprites (like you couldn't have 4 times as many 16x16 sprites, so bullet or enemy, it won't make a difference).

ANNNYYway.  The train sequence would require an inordinate number of sprites especially if it was to be closer to the arcade version, which is more detailed somehow .

BUT, what I figured would be possible, is actually have the level scrolling slowly BACKWARDS, with the train and the rails as part of the background, and have the wooden slats on the track, and the earth ridge as sprites flying backwards.  I'm pretty sure this switcharoo would allow more detail, thus making the train possible.  However, 3 full rows of sprites (even if they're only 3 different unique sprites) might actually be too much.  Plus it would be nice to have some sprites left for foreground and background paralax.  And y'know, enemies.

The other thing I don't know about is sprite layers, and whether you could actually mask part of the sprite as the "background" train approaches.

sorry, I'm getting carried away here, it's all getting a bit tl;dr.

Other thoughts; throwing sprites out faster than the vertical blank to try and create some kind of optical illusion with less sprites, and lastly, forgoing the railway slats altogether, with only foreground and background parallax, and the ridge as indicators of motion.  Although it would be a pretty glaring ommission, it would probably allow a near-arcade experience.

Any ideas?

*edit* another strange question; if I decided for one frame to replace everything on the screen with a red background and one masive sprite (I'm thinking of a way to emulate the dynamite explosions, which are HUGE in the arcade) would it absolutely f*ck up the game on a CD (loading times)?  Having to load everything into vram twice, pretty much.
Title: Re: A few quick (stupid?) questions
Post by: nodtveidt on May 16, 2012, 04:16:31 AM
I guess you could say 482, but transparent is not visible, so what the hells the point.  :)
You're forgetting about the overscan color, which can be a different color than all 481 other displayable colors. :) Hence, 482. :)
Title: Re: A few quick (stupid?) questions
Post by: Arkhan on May 16, 2012, 04:30:40 AM
I guess you could say 482, but transparent is not visible, so what the hells the point.  :)
You're forgetting about the overscan color, which can be a different color than all 481 other displayable colors. :) Hence, 482. :)

Oh. duh.  that's the same color as the transparent sprite palette color of the first sprite palette. 

So, yeah, it shows up.

Kinda.  If you really want to count that as "on screen", lol
Title: Re: A few quick (stupid?) questions
Post by: sunteam_paul on May 16, 2012, 04:54:46 AM
At the moment, in my mind, I'm preoccupied considering how possible various parts of Sunset Riders is, and the one I'm having trouble with is the train section (level 2)


Here's the only practical way I can think of:
(http://img401.imageshack.us/img401/1179/sriders.html)

The bars on the left show horizontal parallax. Ignore the separate red and green - both those would scroll at the same speed otherwise it would look daft.
You'd have to do without the slats and have a bit plain colour for the background behind the train. The back rail wouldn't have any exterior slats visible - it would need to be a horizontal gradient only, like the horizon line.
Title: Re: A few quick (stupid?) questions
Post by: Nando on May 16, 2012, 04:57:51 AM
JEEBUS! how big would your character sprites be?
Title: Re: A few quick (stupid?) questions
Post by: sunteam_paul on May 16, 2012, 04:58:45 AM
JEEBUS! how big would your character sprites be?

I think you'd need to scale everything down a bit, Master System style.
Title: Re: A few quick (stupid?) questions
Post by: soop on May 16, 2012, 05:05:31 AM
JEEBUS! how big would your character sprites be?


They would be 2 32x32 sprites for the character, since the top moves independantly from the legs, for aiming.  With the horses as well, I guess we're looking at 2 more of the same 32x32 sprites, but they do look bloody big.

Paul, I think you're right, that probably is the only way to do it, although if that top layer is sprites (and it's still adding a lot of sprites), we might be able away with a more faithful look with fewer sprites.

I am intrigued though - did  you just knock that up?  I don't recognise it as an existing version, and the colour palette does look very PC Enginey.  How did you do it?

*edit* plus, if we do get away with fewer sprites along the top layer, we might even have enough left for some rudimentary foreground cacti - if we're not horrendously over-budget already.

JEEBUS! how big would your character sprites be?


I think you'd need to scale everything down a bit, Master System style.


Damn.  I just checked, and for the SNES version, which I was assuming I could just rip, the sizes are really non-standard.  The sprites are probably 32px high, but they're about 22 long, and the horse is well over 64 px long, and I'm guessing in some frames, over 64 px high.  I'm using paint in zoom, but here's the SNES sprites for Billy: http://www.spriters-resource.com/snes/sunsetriders/sheet/15665

And FYI, the Genesis sprites look like shit.
Title: Re: A few quick (stupid?) questions
Post by: sunteam_paul on May 16, 2012, 05:11:51 AM
JEEBUS! how big would your character sprites be?

They would be 2 32x32 sprites for the character, since the top moves independantly from the legs, for aiming.  With the horses as well, I guess we're looking at 2 more of the same 32x32 sprites, but they do look bloody big.

Paul, I think you're right, that probably is the only way to do it, although if that top layer is sprites (and it's still adding a lot of sprites), we might be able away with a more faithful look with fewer sprites.

I am intrigued though - did  you just knock that up?  I don't recognise it as an existing version, and the colour palette does look very PC Enginey.  How did you do it?

*edit* plus, if we do get away with fewer sprites along the top layer, we might even have enough left for some rudimentary foreground cacti - if we're not horrendously over-budget already.

The top (mountains) would be a BG layer. You just have to make sure the train never overlaps it. You'd never get away with a complete horizontal layer of sprites.

The pic was an arcade shot I found on Google images. I just painted some stuff out and stuck the mountains from the Mega Drive version on it.
Title: Re: A few quick (stupid?) questions
Post by: soop on May 16, 2012, 05:16:32 AM
JEEBUS! how big would your character sprites be?

They would be 2 32x32 sprites for the character, since the top moves independantly from the legs, for aiming.  With the horses as well, I guess we're looking at 2 more of the same 32x32 sprites, but they do look bloody big.

Paul, I think you're right, that probably is the only way to do it, although if that top layer is sprites (and it's still adding a lot of sprites), we might be able away with a more faithful look with fewer sprites.

I am intrigued though - did  you just knock that up?  I don't recognise it as an existing version, and the colour palette does look very PC Enginey.  How did you do it?

*edit* plus, if we do get away with fewer sprites along the top layer, we might even have enough left for some rudimentary foreground cacti - if we're not horrendously over-budget already.

The top (mountains) would be a BG layer. You just have to make sure the train never overlaps it. You'd never get away with a complete horizontal layer of sprites.

The pic was an arcade shot I found on Google images. I just painted some stuff out and stuck the mountains from the Mega Drive version on it.

That would actually work.  Really well.  I was considering straight sky, and a few sprites dotted around going slowly, but like I say, I don't know anything about layering on the PCE.

Although, if you would never get away with a complete  horizontal layer of sprites...  What about the red layer?
Title: Re: A few quick (stupid?) questions
Post by: sunteam_paul on May 16, 2012, 05:20:42 AM
Ignore the red layer. It should be part of the foreground layer marked green. It contains all the ground and the first rail on the track. The train would sit above it on another layer.
Title: Re: A few quick (stupid?) questions
Post by: soop on May 16, 2012, 05:23:51 AM
Ignore the red layer. It should be part of the foreground layer marked green. It contains all the ground and the first rail on the track. The train would sit above it on another layer.

That makes sense...  But do we get 2 background layers?  I thought we only had one.  I was thinking the red layer was a sprite layer running right to left at speed, while the whole level, including the train as the background layer scrolls slowly left to right?
Title: Re: A few quick (stupid?) questions
Post by: sunteam_paul on May 16, 2012, 05:29:28 AM
When I say layer, I just mean horizontal scrolling layer. There would be 3 for this level: The ground (including the foreground part of the track), the train and the mountains in the background. No sprites needed.
Title: Re: A few quick (stupid?) questions
Post by: soop on May 16, 2012, 05:40:56 AM
When I say layer, I just mean horizontal scrolling layer. There would be 3 for this level: The ground (including the foreground part of the track), the train and the mountains in the background. No sprites needed.

Ok, this is going to sound really stupid, but - the PCE can handle paralax scrolling?!
Title: Re: A few quick (stupid?) questions
Post by: Nando on May 16, 2012, 05:41:15 AM
JEEBUS! how big would your character sprites be?

I think you'd need to scale everything down a bit, Master System style.

Not sure how the MS does it. So the sprite is created bigger and then scaled via hardware/software?
Title: Re: A few quick (stupid?) questions
Post by: Necromancer on May 16, 2012, 05:45:21 AM
Ok, this is going to sound really stupid, but - the PCE can handle paralax scrolling?!

* giant facepalm *
Title: Re: A few quick (stupid?) questions
Post by: spenoza on May 16, 2012, 05:53:14 AM
No, to get the sprites smaller you simply redraw them at a smaller size. This is pretty common practice in ports.

Also, the PC Engine cannot support more than a single background layer, meaning it can't do parallax that way. It can use hsync tricks to make different non-overlapping parts of the background scroll at different speeds and use sprites to aid in the trickery.
Title: Re: A few quick (stupid?) questions
Post by: Arkhan on May 16, 2012, 06:03:21 AM
Watch the atlantean video at www.youtube.com/aetherbyte (http://www.youtube.com/aetherbyte)

theres some paralulz

its better than that now, though. 


Parallax is simply the process of scrolling parts at different speeds

This is not to be confused with layering which is often combined with parallax.

Layers != parallax.

Layers w/ Parallax = better parallax.
Title: Re: A few quick (stupid?) questions
Post by: Nando on May 16, 2012, 06:10:11 AM
No, to get the sprites smaller you simply redraw them at a smaller size. This is pretty common practice in ports.


AH, I was just over complicating shit in my head.
Title: Re: A few quick (stupid?) questions
Post by: sunteam_paul on May 16, 2012, 06:20:50 AM
When I say layer, I just mean horizontal scrolling layer. There would be 3 for this level: The ground (including the foreground part of the track), the train and the mountains in the background. No sprites needed.


Ok, this is going to sound really stupid, but - the PCE can handle paralax scrolling?!

Title: Re: A few quick (stupid?) questions
Post by: nodtveidt on May 16, 2012, 10:35:39 AM
Tons of PCE games have parallax... layers just make it easier to do. Whether you use h-int trickery, dynamic tiles, sprite overlays/underlays, or a combination of any of the three... ultimately, it's pretty easy to do, but just not as easy as on a layered system. Complex, multi-directional backgrounds are difficult with only a single layer, but that too doesn't mean that it can't be done... Frozen Utopia's Jungle Bros' later scenes feature semi-complex multi-directional parallax pulled off via a combined strategy of dynamic tiles and sprites.
Title: Re: A few quick (stupid?) questions
Post by: soop on May 16, 2012, 10:29:05 PM
Tons of PCE games have parallax... layers just make it easier to do. Whether you use h-int trickery, dynamic tiles, sprite overlays/underlays, or a combination of any of the three... ultimately, it's pretty easy to do, but just not as easy as on a layered system. Complex, multi-directional backgrounds are difficult with only a single layer, but that too doesn't mean that it can't be done... Frozen Utopia's Jungle Bros' later scenes feature semi-complex multi-directional parallax pulled off via a combined strategy of dynamic tiles and sprites.

Ok, so dynamic tiles are basically animated background tiles, correct?
Title: Re: A few quick (stupid?) questions
Post by: nodtveidt on May 16, 2012, 10:53:08 PM
Ok, so dynamic tiles are basically animated background tiles, correct?
Yeah. You copy new data to VRAM at the address of the tile you want to change. That's the most efficient way of doing it. If you've ever seen the Monolith prototype videos... I use dynamic tiles for the three-layer lower parallax in the village, and then again in the dungeon for the distant red brick patterns. Both areas also have sprite underlays for additional parallax. The Jungle Bros demo uses the h-int parallax technique together with sprite overlays for depth, though later areas use dynamic tiles with sprite overlays to really look nice. :) It's not too hard to do, but it can take a lot of prep work.
Title: Re: A few quick (stupid?) questions
Post by: soop on May 17, 2012, 02:57:41 AM
Ok, so dynamic tiles are basically animated background tiles, correct?
Yeah. You copy new data to VRAM at the address of the tile you want to change. That's the most efficient way of doing it. If you've ever seen the Monolith prototype videos... I use dynamic tiles for the three-layer lower parallax in the village, and then again in the dungeon for the distant red brick patterns. Both areas also have sprite underlays for additional parallax. The Jungle Bros demo uses the h-int parallax technique together with sprite overlays for depth, though later areas use dynamic tiles with sprite overlays to really look nice. :) It's not too hard to do, but it can take a lot of prep work.

I see!  Ok, so I can see that that would be a great way to get the rails in...  You'd only need about 6-12 different tiles, I'd imagine.

Really looking forward to more tutorials by the way.  How many more do you think you'll do?
Title: Re: A few quick (stupid?) questions
Post by: nodtveidt on May 17, 2012, 03:56:15 AM
"Crash course" is only 11 tutorials. I might do some game-specific tutorials later on... I'm working on a vertical shooter engine right now that I might eventually turn into a tutorial, and of course I'll also do a comparative tutorial on the differences between hucard productions and CD productions.
Title: Re: A few quick (stupid?) questions
Post by: soop on May 17, 2012, 04:03:12 AM
"Crash course" is only 11 tutorials. I might do some game-specific tutorials later on... I'm working on a vertical shooter engine right now that I might eventually turn into a tutorial, and of course I'll also do a comparative tutorial on the differences between hucard productions and CD productions.

Fantastic!  You're a huge asset to the community, and I really like your style of tutorial.  It's very much how I learn best, and (perhaps because I'm more interested) one of the best programming tutorials I've read.
Title: Re: A few quick (stupid?) questions
Post by: sunteam_paul on May 17, 2012, 06:18:45 AM
As good as they are, I don't think using dynamic tiles for the rails is going to be a good solution, especially with the train speeding up and slowing down, while the rails move at the faster background speed. It's a recipe for disaster.
Title: Re: A few quick (stupid?) questions
Post by: spenoza on May 17, 2012, 06:27:08 AM
I think it would be a better idea to alter the perspective a little and simply make it so the track and wheels are obscured by the foreground. Then you can just have the train cars flying by.