Author Topic: lock'n chase for PCE  (Read 1694 times)

Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: lock'n chase for PCE
« Reply #15 on: January 30, 2012, 04:11:25 AM »
Hi, i'm the developper of Lock'n chase. For the moment the dev process goes well. I've just finished coding a PSG librarie to make some sound effect and a little music. The only problem is that i'm not musician  [-X So i have the same problem on Coleco or on any console with a music chip ... But, i'll try to do something acceptable.  :-({|=

You should consider checking out Squirrel : http://www.aetherbyte.com/psg.php   It supports MML, which you might be familiar with already with MSX stuff.  (Assuming you've messed with MSX before based off of your YouTube videos)

What kind of stuff did you do for the psg library? :)  sound related stuff is stuff I am interested in. 


Quote
Thanks for your comments and appreciation. (And sorry for my bad english, i'm french).


Glad you're here.  We need more dedicated PCE game developers! :)   Especially ones from other scenes that have experience completing games. :)

PS: Touko said you were Chinese!
« Last Edit: January 30, 2012, 04:14:15 AM by Arkhan »
[Fri 19:34]<nectarsis> been wanting to try that one for awhile now Ope
[Fri 19:33]<Opethian> l;ol huge dong

I'm a max level Forum Warrior.  I'm immortal.
If you're not ready to defend your claims, don't post em.

bfg

  • Newbie
  • *
  • Posts: 7
Re: lock'n chase for PCE
« Reply #16 on: January 30, 2012, 05:00:06 AM »
The soundLib is far from marvelous
Here's the lib
Code: [Select]
#include "huc.h"

#define LOOP 32
#define END 64
#define SILENCE 128


int idx_part_channel[5];
int *partc0;
int *partc1;
int *partc2;
int *partc3;
int *partc4;
int compteur_part_channel[5];
int c_on[5];

/* Initialise la librairie sonore*/
snd_init()
{
int i;
for (i=0;i<5;i++)
{
c_on[i]=0;
compteur_part_channel[i]=0;
idx_part_channel[i]=0;

}

}
/* Se positionne au début de la partition de la voix "c" */
snd_resetPartChannel(c)
int c;
{
idx_part_channel[c] = 0;
compteur_part_channel[c] = 0;
}

/* Affecte une partition "p" à la voix "c" */
snd_setPartChannel(c,p)
int c;
int *p;
{
if (c==0) partc0=p;
else if (c==1) partc1=p;
else if (c==2) partc2=p;
else if (c==3) partc3=p;
else partc4=p;

snd_resetPartChannel(c);
c_on[c]=0;
}

/* Change le volume global */
snd_setGlobalVolume(v)
int v;
{
poke(0x0801,v);
}

/* Sélectionne la voix "c" sur laquelle on va travailler */
snd_selectChannel(c)
int c;
{
poke (0x0800,c);
}

/* Change la balance de la voix courante */
snd_setChannelBalance(v)
int v;
{
poke(0x0805,v);
}

/* Reset le chargement de sample pour la voix courante */
snd_resetSampleLoad()
{
poke(0x0804,64);
}

/* Commence le chargement de sample pour la voix courante */
snd_beginSampleLoad()
{
poke(0x0804, 0);
}

/* Termine le chargement de sample pour la voix courante */
snd_endSampleLoad()
{
poke(0x0804, 0x8F);
}

/* Charge le sample "sample" pour la voix courante */
snd_loadSample(sample)
int *sample;
{
int temp;
   
for(temp=0 ; temp<32 ; temp++) /* Chargement du sample 32 octets */
         poke(0x0806, sample[temp]);
}

/* Charge un sample "s" dans une voix "c" */
snd_initChannelSample(c,s)
int c;
int *s;
{
   char temp;
   int channel;
   
   channel = c;
   snd_setGlobalVolume(0); /* Met le volume global à 0 */
   snd_selectChannel(channel);    /* On choisit la voix 1 */
   snd_setChannelBalance(0);
   snd_resetSampleLoad();  /* On reset le chargement du sample */
   snd_beginSampleLoad(); /* On va charger le sample */
   snd_loadSample(s);
   snd_endSampleLoad(); /* Fin de chargement */
   /*snd_setChannelBalance(255);*/
}

snd_initChannel(c)
int c;
{
   char temp;
   int channel;
   
   channel=c;   
   snd_setGlobalVolume(0); /* Met le volume global à fond */
   snd_selectChannel(channel);    /* On choisit la voix 1 */
   snd_setChannelBalance(0);   
   snd_setChannelBalance(255);
}

snd_stopChannel(c)
int c;
{
c_on[c]=0;
}

snd_playChannel(c,p)
int c;
int *p;
{
if (c_on[c]==0)
{
snd_setPartChannel(c,p);
compteur_part_channel[c]=0;

if (c==0) partc0=p;
else if (c==1) partc1=p;
else if (c==2) partc2=p;
else if (c==3) partc3=p;
else if (c==4) partc4=p;

snd_resetPartChannel(c);
c_on[c]=1;
}
}
   
/* Joue la partition de la voix "c" */
snd_playsound(c)
int c;
{
int *part;
int channel_select;

if (c==0) {part = partc0;channel_select=0;}
else if (c==1) {part = partc1;}
else if (c==2) {part = partc2;}
else if (c==3) {part = partc3;}
else if (c==4) {part = partc4;}
channel_select = c;

if (c_on[c]==1)
{
snd_setGlobalVolume(255);
/* Loop */
if (part[idx_part_channel[c]]==LOOP)
{
idx_part_channel[c]=0;
}
else
/* End */
if (part[idx_part_channel[c]]==END)
{
idx_part_channel[c]=0;
c_on[c]=0;
compteur_part_channel[c]=0;
poke(0x0800, channel_select); /* On sélectionne le channel qui va bien */
poke(0x0805, 0x00); /* On lui fait ferme sa grande gueule */
}
}

if (c_on[c]==1)
{
poke(0x0800, channel_select); /* Channel 0 sélectionnée */
if (compteur_part_channel[c]<part[idx_part_channel[c]]) /* Durée de la note */
{
poke(0x0805, 0xff); /*Volume à fond --> A paramétrer dans la partition !!*/
poke(0x0803, (part[idx_part_channel[c]+1]>>8)&0xF); /* On joue la note*/
poke(0x0802, (part[idx_part_channel[c]+1])&0xFF);
}
else
{
idx_part_channel[c]+=2; }
}

compteur_part_channel[c]++;

if (compteur_part_channel[c]>part[idx_part_channel[c]])
{
/*poke(0x0805, 0x00);*/ /* Volume à 0 --> Fait tout bugger !!!! */
compteur_part_channel[c]=0;
}
}

   
snd_playAll()
{
snd_playsound(0);
snd_playsound(1);
snd_playsound(2);
snd_playsound(3);
snd_playsound(4);
}

and an example

Code: [Select]

#include "SndLib.c"

/* Pour info
 Non utilisé dans cet exemple */
const int Mus_Notes[]= {
/*    C      C#      D     D#    E      F      F#     G        G#       A      A#     B        */
                                                   0x0fe4,0x0f00,0x0e28,/*0*/
   0x0d5d,0x0c9d,0x0be7,0x0b3d,0x0a9b,0x0a03,0x0973,0x08eb,0x086a,0x07f2,0x0780,0x0714,/*1*/
   0x06af,0x064f,0x05f4,0x059e,0x054e,0x0502,0x04b9,0x0476,0x0435,0x03f9,0x03c0,0x038a,/*2*/
   0x0357,0x0327,0x02fa,0x02cf,0x02a7,0x0281,0x025d,0x023b,0x021b,0x01fc,0x01e0,0x01c5,/*3*/
   0x01ac,0x0193,0x017d,0x0168,0x0153,0x0140,0x012e,0x011d,0x010d,0x00fe,0x00f0,0x00e3,/*4*/
   0x00d6,0x00ca,0x00be,0x00b4,0x00aa,0x00a0,0x0097,0x008f,0x0087,0x007f,0x0078,0x0071,/*5*/
   0x006b,0x0065,0x005f,0x005a,0x0055,0x0050,0x004b,0x0046,0x0043,0x0040,0x003c,0x0039,/*6*/
   0x0035,0x0032,0x0030,0x002d,0x002a,0x0028,0x0026,0x0024,0x0022,0x0020,0x001e,0x001c,/*7*/
   0x001b
};

/*
Commande,Note
<31 = temps pour jouer une note, Note
END -> Fin de partition
LOOP -> Boucle au début de la partition
SILENCE,durée --> A CODER
VOLUME,valeur --> A CODER !
*/
const int part_channel0[] =
{
   
   1,0x01ac,1,0x017d,1,0x0153,1,0x0140,1,0x011d,1,0x00fe,1,0x00e3,END

};

const int part_channel1[] =
{
   
   30,0x01ac,30,0x017d,END
};


const char sin_sample[]=
{
18,22,24,26,28,30,30,
30,30,28,28,26,24,22,18
,12,8,6,4,2,2,0,0,
0,0,2,2,4,6,8,12
};

main()
{

disp_off();
cls();

disp_on();
vsync(1);

snd_init();

/* initialisation du sample sur la voix 0*/
snd_initChannelSample(0,sin_sample);
snd_initChannelSample(1,sin_sample);
snd_initChannelSample(2,sin_sample);
snd_initChannelSample(3,sin_sample);
/* Demande à jouer la voix 0 avec la partition*/



   for (;;)
   {

/* A lancer dans la boucle de jeu */

if (joy(0)&JOY_LEFT) {snd_playChannel(0,part_channel1);}
if (joy(0)&JOY_RGHT) {snd_playChannel(1,part_channel1);}
if (joy(0)&JOY_UP) {snd_playChannel(2,part_channel0);}
if (joy(0)&JOY_DOWN) {snd_playChannel(3,part_channel0);}


      snd_playAll();
      vsync(1);satb_update();

   }

}

And no i'm french, they called me "the Chinese" because it tooks me generally less than 2/3 months to make a game from scratch to the end on Colecovision  :D

I've look at Squirell, but it seems it's only assembly langage, and i don't really know well assembly ...

Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: lock'n chase for PCE
« Reply #17 on: January 30, 2012, 05:04:09 AM »
Your current stuff looks like how Squirrel was when it first started. :)

