Previous Blog Next Blog
Prev/Next Blog
by date

TorqueX Newbie Diary #2

TorqueX Newbie Diary #2
Name:David Everhart 
Date Posted:Dec 01, 2007
Rating:Not Rated
Public:YES
Comments:YES
RSS Feed:GarageGames Blog feedor Subscribe with .
Profile Page:View profile page for David Everhart

Blog post
Well, it has been an eventful last few days. I continued working on the Main menu GUI aspects of Arillian, and also dabbled in other areas. I have a ton to learn.

GUIBitmapButton and Mouse click event

I came across a problem trying to get my GUIBitmapButtons to register a mouse click. At first I figured I didnt read through the code correctly , so spent quite a bit of time seeing how the inputmanager class works. I still was not able to figure out how to bind a mouseclick to the GUIBitmapButton I had on my main menu. The BindAction that was used for the keyboard and gamepad didnt seem to work with the mouse.

After thinking about it, I decided to roll my own. I have done a first pass, by extending the GUIBitmapButton to expose a delegate for the mouse click event. I also implemented the ITickObject interface , and in the ProcessTick, I check the current mouse position, against the bounding box of the button. If it is in the bounds, and the mousebutton state is pressed, I fire off the delegate. I also set the focus to the control at that point. That works like a champ. However, I only wanted it to do the mouse checking when the button is "awake". So I overrode the OnWake function and registered it with the ProcessList, and then I overrode the OnSleep function, so it can be removed.

For my second pass, I think I am going to inherit from the GUIBitMapButton, maybe call it GUIBItmapEnhancedButton, and put all my modifications into that. That way I can use the stock one or my enhanced version. I am thinking I will add another texture for the pressed down state, and also expose a onMouseHover delegate.

Level State Machine

I went through the TorqueCombat Level State Machine code, and it provided some good insights. I used to think of the .txscene files loaded by the sceneloader were "levels" so to speak. However, in their example, they actually create the level through code, and populate it with what is needed. The .txscene file looks like it has everything in it, and it is pulled out as needed. I am thinking I may still want to go with the level per .txscene, especially if I am looking at a possible 3d environment (not fully sure at the moment). I am still going through the code, there is a ton going on in there!!

Sound Effects

I went ahead and used the XACT utility to import some .wav files. I created a new wavebank, and a new soundbank. The two sounds I used were the mouseover and mousedown sounds. When I saved off the project, it created a xap file (I assume that is their project file extension). When I compiled, it created three files, a .xgs , a xsb, and a xwb. I am thinking xgs stands for XACT Global Settings , which I found is also referenced in my torquesettings.xml as a value for AudioGlobalSettings. I am also thinking that the xsb is XACT Sound Bank , and xwb is XACT wave bank.

Once I figured out how it was working, getting it to play wasnt too hard at all. I just had to set up the soundbank and wavebank in code, then tell the soundbank to play a cue. I tested it out, and it worked out great. I can now use sound effects (and I assume ambient music and soundtracks) throughout Arillian!!

World Generation

This is something I have been meaning to do some research heavily into. I thought I was set on a 2.5d world, but I am not so sure anymore. All the benefits of a 3d world just seem hard to pass up. I have heard it is more difficult, but thats ok, I am up for a challenge. I took a look at the new TorqueX 3d beta, and checked out some of the terrain loading code.

I am completely new to this whole process, so I noted the types they supported. Then I went and read what the heck a heightmap is, and found it to be fairly straightforward. I checked out terrain editors, and came across L3dt, FreeWorld3D, Terragen, and a host of others. This has me wondering if I can generate small 3d terrain heightmaps (in 16 bit .raw format) , and swap them in and out with the sceneloader, based on the Level State Machine.

I am thinking instead of one whole world, I only bring "chunks of it". I checked out the fps demo, and they have various .txscene files, and the definition of the terrain was in there. I am leaning towards L3DT (non Torque) one atm, but am still researching it.


Thats it for now. I am having fun researching and learning all these new aspects. Until the next update!

Recent Blog Posts
List:09/03/08 - TorqueX 3D Hiding Meshes Part 2
07/09/08 - TorqueX - First Stab at Hiding Mesh Resource
06/22/08 - Journey Into 3D
01/28/08 - TorqueX Newbie Diary #6
01/07/08 - TorqueX Newbie Diary #5
12/12/07 - TorqueX Newbie Diary #4
12/07/07 - TorqueX Newbie Diary #3
12/01/07 - TorqueX Newbie Diary #2

Submit ResourceSubmit your own resources!

Johnathon   (Dec 01, 2007 at 17:35 GMT)
Freeworld3D is a pretty good editor, and they have an update coming out that looks pretty promising. I think the primary focus of the next release is better TMMOKIT support, but it will export out a 32bit raw now for heightmaps. This will be my next game tool purchase.

www.mmoworkshop.com/trac/mom/phpbb?page=viewtopic.php&t=1241

David Everhart   (Dec 01, 2007 at 22:17 GMT)
I bought l3dt but am going to download the trial for Freeworld3D and check it out. I may just buy it, at 30$ thats a great deal. The ones I saw on the L3dt page were just breathtaking, but my research so far tends to be that FreeWorld3D has a better editor. Thanks for the link John!

Dan Pascal   (Dec 04, 2007 at 15:54 GMT)
3d, bah...
I hope you don't spend all your time trying to debug torque's new technologies.

David Everhart   (Dec 05, 2007 at 20:30 GMT)
hehe Dan, I am actually working on what I posted on your video tutorial thread. However, instead of mounting animations, I am working on a system that generates the animation sequence on the fly (caching as I go) based upon equipment setup. I am almost done with a proof of concept, and will post all the performance aspects of it when I get a chance. I have not given up on 2d and afer working in the beta, I think 2d may actually be a better route to learn at the moment :)

Dan Pascal   (Dec 05, 2007 at 21:27 GMT)
Sounds exciting, if you can pull that off, it would be huge.
Tricky stuff this programming is ( yoda's voice)

You must be a member and be logged in to either append comments or rate this resource.