CPCWiki forum

General Category => Games => Topic started by: Morri on 10:53, 19 June 16

Title: Coolbox [New Game in Basic]
Post by: Morri on 10:53, 19 June 16
Hi All,
I have been working on a basic game for the last few months. Let me introduce "Coolbox", a puzzle game in the vain of Block Dude the old calculator game.
This game is completely written in Basic, no machine code or loaded files. It has multicoloured sprites, scrolling and in game music (thanks to Mr Lou for the tunes).

I was going to enter it into the CPCRetroDev2016 comp but I have failed to get it to work in Basic 1.0. Initially the sprites caused me some problems. I fixed that only to have the scrolling give me issues so I've given up and decided to release it as Basic 1.1 only. However if someone wants to have a go at making it 464 compatible, please be my guest.  ;D

Hope you guys have fun and give feedback here.
Title: Re: Coolbox [New Game in Basic]
Post by: AMSDOS on 11:39, 19 June 16
Quote from: Morri on 10:53, 19 June 16
I was going to enter it into the CPCRetroDev2016 comp but I have failed to get it to work in Basic 1.0. Initially the sprites caused me some problems. I fixed that only to have the scrolling give me issues so I've given up and decided to release it as Basic 1.1 only. However if someone wants to have a go at making it 464 compatible, please be my guest.  ;D


Would of been happy to give it a crack, you should of PM me earlier with it.  ;D
Title: Re: Coolbox [New Game in Basic]
Post by: Morri on 11:48, 19 June 16
Quote from: AMSDOS on 11:39, 19 June 16
Would of been happy to give it a crack, you should of PM me earlier with it.  ;D
You still can mate, it would be great if 464 owners get to have a chance to play it.  8)
Title: Re: Coolbox [New Game in Basic]
Post by: AMSDOS on 11:56, 19 June 16
Quote from: Morri on 11:48, 19 June 16
You still can mate, it would be great if 464 owners get to have a chance to play it.  8)


Yes I can, I just meant it might be a bit difficult to submit it for the compo now.
Title: Re: Coolbox [New Game in Basic]
Post by: ronaldo on 12:16, 19 June 16
It's a great game, @Morri (http://www.cpcwiki.eu/forum/index.php?action=profile;u=95) , congratulations :). It is not easy to make a great playable game in BASIC.

I've tested it and mostly works on BASIC 1.0. The only problem seems to be with your s$ strings. You are using control chars directly there and seems to cause some kind of problem with BASIC 1.0. I think that changing that sequences into CHR$(xx)+CHR$(xx)... instead of directly placing characters may solve the issues.

It's a pitty you haven't asked earlier. It could have been a very competitive game for the compo. You may still reuse some ideas to make a similar but different game and submit it to the compo. Just make sure that games are different enough :).
Title: Re: Coolbox [New Game in Basic]
Post by: VincentGR on 13:01, 19 June 16
This is fantastic!!!!

Thank you.
Title: Re: Coolbox [New Game in Basic]
Post by: arnoldemu on 13:05, 19 June 16
Amazing  :)
Title: Re: Coolbox [New Game in Basic]
Post by: Phantomz on 17:57, 19 June 16
@Morri (http://www.cpcwiki.eu/forum/index.php?action=profile;u=95)

Thanks a lot for this great little game.  :)

Just had a quick go and got to level five, out of interest, how many levels does it have?

I'll play it some more later on my GX4000  ;D
Title: Re: Coolbox [New Game in Basic]
Post by: Morri on 19:39, 19 June 16
Quote from: AMSDOS on 11:56, 19 June 16
Yes I can, I just meant it might be a bit difficult to submit it for the compo now.
Submitting is not an option now but that is OK. I was never doing this for anything other than fun anyway. ::)

Quote from: ronaldo on 12:16, 19 June 16
It's a great game, @Morri (http://www.cpcwiki.eu/forum/index.php?action=profile;u=95) , congratulations :) . It is not easy to make a great playable game in BASIC.
Making a fun game in BASIC was the idea so I'm glad people are enjoying it.
Quote
I've tested it and mostly works on BASIC 1.0. The only problem seems to be with your s$ strings. You are using control chars directly there and seems to cause some kind of problem with BASIC 1.0. I think that changing that sequences into CHR$(xx)+CHR$(xx)... instead of directly placing characters may solve the issues.
Yes BASIC 1.0 and use of control codes is very limited. I have a version where the sprites are fixed in BASIC 1.0 and it wasn't too bad to fix, however the next bug I encountered was a scrolling bug using the OUT commands. The screen moved OK but the sprites would not stay on the screen. This one proved too much for me and I just couldn't bear working on it anymore.