I've look at Squirell, but it seems it's only assembly langage, and i don't really know well assembly ...

You don't need to look at Squirrel very in depth though! :)  It's all set to go.  We made it so that you just need to include the library and call the play function.  Don't sweat the details. :)

You just compile a .MML song, get the output, include it along with the library, and listen to the music.

I could help if you'd like.  Using MML makes it a bit easier to get music going, since you can convert from MIDI to MML really easily.

Or you can stick to your library, if it works for you. :)

You may find that a lot of array accessing in HuC will start to cause severe slowdown though.  Arrays in HuC are terrible.  Avoid them as much as possible.  It's hard to avoid them though, seeing as they're the most basic of data structures.
[Fri 19:34]<nectarsis> been wanting to try that one for awhile now Ope
[Fri 19:33]<Opethian> l;ol huge dong

I'm a max level Forum Warrior.  I'm immortal.
If you're not ready to defend your claims, don't post em.

bfg

  • Newbie
  • *
  • Posts: 7
Re: lock'n chase for PCE
« Reply #18 on: January 30, 2012, 05:28:22 AM »
Thanks for the advices ! On Coleco arrays are a pain too. And array of structure more a pain ! (We use pointers to array and structure to speed up.)

I'll look closer at Squirell so, but if squirell make the music, how can i made SFX ? (Don't want for the moment to use CDROM or ADCPM fonctionnality.)

Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: lock'n chase for PCE
« Reply #19 on: January 30, 2012, 05:34:02 AM »
Thanks for the advices ! On Coleco arrays are a pain too. And array of structure more a pain ! (We use pointers to array and structure to speed up.)
Good to know.  I do some MSX1 and MSX2 programming on the side (PCE is my main thing).  I thought about trying some Coleco stuff.

