Jump to content
IGNORED

Introducing - interleaved charactersets - any game screen is possible (almost :) )


Recommended Posts

Hi All,

 

@playermissilewas creating an excellent tutorials on enhanced DLI techniques. job well done.

 

I would like to introduce (not that it is new), an other DLI advanced technique which I believe can solve the constantly asked question "can this game be ported?" or "can these graphics be doable on A8".

 

Char mode (Antic mode 4) is a very powerfull mode. and it is commonly used to develop some nice A8 games. 

What can you do with only 127 chars that the A8 brings as default? (Well, plus maybe another 127 inverted) - still , very limited, not much.

What about creating a screen like this (look at the level screen and ignore wonderboy and snail):

image.thumb.png.724eace5397552d49f56c2a06980c6ec.png

most of you will say, who are you kidding? this screen is hi-res , too colourfull and if this is charmode it can never fit under a 127 character set.

 

what if I told you this is doable with a caveat of A8 limitations, wouldn't you be interested to first see then learn how to do it?

 

Here is how this screen could look on A8:

image.png.a788656a916cd2bc882e05f32773d427.png 

 

Ignore the top menu bar for a second and focus on the 24 char mode lines in this screen.

looks colorfull enough, looks with nice res considering A8, but how is that possible with only 127 character set?

 

The answer relies on the power of DLI.

You can "attach" to each charmode of the screen a character set.

if you have 24 charmode lines you can have up to 24 charsets 

each charset is 127 chars that gives you a high number of characters that you can use:

24*127 = 3048 chars.

Bear in mind if you use all the 24 charsets  then you will need 24K of memory as each charset is 1K. that is too much for the A8.

you need to find a balance between charsets and the number of chars you need on screen.

For example, in the screen above (which is part of the wonderboy port i am working on) the screen uses 4 charsets. 

when setting the DLI for this screen I use the following table (C Code):

unsigned char charset_table[] = 

    CHARSET_0 >> 8,CHARSET_1 >> 8,CHARSET_2 >> 8,CHARSET_3 >> 8,
    CHARSET_0 >> 8,CHARSET_1 >> 8,CHARSET_2 >> 8,CHARSET_3 >> 8,
    CHARSET_0 >> 8,CHARSET_1 >> 8,CHARSET_2 >> 8,CHARSET_3 >> 8,
    CHARSET_0 >> 8,CHARSET_1 >> 8,CHARSET_2 >> 8,CHARSET_3 >> 8,
    CHARSET_0 >> 8,CHARSET_1 >> 8,CHARSET_2 >> 8,CHARSET_3 >> 8,
    CHARSET_0 >> 8,CHARSET_1 >> 8,CHARSET_2 >> 8,CHARSET_3 >> 8
};

 

The way it is built is that there are 4 interleave character sets that creates the screen above. the 4 character sets repeat themselves 6 times on the 24 charmode lines.

So the DLI attaching the charset set to each charmode line is looking something like this:

0

1

2

3

0

1

2

3

0

1

2

3

0

1

2

3

0

1

2

3

0

1

2

3

 

How do I know how many character sets I need, or even worst, how do I know how to draw a screen like this with these character sets.

 

Well, this was acomplished by the great help of my good friend and A8 guru @popmilo and with the great graphics work of the great A8 artist @José Pereira 

Jose drew this screen in G2F making sure it follows A8 standards the result was a image (png). 

That image was processed by a python tool written by Vlad. you can configure the amount of charsets and the result of the tool processing was:

- A charset file (either bin or header file) - this was to attach into the DLI charmodes in the technique explained above.

- A tilemap file (either bin or header file) - this was used to draw the chars on screen that will produce this level. 

 

Here is an example of one of the levels (full level) scrolling from start to end, the level we will use in the game will look a lot better , this is just to show how the interleaved character sets work:

level.xex

 

Where do we go form here?

If porting wonderboy is doable, I believe many other ports can be accomplished

I call out to all A8 developers and programmers out there to take the challange and try to port good graphics games that were doable on C64 and sure are doable on A8.

 

Hope this was helpful. any comments/questions are most welcome.

 

Cheers,

Yaron

  • Like 12
  • Thanks 2
Link to comment
Share on other sites

  • 3 weeks later...

I was wondering....   since you have four character sets. And you use a different characterset per line, but repeat the usage six times...

