Five clock per pixel RLE mode

Topics related to the API, programming discussions & questions, coding tips, bugs, etc. should go here.
User avatar
Jubatian
Posts: 1560
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Re: Five clock per pixel RLE mode

Post by Jubatian »

Now it shows off a bit more indeed! It is easier to feel what it could become later!

What I see right now in it could be a Pole Position style game of course with just simple cars, but it would still be something quite different from existing Uzebox games.

But of course the ideas you mentioned (particularly Super Hexagon which once you have a good mode for flat polygon graphics maybe isn't even very complicated to realize) are also nice and could reveal a different side of Uzebox! :)
User avatar
Artcfox
Posts: 1382
Joined: Thu Jun 04, 2015 5:35 pm
Contact:

Re: Five clock per pixel RLE mode

Post by Artcfox »

I'm super psyched about this video mode, partly because I can understand it all at the assembly level, and also because of the potential for such radically different games. I'd love to see a de-make of Rez HD.
User avatar
D3thAdd3r
Posts: 3175
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: Five clock per pixel RLE mode

Post by D3thAdd3r »

Makes more sense now, I really like this. It seems like one possible thing that would fit well within time limits(and be within my asm skill to actually finish), is code that grabs from a table following a vector as it scans horizontally for some of the texture mapping looking floors done on SNES. I would have to make a mock up to see how much is possible, but I wonder if something like a cut down version of the original Mario Kart on SNES would be possible if using the SPI Ram and low color counts for a texture lookup table?!
CunningFellow
Posts: 1445
Joined: Mon Feb 11, 2013 8:08 am
Location: Brisbane, Australia

Re: Five clock per pixel RLE mode

Post by CunningFellow »

I've got another mode up my sleeve that will maybe interest you after this one has a good demo or game done on it.

BTW - does the commented ASM make sense. Is everyone able to understand the control flow?

I like to make my comments good enough for me to understand the code if I come back to it 6 months later.

Especially when it is as hairy as this is.
CunningFellow
Posts: 1445
Joined: Mon Feb 11, 2013 8:08 am
Location: Brisbane, Australia

Re: Five clock per pixel RLE mode

Post by CunningFellow »

Sorry for the slow progress.

I've had some more "excitement" around here from crazy malicious people and police.

Here is a triangle. It requires the USART interrupt modified version or cuzebox to run. Of course it runs on real hardware also.

At this point in time I can, if I want to waste time in a spreadsheet, add many more triangles to the screen.

Up to 128 of them if they have flat bottoms (or 85 if they are not flat bottomed)

I can have up to 32 of them on any one scan line.

Once the triangles are added to the list, they take ZERO user time CPU clocks to draw. So it is actually faster to draw these filled polygons in this mode than it is to draw wire frames in tempest/asteroids modes. Its much more expensive to draw lots of little things like particles/explosions/stars here, but big flat triangles are very cheap relative to the other modes.

In fact a flat bottomed triangle takes 16 bytes of RAM no matter how big it is.

I'm just doing some casting of the final uzebox portable and then I will finish off this demo with some spinning polygons or something to show it off more.
Attachments
RLE_Demo.uze
(11.55 KiB) Downloaded 554 times
User avatar
Jubatian
Posts: 1560
Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:

Re: Five clock per pixel RLE mode

Post by Jubatian »

Wow, so it seems like we are going to have a polygon engine here, then? :)

(Maybe in the holidays I will revisit CUzeBox to add a complete UART, necessary anyway if someone would like to have the ESP8266 later)
CunningFellow
Posts: 1445
Joined: Mon Feb 11, 2013 8:08 am
Location: Brisbane, Australia

Re: Five clock per pixel RLE mode

Post by CunningFellow »

I've made it easier to add lines now.

It takes only a few clock cycles to clear the screen (Clearing a linked list). The picture shown here only uses a few 100 clocks of user time to draw. Most of the work is being done in ASM code while the screen is being rendered.

Each transition added requires 8 bytes to be written to "Line RAM" using the following structure

Code: Select all

typedef struct {
	uint8_t next;
	uint8_t col;
	uint8_t y1;
	uint8_t x1Lo;
	uint8_t x1;
	int16_t m;
	uint8_t y2;
} GradLineStruct;
This screen shown is a total of 9 lines added to the screen. The maximum number of lines that can be added is 255.

Obviously it is expensive to work out M. But you needed to do that anyway for hidden surface removal as soon as you start playing filled polygon games.
Attachments
RLE_Triangle2.jpg
RLE_Triangle2.jpg (23.42 KiB) Viewed 10994 times
User avatar
Artcfox
Posts: 1382
Joined: Thu Jun 04, 2015 5:35 pm
Contact:

Re: Five clock per pixel RLE mode

Post by Artcfox »

With 9 lines, does that mean that overlaps are essentially free? I would have thought that you needed to break that up into 11 polygons.
CunningFellow
Posts: 1445
Joined: Mon Feb 11, 2013 8:08 am
Location: Brisbane, Australia

Re: Five clock per pixel RLE mode

Post by CunningFellow »

The video mode. That is the part of the code that renders pixels to the screen from a list of lines in the form Y=MX+C does not care what it draws.

It could be triangles from a space ship, or green grass and grey tarmac in a car racing game.

All I am testing/showing here is how the lines in the linked list cause colour transitions on the screen.

If they were 3D polygons calculated from some kind of object, the code on a higher level to this one would probably have to break up the polygons for other reasons (hidden surface etc).

The picture below shows the 9 different lines (Red lines added in MS_paint)
Attachments
RLE_Triangle3.jpg
RLE_Triangle3.jpg (25.46 KiB) Viewed 10977 times
User avatar
D3thAdd3r
Posts: 3175
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: Five clock per pixel RLE mode

Post by D3thAdd3r »

Looks very impressive, I will have to break the hardware out and try this one.
Post Reply