Pointers/Arrays in HuC are pretty messed up.  You'll find yourself requiring assembly and making up your own structs to get the speed you need for games that are more complex. 

Quote
I'll look closer at Squirell so, but if squirell make the music, how can i made SFX ? (Don't want for the moment to use CDROM or ADCPM fonctionnality.)

Unfortunately Squirrel only makes music in the version we released to the public.

There is an internal "Aetherbyte only" one that does SFX too, but it's still having all of the kinks worked out before it ever gets released to everyone.  The Retrocade project we're working on is the testing setup for it.  No sense releasing a tool for everyone if it doesn't work right and introduces problems for everyone!

Maybe stick to what you have for now and use Squirrel next time!  You plan to stick around after Lock n' Chase, right ?  :)
« Last Edit: January 30, 2012, 05:35:40 AM by Arkhan »
[Fri 19:34]<nectarsis> been wanting to try that one for awhile now Ope
[Fri 19:33]<Opethian> l;ol huge dong

I'm a max level Forum Warrior.  I'm immortal.
If you're not ready to defend your claims, don't post em.

touko

  • Hero Member
  • *****
  • Posts: 953
Re: lock'n chase for PCE
« Reply #20 on: January 30, 2012, 05:38:57 AM »

Thanks for your comments and appreciation. (And sorry for my bad english, i'm french).

Don't worry they are used with me  8)

And i have done my job to link squirrel to BFG, but yes unfortunately it does not allow the creation of sounds fx for now.
« Last Edit: January 30, 2012, 05:44:27 AM by touko »

Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: lock'n chase for PCE
« Reply #21 on: January 30, 2012, 05:40:08 AM »

Thanks for your comments and appreciation. (And sorry for my bad english, i'm french).

Don't worry they are used with me  8)

Yeah, trust me, you two make perfect sense compared to Geralds and RegalSin!

=3
[Fri 19:34]<nectarsis> been wanting to try that one for awhile now Ope
[Fri 19:33]<Opethian> l;ol huge dong

I'm a max level Forum Warrior.  I'm immortal.
If you're not ready to defend your claims, don't post em.

touko

  • Hero Member
  • *****
  • Posts: 953
Re: lock'n chase for PCE
« Reply #22 on: January 30, 2012, 05:46:25 AM »

Yeah, trust me, you two make perfect sense compared to Geralds and RegalSin!

=3

Lol awesome reference arkhan   [-(

 :mrgreen:

2X4

  • Full Member
  • ***
  • Posts: 223
Re: lock'n chase for PCE
« Reply #23 on: January 30, 2012, 06:31:45 AM »
Does/will Squirrell have the ability to include your own sounds?  I think that would be very neat.
The Turbo was Dual Core when Dual Core wasn't cool . . .

Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: lock'n chase for PCE
« Reply #24 on: January 30, 2012, 06:39:56 AM »
Does/will Squirrell have the ability to include your own sounds?  I think that would be very neat.

You can make your own 32-byte waveforms for it.  They can be used for instruments, sound effects, and even for modulation/envelopes.  there's preset instrument/envelope waveforms though.  They're pretty versatile.

In the coming weeks, I will be finally making a tutorial on it.  Ill start a new thread now so we don't hijack this one any further.
[Fri 19:34]<nectarsis> been wanting to try that one for awhile now Ope
[Fri 19:33]<Opethian> l;ol huge dong

I'm a max level Forum Warrior.  I'm immortal.
If you're not ready to defend your claims, don't post em.

bfg

  • Newbie
  • *
  • Posts: 7
Re: lock'n chase for PCE
« Reply #25 on: January 31, 2012, 07:59:25 AM »
So, my sound librairie is 95% done (need to fix the PAUSE command for the sound, and change some action handle to more easily synchronise 2 channels to play at the same time).

Here's the game in action with some jingle :

touko

  • Hero Member
  • *****
  • Posts: 953
Re: lock'n chase for PCE
« Reply #26 on: January 31, 2012, 08:11:32 AM »
Wahou, excellent really  :clap:

Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: lock'n chase for PCE
« Reply #27 on: February 01, 2012, 12:56:35 AM »
I dig it.  The sound effects sound nice.

Do you plan on music too, or just sound effects?
[Fri 19:34]<nectarsis> been wanting to try that one for awhile now Ope
[Fri 19:33]<Opethian> l;ol huge dong

I'm a max level Forum Warrior.  I'm immortal.
If you're not ready to defend your claims, don't post em.

KingDrool

  • Hero Member
  • *****
  • Posts: 1990
Re: lock'n chase for PCE
« Reply #28 on: February 01, 2012, 04:47:26 AM »
One of my favorite games on my favorite console? This is great news!

Are you releasing this on CD, or will it just be a download? If it gets a physical release, count me in for a sale.
Games I Need: Bonk 3 (HuCard), Legend of Hero Tonma, Magical Chase, Soldier Blade, Super Air Zonk.

Got one to sell? PM me!

bfg

  • Newbie
  • *
  • Posts: 7
Re: lock'n chase for PCE
« Reply #29 on: February 01, 2012, 05:20:04 AM »
One of my favorite games on my favorite console? This is great news!

Are you releasing this on CD, or will it just be a download? If it gets a physical release, count me in for a sale.

I'd love to release a physical version. But first, i must finish it. Then i'll look at the solution to make the game on cd.

PCEngine Homebrew on CD are they on burnable CD with lightscribe for example or professionally pressed ?