0

1

2

3

0

1

2

3

. . .

 

Wouldn't it be the same as just using one character set for six contiguous lines before switching character sets...

0

0

0

0

0

1

1

1

1

1

1

. . .

Then there are fewer DLIs that need to change the current CHBAS.

 

Thanks,

Ken

 

  • Like 1
Link to comment
Share on other sites

1 hour ago, kenjennings said:

I was wondering....   since you have four character sets. And you use a different characterset per line, but repeat the usage six times...

0

1

2

3

. . .

Wouldn't it be the same as just using one character set for six contiguous lines before switching character sets...

0

0

0

0

0

1

1

1

1

1

1

. . .

Then there are fewer DLIs that need to change the current CHBAS

That would be what coders usually call "bitmap emulation" method. You arrange characters from single charset in some grid like arrangement like this:
01234567

89ABCDEF

....

..

 

or:

048C....

159D...

26AE..

37BF.

That's not bad at all if you're making something with vector graphics like Elite or mercenary.

But drawing 3x3 chars sprite that takes 4x4 chars counting in the shifted positions to get fine movement takes 16 unique characters. Out of only 128 that atari has...

 

Trick with interleaved charsets with that "one charset per charline" order is that you get to use exactly the same char codes for certain soft sprite anywhere on screen.

 

So let's say your charset has maximum 4 chars. That gives you 1 sprite with 4 occupied characters in each out of 4 charsets. Let them be char codes 4,5,6,7.
You still have 4 characters free (0,1,2,3) to make background. Let's say you want to draw some bullet like object or fruit to collect. You reserve chars 0,1,2,3 for that object. Anywhere on screen you just bang those 4 chars and you're done.

 

When you want to draw sprite for example you just take chars 4,5,6,7 and write them in 4 consecutive rows like this:

000000000000000000000000
000000000000000000000000
000000000004567000000000
000000000004567000000000
000000000004567000000000
000000000004567000000000
000000000000000000000000
000000000000000000000000
000000000000000000000000

Basically best advantage of this layout is that you use less precious character codes per single charset.

Erasing is easy, just write empty char code over area you wanna clear. Drawing sprites or objects on new position is easy. Drawing background is easy.

 

 

 

  • Like 5
Link to comment
Share on other sites

One thing to highlight from @Popmilo's explanation is that the number of fonts needed, and hence the number of rows grouped in the display list, is determined by the maximum sprite height needed (in pixels).

 

E.g. Yaron is using 4 rows repeating, and so the sprite height is 3 rows or 24 pixels high. It should be apparent that the extra row is for 'shifting' the soft-sprite, e.g. by writing to it with an offset of pre-shifting the sprites and copying accordingly.

 

So if you had a game that only used 16 pixel high sprites then that needs 2 rows and so your dlist's rows, and hence number of fonts needed, is 3. For 32 pixel high sprites, this becomes 5 fonts.

So depending on the number and mix of sprite sizes a game needs, instead of using 32 high sprites you could use two 16 high sprites one plotted above the other.

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

To me as a beginner in programming (only managed to write some simple, little demos so far), all this is totally new and it motivates me to dig deeper into it and try to create my first ever game.

So I´m collecting all those Infos, hoping that one day I really can use some of these techniques. Right now they are still a bit too much for me, but I grab useful information from all the tutorials here.

 

So please guys (especially the ones, who program since the 80s), keep on sharing your techniques, even if they appear to be trivial or simple to you. There are still people trying to learn all the stuff, that is nothing new to you.

 

And... keep on coding!

  • Like 4
Link to comment
Share on other sites

if my tutorials helps any developer to get up and start developing new games for A8, then it was worth it!

 

I want to see more and more coders out there pick up their keyboard and start developing new A8 games - mostly arcade ports that never made it to A8 (but were released on C64).

 

 

 

  • Like 7
  • Thanks 1
Link to comment
Share on other sites

Yes thank you very much for this. Although I'm not a gamer, and I haven't been much of a programmer on the A8, I still envision writing some programs eventually that will work with some new hardware I have in mind. So my thoughts were to create something more like a HMI (Human Machine Interface) which would be graphical in nature. So imagine being able to easily build a control panel with electrically actuated devices (solenoids, valves, switches) and also place readouts for temperature, pressure, ect.. Then being able to manual activate or deactivate a device just by selecting it with a mouse and clicking on it. Meanwhile the changes in the readouts could be viewed in real time. So in other words it might look a bit like SCRAM, but you get to build and decide what's all going to be controlled and displayed. I could very well see using the graphics mode you are suggesting as the basis for the HMI screen.

 

