Game Development Community

Brickout Build 2 (pretty much final)

by Drew -Gaiiden- Sikora · in Torque Game Builder · 02/28/2005 (7:48 pm) · 21 replies

Huzzah! The brickout game is now fully operational! Well, to a point anyways :P I don't, for example, have more than one level - but I'm not really out to make a complete Brickout game here, just something to help me learn the basics. Here's what I do have (in addition to build 1)

Fixes/Additions
===========

* All capsules are tested and operational
* Code broken up into relevant files and reorganized for better clarity (I hope :P)
* Global data file added so that you can easily change game values (like paddle/ball speed, # of capsules generated, etc)
* Bricks explode when hit by ball or missiles
* board resets when all bricks are destroyed - capsules regenerated at new random positions
* Sounds added for all game actions
* Optional debug info available for bricks loaded with capsules (see global.cs)

Notes
=====

* Didn't touch the physics at all, so still my crappy implimentation
* Still can't figure out how to get the world coordinates of a certain tile, so all explosions also take place at the ball/missile locations
* Yes, the particle effects are all very tiny. I haven't figured out yet how to resize them. I have some ideas, but after a few tries got nothing so gave up on that for the time being. Guess I'll have to play with the particle editor some more
* For some reason I still couldn't get the torpedo particle effect to display - tho I have a hunch I just couldn't see it cause it was really frikin small. The code is commented out right now.
* For Super Mode, I tried using fxSceneObject2D::setPhysicsSuppress on the tile map but the ball still bounced off the bricks. So I had to disable the ball's collision physics (luckily I do manual reflections off the paddle!). I dunno if I had the physics set up wrong in the first place or if I was misusing setPhysicsSuppress

Controls
======

Left - move paddle left
Right - move paddle right
Space - launch ball/fire missiles
Z - give the ball (main ball only, not sidekick) a boost to the left
X - give the ball (main ball only, not sidekick) a boost to the right
Esc - quit
F1 - toggle T2D debug overlays
1 - enable Fire Mode (paddle has guns)
2 - enable Sidekick Mode (extra ball)
3 - enable Super Mode (ball travels through bricks)
4 - enable Long Mode (wider paddle)

Install
=====

Download Here

Just unzip straight to the examples folder and run the batch file.

This is not a redistributable game! Full source is included and the editors are still accesible through shortcut keys! This game is meant for current T2D licensed users to learn from. If you want to send it to a friend you will be responsible for finishing up the packaging (removing the editors, displaying the GG logo, etc)
Page «Previous 1 2
#1
02/28/2005 (7:55 pm)
Cool, ill try it out as soon as i get some more work done on my tool.
#2
03/01/2005 (12:41 am)
Thx - lemme know what you think. Not only am I hoping this code will help people, but I'm also hoping ppl can tell me how to make it better as well.
#3
03/01/2005 (1:23 am)
@Drew: Cool game.

Considering we only released this thing late Friday night, this is superb!

Been looking at your code and you're using everything exactly as it should be used. I still need to check the physics stuff though. :) The only thing that you've done is add something you don't need to. You don't need to do anything special for your stuff to appear in the tile-editor, it'll do it for you automatically so the code below is redundant. You do...
// load my images into the tile editor
$datablockSet = getDatablockSet2D();
... which gets a copy of the "SimSet" (see TGE documentation) which contains all the datablocks you defined in T2D, imageMaps, animations, object-config datablocks etc. You can go through them and interrogate all sorts of information from them. For imageMaps, things like bitmap details, number of frames etc. Anyway, don't want to hi-jack this thread because it's a perfect example of all we wanted to see after the release of T2D.

With regards to playing the game, it's all good but the only thing that I'd improve is keeping the pace of the ball at a minimum. Sometimes you'd have the ball crawling at acute angles across the screen and it'd take 30 seconds before it came down again. You don't mind this if it was whizzing around knocking bricks out. :)

I'll be spending the next week putting together some preliminary documentation for stuff like physics, tiles, mounting etc and when we've cleaned them up, we'll get them out in the SDK.

All in all, a superb example done very quickly. You're leading the way here dude. :)

- Melv.
#4
03/01/2005 (7:40 am)
Quck question....
I am running the mac version and placed the unziped folder in my example folder. However when I double click the "brick out.bat" I get a message that there is no defult application for this file. I noticed that when I ran the Shooter Demo there is a TerminalShellscript that opens the Terminal and launches the demo.

Can someone help on how to launch "brick out.bat" or any other prgram from the Terminal (if that is the only way for the mac)

Thanks!!!
#5
03/01/2005 (7:50 am)
Get into the console and go to the directory.

Run the executable with a "-mod BrickOut" on the end.
#6
03/01/2005 (8:21 am)
Are you talking about the "Console" from T2D-OSX or the "Terminal" program in osX?
#7
03/01/2005 (8:53 am)
Wouldn't there be an issue with the .dso files created under windows & then running it on a Mac? The .cs files would have to be re-compiled by T2D under the Mac, correct?
#8
03/01/2005 (8:57 am)
@Keith: correct.
#9
03/01/2005 (10:09 am)
@Stephen: To be honest, I never quite undersood why that was. Is that because there's some endianess in the DSOs or some other particular OS-dependant binding?

- Melv.
#10
03/01/2005 (10:25 am)
Must be endianess... I can use .dso files from windows on my linux machine.
#11
03/01/2005 (11:13 am)
Quote:
... which gets a copy of the "SimSet" (see TGE documentation) which contains all the datablocks you defined in T2D, imageMaps, animations, object-config datablocks etc. You can go through them and interrogate all sorts of information from them. For imageMaps, things like bitmap details, number of frames etc. Anyway, don't want to hi-jack this thread because it's a perfect example of all we wanted to see after the release of T2D.
Thx, I was having trouble in the beginning getting my bricks to show up in the tile editor so someone suggested this to me - turns out it was me not defining my datablocks properly. After that I just forgot it was there :P
Quote:
With regards to playing the game, it's all good but the only thing that I'd improve is keeping the pace of the ball at a minimum. Sometimes you'd have the ball crawling at acute angles across the screen and it'd take 30 seconds before it came down again. You don't mind this if it was whizzing around knocking bricks out. :)
Yea... funny thing actually. I tried using setMinLinearVelocity(200) and setMaxLinearVelocity(200) under the impression that this would keep the ball traveling at 200 units (for lack of a better term). However when it hit a brick after launch, it would stop. It drove me nuts for a while until I realized that because I set the minimum velocity above 0, the ball's velocity couldn't drop below that and go negative to travel in the opposite direction! Is this a bug? Because in order to get it to work I had to define the min velocity as -200 and the max as 200, but that still leaves the ability for the ball to slow down to 0. So it seems kind of strange to me. In the meantime however make good use of the Z and X keys :)
#12
03/01/2005 (12:36 pm)
So... can people with a MAC run this batch file?
#13
03/01/2005 (1:08 pm)
@Drew: That would indeed be a bug if that's what it's doing. I'll add that to the list. :)

