SpaceShip - simple game for RISC OS
Patrick M (2888) 117 posts |
Hi, During the past week I had a go at making a simple game in BASIC. Here’s a dropbox download link: I might still work on it a bit more, but I think it’s mostly finished now. If anyone tries it, let me know if it works on your system. It works alright on my Raspberry Pi 2 with the RC14 image. |
Anthony Vaughan Bartram (2454) 455 posts |
Hi Patrick, Thanks for sharing. I’ll give it a go and review the code Regards, |
Anthony Vaughan Bartram (2454) 455 posts |
If its ok with you, I’m going to add sound effects (SOUND and ENVELOPE) with my alpha RDSP module and send it back to you with a couple of adjustments. Every time I see a game at the moment I want to add sounds to it :-) |
Patrick M (2888) 117 posts |
Hi Anthony,
Please do, that’d be cool. It’ll be interesting to see what it’ll be like with more serious/realistic/proper sounds. (though I also quite the Percussion-Soft sounds it has at the moment – it gives it that old-Archimedes-game feel.) |
Anthony Vaughan Bartram (2454) 455 posts |
Hi Patrick, Thanks. This code is good. Like the game. The virtual sound chip I’ve written is a bit of a fusion of different systems. Its 16 bit 44khz and shares architectural similarities with the SID chip in the C64 (with digital filter), guitar pedals, TI chip BBC Micro and offers sample playback. The sound module is alpha quality at the moment (and will probably only run on the Iyonix, Pi, RPCEmu and the ARM X6 at present). I’m still adjusting the sound command parameters/features and the envelope does not behave the same way as the Beeb. I’ll add some synth sounds and a couple of samples tonight. |
Anthony Vaughan Bartram (2454) 455 posts |
Hi Patrick, I’ve added some sounds: ps. I know this module works on ‘some’ but not all RISC OS systems. Quick feedback:
I added some notes for RDSP alpha 18 (unreleased officially) into the application directory. Best Regards, Tony ps. This is the first game that RDSP has ever been added to. |
Patrick M (2888) 115 posts |
Thanks for the feedback, Tony.
Now that I think about it, I’m guessing that’s probably because I’ve been using the ‘WAIT’/wait for vsync command between screen updates, and I’m guessing that means the speed will change depending on display refresh rate. Nice sounds by the way, the title screen sound is really cool. |
Jeff Doggett (257) 231 posts |
Don’t do this. It is a common beginners blunder.
Think about what happens when the timer rolls over. |
Anthony Vaughan Bartram (2454) 455 posts |
Hi Patrick, Glad you like the sounds. The in game sounds are generated in real-time using the ‘virtual sound chip’ via the ENVELOPE command. The title screen sound is a WAV file sample (run through the RDSP’s echo effect) played using the SOUND command which I got from a Future Music cover disc. I plan to make those samples available for free download when I produce the release version of RDSP (hopefully next month). As far as I know they are public domain demos of synthesisers that were being reviewed by the magazine. |
Patrick M (2888) 115 posts |
Hi, Jeff, Tony,
It’s curious, I tried it on my old Pi 1 model B last night (using the same SD card/RISC OS set up that I use on my Pi 2) and it seemed to run at the same speed as it did on my Pi 2, even when I temporarily changed the code so that the maximum number of asteroids would spawn at the start of the game. Then I tried it again on the old Pi 1, but with a different version of RISC OS dating from around late 2012 – a labelled SD card that I bought from riscosopen.org at that time. It ran at the same speed, but it was using a different screen mode. |
Anthony Vaughan Bartram (2454) 455 posts |
Hi Patrick, With my games I usually display an FPS counter whilst testing them. The particles seemed to visibly more slower that the ARM x6. But maybe I’m wrong so tomorrow I’ll add a frames-per-second counter to see what my Pi 1 is managing. i.e. I print tab(0,0) the number of frames drawn each second. Are you ensuring your Pi 2 is running at full speed? By default with the latest firmware, I understand that this is not the case Tony |
Anthony Vaughan Bartram (2454) 455 posts |
Top score so far – 6108 on level 9. |
David Feugey (2125) 2687 posts |
I tried it today. Very cool game :) |
Anthony Vaughan Bartram (2454) 455 posts |
Hi David, I’m impressed by the game’s playability too. |
David Feugey (2125) 2687 posts |
Yep, I use it with the sound. No problem. |
Patrick M (2888) 115 posts |
Hi, @Tony In the mean time, I tried implementing an FPS counter, and it reported a constant 60 FPS. I also tried temporarily removing the WAIT/vsync wait command and the game ran so fast that it was difficult/impossible to play, even with the maximum number of asteroids on the screen. So it seems on my Pi 2 it’s running at a constant framerate with no lag. But I still haven’t tested it extensively with my Pi 1, so I’ll probably do that tonight. By the way, the furthest I’ve gotten is level 17 with 9512 points. I seem to spend more effort evading the asteroids rather than shooting them. @David |
Anthony Vaughan Bartram (2454) 455 posts |
Thanks David for confirming sound in Spaceship works for you. Hi Patrick, My games use triple buffering because on modern RISC OS hardware it is not guaranteed that the video buffer switch will not occur when the screen blanks. So at the time Jeffrey Lee recommended triple buffering to ensure there was no tearing. Here is are the BASIC code PROCs for triple buffering and calibration: Best Regards, Tony |
Patrick M (2888) 115 posts |
Hello again, Thanks Tony for the triple buffering routines. Here are the updated versions:
If anyone tries it, let me know if it works on your system, or if there are any problems. Thanks again, -Patrick |
David Feugey (2125) 2687 posts |
Cool game and cool sounds. Could the ship slow down when you don’t it the space bar any more? Another feature would be to add some gravity to the biggest asteroids. |
Anthony Vaughan Bartram (2454) 455 posts |
You’re welcome Patrick. Please feel free to redistribute the version with RDSP sounds. I’m getting SWI ranges, a module name and *commands allocated by ROOL at the moment. After that allocation, if I have to change anything I will also update the version included in the game. |
Anthony Vaughan Bartram (2454) 455 posts |
Hi Patrick,
Tony |
David Feugey (2125) 2687 posts |
I don’t know if Patrick is interested, but I’m, since I’m now coding a lot on RISC OS :) |
Patrick M (2888) 115 posts |
Hi, @David @Tony |
Anthony Vaughan Bartram (2454) 455 posts |
Hi Patrick, Once I’ve got RDSP at beta I will organise the routines into a BASIC library. I don’t have any free games available at the moment, but will write a couple of arcade style ones to put in the kit for demo purposes. I’ve just sent out the Mop Tops beta, so will get some more time do do this now. I plan to add a place to my website for RDSP and this kit in the next few weeks. However, I will put my routines in a library first so that both you and David can use them. By way of example (and so you can try MP3s if you like)
And in your run file you will need:
|