SCRAM.thumb.png.6e0fd9fd3e0939a34760eb3d4fec46d6.png

 

Of course I'll need to design some hardware for interfacing the Atari to real world devices :) .

 

 

  • Like 3
Link to comment
Share on other sites

On ‎1‎/‎6‎/‎2020 at 11:05 PM, Yaron Nir said:

if my tutorials helps any developer to get up and start developing new games for A8, then it was worth it!

 

I want to see more and more coders out there pick up their keyboard and start developing new A8 games - mostly arcade ports that never made it to A8 (but were released on C64).

 

 

 

 

If you want to have coders "pick up their keyboard and start developing new A8 games - "

 

 

Why don't you get a bit more serious?

Particular Wonderboy is a hoax on all 8 bit machines. Have you played the Arcade version? Even the C64 Version doesn't give a touch of the real thing. As they say in English "It's not worth the hassle" ...

And then the Engine that cost more CPU than any game could benefit from?

Despite of the facts that José Pereira lives in his own world, and Miker cannot do melodic tunes, the game doesn't need too much ( as even the C64 soundtrack is horrible ) resources for the Atari. So they could help you to "finetune" things. The C64 Version is rather restricted..., very low amount of things going on...

But in the Arcade there are parts that use 8 way scrolling and about 10 sprites at the same time. It's just a "wow" experience, and even the simple and short music in the game doesn't kill any nerves by the clever arrangement.

Well, mostly object in the game could be a part of the background, so a lot of the game could be converted to the Atari. But not the game as it should be.

 

"mostly arcade ports that never made it to A8 (but were released on C64). "

 

I also wonder , how to break that nonsense. It seems the only cause for people to do stuff for the Atari but is exactly the opposite of what the Atari can do best. 

Actually I really hope that Jetpack Part in the Far Away demo will turn into a real game...

  

A universal engine, to convert any "C64 style"  game, NEEDs the solution of a DL that allows LMS and DLI as in your solution, but it only will be available , if you turn Mode 4 to Mode 5 and allow to multiplex the PMg with flicker.

Then a Screen only needs up to 12 different fonts than can be accessed logically , which ends up in a fair memory usage, and an acceptable CPU usage.

AND, you could use the PMg at the single scanline resolution, to enhance the visuals in their appearance. So a lot elements could look like C64 and use the "5 colors" for single Sprites . 

 

What You were doing is an "Engine" that possibly allows to play Wonderboy in the limited style of the C64. But that will be the limit at all.

 

  • Confused 2
Link to comment
Share on other sites

5 hours ago, Stephen said:

Emkay - can you collectively go fuck off and just leave this place please?  You contribute absolutely nothing but vitriol and negativity.  Seriously dude, just fuck off and don't come back.  nobody will miss you.

Calm down, breathe, it's not so serious :)

Tldr of Emkay's post is that:

- Miker doesn't know how to make a good tune. Imho 99% of atari users think he knows his stuff, 1% that he doesn't. My guess is that the difference is in music preferences of that 1%.

Recommendation - go here and download New wonderboy music and decide for yourself if it's melodic or not.

- José lives in his own world. Yeah, world in which he did gfx for bunch of games and invented a brand new gfx mode with best soft sprites ever.

- Wonderboy is a hoax on all 8bits -  so what ? We're making a8 wonderboy based on arcade game exactly because of that.

- "Engine that cost more CPU than any game could benefit from" - I would say engine that hasn't been used in any game so far. Doesn't this look usable in a game ? 

 

 

Imho mode 5 + multiplexed pms would produce something like uglier and maybe faster (larger screen) version of crownland. Good enough for some games probably.

 

  • Like 5
Link to comment
Share on other sites

On 1/7/2020 at 4:35 AM, mytek said:

