Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : PICO PETSCII
Page 21 of 38 | |||||
Author | Message | ||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9129 |
Compressed will generate bigger files than non-compressed with things like dithering or very complex images (worst case 2x bigger). It is worth checking the file sizes for each sprite compressed vs non-compressed before just always using compressed. Remember you can now set the top bit in the width or height to indicate a sprite is compressed and then use BLIT MEMORY If you do this you could modify my csub generator programs to evaluate each sprite and use the optimum output for that sprite setting the top bit to indicate to BLIT MEMORY which type of sprite to read Edited 2023-10-31 05:49 by matherp |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4247 |
I think I have the function of the time-bomb the same as the original game. - radius 2 - damage 11 - delay 3 seconds (to get away) - damages robots - damages tiles (i.e. canisters/boxes/bridges) - vaporizes hidden objects in range (yes... same as original game). Install the earlier petrobot22 zip file (and library) The run pet22b.bas (attached). Please check, and feedback. pet22b.zip Volhout Peter: once we run out of space I will do what you propose. At the moment it still fits, and we do not plan to do anything with the rest of the 100k library/flash slot yet. Edited 2023-10-31 06:37 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
Martin H. Guru Joined: 04/06/2022 Location: GermanyPosts: 1114 |
Sounds great, but I can't test it until Wednesday when I'm back home. Edited 2023-10-31 07:10 by Martin H. 'no comment |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4247 |
@Martin, If you have the opportunity to combine the music and sfx into one mod file with better quality, what size would the mod file be ? You are doing your utmost to fit it in 128k, but what if you maintain quality. Would it be < 256k? It would be worth looking into. We do not need to provide all the design file in the playable version. So we would need to 100k tiles and sprites, the music, the game (<100k) and index files and images. if music/sfx = 128k 220k mod file (100k intro, 123k game music/sfx, now) 128k mod buffer 100k library 100k game 250k associated files (images, world maps) = 800k. This would "just" fit on the A drive as is now. Anything we add just runs out of the A drive. So for now, let's go for quality, and assume to run from B drive. When the game is finished, we can always look where to shrink, and what to compress (using the crunch function in MMEdit shrinks the main program by 40%, and it still plays the same). Volhout PicomiteVGA PETSCII ROBOTS |
||||
Martin H. Guru Joined: 04/06/2022 Location: GermanyPosts: 1114 |
for all SFX we need additional 80 K in the Mod File but thats for the 3 ingame MODs only In the Intro we just need the Bleep for navigation.. so that are just additional 1.4k I will add the SFX for the 3 ingame Mods and see, how big it will get. (i found a new tool "Milky tracker" , which makes the work a lot easier and faster than ProTracker.) I will do it Edited 2023-10-31 18:20 by Martin H. 'no comment |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9129 |
If you post the raw sprite directory(ies) I will have a play with the Basic code and produce an optimised version |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4247 |
Hi Peter, These are in the petrobot22.zip few posts back. The /tiles and /sprites folders. Each sub folder contains a spr2csub.bas that generates the csub and index file for that folder. The tile0_3f named folders are groups that create a csub that fits in memory. Your help is definitely appreciated. It would be my ultimate dream to have a tool that can generate a compact library and index file that combined would be one binary blob for a flash slot. And a way to retrieve the indexes into the arrays in the game. We will be using this tool until the game is released, since tiles are being modified/sprites added while the game becomes more and more complete. the arrays are: (base 0) tile_index(255) sprite_index(95) health_index(5) key_index(2) item_index(5) tla_index(23) Volhout Edited 2023-10-31 20:03 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4043 |
Regarding MOD file sizes, is this limited by the size of the mod buffer, i.e. if you increase the former > 128K then do you also need to increase the latter ? (Selfishly) for the Game*Mite I was rather hoping to standardise on the 128K mod buffer, I don't want to give up too much space on A:/ and I don't want users to have to reconfigure the OPTIONs between games, especially since changing the mod buffer size is (supposed to be) a fairly destructive operation on the contents of A:/ Best wishes, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Martin H. Guru Joined: 04/06/2022 Location: GermanyPosts: 1114 |
Maybe the cheat sheet(s) helps as decision support. the current Tileset the previousTileset and the original PSP / CMM2 /MMB4W Tileset for my taste, D6 E4,E5 E8 E9 maybe look better in solid Tiles C4 5 8 9 (The air conditioning fan) are placeholder for the Ani Tiles replaced by the program and can be painted black if they use too much memory @Harm, as you see in the Original, the Tiles F0 to FF has a transparent Background, so we maybe better use them as Sprites. like the Magnet and the Bomb Edited 2023-10-31 21:36 by Martin H. 'no comment |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9129 |
Here is the analysis of the compression. Filename, uncompressed size, compressed size Files not reported will be smaller in the compressed state Wasted space 14968 bytes + a small performance hit. I haven't checked all the directories for gains but one sample directory of gains is at the bottom Edited 2023-10-31 23:30 by matherp |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4247 |
@Peter Looks like on average the compression is not doing much. But in practise we have 255+100+23+.. is some 400 graphical elements. Roughly each is 24x24 -> 576 nibbles (16 colors). So without compression the best we could get is 115kbyte (without size information, just the binary data). The compression currently gives us 20% gain. If we could have the tiles with poor compression left uncompressed then it would be even better. @Martin - I agree the solid tiles look better (and compress better) - Leave the F0...FF tiles as it. Currently I simply write them to L with color 0 as "do not copy". This means that these tile have 2 missing colors, magenta and black. This is the latest version, not thoroughly tested, but it allows avalanche blasts (cannisters igniting other cannisters). pet22c.zip Press F3 to get ammo and bombs and life and.... cheat... Regards, Volhout Edited 2023-11-01 01:02 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9129 |
Here is a conversion program that uses compressed and uncompressed intelligently. You will need to regenerate all the sprites and change the petscii code to use BLIT MEMORY instead of BLIT COMPRESSED. This is all untested in the actual program but the csub looks about right and the offsets work at the command line 'program to convert all the sprite files in a directory to a CSUB using compression where appropriate Option explicit Option default none Const separatesubs% = 0 Dim offset% Dim fname$=Dir$("*.spr",FILE) Open "spr_csub.bas" For output As #2 Open "spr_index.txt" For output As #3 If separatesubs%=0 Then Print #2,"CSUB SPRITES" Print #2,"00000000" offset%=0 EndIf Do If fname$<>"" Then code fname$ fname$=Dir$() Loop Until fname$="" If separatesubs%=0 Then Print #2,"END CSUB" Close #2 Close #3 'convert the file f$ to a compressed CSUB Sub code f$ Local i%,j%,h%,l%,w%,n%,s%,il% Local a$,o$,oc$ Open f$ For input As #1 Line Input #1,a$ 'process the dimensions and count w%=Val(Field$(a$,1,",")) n%=Val(Field$(a$,2,",")) h%=Val(Field$(a$,3,",")) If h%=0 Then h%=w% i%=Instr(f$,".") o$=Left$(f$,i%-1) If separatesubs%=1 Then Print #2,"CSUB "+o$ Print #2,"00000000" offset%=0 ' Else ' Print #2,"'"+o$ EndIf Local obuff%(w%*h%\8+128),buff%(w%*h%\8+128) For s%=1 To n% 'process all the sprites in a file Print #3,Str$(offset%) Print #2,"'Offset ";offset% For l%=1 To h% a$="'" Do While Left$(a$,1)="'" 'skip comments Line Input #1,a$ Loop 'make sure all lines are the correct length If Len(a$)<w% Then Inc a$,Space$(w%-Len(a$)) If Len(a$)>w% Then a$=Left$(a$,w%) LongString append buff%(),a$ 'get all the file into a single longstring Next l% j%=0 For i%=1 To LLen(buff%()) LongString append obuff%(),mycol$(LGetStr$(buff%(),i%,1)) Next i% LongString clear buff%() il%=(LLen(obuff%())+7)\8 * 8 i%=0 Do While i%<w%*h% 'compress the data j%=LGetByte(obuff%(),i%) l%=1 Inc i% Do While LGetByte(obuff%(),i%)=j% And l%<15 Inc l% Inc i% Loop LongString append buff%(), Hex$(l%)+Chr$(j%) Loop 'the output must be a multiple of 8 nibbles LongString append buff%(),Left$("00000000",8-(LLen(buff%()) Mod 8)) If LLen(buff%())<il% Then 'compressed version is smaller so use it Print #2,"'"+o$; Print #2," is compressed" Print #2,Hex$(h%+&H8000,4)+Hex$(w%,4) j%=0 For i%=8 To LLen(buff%()) Step 8 'reverse the order o$=LGetStr$(buff%(),i%,1) Inc o$,LGetStr$(buff%(),i%-1,1) Inc o$,LGetStr$(buff%(),i%-2,1) Inc o$,LGetStr$(buff%(),i%-3,1) Inc o$,LGetStr$(buff%(),i%-4,1) Inc o$,LGetStr$(buff%(),i%-5,1) Inc o$,LGetStr$(buff%(),i%-6,1) Inc o$,LGetStr$(buff%(),i%-7,1) Inc j% If j%=8 Then Print #2,o$ j%=0 Else Print #2,o$+" "; EndIf Next i% If j%<>0 Then Print #2,"" Inc offset%,4+LLen(buff%())\2 Else Print #2,"'"+o$; Print #2," is uncompressed" Print #2,Hex$(h%,4)+Hex$(w%,4) LongString append obuff%(),Left$("00000000",8-(LLen(obuff%()) Mod 8)) j%=0 For i%=8 To LLen(obuff%()) Step 8 'reverse the order o$=LGetStr$(obuff%(),i%,1) Inc o$,LGetStr$(obuff%(),i%-1,1) Inc o$,LGetStr$(obuff%(),i%-2,1) Inc o$,LGetStr$(obuff%(),i%-3,1) Inc o$,LGetStr$(obuff%(),i%-4,1) Inc o$,LGetStr$(obuff%(),i%-5,1) Inc o$,LGetStr$(obuff%(),i%-6,1) Inc o$,LGetStr$(obuff%(),i%-7,1) Inc j% If j%=8 Then Print #2,o$ j%=0 Else Print #2,o$+" "; EndIf Next i% If j%<>0 Then Print #2,"" Inc offset%,4+LLen(obuff%())\2 EndIf LongString clear obuff%() LongString clear buff%() Next s% Close #1 If separatesubs%=1 Then Print #2,"END CSUB" End Sub ' 'converts the Ascii colour from the Maximite standard to PicoMite standard Function mycol$(c$) Static cols%(15)=(0,1,6,7,8,9,14,15,2,3,4,5,10,11,12,13) Local i% If c$=" " Then c$="0" i%=Val("&H"+c$) mycol$=Hex$(cols%(i%)) End Function Edited 2023-11-01 01:11 by matherp |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4247 |
@Peter, I have not tested it, but have doubt. I use an integer array to store the addresses. These are signed integers right ? Or should I use unsigned integers to pass them to the blit memory function ? Remember I add the offset (index) to get the final vector. Volhout Edited 2023-11-01 01:18 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9129 |
There should be no change needed, whatever you passed to BLIT COMPRESSED pass to BLIT MEMORY, it should just work - just do a global replace. Obviously you need to use the new offset files that are generated as well as the CSUBs BLIT MEMORY looks at the top bit of the width and/or height fields and if set processes the data as compressed. The new conversion code sets the bit correctly Edited 2023-11-01 01:22 by matherp |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4247 |
@Peter, My question is about math. Setting the &h80000000 bit makes it into a negative integer number. When I add the offset to it, the integer number does not increase, but decrease. Anyway... I will try and see if it works. Volhout PicomiteVGA PETSCII ROBOTS |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9129 |
The offset isn't changed it is the width/height word that has the bit set and that is taken care of by the firmware |
||||
Martin H. Guru Joined: 04/06/2022 Location: GermanyPosts: 1114 |
Hopfully the last revision of the Tiles... The "outdoortiles"(D6 E4,E5 E8 E9) are solid again. and i left the Tiles, which replaced by the Animation, black tiles_v3.zip So they might be better to compress .. Edit: Tested to convert with Peters new Routine for compressed/uncompressed mix: 57308 Bytes (last Offset+40) compare to uncompressed 73728 (12*24*256) I'll test your new Update tomorrow. Cheers Mart!n Edited 2023-11-01 17:42 by Martin H. 'no comment |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4247 |
@Peter @Martin Thank you both for your contributions. I have managed to combine them and the result is that we have saved 10kbyte in the library (97k->87k) for all sprites and tiles. The new tileset works with the BLIT MEMORY command (simple find-replace -> done). For me this is "petrobot23". I will provide a zip later. Volhout PicomiteVGA PETSCII ROBOTS |
||||
Martin H. Guru Joined: 04/06/2022 Location: GermanyPosts: 1114 |
Volhout, here are the MODs you asked for. They are, as they've been on Github and I repaired the broken samples. SFX are added 16-30, exept metal_heads-sfx just got the Beep for the Intro. Win and Lose doesn't have sfx. As they are, they dont fit into the Modbuffer. If you're used to the Adlib music on the PC version, they sound different. Maybe I could try sampling them (CTRL+F6 records the sound in the DOSBox as an audio file or ends the recording) and then replacing them in the mods (if they are smaller). MusicSFX.zip Edited 2023-11-01 21:01 by Martin H. 'no comment |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9129 |
Remember the modbuffer only has to be a multiple of 4K bytes so without upsetting Tom too much you could go to 132K or 144k say without impacting file space too much. You don't want to be reloading mod files too much as it causes a big delete on the flash memory which should probably be avoided. With a little thought I can probably test the modbuffer and only overwrite it if the mod file has changed so if you can avoid this the delay will only happen the first time the game is played IFF you can constrain yourselves to just one mod file |
||||
Page 21 of 38 |
Print this page |