Game Development Community

PowerPong: Sprint 1 "Classics

by Charles "monkeyboy" Gibson · in Torque Game Builder · 04/24/2008 (11:11 pm) · 15 replies

Hi, I am currently in development to make my first game. It is a Pong clone with some additional features that I would like to see.

It is still in development is scheduled for two more iterations. Currently I have finished the first iteration themed "Classics". I am also planning to post my iteration reviews on my blog along with the iteration deliverables. Here is the url to my blog: http://monkeydungeon.blogspot.com/2008/04/sprint-1-classics.html

I was wondering if you guys could try it out and tell me your thoughts. I'm looking for honest constructive feedback.

Thanks in advance.

#1
05/11/2008 (5:59 am)
I just downloaded the demo, Charles. I'll let you know what I think.
#2
05/11/2008 (7:48 am)
Thanks, I will be updating my blog tonight with Sprint 2's iteration. It is still more of the old classic pong with multiplayer (same machine) and control selection support. Stay tuned though, it will get better! :)
#3
05/12/2008 (6:53 pm)
Nice solid base, my friend. Although I just played the first iteration. Is there a new one out already?

I'm guessing that its possible to beat the computer, but it seemed to be really hard. I also couldn't help noticing the after image effect you used in the title screen. I just recently wrote an article on TDN about how to create a dynamic, though simple, after image effect in script.

tdn.garagegames.com/wiki/TGB/AfterImage_Effect
#4
05/13/2008 (7:04 am)
Thanks Kevin! I appreciate you taking the time to check out my progress.

Yeah, at the moment, the cpu is elite. In my second iteration, I slowed its movement down some so it can lose. I plan to do more game balancing once I start adding the power-ups to the game. I was even thinking of throwing in some sort of randomness that would simulate a failed anticipation of where the ball might be (i.e. under/overshooting the ball). But in the mean time I decided to kept it simple.

Regarding the "after image effect", are you referring to the menu buttons? If so, I originally used t2dStaticSprites and hooked up my grow/shrink behavior to them. In this past iteration I changed that in an attempt to learn more about TGB's GUI system. Now the menu buttons, and all menus for that matter, have been converted to use the GUI system.

I implemented the mouseover/out handlers of the GUIBitmapButtonTextCtrl to handle the grow/shrink behavior. There is a little defect though, sometimes when the mouse travels over a button, the button positions itself left of its original position after the mouse leaves. It has been added to the defect list, so it will be scheduled to get fixed.

Here is the link to the results of my second iteration monkeydungeon.blogspot.com/2008/05/sprint-2-it-takes-two.html. The game play remains the same, except for a slower cpu opponent. I added an ability to set your control type and head-2-head play. More of the details are listed on my blog.

So stay tuned, it will only get better. Also, keep the feedback coming! I want to make this a really fun game that others would like to play.
#5
05/13/2008 (1:14 pm)
Don't mention it. ;) Glad to hear that there are plans to incorporate flaws into the AI. I'll have fun trying to beat this one for as long as I can stand it, though I'll definitely check out the 2nd iteration.

This is the afterimage effect:

www.metalbuildingreplicas.com/clan/afterimage2.jpg
The pong ball on the main menu has this effect. The article I wrote gives code on how to do this real time. It doesn't really matter to me whether you use it or not; I am just throwing it out there.
#6
05/13/2008 (3:54 pm)
Ah, now I understand what you were refering to. Yeah, I just made it by hand.

I did look at your code for the dynamic afterImage effect. If you don't mind I would like to use it for some added effects when I start implementing the power-ups.

Have you thought about turning your code into behaviors? I think that would be really cool. Then we could just plop them on any game object using the designer.

Also, is that above screenshot a game you are working on?
#7
05/14/2008 (9:07 am)
I'd be overjoyed if you used it. ;)

Yeah, someone else mentioned making a behavior out of it, but I'm not sure how to make it generic enough to be useful as a behavior. In the game above, when you hit "c", the after image effect plays -- simply because I was just testing whether it looked good or not. If you have an idea, let me know :)

That's Unek. I'll be stripping parts of it for a game that I will be making. The acrobatics system got a little crazy -- I basically added code until it worked. When I left TGB, I was working on making the acrobatics system modular and very strictly organized. Basically starting over. I'll send you the project if you're interested.
#8
05/14/2008 (1:12 pm)
Sorry man, I forgot to mention the beta test results:

Awesome changes from the first version:

*The count down number text is much cooler looking and not pixelated.
*It is possible to score against the CPU.
*Controller support works perfectly. Using a controller is cool.
*Two player mode seems like it would be fun, but I haven't gotten the chance to play with anyone yet. The scoring bug affects the playability of the game. (See below)

Suggestions/Bugs:

