![]() |
Forum Index : Microcontroller and PC projects : NEXT STEP- To start converting all the archive of programs.
![]() ![]() |
|||||
Author | Message | ||||
capsikin Guru ![]() Joined: 30/06/2020 Location: AustraliaPosts: 341 |
I see this deals with both the different colours, and the different Pixel command syntax. I was going to ask if you had the original source, but I see it's just the same but without the added code at the front, and with the different Pixel command which you've included in the comments. I've noticed that the second argument to MODE can be left off, this should go in the manual if it's officially supported: "MODE r, [bits [, bg [, int]]]" with the extra square brackets instead of "MODE r, bits [, bg [, int]]". Is there a default colour depth? |
||||
mclout999 Guru ![]() Joined: 05/07/2020 Location: United StatesPosts: 482 |
OK, I am trying to convert a game with a load sprite ( ) comand and it error out saying to many sprites. What was the limit of CMM1 because we have the limit of 64. If CMM1 had more why did it get limited on the CMM2. On a simulare limitation CMM1 had 8 levels of demintions of arrays I think and CMM2 is limited to 5. I know most programs will seldom need more than 5 but why, if it has not been discused yet. Was it a performance issue? Thanks. |
||||
JohnS Guru ![]() Joined: 18/11/2011 Location: United KingdomPosts: 3988 |
Sounds like an oddity of the syntax or your code or some such. Maybe post the simplest way to show it. If it's a bug a simple example will be needed anyway. John |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10002 |
Yes Sprites are computationally very expensive particularly the collision detection. If you need more than 64 sprites then you are probably using the wrong approach and should look at tiles and BLIT. Sprites should be reserved for moving elements where collision detection is an essential component. If you need diferent sprites for different levels then sprites slots can be closed and reused. Edited 2020-08-01 18:20 by matherp |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10002 |
To convert the 8-bit Guys Tetris Put the command OPTION LEGACY ON at the top of the program. Then insert the command MODE 5 Delete the existing MODE command later in the program (leave the CLS) Then change the two commands below to stop the text scrolling Print @(170,180,1) "ESC to Print @(170,190,1) "PAUSE/EXIT" |
||||
mclout999 Guru ![]() Joined: 05/07/2020 Location: United StatesPosts: 482 |
Yah I think is was not clear because I brought up 2 issues when I was mostly interested in why so many of the programs for the CMM1 error out saying you have exceeded the number of sprites. I look at the spr file they are trying to load and it seems like there are less than 64 in the file. I am not sure what is happening there and because I was getting that error I was asking if there where different max # of sprints. I want to understand how I can fix the games when I get one of those errors. On the performance thing, I am guessing that the sprites are not hardware-based like on some of the old 8bit and 16bit systems. I thought they might be. I'm realy trying to undersand how this thing works and am feeling a little overwhelmed as I am not figuring much out so far. |
||||
capsikin Guru ![]() Joined: 30/06/2020 Location: AustraliaPosts: 341 |
Yes Sprites are computationally very expensive particularly the collision detection. If you need more than 64 sprites then you are probably using the wrong approach and should look at tiles and BLIT. Sprites should be reserved for moving elements where collision detection is an essential component. If you need diferent sprites for different levels then sprites slots can be closed and reused. Yah I think is was not clear because I brought up 2 issues when I was mostly interested in why so many of the programs for the CMM1 error out saying you have exceeded the number of sprites. I look at the spr file they are trying to load and it seems like there are less than 64 in the file. I don't know why else you might get the error. Unless the program is using "SPRITE COPY" to make more sprites than are in the file. In which case it could be using high numbered sprites even with only a few sprites, as it lets you set the new sprite numbers. Is the error happening at a SPRITE LOAD command, or could it be somewhere else? I am not sure what is happening there and because I was getting that error I was asking if there where different max # of sprints. I want to understand how I can fix the games when I get one of those errors. On the performance thing, I am guessing that the sprites are not hardware-based like on some of the old 8bit and 16bit systems. I thought they might be. I'm realy trying to undersand how this thing works and am feeling a little overwhelmed as I am not figuring much out so far. From the old manual: "The sprites are defined in a file which is loaded into memory using the SPRITE LOAD command, the number of sprites contained in the file is only limited by the amount of available memory" |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6212 |
Yah I think is was not clear because I brought up 2 issues when I was mostly interested in why so many of the programs for the CMM1 error out saying you have exceeded the number of sprites. I look at the spr file they are trying to load and it seems like there are less than 64 in the file. I am not sure what is happening there and because I was getting that error I was asking if there where different max # of sprints. I want to understand how I can fix the games when I get one of those errors. Give us a clue. What program are to have trouble with? Pick one, preferably not too big and start with it. Jim VK7JH MMedit |
||||
mclout999 Guru ![]() Joined: 05/07/2020 Location: United StatesPosts: 482 |
Yah I think is was not clear because I brought up 2 issues when I was mostly interested in why so many of the programs for the CMM1 error out saying you have exceeded the number of sprites. I look at the spr file they are trying to load and it seems like there are less than 64 in the file. I am not sure what is happening there and because I was getting that error I was asking if there where different max # of sprints. I want to understand how I can fix the games when I get one of those errors. Give us a clue. What program are to have trouble with? Pick one, preferably not too big and start with it. Jim A game of Space invaders File name Col_inv.bas The error it throws is [40] Error: Maximum of 64 sprites I got it somewhere I can't tell you where. When I come across any more gain(now I cant find them. I have literally downloaded every MMbasic code I have found and I search high and low. SPACEInvaders.zip |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6212 |
Looking at "invader2.spr" 'SprMite0Generated0Sprites 'D:\projets\2k12_DXE2\SprMite\invader.spr 16,100 0000000000000000 0000000000000000 0000000000000000 0000000000000000 The first non-comment line is 16,100 which means the size of the sprites is 16x16 and the number of sprites in the file is 100 The original sprites were always 16x16 Line 46 of the program has MaxSprite = 94 which I would suggest that the program is using up to 94 sprites. Try changing the "invader2.spr" file line 3 from 16,100 to 16,64 and line 46 of "Col_Inv.bas" to MaxSprite = 64 You might have to cut the end off the sprite file to bring it down to 1027 lines but try as is first. (16 lines x 64 sprites + 3 comments and specs = 1027) That might get you going. Here are the fonts files, converted to CMM2 format SPACEInvaders.zip Jim Edited 2020-08-02 15:35 by TassyJim VK7JH MMedit |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6212 |
You might have better luck with 63 as a maximum number of sprites. VK7JH MMedit |
||||
darthvader Regular Member ![]() Joined: 31/01/2020 Location: FrancePosts: 80 |
Hi , i just have take a look at the original source , and i think they are some misunderstood on the number of sprite used. Original sprite file was 'font file' : 'AniMite Generated Fonts and Sprites 'D:\projets\2k12_DXE2\AniMite\invader.fnt 13,16,97,121 o o o o ooooooo oo ooo oo ooooooooooo o ooooooo o o o o o oo oo .... It means , each sprite is 16 pixels wide , 13 pixels high , the first sprite 'font' start at 97 and the last is the number 121 , they are then only 25 sprites ![]() The original program load the new font : 'Get the Invaders font (16 x 13 pixels) Font Load "invader.fnt" As #6 'Get the start Screen font (8 x 8 pixels) Font Load "invmenu.fnt" As #7 I actually don't have get my CMM2 and don't know how you convert the old sprite to the new one. Just take care where the sprite starts/ends and how much they really are ![]() Cheers. Theory is when we know everything but nothing work ... Practice is when everything work but no one know why ;) |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6212 |
Hi , i just have take a look at the original source , and i think they are some misunderstood on the number of sprite used. Original sprite file was 'font file' : I actually don't have get my CMM2 and don't know how you convert the old sprite to the new one. Just take care where the sprite starts/ends and how much they really are ![]() Cheers. That is for the mono version of the game. He is trying to convert a colour version which does use sprites to get multi colour sprites. Converting old font files to the new format is easy - just use FontTweak. Jim VK7JH MMedit |
||||
mclout999 Guru ![]() Joined: 05/07/2020 Location: United StatesPosts: 482 |
Hi , i just have take a look at the original source , and i think they are some misunderstood on the number of sprite used. Original sprite file was 'font file' : I actually don't have get my CMM2 and don't know how you convert the old sprite to the new one. Just take care where the sprite starts/ends and how much they really are ![]() Cheers. That is for the mono version of the game. He is trying to convert a colour version which does use sprites to get multi colour sprites. Converting old font files to the new format is easy - just use FontTweak. Jim This was what I needed thanks. I have your app so I will convert that file and go on from there. Thanks. |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6212 |
This was what I needed thanks. I have your app so I will convert that file and go on from there. Thanks. Remember that you can only 'load' one font and it must be font #8 If you want more than one, it is simplest to put them all in a .inc file and that way you can have many loaded at once. By using an INC file, it makes editing your main program easier without the extra lines of font definition as a distraction. Jim VK7JH MMedit |
||||
![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |