Game creation book for QL?

Anything QL Software or Programming Related.
Post Reply
User avatar
SinclairSociety
Trump Card
Posts: 154
Joined: Fri Feb 22, 2019 6:17 pm

Game creation book for QL?

Post by SinclairSociety »

What QL book do you all recommend for creating video games on a QL... Ummm.... for the QL beginner. Want something that shows how to create creatures and move them via keyboard. Like UDG in speccylands but for QL.


Sinclair Computers are AWESOME!!
User avatar
Andrew
Aurora
Posts: 786
Joined: Tue Jul 17, 2018 9:10 pm

Re: Game creation book for QL?

Post by Andrew »

No good books on the subject - but there are some free games that include the code published in QL User magazine and on Rich's site https://rwapsoftware.co.uk/pdsoftware.h ... HMO1rbdmMQ
Also you should take a look at Super Sprite Generator 4 (still not free :( ) , Frank's Sprite Generator (free - http://www.dilwyn.me.uk/games/index.html ) and Adventure Creation Tool (not free)


Derek_Stewart
Font of All Knowledge
Posts: 3932
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: Game creation book for QL?

Post by Derek_Stewart »

Hi,

I have some QL programming books, but they have had some coffee split onto them. I will maybe scan them and remove the stains.

I would read all the QL World Magazines and type all the programmes featured. Mike Lloyd did some programming tutorials on games programming. Maybe worth a look

There is a programme to use UDG on the QL, but I have never got it to work properly. On saying that the ZX Spectrum UDG just redefines existing characters in the defined ASCII character set.

If you read in QL Today V13 iss2-4, Dilwyn Jones did some articles on manipulation of the QL Font, it should be possible to implement QL UDGs by changing the QL Font to a user defined font with the UDG changed to a defined graphics shape.

I did look at this in a port of the ZX Spectrum Football Manager, which is written in Spectrum Basic, I have converted this to Superbasic and just had the Spectum UDGs to sort out.


Regards,

Derek
User avatar
Sparrowhawk
Super Gold Card
Posts: 624
Joined: Wed Dec 15, 2010 12:33 pm
Location: @131072
Contact:

Re: Game creation book for QL?

Post by Sparrowhawk »

To jump onto this thread - I downloaded Dilwyn's font2data program, and I can generate the DATA from one of the sample font files. How does one change a specific character though, say 174 (Theta) ? Is there some specific calculation that can be used to specify the offset for the start of the character?

Thanks.


a.k.a. Jean-Yves
User avatar
Andrew
Aurora
Posts: 786
Joined: Tue Jul 17, 2018 9:10 pm

Re: Game creation book for QL?

Post by Andrew »

Sparrowhawk wrote:To jump onto this thread - I downloaded Dilwyn's font2data program, and I can generate the DATA from one of the sample font files. How does one change a specific character though, say 174 (Theta) ? Is there some specific calculation that can be used to specify the offset for the start of the character?

Thanks.
On a QL, a font is stored in the following format:

Code: Select all

Offset   Value
$0       Byte giving code of first character defined in the font
$1       Byte giving the number of characters defined minus 1
$2…$A    Nine bytes defining the first character
$B…      Nine bytes for each subsequent character…
........
Also see the Toolkit II commands CHAR_USE, CHAR_INC: https://superbasic-manual.readthedocs.i ... l#char-use


User avatar
dilwyn
Mr QL
Posts: 2753
Joined: Wed Dec 01, 2010 10:39 pm

Re: Game creation book for QL?

Post by dilwyn »

Worth adding here perhaps a couple of caveats about fonts.

Most fonts have characters in a set range, say space (CHR$ 32) up to copyright (CHR$ 127). But such fonts will have a default character too, whichis usually one character code lower than the first character.

The standard QL font, for example, covers character codes 32 to 127. But there is a CHR$(31) as well, which is usually a chequerboard character used for characters outside the range of the font.

Fonts generally start with two bytes:
First - lowest valid character code, for the standard QL font this would be 31.
Second - number of valid characters in this font less one (so that you can add it to the lowest character to get the highest in the font). So, if you have a font covering space to copyright plus the default character, the first two bytes in the font would be 31 and 96. 31+96=127, the last character int he font.

As characters are 9 bytes each, this makes it fairly easy to work out where each character is as an offset in the font. So we have to read the value of the first byte to get the first character code and do a simple calculation based on the code of the character you want to find after those first two bytes. I'll assume we want to find a character with code c:

OPEN_IN #3,flp1_my_font
BGET #3,lowest : rem code of lowest character in font
postn = 2+((c-lowest)*9)
CLOSE #3

So, to find the space character, this is code 32, at file position 2+((32-31)*9) or 2+(1*9) or 11.

For the upper character set with accented characters etc, the same applies just a different set of codes. This font will also have a default character, normally 127 if the font covers the usual CHR$ 128 to 191.

Hope all that makes sense.


User avatar
Sparrowhawk
Super Gold Card
Posts: 624
Joined: Wed Dec 15, 2010 12:33 pm
Location: @131072
Contact:

Re: Game creation book for QL?

Post by Sparrowhawk »

Many thanks Andrew and Dilwyn, very helpful :)

I am currently trying to update a game I wrote in 1988. First pass through was breaking down code where I had 4 or 5 statements on one line into separate lines, adding indenting, adding comments and general cleaning up of what was frankly a horrid mess!

I clearly had no idea what a function was, or local scope back then. All global scope with procedures changing global vars any which way. Also, my variable naming conventions leave a lot to be desired.

I have been considering tidying up the code base for my Dreamlands adventure too , but frankly that is a monster and I am not sure that I would survive the ordeal :D


a.k.a. Jean-Yves
Post Reply