- Melv.
#14
03/01/2005 (1:53 pm)
Still trying to load BrickOut example on the MAC with no luck at all. I could not figure out how to load the program itself so I modified the Terminal Shell Script that was made for the ShooterDemo. When I run the terminal script it crashes. Here is the code for the shell script as well as the console log. Any ideas? ...and is there any documentation on the console and or commands? Thanks for the help (i need it ;)


Terminal Shell Script:

#!/bin/tcsh
# if launched from the finder, we'll not be in the correct directory.
# get to the directory where this script file lives
cd 'dirname [[62817db84e4d8]]'

T2D-OSX.app/Contents/MacOS/T2D-OSX -mod brickout

echo ""
echo ""
echo "Thanks for using Torque 2D!"
echo "The Torque 2D Demo Application has finished running."
echo "You may close this Terminal window at any time."




Console Log:

Loading compiled script common/ui/defaultProfiles.cs.
Loading compiled script common/ui/GuiEditorGui.gui.
Loading compiled script common/ui/ConsoleDlg.gui.
Loading compiled script common/ui/InspectDlg.gui.
Loading compiled script common/ui/InspectAddFieldDlg.gui.
Loading compiled script common/ui/LoadFileDlg.gui.
Loading compiled script common/ui/SaveFileDlg.gui.
Loading compiled script common/ui/MessageBoxOkDlg.gui.
Loading compiled script common/ui/MessageBoxYesNoDlg.gui.
Loading compiled script common/ui/MessageBoxOKCancelDlg.gui.
Loading compiled script common/ui/MessagePopupDlg.gui.
Loading compiled script common/ui/HelpDlg.gui.
Loading compiled script common/ui/RecordingsDlg.gui.
Loading compiled script common/ui/optionsDlg.gui.
Loading compiled script common/client/metrics.cs.
Loading compiled script common/ui/FrameOverlayGui.gui.
Loading compiled script common/client/messageBox.cs.
Loading compiled script common/client/screenshot.cs.
Loading compiled script common/client/cursor.cs.
Loading compiled script common/client/help.cs.
Loading compiled script common/client/recordings.cs.