*Scoring doesn't work on either side in the latest build. The ball just goes away and nothing happens.
*Being able to restart a game or go back to the main menu during a match might also be helpful.
*Hitting the ball from the side results in it morphing behind the paddle. I'm guessing you do this so that the ball isn't in play at a x linear velocity of 0.1. If you could think of a better solution, that'd be great.
#9
05/14/2008 (6:31 pm)
Awesome Kevin! Thanks for the feedback that rocks. I will make sure the bugs are added to my defects list.
Quote:
*Scoring doesn't work on either side in the latest build. The ball just goes away and nothing happens.
Yeah, I've noticed that happening, but it didn't seem to be consistent. Still on the defect list.

Quote:
*Being able to restart a game or go back to the main menu during a match might also be helpful.
Honestly, I hadn't even considered restarting a singleplayer match in the middle of a match. I will add that feature, nice one! As far as going back to the main menu, I did add that to the pause menu. If you hit the "p" key during play the pause menu will appear and you can choose to resume, exit to main menu, or exit game. I will add the restart feature too.

Quote:
*Hitting the ball from the side results in it morphing behind the paddle. I'm guessing you do this so that the ball isn't in play at a x linear velocity of 0.1. If you could think of a better solution, that'd be great.
Yeah, that ding dang ball physics is a thorn in my side. Right now it is using the BOUNCE collision model and I think there are issues when the ball speed gets too fast and collision detection gets funky. I also noticed that a player will sometimes lose two lives when that scenerio occurs. I would appreciate any ideas you may have regarding this.

Yeah, ship me the project. I would really like to check it out. Your project looks and sounds really interesting.

I do have an idea for how to convert your dynamic after image effect script code into a behavior. Let me play with it a bit and I will post my idea. Plus, it will be a good break from my project! :)
#10
05/15/2008 (6:23 am)
Alright here's what I came up with for converting your after image effect into a behavior. It consists of two files, afterImageEffectBehavior.cs and afterImageEffect.cs.

Here is the code for the AfterImageEffectBehavior.cs file. It's main goal is to allow any game object that should have an after image effect have its own unique creation and fade values specified from the TGB editor. This file should be added to the behaviors folder (remember not to exec this script file it is automatically loaded).
if(!isObject(AfterImageEffectBehavior))
{   
   %template = new BehaviorTemplate(AfterImageEffectBehavior); 
        
   %template.friendlyName = "After Image Effect";   
   %template.behaviorType = "Effect";   
   %template.description  = "Creates an affter image effect as the owner moves"; 
        
   %template.addBehaviorField(frequency, "how often to make after image clones", float, 250.0); 
   %template.addBehaviorField(totalFadeTime, "how long it takes for the after image effect to fade", float, 2000.0); 
   %template.addBehaviorField(fadeTimeSlice, "how many times the after image effect's fade is updated", float, 30.0); 
}

function AfterImageEffectBehavior::onBehaviorAdd(%this)
{
   %this.owner.setTimerOn(%this.frequency);
}

function AfterImageEffectBehavior::onTimer(%this)
{
   %afterImageEffect = createAfterImageEffectFrom(%this.owner);
   %afterImageEffect.fade(%this.totalFadeTime, %this.fadeTimeSlice);
}

Here is the code for the AfterImageEffect object. My idea isn't completely tested because I didn't create an animated sprite to make sure the framing worked properly. I am sure with a little tweaking or an added factory method this could be fixed to convert an animated sprite into a static sprite. But basically my idea is all after image effects are essentially static sprites that fade out over time. Add this file to the gameScripts folder (do not forget to exec this file).
function createAfterImageEffectFrom(%gameObject)
{
   if (!isObject(%gameObject))
      return;
      
   %afterImageEffect = new t2dStaticSprite()
   {
      scenegraph = %gameObject.getSceneGraph();
      class = "AfterImageEffect";
      size = %gameObject.getSize();
      Position = %gameObject.getPosition();
      Layer = %gameObject.getLayer() + 1;
      FlipX = %gameObject.getFlipX();
      Rotation = %gameObject.getRotation();
      imageMap = %gameObject.getImageMap();
      frame = %gameObject.getFrame();
   };
   
   %afterImageEffect.setBlendAlpha(%gameObject.getBlendAlpha());
   
   return %afterImageEffect;
}

function AfterImageEffect::fade(%this, %totalFadeTime, %timeSlice)
{
   %this.timeSlice = %timeSlice;
   
   %this.updatesRemaining = mCeil(%totalFadeTime / %timeSlice);
   %this.alphaStep = %this.getBlendAlpha() / %this.updatesRemaining;
   
   %this.step();
}

function AfterImageEffect::step(%this)
{
   if (%this.stillFading())
   {
      %this.setBlendAlpha(%this.getBlendAlpha() - %this.alphaStep);
      
      %this.updatesRemaining--;
      %this.schedule(%this.timeSlice, "step");
   }
   else
   {
      %this.setBlendAlpha(0);      
      %this.schedule(500, "safeDelete");
   }
}

function AfterImageEffect::stillFading(%this)
{
   return %this.updatesRemaining > 0;
}