Yes thank you very much for this. Although I'm not a gamer, and I haven't been much of a programmer on the A8, I still envision writing some programs eventually that will work with some new hardware I have in mind. So my thoughts were to create something more like a HMI (Human Machine Interface) which would be graphical in nature. So imagine being able to easily build a control panel with electrically actuated devices (solenoids, valves, switches) and also place readouts for temperature, pressure, ect.. Then being able to manual activate or deactivate a device just by selecting it with a mouse and clicking on it. Meanwhile the changes in the readouts could be viewed in real time. So in other words it might look a bit like SCRAM, but you get to build and decide what's all going to be controlled and displayed. I could very well see using the graphics mode you are suggesting as the basis for the HMI screen.

 

SCRAM.thumb.png.6e0fd9fd3e0939a34760eb3d4fec46d6.png

 

Of course I'll need to design some hardware for interfacing the Atari to real world devices :) .

Sounds like an awesome little SCADA system you have there :)

It looks like you wouldn't need lot of speed on this one (lot's of objects moving around). In that case better go with simple bitmap if 4 colors are enough. Or go for 4+1 color text mode and build screen with that simulate bitmap method (one charset for 3 charlines for example. 8 charsets total for 40 wide screen). You get that nice 5th color bit 7 switch that you can use to highlight pieces of your interface (leds, switches etc...).

Please let me know if you ever build that hw and need help with sw !

I work a lot with PLC's and all kinds of industrial and home automation. I did plan to use c64 for that purpose though ;)

 

 

 

  • Thanks 1
Link to comment
Share on other sites

11 hours ago, Stephen said:

Emkay - can you collectively go fuck off and just leave this place please?  You contribute absolutely nothing but vitriol and negativity.  Seriously dude, just fuck off and don't come back.  nobody will miss you.

If people like you immediately would sod off , there would be lot better communication here in the forums. And take that McNerdInc with you. Go, read books about the Atari , and then come back.

 

5 hours ago, popmilo said:

Calm down, breathe, it's not so serious :)

Tldr of Emkay's post is that:

- Miker doesn't know how to make a good tune. Imho 99% of atari users think he knows his stuff, 1% that he doesn't. My guess is that the difference is in music preferences of that 1%.

 

One of those points why the Atari scene is so much underrepresented with good coders. The only chance seems coders like Heaven. I guess you have seen the "great Music" he posted in the other thread. It fits well.

I'm always thankful for good examples ;)

You won't imagine how big the benefit of SID in the C64 is , and caused people to do a lot software just to have such a tune running.

 

Yeah, you can not get rid of the 8 bit resolution. At least I'm trying to optimize things....

 

For example. This happened when I adjusted the Mod file instruments in RMT from the "real" Note to always "A" ... but there still had been differences..

Then there was the RMT detuning wich is up to 2 pitches different from the low to the high notes. Adding some tones to build a bridge from the start to the end.

Then there have to be done a lot volume adjustments... to get that.

Like the result or not. At least the first, the second and the 3rd melodic part fit together.

 

 

Who would do that, coming from "outside" the Atari , just testing the available Software? No one.

The Software has to offer that by default. So a musician could do his own ideas.

Vice Versa they do standard out of tune stuff and get applause by the community.

 

 

5 hours ago, popmilo said:

Recommendation - go here and download New wonderboy music and decide for yourself if it's melodic or not.

 

Sorry. Listen to the Arcades again and compare. It is even no "melodic tune" , just an arrangement.

If you start something, it has to be solvable to the end.

 

 

5 hours ago, popmilo said:

- José lives in his own world. Yeah, world in which he did gfx for bunch of games and invented a brand new gfx mode with best soft sprites ever.

 

Where ? Any game available?

 

5 hours ago, popmilo said:

- Wonderboy is a hoax on all 8bits -  so what ? We're making a8 wonderboy based on arcade game exactly because of that.

- "Engine that cost more CPU than any game could benefit from" - I would say engine that hasn't been used in any game so far. Doesn't this look usable in a game ? 

 

 

Imho mode 5 + multiplexed pms would produce something like uglier and maybe faster (larger screen) version of crownland. Good enough for some games probably.

 

 

This is actually the only solution to get a lot games done for the Atari.

It leaves a little more CPU free, and the memory handling of 50%.

The nifty point is to use the PMg for colors and detail enhancement.

 

And here we are on the other missing plot.

For development of games , a PC Tool is needed to create procedural graphics on the PC.

In theory an Emulator that is fed by an Editor. Allowing some drawing features and short Assembler routines , to get quick first results.      

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...