05.05 - (A) Home Stretch Assistance

Started by
20 comments, last by Teej 22 years, 7 months ago
I''ve created this post in order to try and guage people''s progress for Blocks ''n Lines. If you''re working on completing the game project, but have some questions, here''s the place to post them. I''ll keep a close eye on this particular topic and try and help everyone out as quickly as possible. You''ll know when you''ve completed your project when it somewhat resembles a simple Tetris clone. Game pieces fall, one after the other, until a new piece cannot lower into the play area any longer. Completed lines are removed from the play area, and some score is assigned. At your discretion, you may choose to gradually increase the piece''s falling speed as their score increases -- it''s up to you. Show the player''s score somewhere on the display using simple GDI calls (as was used in the original BASECODE). When you can play a complete game from beginning to end and have a final score, you''re done with this part of the project, and can sign-in at the next topic (05.05 (B)). See you there!
Advertisement

1. How can I play a track ? ( .mp3 or .waw ) in the game?
2. I made a function that deletes completed rows but I am not very happy with it. 3 for''s and not any briliant ideea.
But it does it''s work . So please give me if you can somme advices .... on that piece og program
( should I post my function ? )
3. How can I implement the mouse functions ( I am tring to make a Menu more not so KISS )


MAD_Mask: The MMIO library (WINMM.LIB) is what we''ve been using for loading WAV files, and DirectSound to play them. For MP3 music, you''ll have to turn to DirectShow, as it can make use of codecs such as MPEG-3. For WAV files, it is also possible to stream them with DirectSound, but that''s something to be left for a later article. Just be patient; we''ll be exploring in-game music inevitibly.

For a line completion algorithm, I''ll let you in on what I originally used (generally speaking): I had a separate, temporary play area array that I used to copy the ''levels'' of the play area line-by-line from bottom to top (unless a line was completed, in which case it was tallied and discarded). When my algorithm was complete, the temporary play area array contained the new representation of the play area. Then, this can be swapped (using pointers) or copied back to the original play area data structure, and you''re all set.

As for using the mouse, that involves setting up the mouse via DirectInput and keeping track of its position. I''m sure will be looking at this in an upcoming article as well, but there''s nothing stopping you from reading up on it in the SDK documentation.

Teej


I have a problem : I tried to change the path for the soud file to open. It compiles OK but it gives me an "DS init error -6."
I should mention that in basecode1 I made 3 DS objects and
I didn''t had any problem.
But in basecode3b I just replaced "Sample.wav" with "Tauru06.wav"
( and I aded that file to the project ... )
So whay it works in basecode1 but not in basecode3?

Teej great job ...btw .




I have another problem now ( + the last post ( see above ) )
How can make a version of the game that I can move to other compiuters?


If you look in the InitTerm.cpp file, error -6 is after loading the file, so the filename is not the problem, maybe you are not using the right codec, I can't really help though as I don't know DirectSound (yet).

With your second problem all you have to do is compile the release version (build->set active configuration - it makes a smaller and faster file) copy the exe file from the release folder, and dump it in a folder, then copy all the bitmaps and wavs and whatever else you have and dump them in the same folder as well.
Remember - you need DirectX 7 on the PC you are testing it on.

Edited by - TheTramp on July 29, 2001 4:58:18 PM
TheTramp : thanks for the advice on the compile issue.
Everybody:
I figured out that the problem is not from loading the file, but
I even "copy - paste" the DS_Init function from basecode1 (where it worked just fine with other wav files ) but in "MyTitres" (that''s my version of tetris ) it won''t work .
And I''d realy like to include somme nice sounds in the game ..so pls "F1" me.

Optimization

My question today stems from an answer that I received recently about arrays that turned out to concern performance issues. With this in mind, I started looking at the various basecodes. I realized that ClearBackground() clears our background every frame (no duh). Currently, I have a new Clear() function that clears the whole screen to my background image (that already has the black backgrounds where I need them such as my scoreboard, next piece and game area) and did away with ClearBackground() in these sections of code. I haven''t seen any performance change, but I''ve begun to wonder - is it faster to clear the whole background, or just certain RECTS?

videns
EZ
To MAD_Mask:
have you tried using Tauru06.wav in basecode1? I think the problem might be that it is not a PCM wav file, open it in Sound Recorder and do save as then choose PCM wav file.
Yes I tried to put Tauru06.wav in basecode1 and it worked.And I
tried other wav files to in basecode1 and they worked but not in
basecode3c.Uff I tried to look in SDK docs but I didn''t understend very much.... even the samples files are sooooo big ..
..


This topic is closed to new replies.

Advertisement