OpenAL Driver Init:
OpenAL
   Failed to initialize driver.
Loading compiled script brickout/client/datablocks.cs.
Loading compiled script brickout/client/audiodatablocks.cs.
Loading compiled script brickout/client/mainScreenGui.gui.
Loading compiled script brickout/client/globals.cs.
Loading compiled script brickout/client/bricks.cs.
Loading compiled script brickout/client/player.cs.
Loading compiled script brickout/client/ball.cs.
Loading compiled script brickout/client/capsules.cs.
Loading compiled script brickout/client/control.cs.
Loading compiled script brickout/client/game.cs.
capsule 4 assigned to brick 6 8
capsule 0 assigned to brick 2 12
capsule 3 assigned to brick 9 15
capsule 3 assigned to brick 5 7
capsule 2 assigned to brick 3 12
capsule 3 assigned to brick 4 2
capsule 2 assigned to brick 0 14
#15
03/01/2005 (2:02 pm)
If the download included .dso files. Delete them. The .dso files created on a Win32 system are not compatible with the Mac
#16
03/01/2005 (2:13 pm)
Since people in here are owners of T2D, the author would be able to give the Mac user the original scripts, but for everyone else, only compiled scripts can be passed out according to the EULA (except for the scripts that have no Torque 2D-specific functionality in them at all).
#17
03/01/2005 (2:19 pm)
YES! Removing the .DSO files worked!!!!!

Now all I need to do is write a quick applescript to auto delete the .dso. for futrue use. Is there any reason why I would EVER need "DSO" files?

Thanks for the help (i am getting there....)
#18
03/01/2005 (3:02 pm)
@Melv: yes, it has to do with endian stuff. What specifically, I have no clue...

@Brian: You should only have to delete the .dso's once, assuming that what happened was the distribution he published included Windoze .dso's. Since TGE (and therefore T2D) checks the date/time stamps of .dso's against their .cs (if present) to determine if it should recompile, you were probably not compiling anything (note all the "loading compiled script xxxx lines, without corresponding "compiling script xxxx" on your published console.log, vs what the console.log would show if on the first run after you delete all the .dso's.)

In other words, for T2D publishers: you will need to provide .dso files compiled on a Mac box to release your game for Mac. You cannot release Windows/linux .dso's and expect them to work...and since by EULA you cannot release .cs files, you can't let the Mac owner compile them on their own.

Something to work around for now, and who knows, someone may just re-write the script byte-code compilation to allow for a "--byteCodeCompileAsMac" option...don't hold your breath however!
#19
03/01/2005 (5:57 pm)
Thx for the heads up all you guys. I'll keep that in mind when releasing an actual product. I'll prob just hijack my friends who have a Mac and Linux machine for the time being :P
#20
03/01/2005 (6:25 pm)
Not an issue with linux. DSO's from windows will work under linux.
Page «Previous 1 2