Quote from: Phantomz on 17:57, 19 June 16
@Morri (http://www.cpcwiki.eu/forum/index.php?action=profile;u=95)

Thanks a lot for this great little game.  :)

Just had a quick go and got to level five, out of interest, how many levels does it have?

I'll play it some more later on my GX4000  ;D
Good going. It has 9 levels and I even put in an ending. 7 and 8 are real ball busters though.
Title: Re: Coolbox [New Game in Basic]
Post by: Kris on 19:52, 19 June 16
Great realisation, especially in Basic.
I really like gfx and gameplay: a nice & addictive game  ;)
Title: Re: Coolbox [New Game in Basic]
Post by: Phantomz on 20:07, 19 June 16
Quote from: Morri on 19:39, 19 June 16
Good going. It has 9 levels and I even put in an ending. 7 and 8 are real ball busters though.

@Morri (http://www.cpcwiki.eu/forum/index.php?action=profile;u=95)

Cool.  8)

Is it ok to upload the cpr for plus users to use and a version for the GX4000 where I've changed the controls ?

In the GX4000 version I've made it push down to pick up and drop cube, Button 1 to turn music on / off, and Button 2 to restart the level, the console pause button goes back to the main menu.  ;D

I've only tested it in emulation at the moment but appears to work ok.  ;)
Title: Re: Coolbox [New Game in Basic]
Post by: Morri on 20:21, 19 June 16
Quote from: Phantomz on 20:07, 19 June 16
@Morri (http://www.cpcwiki.eu/forum/index.php?action=profile;u=95)

Cool.  8)

Is it ok to upload the cpr for plus users to use and a version for the GX4000 where I've changed the controls ?

In the GX4000 version I've made it push down to pick up and drop cube, Button 1 to turn music on / off, and Button 2 to restart the level, the console pause button goes back to the main menu.  ;D

I've only tested it in emulation at the moment but appears to work ok.  ;)
Yeah of course, my first GX4000 game.  8)
Title: Re: Coolbox [New Game in Basic]
Post by: Phantomz on 20:34, 19 June 16
Quote from: Morri on 20:21, 19 June 16
Yeah of course, my first GX4000 game.  8)

Cool.  8)

I don't know if there is any highscore table to get stuck on.  :laugh:

Here is the cart with controls unchanged and one for the GX4000.  :)
Title: Re: Coolbox [New Game in Basic]
Post by: HAL6128 on 21:02, 19 June 16
Very good and impressive BASIC game!
Title: Re: Coolbox [New Game in Basic]
Post by: SRS on 22:35, 19 June 16
nice game !

Tried to BASCOMPILE it to get it on 464 but if gives me syntax error in line 80.

"ENT -3,=1000,60,=3000,40"

wondering why this works on emulator but bc does not like it
Title: Re: Coolbox [New Game in Basic]
Post by: ||C|-|E|| on 23:24, 19 June 16
It is very cool! I was playing it for a while and the only thing I miss is being able to face left or right without moving the main character :)
Title: Re: Coolbox [New Game in Basic]
Post by: Morri on 23:46, 19 June 16
Quote from: SRS on 22:35, 19 June 16
nice game !

Tried to BASCOMPILE it to get it on 464 but if gives me syntax error in line 80.

"ENT -3,=1000,60,=3000,40"

wondering why this works on emulator but bc does not like it

I'm not a sound person but I believe the equals sign is a hardware direct call from basic used for more advanced sounds. Removing this line would affect one of the sound effects but should be OK.

Quote from: ||C|-|E|| on 23:24, 19 June 16
It is very cool! I was playing it for a while and the only thing I miss is being able to face left or right without moving the main character :)
I thought about this feature and whether or not to do it (Block dude allows this). I decided not to as it makes the stages slightly more challenging but was careful to make sure all the levels can be passed.
People are free to edit the code as they wish and adding this feature should be fairly easy.
Title: Re: Coolbox [New Game in Basic]
Post by: AMSDOS on 01:05, 20 June 16
Quote from: Morri on 19:39, 19 June 16
Submitting is not an option now but that is OK. I was never doing this for anything other than fun anyway. ::)
Making a fun game in BASIC was the idea so I'm glad people are enjoying it.
Yes BASIC 1.0 and use of control codes is very limited. I have a version where the sprites are fixed in BASIC 1.0 and it wasn't too bad to fix, however the next bug I encountered was a scrolling bug using the OUT commands. The screen moved OK but the sprites would not stay on the screen. This one proved too much for me and I just couldn't bear working on it anymore.

Good going. It has 9 levels and I even put in an ending. 7 and 8 are real ball busters though.


I noticed one of your Coolbox dude wasn't displaying itself where they should on the title screen, so loaded the program, I put an end statement at 1051 (sorry I renumbered it), run the program, when I press any key to begin the program ends and did this test:



for x=1 to 30:locate x,10:print s$(1);chr$(22);chr$(0);:next x



sure enough the XPOS of the character gets to 19 and then it bellies up. So it's a similar problem to the one you had earlier with the FourXs. I was checking the length of your s$(1) and found it was 25 characters in length, but when I counted the BackSpaces in it, this brought that back to the 19 figure.


So it looks like the difference in string management on the 464 which is causing those problems.
Title: Re: Coolbox [New Game in Basic]
Post by: Morri on 01:23, 20 June 16
Quote from: AMSDOS on 01:05, 20 June 16

I noticed one of your Coolbox dude wasn't displaying itself where they should on the title screen, so loaded the program, I put an end statement at 1051 (sorry I renumbered it), run the program, when I press any key to begin the program ends and did this test:



for x=1 to 30:locate x,10:print s$(1);chr$(22);chr$(0);:next x



sure enough the XPOS of the character gets to 19 and then it bellies up. So it's a similar problem to the one you had earlier with the FourXs. I was checking the length of your s$(1) and found it was 25 characters in length, but when I counted the BackSpaces in it, this brought that back to the 19 figure.


So it looks like the difference in string management on the 464 which is causing those problems.

That was the conclusion I came to as well. BASIC 1.0 doesn't like the backspaces. I solved it using techniques we discussed in the previous threads and had everything working until the screen scrolled using the OUT &BC00,XX command. Then I started getting a whole new host of display bugs and I lost heart after that.

When I get home from work, I'll post the dsk image of the BASIC 1.0 code I had so far so you can see the issue. Maybe someone better than me can see the issue and fix it.
Title: Re: Coolbox [New Game in Basic]
Post by: AMSDOS on 01:32, 20 June 16
Sorry I was following your comments, unfortunately I thought I was playing with the 464 attempt.

I noticed your scroll routine I'll have to go back to the one made earlier, I think it works with basic 1.0.


EDIT:Not to worry about the scroll routine I made earlier, seems to work differently from the one you've made.
Title: Re: Coolbox [New Game in Basic]
Post by: Morri on 07:50, 20 June 16
Here is an updated dsk file with my best 464 code so far. Quite a few additions to the original file in my 1st post.
I think it still works OK in BASIC 1.1.
Title: Re: Coolbox [New Game in Basic]
Post by: AMSDOS on 10:26, 20 June 16
Quote from: Morri on 07:50, 20 June 16
Here is an updated dsk file with my best 464 code so far. Quite a few additions to the original file in my 1st post.
I think it still works OK in BASIC 1.1.


Yes it's still working fine with BASIC 1.1, unfortunately I haven't been able to pinpoint the source of the trouble. I think the Scroll is working fine, but in BASIC 1.0 when the scroll has been carried out and new scenery is redrawn in Window 3, your character is ending up there as well. I just presumed all the PRINT & LOCATE statements without any Stream numbers refer to the main window, and altered them accordingly, but I'm still getting that result.  ::)
Title: Re: Coolbox [New Game in Basic]
Post by: ronaldo on 18:59, 20 June 16
It's curious that it only happens at the start of the scroll. Once you go 5 or 6 steps into the scroll, everything works again.

I still think it could be due to some kind of bug in the implementation of control codes in BASIC 1.0. Have you tried using no control codes? What about a drawing subroutine instead of a control-coded string? It may work.
Title: Re: Coolbox [New Game in Basic]
Post by: Dagger on 20:38, 20 June 16
I finished all the levels, good game, very addictive. Please do some more levels
Title: Re: Coolbox [New Game in Basic]
Post by: TFM on 21:21, 20 June 16
Nice little cool game!  :)
Title: Re: Coolbox [New Game in Basic]
Post by: Morri on 20:09, 21 June 16
Quote from: ronaldo on 18:59, 20 June 16
It's curious that it only happens at the start of the scroll. Once you go 5 or 6 steps into the scroll, everything works again.

