The Breakout Tutorial - Part Two
by Tetraweb · in Torque Game Builder · 03/29/2008 (4:51 pm) · 29 replies
Part Two of The Breakout Tutorial is now live. This thread is intended for discussion, questions and problems specifically related to Part Two.
Thanks,
Greg
The Breakout Tutorial
Thanks,
Greg
The Breakout Tutorial
#2
TDN is not responding, so I can't check out the missing image issue. And I stand by my full screen assessment. As a developer with two screens, of course it is annoying for you. I don't develop games with full screen on either.
However, the percentage of the casual game audience that do have two screens is probably so small as to be close to zero; I mean the real target audience that actually purchase the bulk of casual games.
Thanks again for your attention to detail in making this tutorial better. I could have used a second set of eyes earlier.
Greg
04/06/2008 (4:52 am)
Thanks, Deozaan. I have fixed all those typos. The indentation is something that looks different on my system than it does in the Wiki, so I have to fix that as I notice it, thanks again.TDN is not responding, so I can't check out the missing image issue. And I stand by my full screen assessment. As a developer with two screens, of course it is annoying for you. I don't develop games with full screen on either.
However, the percentage of the casual game audience that do have two screens is probably so small as to be close to zero; I mean the real target audience that actually purchase the bulk of casual games.
Thanks again for your attention to detail in making this tutorial better. I could have used a second set of eyes earlier.
Greg
#3
EDIT: Was able to unzip with UnZip 5.52 on my linux box... could this all be WinZip wackyness?
05/04/2008 (3:24 pm)
I'm getting a CRC error on the file "particles4.png" in the "Twbt_ball.zip" archive under WinRar 3.71, 7-Zip 4.57 and the XP Shell.EDIT: Was able to unzip with UnZip 5.52 on my linux box... could this all be WinZip wackyness?
#4
Greg
05/05/2008 (4:59 am)
I haven't heard of anyone else having trouble with that zip file. I have unzipped it on two of my windows test machines with no errors. If anyone else is having trouble with any of the zip files, please post here and I will rezip and upload them.Greg
#5
Firstly it does not say whether or not you put the ball onto the scene or not. And when I run it i get the following:
Compiling C:/Users/Sandy/Documents/MyGames/Breakout/game/gameScripts/ball.cs...
C:/Users/Sandy/Documents/MyGames/Breakout/game/gameScripts/ball.cs Line: 17 - parse error
>>> Advanced script error report. Line 17.
>>> Some error context, with ## on sides of error halt:
^^CollisionActiveReceive = "1";
^^CollisionPhysicsSend = "1";
^^CollisionPhysicsReceive = "0";
^^CollisionCircleScale = "0.7";
^^CollisionDetectionMode = "CIRCLE";
^^CollisionResponseMode = "BOUNCE";
^^CollisionCircleSuperscribed = "0";
^^%theball.setCollisionMaxIterations(3);
##^##^%theball.setMass(10.8);
^^%theball.setMaxAngularVelocity(4);
^^%theball.setMaxLinearVelocity(150);
^^%theball.setRestitution(1.0);
^^%theball.setFriction(0);
^^%theball.setCollisionCallback(1);
^^%theball.setConstantForce( 0, 0.5, true );
^^%theball.setLinearVelocity(%ballVector);
>>> Error report complete.
05/12/2008 (10:52 am)
I'm having trouble with the ball part.Firstly it does not say whether or not you put the ball onto the scene or not. And when I run it i get the following:
Compiling C:/Users/Sandy/Documents/MyGames/Breakout/game/gameScripts/ball.cs...
C:/Users/Sandy/Documents/MyGames/Breakout/game/gameScripts/ball.cs Line: 17 - parse error
>>> Advanced script error report. Line 17.
>>> Some error context, with ## on sides of error halt:
^^CollisionActiveReceive = "1";
^^CollisionPhysicsSend = "1";
^^CollisionPhysicsReceive = "0";
^^CollisionCircleScale = "0.7";
^^CollisionDetectionMode = "CIRCLE";
^^CollisionResponseMode = "BOUNCE";
^^CollisionCircleSuperscribed = "0";
^^%theball.setCollisionMaxIterations(3);
##^##^%theball.setMass(10.8);
^^%theball.setMaxAngularVelocity(4);
^^%theball.setMaxLinearVelocity(150);
^^%theball.setRestitution(1.0);
^^%theball.setFriction(0);
^^%theball.setCollisionCallback(1);
^^%theball.setConstantForce( 0, 0.5, true );
^^%theball.setLinearVelocity(%ballVector);
>>> Error report complete.
#6
05/12/2008 (1:47 pm)
Sandy... Without including your source script, it's hard to see what the problem is. It would appear as if you might have forgotten to include the closing bracket that defines the %theball t2dStatic Sprite declaration.function newBall(%ballLoc,%ballVector) {
%theball = new t2dStaticSprite() {
scenegraph = $thescenegraph;
imageMap = "basicballImageMap";
canSaveDynamicFields = "1";
Position = %ballLoc;
size = "5.000 5.000";
class = "ballClass";
CollisionActiveSend = "1";
CollisionActiveReceive = "1";
CollisionPhysicsSend = "1";
CollisionPhysicsReceive = "0";
CollisionCircleScale = "0.7";
CollisionDetectionMode = "CIRCLE";
CollisionResponseMode = "BOUNCE";
CollisionCircleSuperscribed = "0";
};
%theball.setCollisionMaxIterations(3);
%theball.setMass(10.8);
%theball.setMaxAngularVelocity(4);
%theball.setMaxLinearVelocity(150);
%theball.setRestitution(1.0);
%theball.setFriction(0);
%theball.setCollisionCallback(1);
%theball.setConstantForce( 0, 0.5, true );
%theball.setLinearVelocity(%ballVector);
#7
The error you were having in part one was because base.cs wasn't being included, and it wasn't being included because of some path placement of the files.
If you go back to part one and pay close attention to where the files are placed, it may make all the difference. Perhaps I should add a snapshot of the directory structure so it is more visible.
Regarding this post about the ball, this series was designed as a step by step, so if it doesn't say to do something like add the ball to the scene, don't do it.
I'll be happy to help with any problems, but the series has been tested quite thoroughly, and though I could probably be more clear in parts, if you follow it slowly it is pretty bulletproof.
Greg
Greg
05/12/2008 (3:21 pm)
Sandy, I suggest you go back to part one and start from there. Using the exec.cs method is important, and will become very confusing for you as the series gets more complicated.The error you were having in part one was because base.cs wasn't being included, and it wasn't being included because of some path placement of the files.
If you go back to part one and pay close attention to where the files are placed, it may make all the difference. Perhaps I should add a snapshot of the directory structure so it is more visible.
Regarding this post about the ball, this series was designed as a step by step, so if it doesn't say to do something like add the ball to the scene, don't do it.
I'll be happy to help with any problems, but the series has been tested quite thoroughly, and though I could probably be more clear in parts, if you follow it slowly it is pretty bulletproof.
Greg
Greg
#8
05/13/2008 (6:15 am)
What difference does it make if all the exec.'s are in the main.cs? I was always taught to have them in the main .cs. To be honest I'm only trying to achieve a watered down version of this game.
#9
*edit* Cheers don I didn't realise that it was added after that function I thought it was part of it.
The exec.cs is a mystery to me it doesn't work at all. I have got to the ball mounted to the space ship without it.
05/13/2008 (6:38 am)
Ok I listened to you added the exec.cs put all the exec stuff in there and now I get an error and nothing works at all. *edit* Cheers don I didn't realise that it was added after that function I thought it was part of it.
The exec.cs is a mystery to me it doesn't work at all. I have got to the ball mounted to the space ship without it.
#10
I have seen an odd situation at this point in the process. On occasion, the bouncing ball gets stuck on one of the walls. I've gone back and double checked my following of the tutorial, and I can't come up with the why of it.
I am using TGB 1.7.3 (which isn't explicity stated as supported), and was hoping someone else might have discovered this issue, or have a suggestion that might get to a solution for this. In some of my other experiments with basic bouncing balls in a square container, I've also seen this problem. So, I'm sort of leaning towards some kind of engine issue...
Melv, if you happen to read this, could you go through this tutorial up to this point? and see if you can repro it?, if not I'll be happy to send you a copy of my project.
I am going to proceed through the rest of the tutorial, it is very interesting, and I'm looking forward to evolving this tutorial into a complete game, I've always liked the breakout type games, I can also see a possiblity for a 2 player version of this, using joysticks, or gamepads.. :D
Thanks Tetraweb!
06/02/2008 (10:32 pm)
Ok, I've been following the tutorial, with good success, and I would like to say what a good job you've done, I can tell a lot of work has gone into this series.I have seen an odd situation at this point in the process. On occasion, the bouncing ball gets stuck on one of the walls. I've gone back and double checked my following of the tutorial, and I can't come up with the why of it.
I am using TGB 1.7.3 (which isn't explicity stated as supported), and was hoping someone else might have discovered this issue, or have a suggestion that might get to a solution for this. In some of my other experiments with basic bouncing balls in a square container, I've also seen this problem. So, I'm sort of leaning towards some kind of engine issue...
Melv, if you happen to read this, could you go through this tutorial up to this point? and see if you can repro it?, if not I'll be happy to send you a copy of my project.
I am going to proceed through the rest of the tutorial, it is very interesting, and I'm looking forward to evolving this tutorial into a complete game, I've always liked the breakout type games, I can also see a possiblity for a 2 player version of this, using joysticks, or gamepads.. :D
Thanks Tetraweb!
#11
Melv is working some other physics fixes into the next version which I hear solves some of the other collision issues, and may well end that issue.
Greg
06/03/2008 (5:09 pm)
Hi Scott. The next part you are about to do starts with a hack fix for the paddle double bounce. If your 'stuck in the wall' happens most often when the ball is trapped between the paddle and the wall, this fix should lessen that greatly.Melv is working some other physics fixes into the next version which I hear solves some of the other collision issues, and may well end that issue.
Greg
#12
I should have read ahead a bit.. I have seen the paddle double bounce issue.
The ball does indeed get stuck at an indeterminate time, and at random locations along the wall.
Which makes it hard to reliably reproduce, however after just a few minutes for me it always happens.
I've been following all of the outstanding tgb threads, and I'm looking forward to seeing futher fixes as this last update (1.7.3) was a great step foward, and has solved a great many issues regarding basic physics responses. I also feel this is and will open up new avenues for innovative and unique new gaming experiences.
Later!
06/03/2008 (9:42 pm)
Thanks Greg!I should have read ahead a bit.. I have seen the paddle double bounce issue.
The ball does indeed get stuck at an indeterminate time, and at random locations along the wall.
Which makes it hard to reliably reproduce, however after just a few minutes for me it always happens.
I've been following all of the outstanding tgb threads, and I'm looking forward to seeing futher fixes as this last update (1.7.3) was a great step foward, and has solved a great many issues regarding basic physics responses. I also feel this is and will open up new avenues for innovative and unique new gaming experiences.
Later!
#13
I was also playing around the other night with some of my own stuff and also had a similar physics sticking issue with a ball on walls and corners of walls. I am leaning towards this being an engine issue, but if someone out there knows a fix for this, I would love to hear about it. :)
Thanks!
Mark
06/17/2008 (3:39 pm)
I am well into step 4 of the tutorial and I am also seeing the "stuck ball" issue on walls and also sometimes on the squares themselves. I am also using the newest version of TGB (1.7.3). I was also playing around the other night with some of my own stuff and also had a similar physics sticking issue with a ball on walls and corners of walls. I am leaning towards this being an engine issue, but if someone out there knows a fix for this, I would love to hear about it. :)
Thanks!
Mark
#14
Great tutorial! I'm really learning a lot from it and I can't wait for the last remaining sections.
Keep up the excellent work!
Eric
06/19/2008 (11:03 am)
I also ran into the "stuck ball" problem. I found that the same fix used for the ball being stuck in the paddle will work just as well for when the ball gets stuck against the wall or one of the tiles. Simply turn off collision detection for the object that was struck, and schedule an event to turn the collisions back on in a short time. Since the walls and tiles aren't mobile like the paddle, this can be a very short interval. I found that 20 ms works just fine on my project.Great tutorial! I'm really learning a lot from it and I can't wait for the last remaining sections.
Keep up the excellent work!
Eric
#15
p.s. (edited)I've also seen the "stuck ball" effect. Eric Rolfe's solution seems to have taken care of it.
07/25/2008 (6:27 pm)
Luuuuuuuuv the sound effects! I always put them off until the end of my game development, which means that sometimes they never happen. It's a lot more gratifying to hear them in the beginning like this. I learned something new!p.s. (edited)I've also seen the "stuck ball" effect. Eric Rolfe's solution seems to have taken care of it.
#16
08/12/2008 (9:05 pm)
Just chiming in to say thanks, and I too had the "stuck ball" problem. Might want to add to the tutorial something about it, since at this point (part 2) I didn't know if it was a known problem or not, so it kind of distracted me.
#17
Thanks a bunch for the tutorial. I'm enjoying the 2 parts that I've been working on greatly and they are a great tool for getting into TGB.
I've encountered a problem with part two of the tutorial and I'm having some difficulty finding out where the error lies, which I'm guessing is a typo somewhere. Aside from simply ripping everything apart and performing a copy/paste, I'd like to ask for some help with what could be going wrong.
The problem is that I am not getting the collision particle effect (nor the sound effect for that matter). After getting no where with a proof read of the ballClass I eventually did a copy/past of that function. I've also read over each of the other additions to the code for the effect with no luck. I've copied the code below. Am I missing something?
Thanks again for the tutorial.
-z
p.s. I'm having the stuck ball issue as well.
08/17/2008 (5:19 pm)
Hi, Thanks a bunch for the tutorial. I'm enjoying the 2 parts that I've been working on greatly and they are a great tool for getting into TGB.
I've encountered a problem with part two of the tutorial and I'm having some difficulty finding out where the error lies, which I'm guessing is a typo somewhere. Aside from simply ripping everything apart and performing a copy/paste, I'd like to ask for some help with what could be going wrong.
The problem is that I am not getting the collision particle effect (nor the sound effect for that matter). After getting no where with a proof read of the ballClass I eventually did a copy/past of that function. I've also read over each of the other additions to the code for the effect with no luck. I've copied the code below. Am I missing something?
function initializeEffects()
{
$wallbang = new t2dParticleEffect() { scenegraph = $thescenegraph; };
$wallbang.loadEffect( "~/data/particles/chip.eff");
$wallbang.setEffectLifeMode(stop, 0.2);
}function endGame()
{
if ($wallbang) $wallbang.safeDelete();
sceneWindow2D.endLevel();
moveMap.pop();
moveMap.delete();
Canvas.showcursor();
// %res=toggleFullScreen();
}function initializeLevel()
{
$theballs = new SimSet()
{
};
$thebase.loadBall();
initializeEffects();
}function ballClass::onCollision(%srcObject, %dstObject, %srcRef, %dstRef, %time, %normal, %contacts, %points) {
if (%dstObject.class $= "paddleClass") {
%speed = getword($thebase.getlinearVelocitypolar(),1);
if (%speed > 150) {
%force = t2dVectorScale(%normal,(-%speed*2));
%srcObject.setImpulseForce(%force, false);
}
%r=getRandom(1,2);
%hitsound="shieldhit"@%r;
alxPlay(%hitsound);
$wallbang.setPosition(%points);
$wallbang.playEffect(false);
} else if (%dstObject.class$="wallClass") {
alxPlay(wallhit);
$wallbang.setPosition(%points);
$wallbang.playEffect(false);
}
}Thanks again for the tutorial.
-z
p.s. I'm having the stuck ball issue as well.
#18
thank uuuuuu
10/29/2008 (12:58 pm)
I am having the same problem as well with the ball collision effect in tutorial 2 I have added the script just like zenasprime above, but all i got was a shooting star. please help?thank uuuuuu
#19
The command line, says there are no emitters present.
Hope you can answer.
Thanks
04/26/2009 (7:50 pm)
I have the same problem with the Particle effect, The command line, says there are no emitters present.
Hope you can answer.
Thanks
#20
I'm trying this tutorial on iTGB and I can't get the sound to work. Anyone run into this problem?
Thanks
07/18/2009 (12:10 pm)
Great tutorial!I'm trying this tutorial on iTGB and I can't get the sound to work. Anyone run into this problem?
Thanks
Torque Owner Deozaan
Two small typos in the opening paragraph (emphasis added):
Should probably be:
I'd also like to chime in my opinion that as someone who uses dual monitors, any application that forces full-screen at any resolution other than what I have it set to (1280x1024) is very rude and inappropriate, because during the resolution change it moves all the windows partially over to the second monitor and it doesn't fix them when it exits out of full screen mode.
Down later in the tutorial where you have the code for Shooting the ball, you have what appears to be an image with the caption: "The shooting ball." but the image isn't showing up.
A lot of your code indention is a little bit off. For example, the following code:
function ballClass::onTimer(%this) { %angle = getword(%this.getlinearVelocitypolar(),0); %speed = getword(%this.getlinearVelocitypolar(),1); if (%speed > ($levelBspeed+2)) { %this.setlinearvelocitypolar(%angle, %speed-4); } else if (%speed < ($levelBspeed-2)) { %this.setlinearvelocitypolar(%angle, %speed+4); } }Should look like this:
function ballClass::onTimer(%this) { %angle = getword(%this.getlinearVelocitypolar(),0); %speed = getword(%this.getlinearVelocitypolar(),1); if (%speed > ($levelBspeed+2)) { %this.setlinearvelocitypolar(%angle, %speed-4); } else if (%speed < ($levelBspeed-2)) { %this.setlinearvelocitypolar(%angle, %speed+4); } }A couple of typos in the Let's Not Have a Ball section:
And the paragraphs following don't use consistent capitalization with the word SimSet:
Finally, as in Part One, you have other inconsistencies in capitalization and how you use opening and closing brackets in your code.
That's all for tips for improvement. Let me just say thank you very much! It's so nice to have working tutorials for that cover a wide range of topics and are updated for the latest version of TGB.
I'll go through part 3 soon.