David Haywood's Homepage
MAME work and other stuff
February 28, 2013 Haze Categories: General News. 44 Comments on Does It Blend?

Why, yes, it does


Cool Riders Cool Riders
Cool Riders Cool Riders
(4 different places blending is used for effect)

I’ve done an initial implementation of the blending in Cool Riders, turns out the basic logic is

If a sprite has palette value of 0x8000 it’s transparent, always.
A value < 0x8000 is a solid 555RGB colour A value > 0x8000 is a blended 555RGB colour

when a Colour is blended a sprite attribute is used to decide the blending level, this goes between 0x0 (full blend, MAYBE 100% invisible) to 0x7 (no blend, solid)

Implementing this was more work than I expected, mainly because it broke my zbuffer implementation, because in some cases transparent sprites were being sent to the display by the game before the sprites they were meant to cover, causing them to cut holes in sprites and show the background instead. The only real way to fix this was to sort all the sprites based on their z value before drawing which meant a slight change in the way things were being done was needed.

Having done that, I was able to get the above screens, and blending seems correct in the cases where it’s used now.

One thing that threw me off when trying to figure out the blending at first was that ALL the road pixels had the 0x8000 bits set, why would you want to blend the road? The only thing underneath it is the background! It turns out that most sections of the road actually have the 0x7 value set for the blend level, meaning they render as solid, but during my testing (rendering different values of that register as random colours every frame) I noticed that some bits of the road actually had different blend values set, in increasing amount. It turns out the blending is used for a most unexpected effect too, blending the end of one road terrain type with the start of the next! The screenshots below show the road between stages first, on the left from an earlier build without blending, and the right the current code, with blending applied, kinda neat.


Cool Riders Cool Riders
(Left, old code, no blending | Right, new code, blending used between road sections)

This is also used to great effect on short tunnels and the like. The road blending also gets used to show sprites below the tunnel for a special effect when entering the extra stage, as the first lot of screenshots show.

Of course doing all this slows things down a bit, so I’ve actually spent most of the past 2 days coming up with optimizations, including an object tile caching system so that we can avoid calling the RLE decoder too often, as decoding entire rows of 16×16 tiles each time just to draw a tiny road line in the background is not an insignificant waste of CPU power! All that got it up to a decent enough speed on my system, before all the extra effects dragged us to around where we were before, so time well sent.

Additionally I improved the full-screen RGB effect logic, so it now actually gets applied to the full screen instead of just the tilemaps, but it will need a video to demonstrate that, and I don’t have time to do one tonight, later maybe.


Content not available.
Please allow cookies by clicking Accept on the banner

(Video showing the latest progress, cropped to a single screen)


Content not available.
Please allow cookies by clicking Accept on the banner

(same video, without cropping so you can see the attract on the 2nd screen)

A few graphical glitches remain, but nothing major and it’s feasible the ones we have left could be original bugs although I do have a few things to try first. The sound is still buggy, but as of now the game is marked as WORKING.

44 Comments

You can follow any responses to this entry through the RSS 2.0 feed.

WORKING! Wait, is there an echo in here?

Thanks Kale. And Haze too. :)

Yes! This is the best! Vamola Haze!!

This might seem like a dumb question, but why do you have to manually implement all this sprite handling, decoding and blending logic? Was it done by custom chips that aren’t emulated yet? I mean, something in the hardware on the original board used to do what you’re now doing in software, right?

The original bugs would be the ending Text for each of the respective bikers?

Only one biker seems to have any ending text at all.

The others have 2 pictures, which now fade between each other (I don’t know if you get a different one if you finish first, only managed to once by luck ;p)

The first picture doesn’t quite fade to 0 at the moment, which makes me think that a blend value of 0 should actually be fully invisible.

The bug I’m talking about is actually a red bar under the ending of the ‘LoveMachine’ but it’s possible I need to sort the clipping commands with the sprites, the ending uses what seems like an extra clip-window brute forced in, and I already have a hack to deal with it. I’m going to look into that one anyway.

The slightly ugly scaling on some text may or may not be a bug too, precision of emulated zooms is rarely accurate and it’s possible the game font was tuned around exactly which pixels get dropped. I won’t be investigating that in the short term.

In all honesty I think the game ended up being rushed out the door, the endings are all very minimal, and the stage theme reuse (and many objects / parts of stages beyond that) seems very cheap / lazy, with reports it was ‘finished’ in 1994 and only shipped in 1995 make me wonder if it wasn’t originally canceled then sold anyway to shift the stock.

and right, you have to emulate the custom chips.

Cool Riders basically uses different custom chips for the video than any other Sega title, it’s what makes it unique.

Emulation is all about understanding what the hardware does and implementing it in software either through working it out from what the game attempts to do, as I have here, or from testing on real hardware (often needed to nail down exact behavior, or discover things the game(s) don’t even use and you’d have no way of knowing otherwise) In some rare occasions there will be full docs, either official or unofficial, but typically customs used on arcade systems aren’t documented.

Tonight, I just listened to thr sound test for each channels but the problem is that it played both at the same time rather than just being on an individual channel no matter what channel test it out, maybe its part of the sound bug

Sorry for spelling mistakes because I typed it on the iPhone

Thanks for the explanation. I’m not being critical, I’m just trying to understand how this works. I find it fascinating.

So if these custom chips were better documented and understood (and used by more games/systems), they would probably be implemented as proper standalone devices, right?

Krick, are you talking about the real board?

if the chips were used elsewhere and their individual functions identified then they could be converted to devices, as it stands there isn’t really much point, it’s just another way of representing things.

that’s not really a concern at the ‘figure out how stuff works’ stage anyway where you simply want to be able to try out new ideas and perform tests as quickly and easily as possible.

test mode runs both screens. if you play with the volume sliders in MAME you can tell that each screen has 2 of the 4 SCSP channels dedicated to it.

the sound problem is likely some kind of dma / irq / comms problem of some sort.

the sega other system like system 32 driver if has use the same video chip as the cool riders?

learn to read.

No, it’s not the same, Sega H1 has their own board differs to any other non-Polygonal board.

Although the production values are scrappy in places, it’s great to finally see the swan-song of Sega’s Sprite Scalers released almost 10 years after Hang-On and Enduro from a pure historic game dev point of view.

Some of the road texturing, level design and effects are truly mind-bending for what is 2D hardware. The actual game engine and codebase must have been relatively complex.

It’s somewhat reminiscent of the final pre-CGI Hollywood blockbusters, reflecting the pinnacle in evolution of a particular technology path.

It’s a shame the game didn’t have the same solid art direction and production values of the 80s scaler titles. But as we know, those teams had moved onto the 3D hardware by this point.

Good work!

In some ways, I’m surprised the level of pop-up is as high on this title, given that it was 2D.

Given the absence of pop-up on the earlier Sega titles, it’s a shame they didn’t manage to carry that trend on. (Mind you OutRun deals with this by simply dropping sprites on occasion, for example on the Gateway course.)

I guess the computation of the pseduo-3D environment must have been extreme, even with hardware scaling.

Great work Haze another one in the pot so to speak i read the WIP
from start to finish find it really interesting to see a non working
game go through the various stages on route to being fully playable
if one day you write a book about your mame dev days id
certainly give it a read :)

yeah the popup is surprisingly bad.

the game IS driving 2 496×384 (medium resolution) monitors whereas while OutRunners is 320×224 per screen ingame meaning this has 2.66x more pixels to cover, BUT at the same time this is only pumping out 30fps, and you really notice it, OutRunners was a solid 60 for most of the time so it’s not actually doing much more at all.

It also has to having to draw all the road with sprites, when instead OutRunners used the 2nd tilemap in line mode, that’s no doubt eating up a lot of the sprite capacity that could have otherwise been used to improve the popup situation.

Trivia, Outrunners flips to 416×224 to show the For Use In Japan warning, because it won’t fit the number of tiles otherwise, this instead remains at 496×384 but draws it all using scaled sprites.

Amusingly, Sega’s marketing team chose to describe the time as sporting “Virtual Reality with real-time 3D graphics”:

Ref: http://flyers.arcade-museum.com/?page=flyer&db=videodb&id=225&image=2

They also chose the term ‘realistic biking action’

I can only guess they hadn’t played it

great write-ups Haze. Even if the stuff was over my head in some places, I enjoyed reading about it.

And “motocross simulator”, where “motocross” is normally an enclosed dirt track.

You’d might be thinking of Namco’s Motorcross Go!

At the end of England stage @ 3:38, there’s a castle from Spain.

If you remember/play Super Pang, it’s the “castle” at Spain stage.

It’s the Alcazar of Segovia, my city.

They gave us a lesson of geography xDDDDD

FANTASTIC.
Commando work.

With your permission, Haze, can I post this on the MAMEWorld forums? I didn’t want to do it without your apporval.

I already posted it by myself on the forums

You don’t need my permission to spread news I post ;-)

Man… I wanted to do that…

It’s on the post called “Will it Blend?”

I really read the Segaretro site and states that this game is only released in Japan and the USA, but it might be wrong because the test settings contains an “export” version to release around Europe and Asia, and even there’s a video of someone playing this game in Thailand:

http://www.youtube.com/watch?v=KeK7pQlyn3E

Haze/Kale, how about some progress, screenshots, etc., on Gunpey? :D

will do later.. if Kale doesn’t first ;-)

Embryoice, I clearly remember playing it here in Portugal (Europe) about 15 years ago, that’s why I’ve been eagerly waiting for its emulation. And yes, it’s was the same game, I remember the “Born To Be Wild” playing at the attract screen.

Also, it wasn’t in a popular huge arcade, no. It was in a very tiny, old mall. I haven’t seen it anywhere else though. It was there until a few years ago, I’ll have to check if it’s still there.

I wanted to repost it, and see if I land main page in MAMEWorld.

Fantastic work as always.

I was just wondering…. the sound seems to be pretty well sorted listening to the video, but there is one sound in particular that seems to stick.

Is it doing anything different with this particular sound effect?

I’m not entirely sure about the sound issues and why they occur, it’s a pretty weird setup. I know that isn’t much help, but it isn’t an area I’ve looked at myself, I’ve concentrated on the graphical side of things.

Amazing! I would very much like to know which MAME version would help me play this! :D

The progress will (officially) be released with 0.148u2 whenever that comes out, although it is possible to roll your own before then.

Sound issues remain unfortunately.

Very nice. Will the sound issues be worked on, either by you or by any other MAMEDev?

Not sure, I hope so, but we’ll see.

For now I’m leaving the code as it is because I consider it ‘stable’ and don’t want to make anything worse than it already is before the next u update, after that I’ll play with a few bits and pieces in the driver again and might look at the sound when doing that to make sure nothing obvious was missed.

Amazing work! Please finish this!@!!@!!!!

It would be great if you did. The OST is a vital aspect of the game!

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close