I still think it could be due to some kind of bug in the implementation of control codes in BASIC 1.0. Have you tried using no control codes? What about a drawing subroutine instead of a control-coded string? It may work.
Yes, it seems it is the control codes fault. Once I removed all the control codes the game works fine. No colour yet, I'd have to work on something that redraws using transparent sprites but without control codes.
Title: Re: Coolbox [New Game in Basic]
Post by: ronaldo on 21:01, 21 June 16
You can use transparency with control codes, but don't embed it the middle of a string. Activate transparency then draw with control codes, deactivate it then clear. It should work this way.
Title: Re: Coolbox [New Game in Basic]
Post by: Morri on 22:03, 21 June 16
Quote from: ronaldo on 21:01, 21 June 16
You can use transparency with control codes, but don't embed it the middle of a string. Activate transparency then draw with control codes, deactivate it then clear. It should work this way.
I'm sure this is what I did in the cool464.bas file but the problem remained.

The bug in BASIC 1.0 seems to be for every control code you embed in a string, you lose a column in the window. i.e. string has 5 control codes then anything past LOCATE 35,XX won't work. 10 cc's would be LOCATE 30,XX etc... I think that's why the character returned to normal after 5 or so moves because he had wrapped around the screen back to XPOS 1 after glitching through XPOS 35 - 40.
Title: Re: Coolbox [New Game in Basic]
Post by: AMSDOS on 09:51, 22 June 16
I remember having some problems, which related to my positioning of my LOCATE, when I was writing my Block Editor (which is in my Silly Programming Ideas Thread) last year. In that situation I had a LOCATE, followed by the Control Code for turning off the Transparency Mode, Printing the relevant colour block in that spot & then turning the Transparency Mode back on. I was finding in that situation my Cursor (X) was working fine until I went to the far right of screen, the correction I made was to use the Control Code, followed by the LOCATE, PRINT the relevant colour block, turn Transparency back on.


But I think circumstances in your program are different in the way you're managing your program, so the resolution in your case maybe to simply LOCATE before the control code, it could be placed in another window like window 1, I was going to try that to see if that would make a difference, though I'm not 100% certain if this will correct what's happening.
Title: Re: Coolbox [New Game in Basic]
Post by: ronaldo on 11:25, 22 June 16
Quote from: Morri on 22:03, 21 June 16
The bug in BASIC 1.0 seems to be for every control code you embed in a string, you lose a column in the window. i.e. string has 5 control codes then anything past LOCATE 35,XX won't work. 10 cc's would be LOCATE 30,XX etc... I think that's why the character returned to normal after 5 or so moves because he had wrapped around the screen back to XPOS 1 after glitching through XPOS 35 - 40.
Is not exactly related to the number of control codes embeded, but to the length of the string itself (counting the control codes). I have created a proof of concept that you can use for testing and understanding what really happens.

''' Setup
10 defint a-z:ox=1:x=1:y=3:m=0:l=8:pm=0
20 mode 0
30 gosub 2000:gosub 1000:gosub 1200

''' Main Loop: Read keyboard and perform actions
''' O, P: move left-right
''' Z, X: Shrink-Enlarge control-code string
''' Space: Change printing method
'''
40 k$="":while k$="":k$=upper$(inkey$):WEND
50 if k$="O" then if x>1 then x=x-1:m=1
60 if k$="P" then if x<20 then x=x+1:m=1
70 if k$="Z" then if l>1 then l=l-1:gosub 2000
80 if k$="X" then if l<40 then l=l+1:gosub 2000
90 if k$=" " then gosub 1200
100 if m then m=0:if pm then gosub 1000 else gosub 1100
110 goto 40