This screenshot shows how to use the behavior from the TGB editor. I changed the frequency from its default value of 250.0 to a value of 50.0 to make a more dramatic effect.
home.comcast.net/~charles_gibson_jr/images/afterImageEffectBehavior.jpg
This screenshot show the after image effect in action.
home.comcast.net/~charles_gibson_jr/images/afterImageEffect.jpg
Let me know what you think!
#11
05/17/2008 (12:26 pm)
Hey Kevin, can you send me the console.log file to troubleshoot the errors you were receiving? My email is charles_gibson_jr@hotmail.com
#12
05/17/2008 (7:03 pm)
Sorry for the silence!

Your behavior code looks good. The thing I can't get past is what if the developer wants the after effect to only be active, say when the player is in bullet time mode? Or maybe only if the player is moving greater than or equal to a certain speed? In that case, providing behavior code wouldn't be as effective as I would like. That's why I only gave the generic script to achieve the after image effect. Also, at faster frequencies, the clones start to appear at non-equidistant intervals. That really bugs me, but I have no idea how to fix it.

As far as the console log, do you want one from the 2nd or 1st version? And btw, is a 3rd version planned?

Quote:I did add that to the pause menu. If you hit the "p" key during play the pause menu will appear and you can choose to resume, exit to main menu, or exit game.

Yeah, sometimes those dang beta-testers miss features that you put in! lol. What's really bad is when you tell them that its there, and they still don't believe you!

Quote:Yeah, that ding dang ball physics is a thorn in my side. Right now it is using the BOUNCE collision model and I think there are issues when the ball speed gets too fast and collision detection gets funky.

That's interesting. Have you checked out version 1.7.3? A lot of things in Unek dealing with collision stopped working when I upgraded to 173, but I think that's mostly because I weaseled so many aspects of the game. Maybe your physics issues will be solved by the upgrade because your situation is much simpler. That's kind of why I've hesitated to send off the latest Unek source -- its in some bad shape right now. You can check out my site listed under my profile to download some much more stable games as well as a stable version of Unek. I'll still send you the Unek source, but there's no telling what's going to happen.

Quote:I also noticed that a player will sometimes lose two lives when that scenerio occurs.

Wow. Now that's really interesting. I'd have to see the source to have any idea why that's happening, but I wanted to see what the debug mode could give me -- just on the release version.

Happy programming!
#13
05/19/2008 (10:05 am)
One implementation, is the behavior could take the name of a callback function that would be responsible for telling the behavior when to run. In your example if the player was in the bullet time mode, then the callback function would query for that and if true the after image effect would fire. It would also allow for different game objects to define different triggers which could all be setup from the designer. (That seems like an interesting project...)

Yeah, the clone positioning at high frequencies bugged me too. I wasn't sure how to fix it either. I was thinking of investigating that, because I like the idea of using the after image effect. I'll keep you posted if I get that worked out.

Can you send me the 2nd version of the console log? And yes, there is a third version. I just started my third iteration. It is focused on network play. I'll be posting when that is complete too. That is scheduled to be complete June 2nd.

Yeah, I upgraded to the 1.7.3 version. Still having the ball issues. It seems to happen when the ball is moving at high speeds. It is still on the defect list to get fixed. I did get rid of some defects. Especially the annoying menu one. When you mouse over a menu item fast it repositions itself. That was a dumb mistake that was corrected. So now they function like I want them too. There were a few others. I will update the readme to reflect the fixes/changes from the last release.

Thanks for help me out Kevin. I really appreciate it. I will post the source when I get home from work. Check it out and give me your thoughts.

I'll looking into extending that behavior. I think it would be cool to have. Also, how often did you have the after image effect clone in your game? My example was updating every 50 ms.
#14
05/25/2008 (6:29 pm)
The default value that I included in the code is usually what I use.

You should also know that I made a quick mock pong game and it has the same exact problems that yours has, even though I use different methods, such as world limits instead of triggers. Something is really wrong here.

EDIT (Continuing rant)

Its ridiculous that TGB can't handle a simple pong game, with the "out-of-the-box" code. Hopefully we're both missing something.
#15
05/27/2008 (5:40 am)
Ok, so yesterday I made a test level. That would use two AI controlled paddles that would track the ball at high speeds. I ran this level for an hour. I wanted to recreate the ball stopping.

What I found was the ball wasn't actually stopped, it was still moving and colliding with the paddle, so it was caught is some sort of collision detection/response loop. I verified this by echoing print statements during collision. My assumption was maybe there was an issue with collisions at high speeds, so I slowed the ball speed and ran the same test. It presented the same results.

For the next test, I changed the collision detection mode from "Circle" to "Polygon" and ran the test again. Surprisingly, it ran flawlessly. As an psuedo-stess test, I ran the test for another 5 hours and it never stopped. I also increased the ball speed and ran the test for another 3 hours and it never stopped.

So my thought is there is some sort of issue with collisions when at least one of the bodies is using the "Circle" collision detection mode. I haven't identified what the exact problem is yet, but am still looking into it. It's a bugger!

Let me know if you come up with anything.