QL Tinkering

Helpful tips and guides, also new users can ask for help here.
stevepoole
Super Gold Card
Posts: 716
Joined: Mon Nov 24, 2014 2:03 pm

Re: QL Tinkering

Post by stevepoole »

Hi Qbits,
Very impressive progress, which I suppose all boils down to good project planning.

I tend to get somewhat lost on larger projects, so have to regularly print listings to keep a hold on developments.

I never wrote a 'railway line' schema or suchlike, which is no doubt a grave default,

One major project 'almost finished', is a screen keyboard with mouse note inputs, music score and instant score replay.

I redesigned a music notation font, and the thing uses system for-loop delays to get exact delays on any system.

Why did it not get finally finished ? I can't remember, so I suppose I will have to take another look soon...

On things seem sure, It will be ten times bulkier and many times less compactly designed than a QBITS prog !


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

Re: QL Tinkering

Post by Derek_Stewart »

qbits wrote: Wed Nov 22, 2023 10:26 am Derek I hope your handicap is improving (Playing QBITS Golf).
I am little of of game playing practice, but your Golf game is good.
qbits wrote: Wed Nov 22, 2023 10:26 am Who knows I might be tempted in the New Year to get my soldering iron out and upgrade one of my BBQL’s with Q68 components.
Not sure that a Q68 can be fitted to the QL by soldering. QIMSI plugs into the Romport.

I have run all the review package on sQLux with Minerva v1.98.


Regards,

Derek
User avatar
vanpeebles
Commissario Pebbli
Posts: 2821
Joined: Sat Nov 20, 2010 7:13 pm
Location: North East UK

Re: QL Tinkering

Post by vanpeebles »

Excellent work as usual. :D


qbits
Trump Card
Posts: 173
Joined: Sun Dec 11, 2016 3:32 pm

Re: QL Tinkering

Post by qbits »

Hi all, QBITS PIXArt TGen Part Two

Down Load the Zip file and Install QBITSConfig and QBITS_PIXArt_TGen to win1_ or If not, you will need to change ‘win1_’ on line 1002 of QBITS_PIXArt_TGen to your preferred Drive.

If it successfully loads and runs then press any key to clear the Help screen and then ‘L’ to load the QBPIX-ELTile01_bmp file supplied. A set of Sprite Tiles displayed to screen, then Press ‘+’ to show the Sprite BITMAP in Grid Edit Mode. Pressing + or – moves forward and back through the Sprites list.

You can now switch to Screen Tile Mode by pressing ‘T’ then Press ‘A’ to add to Tile library, the Bitmap now appears in the top right Tile Viewer and the number below is incremented. Select other Bitmaps with -/+ from the loaded Sprit file. Now you can start to populate your background Screen, move cursor around and toggle ON/OFF Paint to copy Tiles to screen. Select different Tiles with Left < > Right Chevrons. As with Sprite Grid Mode you can also toggle Rubber ON/OFF to remove Tiles from background screen.

To Switch screens, Press Keys 1 to 9. Once you have created a number of screens you can Save to file. Just to make things easier a Screen File is included. Use the Load command to open and install QBPIXELScn01_bmp. This opens with screen 1, you can step through the other screens by pressing 1…9 to view the different layouts. The Tile commands (A)dd (D)elete are hopefully now obvious and control the Tile entries to the Tile Library. Displayed below is (M)APS[#]. If you now press ’M’ the background screen clears to display the Set Links screen, where each screen’s side can be linked to other screens. It can be set up for a logical A-B-C-B-A ar-rangement or become totally confusing as to where you might end up after travelling through several screen. I’ll let you experiment and find out for yourself.

Press Spacebar or Enter to return to the background displays. To Test the screen layouts Press ‘#’ hash. You will now find the cursor movement is limited to only the open spaces. If you move the cursor to one of the screen edge openings and if a screen link has been set up, the new screen will be displayed and the cursor now is place on the opposite side of the screen as in the direction of travel. For example, North connects to South of next screen. If there is no linked screen the cursor stays in present location until moved with cursors.

Have Fun…
QBITS PIXEL Art Step1&2.jpg

UPDATE Notes:
In developing the code I’m taking my time over the File format and memory use. The Retro Games of the 1980’s used typical screen sizes to the QL’s 256x256 in Mode 8. The QBITS choice of a 320x192 main window was based on the 512x256 screen and space left for Headers, Menus and Guides etc.

1980’s Retro Games used 8x8 Tiles to build screen backgrounds and multiple Tiles for Sprite Characters. A screen Bitmap of 320x192 for Floating Point’s is 368,640Bytes (6Bytes/FP). For Integers 122,880 Bytes (2Bytes for each integer) with individual pixels colours represented by 1 byte this reduces to 61,440 Bytes. If we relate this to Tiles of 8x8 this is 40x24 or 960 Tiles. Most backgrounds can be sorted with maybe 10 to 20 Tile changes and having Sprite Characters of say 24x24 or 9 Tiles for each, again greatly reduces the total bytes for creating a Sprite Character including left, right, run, walk, jump changes when manoeuvring a Sprite.

For QBITS PIXEL Art I set on 32 for the number Sprite Characters (max size of 64x64x32=131,072Bytes). For storage the File Headers identify the type of ‘_bmp’ file, the first three bytes are set with QL8 or PAL which dis-tinguishes the QPC2 (SMSQ/E) Colour Palette used, the fourth (frt) the number of Frames. The fifth and sixth the individual Bitmap number of columns (cm) and rows (rm). The background colour (bg) is held in byte sev-en. Byte eight holds a check number (sz) for File further type definition.

The sz=0 identifies file with original 8 bit header, sz=1 for the 16 bit header this has an additional 8Bytes for the changes to the Colour Palette. Selecting a colour between 8 and 15 the (above 7 =white) pressing ‘P’ allows changes to the colour the Palette. These are saved with the Sprite File to provide combatable colours when re-loaded. For the Screen MAPS files sz=2 which includes data for Screen Links, Screen Maps and Tile matrix-es.36Bytes for the 9 Screens and their compass directional links. The Screen MAPS themselves are 20x12=240 Tile Positions and with 9 Screens requires 2160Bytes followed by the number of Tiles in the Library (16x16) max 96 = 24,576Bytes. Therefore, the Maximum File Size created being 8+8+36+2160+24,576=26,788.

For Screen/Tile files the variable frt (Frame Total) is swapped with tm number of Tiles.

At present the Prog uses FP and Int% variables when working with Arrays for storage. The data for bitmap files being converted into bytes for use with SBYTES/LBYTES. The Array sizes are high with floating Point numbers of a 64x64x32x6 being potentially 786,432bytes even with INT% this is 262,144Bytes. This may limit the QBITS PIXArt Prog to only run on QL Platforms with access to a megabyte of RAM or more. To reduce the amount of RAM one option to explore is use of PEEK and POKE byte entries in pre-allocated memory instead of the Arrays. This could potentially improve overall execution speeds as well as make it easier to compile.

QBITS
May The TINKERING in QL S/SuperBASIC be with YOU…

UPLOADS
QBITS_PIXELTile01_bmp is the Sprites for Background Screens Tile.
Note: When adding Tiles from a loaded Sprite File only the first 16x16 Bite will be copied across.

QBITS_PIXELScn01_bmp is a Screen file with the extended header of Screen Maps etc
Note: The Tiles Library can be added to or have Tile deleted. To add new design, they ned to be generated in Sprite Mode and copied across with Add in Tile Mode

QBITS_PIXArt_TGen is the PIXEL Art Prog with the Sprite and Background Screen Generators

Footnote: Further development Step 3 the Sprite Movement Controls will now continue into Next Year, my Christmas List keeping me busy. Have to keep the family Elf’s happy ELF and Safety and all that!

Enduring Lifelong Friends…
Attachments
QBITS_PIXELArt_TGen.zip
(14.32 KiB) Downloaded 191 times


User avatar
Tesla
Bent Pin Expansion Port
Posts: 83
Joined: Fri Sep 15, 2017 6:19 pm

Re: QL Tinkering

Post by Tesla »

Hi Qbits.
What to say.............bravissimo! :shock:
I look forward to the complete work.
Ciao.
Marco


qbits
Trump Card
Posts: 173
Joined: Sun Dec 11, 2016 3:32 pm

Re: QL Tinkering

Post by qbits »

Hi All,

Well A warm and Merry Christmas to all.

The QBITS PIXEL Art Project not complete but still progressing as and when I have time.
To end the Year I’m posting the QBITS Progs Review 2023 with just a minimal number of text tidy ups in line with resent changes.

QBITS
QBITSProgsIntro.jpg
Attachments
QBITSProgs_doc.zip
(14.43 MiB) Downloaded 149 times
QLCharFonts.zip
(231.15 KiB) Downloaded 179 times
QBITSProgs_bas.zip
(223.73 KiB) Downloaded 189 times


qbits
Trump Card
Posts: 173
Joined: Sun Dec 11, 2016 3:32 pm

Re: QL Tinkering

Post by qbits »

Hi All,
QBITS PIXEL Art ACTION – The latest WIP included Step 3 Part One – setting out Attributes for Action Sprites.

Step 3 Part Two – I decided to take a Side Step (no pun intended) to assess Sprite Actions.

For this I chose to create a QBITS version of Breakout. This has four elements to explore.
(1) Gravity: in this case a Ball that freely travels around the screen.
(2) Bounce: Side walls (Tiles) to Bounce OFF. Plus, breaks to leave one side and appear on the other.
(3) Reward: A Wall – Rows of Bricks (Tiles) which are deleted when ball hits them and a Score incremented.
(4) Hazard: A Paddle at the bottom of the screen to bounce ball back up if missed then a life is lost.

The Paddle is Player Controlled with Left/Right cursors. The Prog variables are displayed and (F1) Toggles ON/OFF an auto-mated Paddle movement so as to help test the Functions of the Game.

Expand your horizons with QL SuperBASIC
QBITS
Attachments
QBITS_Breakout_WIP.zip
(1.68 KiB) Downloaded 173 times
Breakout.jpg


qbits
Trump Card
Posts: 173
Joined: Sun Dec 11, 2016 3:32 pm

Re: QL Tinkering

Post by qbits »

Hi All,
QBITS PIXEL Art ACTION – The latest WIP has Step 3 Part Two – Limited Test of ACTION Settings
Attached pdf is just a Quick Guide to Key functions the full Documentation is still being put together.

Download UNZIP and load files into your Source Device then LRUN QBITS_PIXART_AGen
LOAD files QBPIXELAGen01_bmp Sprite File and QBPIXELAGen02_bmp Screen Map file

This is still a WIP so hopefully all will be OK on your choice of QL Platform. Enjoy

QBITS
Attachments
QBITS_PIXELArt Step3.jpg
QBITS_PIXELArt Step3.jpg (31.32 KiB) Viewed 9486 times
QBPIXELArt_AGen_doc.pdf
(385.66 KiB) Downloaded 94 times
QBITS_PIXArt_AGen.zip
(15.83 KiB) Downloaded 115 times


User avatar
vanpeebles
Commissario Pebbli
Posts: 2821
Joined: Sat Nov 20, 2010 7:13 pm
Location: North East UK

Re: QL Tinkering

Post by vanpeebles »

I keep meaning to check this out :)


