| www.retrosoftware.co.uk http://www.retrosoftware.co.uk/forum/ |
|
| I'm thinking of writing a version of carnival for the BBC http://www.retrosoftware.co.uk/forum/viewtopic.php?f=19&t=877 |
Page 5 of 7 |
| Author: | oss003 [ Mon Jan 13, 2014 4:14 pm ] |
| Post subject: | Re: I'm thinking of writing a version of carnival for the BB |
Hi Tricky, in the past I found this interesting ZX Spectrum routine for plotting sprites with a pre-shifted data table to save memory space. I rewrote it for the Atom and it works nicely. Maybe it's something you can use. The article + source can be found at: http://zxspectrumdev.blogspot.com/2009/ ... -data.html Greetings Kees |
|
| Author: | tricky [ Mon Jan 13, 2014 5:42 pm ] |
| Post subject: | Re: I'm thinking of writing a version of carnival for the BB |
Thanks, the download seems broken. How fast was your routine, his looks like 2 sprites in roughly 1/4 of a frame, mine does 13 (of about the same size) in 1/4 of a frame. When I started on the BBC (over 30 years ago now) I wrote quite a few routines that allowed one copy of the data and did lots of bit manipulation to draw it as quickly as I could anywhere on the screen; without limiting where they were on screen, but that was only really good for packman and there I didn't really need to save memory. One of the reasons I chose Carnival to write was because of a sprite drawing routine that I had just though of |
|
| Author: | oss003 [ Mon Jan 13, 2014 6:18 pm ] | ||
| Post subject: | Re: I'm thinking of writing a version of carnival for the BB | ||
Hi Tricky, actually the routine is not bad at all. In the demo it draws 8 sprites 16x16 pixels with animation. 1 Sprite can be controlled by keys and shows when another sprite is hit. You can view it at: http://www.youtube.com/watch?v=qcQ-1NaPWno It's a conversion of the Z80 code and not optimal programmed but the result is pretty good. The source file is added. Greetings Kees
|
|||
| Author: | tricky [ Tue Jan 14, 2014 12:23 am ] | ||
| Post subject: | Re: I'm thinking of writing a version of carnival for the BB | ||
Here is the working HI-Score, I still haven't tried saving it, but shift-break should do that if the disc isn't write protected. I now have exactly 0 bytes free, so time for another clean-up.
|
|||
| Author: | tricky [ Sat Jan 18, 2014 10:32 pm ] |
| Post subject: | Re: I'm thinking of writing a version of carnival for the BB |
A few more updates: Hi-score works and saves (at least on BeebEm when I remember to un-write-protect the image - haven't tried B-Em). Added envelope handling and sfx for hitting a target (13 bytes) and firing the gun (7 bytes), which, works on B-Em (I still don't have sound on BeebEm on my desktop!). Added speeding up game-play and music as you take longer on a level, this was in the arcade game, but I had forgotten. This makes the game much more frantic! Now down to just &72 bytes again, so the end is nigh! Richard |
|
| Author: | tricky [ Sun Jan 19, 2014 2:14 pm ] |
| Post subject: | Re: I'm thinking of writing a version of carnival for the BB |
Added more sound effects for falling ducks, bears and pipes. Added attract mode and hooked up the mute music toggle box. I have one rarely occurring bug (bullet left behind after hitting duck) left to fix. I still need to add joystick support and have 40 bytes left to do it in! key redefinition and joystick selection (if I get it in) will be done in the basic loader, so that doesn't come out of my memory budget. My daughter (9) has been playing it this morning and won't get off; even my partner has played a few games and she is quite fed up with me working on it! Now I just need to know if RetroSoftware would like to release it! |
|
| Author: | DavidB [ Sun Jan 19, 2014 6:26 pm ] |
| Post subject: | Re: I'm thinking of writing a version of carnival for the BB |
It sounds more impressive with each update. I think the usual process is that you get a project page and a forum. This thread will get migrated to that forum. As to how the cassette/disk production works and who decides what, you'll have to wait for DaveM or Samwise to answer those kinds of questions. |
|
| Author: | tricky [ Sun Jan 19, 2014 8:04 pm ] |
| Post subject: | Re: I'm thinking of writing a version of carnival for the BB |
Thanks David, I was feeling a little lonely there I have just tried it on BeebEm on another PC and most of the sound effects are different, so it looks like I will need to find my real BBC and try it on that - I am probably using white/periodic noise tied to the frequency of another channel and one of the emulators (or both) is a bit off. Richard |
|
| Author: | trevj [ Mon Jan 20, 2014 10:19 pm ] |
| Post subject: | Re: I'm thinking of writing a version of carnival for the BB |
This is looking and playing great. I've yet to check against the Acornsoft version, but from memory I agree with others that yours is vastly improved! One thing which might be worth considering is that the music seems to jump back to the start on a new game, which interrupts the flow a little, but is only a very minor niggle. I need to play this a bit more |
|
| Author: | tricky [ Tue Jan 21, 2014 12:49 am ] |
| Post subject: | Re: I'm thinking of writing a version of carnival for the BB |
Thanks trevj, the new version displays the hi-score table after game over. Currently the hi-score table still plays the music, but I will probably turn it off then (if memory serves, the original only played music during actual game play). The new version also changes the speed of the music, starting at normal speed and getting faster with each time through. If I slowed it mid tune, three tracks would get out of sync. I play the music too much at the moment, but that is probably because it took me so long to get it working. The game still has a few rough edges including mostly place-holder sound effects and only one player, but I do believe it is quite a bit better than carousel - try it on an emulator and let me know Richard |
|
| Author: | DaveM [ Tue Jan 21, 2014 12:00 pm ] |
| Post subject: | Re: I'm thinking of writing a version of carnival for the BB |
Sorry Richard, away at events at the moment but will pick up your pm's when I'm back next week. |
|
| Author: | DaveF [ Tue Jan 21, 2014 12:45 pm ] |
| Post subject: | Re: I'm thinking of writing a version of carnival for the BB |
tricky wrote: Now I just need to know if RetroSoftware would like to release it! Well you've got a buyer here when they do Really great progress on this, you've flown through it! Great stuff. |
|
| Author: | tricky [ Tue Jan 21, 2014 7:38 pm ] | ||
| Post subject: | Re: I'm thinking of writing a version of carnival for the BB | ||
I have uploaded a video of my latest demo to you tube. I'm not sure if the sound bugs (odd whistles) are me or the emulator as they are different on different emulators and I don't have either of my BBCs available at the moment. http://youtu.be/PEIBXWyUe8o
|
|||
| Author: | oss003 [ Tue Jan 21, 2014 11:32 pm ] |
| Post subject: | Re: I'm thinking of writing a version of carnival for the BB |
Ok Richard ........ nice job!!!! You also did it in a very short time. Maybe it's nice to start a development diary on this site to show some tricks and tips of the game. I think it's good to read what solutions you came up with when having a problem with the game. Keep up the good work!! PS The video on Youtube is very bad on my PC. Is it recorded in low resolution? I use Camstudio Recoder at: http://camstudio.org/ This is a nice small program to record programs running in a window. Greetings Kees |
|
| Author: | DavidB [ Wed Jan 22, 2014 12:27 am ] |
| Post subject: | Re: I'm thinking of writing a version of carnival for the BB |
Looking very polished now. Very nearly a candidate for the high score challenge currently going on in the stardot forums. |
|
| Author: | RobC [ Sat Feb 01, 2014 11:05 am ] |
| Post subject: | Re: I'm thinking of writing a version of carnival for the BB |
[quote="tricky"] I can now fairly easily (in a couple of minutes) convert and general midi file into BBC register settings and timings for the music code in carnival.[quote] I'd love to know how to do this - I've captured the music from BombJack as MIDI files but need to convert them to play on the Beeb. Any pointers would be very welcome! |
|
| Author: | tricky [ Sat Feb 01, 2014 12:43 pm ] | ||||
| Post subject: | Re: I'm thinking of writing a version of carnival for the BB | ||||
I have used a few methods, but the most straight forward was to: Use MIDIeditor to move the notes in to separate channels, this let me pick the 3 most important notes at any time and easily preview them. I did try to automate them, but it wasn't very reliable. You might also want to tidy up the timing here. Then use MIDIanal to convert the MIDI to a .CSV, I have attached MIDIanal.png with the settings that I used. I wrote a c++ program attached as make_music.zip to parse the .CSV and convert to register settings for notes, duration's for notes and the time to the next note on that channel. The text file produced for carnival is attached as carnival_music.zip and contains 3 sections: .snd_channels .snd_channel_0 \\ %rrrrllll len +8* reg EQUB &5D, &64, &5C, &3C, ..., 0 .snd_channel_1 \\ %rrrrllll len +8* reg EQUB &E8, &92, &93, &92, ..., 0 .snd_channel_2 \\ %rrrrllll len +8* reg EQUB &C2, &B2, &B2, &DA, ..., 0 These are the indices into the tables below; (num & 7) indexes snd_len and snd_gap while (num >> 3) indexes snd_reg_lo and snd_reg_hi. 0 means go back to the beginning (I was going to extend this but didn't need to). snd_len_mul and snd_len_div were used to convert note timings to 50Hz, but in the latest version, the multiplication is done in real time to allow the music to change speed. .snd_len \\ 10 lengths - hand hacked to 8 EQUB 0 * snd_len_mul / snd_len_div EQUB 1 * snd_len_mul / snd_len_div EQUB 1 * snd_len_mul / snd_len_div ... EQUB 8 * snd_len_mul / snd_len_div .snd_gap \\ 10 gaps - hand hacked to 8 EQUB (0+2) * snd_len_mul / snd_len_div EQUB (1+0) * snd_len_mul / snd_len_div EQUB (1+1) * snd_len_mul / snd_len_div ... EQUB (8+0) * snd_len_mul / snd_len_div Note is silenced after snd_len updates and a new one started after snd_gap updates. .snd_reg_lo \\ 30 notes %1cc0rrrr channel, reg & %00001111 EQUB %10000000 + (0 * %00100000) + (286 MOD 16) EQUB %10000000 + (0 * %00100000) + (321 MOD 16) EQUB %10000000 + (1 * %00100000) + (321 MOD 16) ... EQUB %10000000 + (1 * %00100000) + 0 .snd_reg_hi \\ 30 notes %00rrrrrr reg >> 4 EQUB 286 DIV 16 EQUB 321 DIV 16 EQUB 321 DIV 16 ... EQUB 1922 DIV 16 EQUB 0 These are the two bytes to write to the slow data bus, _lo first to latch the channel for _hi. I could have saved a few bytes by or-ing in the channel, but this lets me "hack" in silence by substituting a volume register setting for pitch. In the actual music I needed 10 len/gap combinations and hand hacked the note to make a 12 length out of two 6 lengths with no gaps. I am planning on making a sound tutorial at some point, but the basics are: Set the system via data direction register to all write to put data on the slow data bus: lda #&FF : sta SysViaDDRA \\ when sound selected, write val as per SN76489 data byte format Then put the data on the bus and hold the sound select (or whatever it is called) on for 10us before turning it off per register setting: .snd_write_A \\ A is written to sound slow data bus : Z=0 A=8 X=X Y=Y { SEI sta SysViaRegA \\ UG/AUG sample says SysViaRegH but OS uses no handshake \\ handshake regA lda #0+0 : sta SysViaRegB \\ enable sound for 8us (addr 0, bit 0) PHA : PLA : PHA : PLA \\ 3+4+3+4 + 2(lda #) = 16 clocks = 8us lda #0+8 : sta SysViaRegB \\ disable sound (addr 0, bit 1) CLI RTS } Here, I use SEI/CLI - they aren't really necessary as I have all the interrupts covered and none actually touch the SysVia, but to be safe, you should probably include the lda #&FF : sta SysViaDDRA inside the SEI/CLI and do it each time. The code in make_music.zip is probably quite hard to read, as I wrote it late at night, in a hurry and was quite fed-up with sound at the time! It reads the notes, tracks start and end, tries to find a unit of time that fits all the note and gap lengths and then scales them accordingly - this works better if your source is precise, or if you tweak it in a MIDI editor. You could just fix float scale = beats[i]; to a number that works for you. Richard
|
|||||
| Author: | tricky [ Sat Feb 01, 2014 12:52 pm ] |
| Post subject: | Re: I'm thinking of writing a version of carnival for the BB |
PS I just had a look at the Bombjack specs and it looks like it had 3 AY3 chips, as one is roughly equivalent to the chip in the beeb, it might be tricky. |
|
| Author: | RobC [ Sat Feb 01, 2014 1:37 pm ] |
| Post subject: | Re: I'm thinking of writing a version of carnival for the BB |
Many thanks Richard - that's brilliant! I did capture the music from the arcade game but, as you say, it has 3 sound chips so it's too complicated for the Beeb. I've looked at simplifying it but it's a big job and appears to be beyond my limited musical ability. My current plan is to use the music from the Sega SG-1000 version - this has the same sound chip as the Beeb so should be much easier to convert. Thanks again, Rob |
|
| Author: | tricky [ Sat Feb 01, 2014 2:06 pm ] |
| Post subject: | Re: I'm thinking of writing a version of carnival for the BB |
If there is an emulator that emulates the sound chip, you can probably hack it to just dump out the register being set and the time it was set, I did this to try out a few other games music. |
|
| Page 5 of 7 | All times are UTC [ DST ] |
| Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |
|