Advertisement

05.05 - (A) Home Stretch Assistance

Started by July 25, 2001 11:28 AM
20 comments, last by Teej 23 years ago
MAD_Mask:

Best thing to do would be to try to figure out what the CreateSoundBuffer function returns when you try it. That would help us greatly in finding the problem.

Piotyr
Software Engineer by day, Game developer by night

The early bird may get the worm, but the second mouse gets the cheese.
PiotyrSoftware Engineer by day, Game developer by nightThe early bird may get the worm, but the second mouse gets the cheese.
Ok, I am learning more from SDk hellp and I am hoping that I''ll be ok .Thanks for tring hellping me. I''ll try and tell you more about my problem...
Btw, what PCM wav file means? I know what a wav file is but ,
for what stands PCM?
And what about "Sound Recorder" where and what is that?
bye now
The Mask.




Advertisement
Here is the defintion of PCM according to atomica.com.

(Pulse Code Modulation) A technique for converting analog signals into digital form that is widely used by the telephone companies in their T1 circuits. Every minute of the day, millions of telephone conversations, as well as data transmissions via modem, are converted into digital via PCM for transport over high-speed intercity trunks. In North America and Japan, PCM samples the analog waves 8,000 times per second and converts each sample into an 8-bit number, resulting in a 64 Kbps data stream (a single DS0 channel). The sampling rate is twice the 4 kHz bandwidth required for a toll-quality conversation.

Hope this helps

- Clash
- www.zeroinfinity.net
- A New World, Built By New Minds
- Clash- www.zeroinfinity.net- A New World, Built By New Minds


Yes , I made it. My game has sounds... and realy nice ones from
Shogun and AOE2.... it is cool.
I hope that this interactive tutorialis not over because I am filing that I have so much to learn and this forum ( read Teej and others )is very good in teaching peoples like me.

Oh , my problem was that there was a missing line in my DS_Init.


The Mask.




Yes , I made it. My game has sounds... and realy nice ones from
Shogun and AOE2.... it is cool.
I hope that this interactive tutorialis are not over because I am filing that I have so much to learn and this forum ( read Teej and others )is( are) very good in teaching peoples like me.

Oh , my problem was that there was a missing line in my DS_Init.


The Mask.


I'm having a little trouble with the line checking thing function something.
It doesnt work
Any knows whats wrong with it, I cant figure it out.

        void CheckingLine(){	int CheckingLine,		x,		y,		fullX;	for(y = 0; y < PLAYAREA_HEIGHT; y++)	{		for(x = 0; x < PLAYAREA_WIDTH; x++)		{			if(G.PlayArea[x][y] != 0) CheckingLine += 1;						if(CheckingLine <= PLAYAREA_WIDTH)			{				fullX = x;				continue;			}		}	}	if(CheckingLine <= PLAYAREA_WIDTH)	{		// Time to remove the line...		for(y = 0; y < PLAYAREA_WIDTH; y++)		{			G.PlayArea[fullX][y] = 0;		}		// ...and to move the rest down		for(y = 0; y < PLAYAREA_WIDTH; y++)		{			for (x = fullX - 1; y < PLAYAREA_WIDTH; x--)	// Checking from top to bottom															// and no need to check below the line			{				if (G.PlayArea[x][y] != 0)				{					G.PlayArea[x + 1][y] = G.PlayArea[x][y];					G.PlayArea[x][y] = 0;				}			}		}	}	return;}  


I have a new problem now, cause when I try to run the game and press 1 to start, my game quits!

Edited by - Unini on August 6, 2001 5:28:56 PM
Advertisement
Unini, i''m having a bit of trouble with your for loops first off.

for(y = 0; y > PLAYAREA_WIDTH; y++)

So, y starts at 0, and continues while y > PLAYAREA_WIDTH...

well, since 0 is probably not higher, you''re never even going to get into your for loop. You need to change the middle parameter of your for loops to be the conditional which must be TRUE, so it should probably be y < PLAYAREA_WIDTH.

That''s just for starters, fix that and then see if you can''t figure out the rest.
I updated my the code above to my new (yet unworking) code

Youre right about the loops.

But I found the solution (I think) as soon as I posted this, but havnt had the time to reply.
if(G.PlayArea[x][y] == 1) ...
should be
if(G.PlayArea[x][y] != 0) ...
cause there can also be 2, 3, 4 etc. and I forgot about that

And another mistake I made is that in my loops I had X as PLAYAREA_HEIGHT and that should we PLAYAREA_WIDE.

Edited by - Unini on August 6, 2001 5:23:59 PM
Unini : Sorry if I can't give you complete help at this moment -- I'm about to leave for the day, but here goes (from what I can see glancing at the code):

  1. CheckingLine needs to be initialized to 0. Since it's a local (stack) variable, only God knows what the value actually is...

  2. CheckingLine, it would seem, will end up being == PLAYAREA_WIDTH, and that's how you'll know when you have a complete line

  3. I don't quite see what you're doing with fullX. It seems that you're confusing x and y in your code -- you'd want to remove the rows where CheckingLine == PLAYAREA_WIDTH, and not remove columns...

  4. Your function is structured in such a way that only one line can be processed. In reality, there may be multiple completed lines in the play area, so you should remove lines AS you scan the array


I can see what you were trying to do, and part of the confusion you may be facing has to do with ARRAY[x][y] versus ARRAY[y][x]. If you plug in the values like so [y][x], then you can think of x and y in the correct way (i.e. x goes across and y goes down). Here's my quick shot at an algorithm along your lines:

  • For each row in the play area, starting from the top
    • look from left to right, counting the number of blocks in the row

    • if the number of blocks in the current row is equal to the total number of 'spaces' in a row of the play area
      • copy the contents of the row above the current row INTO the current row

      • continue copying row n - 1 into row n until you're at the top of the play area (i.e. you're done)

  • check all of the rows in the play area for complete lines


Hope that helps...

Teej



Edited by - Teej on August 9, 2001 5:03:11 PM
I am back from a brief vacantion at the country side !!!
So , what''s cooking dock? (read Teej ).
Could you find somme time and continue this wanderfull tutorial?
Ah , and I have a question :
Could you ( or somme one give me an input on DirectSound?
The ideea is that I am reading the SDK documentation but is
soooo big and is hard tu understand all from begining even more to applay . I had the same problem with DirectDraw but Teej''s tutorial hellped me to understand the basics , to have a fundations and now is easyer for me to understand DD.
For DirectSound , well , I tried to make a function that has
2 parameters : a LPDIRECTSOUNDBUFFER object and a path to a wav
file in the HDD, and that function should init that sound(wav).
Well I didn''t succed and the SDK docs didn''t hellped much ( streams chuks and all that .... I am not even shore how to translate those words in romanian ).
So a base start well explained ( like DirecDraw ) will be nce and handy
Thancks in advance
The Mask

This topic is closed to new replies.

Advertisement