qbits
Trump Card
Posts: 173
Joined: Sun Dec 11, 2016 3:32 pm

Re: QL Tinkering

Post by qbits »

Hi All,
Been a tad busy of late so this is just a quick update on QBITS PIXEL Art progress.
There are a few screen changes to layout, Tile (A)dd and (D)elete now use the (C)opy and (D)elete that are shown under the SPRITE Frame side of the screen. The logic being you are Copying from the Sprite Frame to Tile Frame and (D)elete in TILE Mode applies to the Tile Frame display top right. This has led to some repositioning of other Key Commands. Under the KEY CTRL settings for (A)ction a set of Boundary Tiles are displayed for the Limited Testing. Jump has been removed and is now automated if SPRITE exits Test Screen. (S)ound is now Highlighted if Switched ON.
Note: I haven’t had time to check if all these functions still work OK with larger sized Sprites than the ones supplied with present _bmp files.

The latest update to the code looks at Collision Detection with Tile Mapping. This checks the TILE positions surrounding a SPRITE’s forth coming Gravity changes along XX YY axis and if true Resolves with an appropriate Response: block, Bounce, Explode and Updates Game Stats Score, Lives lost etc.

My recent investigation into 1980 Retro Games has thrown up a number of considerations. The grid location of a Background TILE at present is seen as empty space or as a solid object [ie. Wall or Platforms]. What if a SPRITE needs to move over a TILE which displays flooring etc. move behind object such as furniture. The progress so far includes jumping between Screen, maybe Screens need to PAN or SCROLL.

Your thoughts or suggestions, I appreciate any contribution.
QBITS

QBITS PIXEL Art – Collision Detection
Resolving moving Sprites interaction with other moving or static objects and apply a response. Tile mapping requires only identifying the active Tiles surrounding the Blue Hit-box and the action would be something like this:
Tile Collision Detection.jpg

Note: Resolving Y-axis first makes sliding over floors areas smoother, where occasional lost Gravity values when falling next to a Wall is much less noticeable. s=SPRITE : t=TILE o=old : x,y Coordinates : xx,yy Gravity : w=width : h=hight : c=column : r=row

sy=osy+yy :tc=osx DIV tw :tr=sy DIV th : Collision_Check : IF chk=1 : YRespons : chk=0
sx=osx+xx :tc=sx DIV tw :tr=osy DIV th : Collision_Check : IF chk=1 : XRespons : chk=0

SP_Draw osx,osy : PAUSE 5 : sx=osx+xx : sy=osy+yy SP_Draw sx,sy : PAUSE 5 : osx=sx : osy=sy :

SP_Draw
OVER -1:Draw Sprite :OVER 0

Collision_Check
FOR r=0 TO sh DIV th
FOR c=0 TO sw DIV tw : IF Tile(tc+c,tr+r)>0 : chk=1: Note: True
END FOR r

Note: SK(ka,kb) Sprite Key ka Screen number 1..9 kb Attributes 0..18 : (ka,16)=0 Stop =1 Bounce =2 Explode
YResponse
IF SK(ka,16)=0 : sy=osy : XX=0 : yy=0
IF SK(ka,16)=1 : sy=osy : yy=-yy
IF SK(ka,16)=2 : sy=osy : SP_Ex

XResponse
IF SK(ka,16)=0 : sx=osx : xx=0 : yy=0
IF SK(ka,16)=1 : sx=osx : xx=-xx
IF SK(ka,16)=2 : sx=osx : SP_Ex

***********
Attachments
QBITS_PIXELArt_AGen2.zip
(16.47 KiB) Downloaded 82 times
QBPIXELArtA_doc.pdf
(491.24 KiB) Downloaded 84 times


Post Reply