'''' Print Character (Method 1: Control Codes)
1000 locate 1,1:print x;y;"  ":locate ox,y:print" "
1010 locate x,y:print p$
1020 ox=x:return

'''' Print Character (Method 2: Standard print)
1100 locate 1,1:print x;y;"  ":locate ox,y:print" "
1110 locate x,y:print "A";chr$(;"B";chr$(;"C";chr$(;"D";chr$(
1120 ox=x:return

'''' Change Print Method
1200 pm=not(pm):locate 1,5
1210 if pm then print "CONTROL CODES " else print "STANDARD PRINT"
1220 return

'''' Create character string with control codes
2000 p$=""
2010 for i=1 to l:if i mod 2<>0 then p$=p$+chr$(64+i/2) else p$=p$+chr$(
2020 next:locate 10,1:print "LEN:";len(p$);" "
2030 return

In this proof of concept, I also show you an alternate method to print your characters using control codes. Create a subroutine that prints your character instead of a string, then use GOSUB instead of print string$. In this case, I print the string character by character, but you may use several strings joined by semicolons, being sure that the length of your strings (counting control codes) added to your x-coordinate do not sum more than screenwidth+1.

That should solve your issues, at the cost of a little bit of speed loss.
Title: Re: Coolbox [New Game in Basic]
Post by: VincentGR on 15:06, 22 June 16
Finally after some days I finished this fantastic game.
I had no spare time so I did a level or two per day.
The last two were the easiest  :-X





Thanks again.
Title: Re: Coolbox [New Game in Basic]
Post by: Bytebreaker on 15:49, 22 June 16
Yes, very amazing. The Youtube publication maybe attracts more people who might get interested in Amstrad Retro stuff and its superior Basic abilities.
Title: Re: Coolbox [New Game in Basic]
Post by: Gryzor on 14:29, 23 June 16
What a cool, cute little game!! Very clever use of the large pixels, and great puzzles too. Imagine if this was a type in back in the day...
Title: Re: Coolbox [New Game in Basic]
Post by: mr_lou on 18:35, 23 June 16
I notice in the video that the audio channels are out of sync in the title tune. It's not supposed to sound like that.

The ingame tune seems to be fine.
Title: Re: Coolbox [New Game in Basic]
Post by: VincentGR on 20:05, 23 June 16
Quote from: mr_lou on 18:35, 23 June 16
I notice in the video that the audio channels are out of sync in the title tune. It's not supposed to sound like that.

The ingame tune seems to be fine.


Maybe it messed up while I was editing with VDub, dunno  :-X
Title: Re: Coolbox [New Game in Basic]
Post by: Morri on 01:01, 24 June 16
Quote from: mr_lou on 18:35, 23 June 16
I notice in the video that the audio channels are out of sync in the title tune. It's not supposed to sound like that.

The ingame tune seems to be fine.
This may have been something I did wrong. I used the MERGE command to get your code into the game and had to change the variable names to avoid clashes. The title tune seems to work OK the 1st time it plays, then when you play the game and return to the title screen, it slowly starts to go out of sync. I tried to fix it but couldn't pinpoint anything. :-[
Title: Re: Coolbox [New Game in Basic]
Post by: ukmarkh on 21:46, 08 October 16

I love this game:


http://classicreplay.blogspot.com/2016/10/coolbox-amstrad-cpc.html


(https://2.bp.blogspot.com/-08UiMn7ymAU/V_lDv_Sm82I/AAAAAAAAB-Q/QFQHjvyRP0IuK6PihzvO-25ZLZOwfIwaQCLcB/s1600/CoolBox.jpg)
Title: Re: Coolbox [New Game in Basic]
Post by: Sykobee (Briggsy) on 15:55, 09 October 16
Neat little game! Great use of BASIC (although I can see you're getting hit hard by the column redraw - are you PRINTing solid blocks? Might be better to POKE solid data into screen memory instead...
Title: Re: Coolbox [New Game in Basic]
Post by: roudoudou on 12:05, 13 October 16
Quote from: Morri on 10:53, 19 June 16
Hope you guys have fun and give feedback here.


I discover the game yesterday, woaaaaaaah! Huge work, pure basic, very nice! And playable!


It was a real pleasure to play with your game!


Thank you!
Title: Re: Coolbox [New Game in Basic]
Post by: Puresox on 18:13, 13 October 16
It's definitely the finest Basic game I have come across. Please let us know if there are any other good Basic examples.
Title: Re: Coolbox [New Game in Basic]
Post by: Morri on 19:08, 13 October 16
Quote from: Sykobee (Briggsy) on 15:55, 09 October 16
Neat little game! Great use of BASIC (although I can see you're getting hit hard by the column redraw - are you PRINTing solid blocks? Might be better to POKE solid data into screen memory instead...
Yes, it is simply a PRINT command to get the next lot of screen. Not sure how easy it would be to POKE things onto the screen. This was discussed some time this year but the tests made showed POKEing pixels in BASIC wasn't any faster so I never bothered to try. Machine code would definitely be faster but my goal was 100% BASIC.
Powered by SMFPacks Menu Editor Mod