Game Development Community

A few specific questions

by Daniel Balmert · in Torque Game Builder · 04/30/2007 (10:52 am) · 3 replies

1:: When I mount the camera to my player, I cannot do any camera moves. The script tells me that I cannot make camera moves when the camera is mounted. What's the easiest way to get the camera to follow the player yet still be able to do camera effects when I need to? Is there anything I should be worried about if I decide to dismount camera -> make a camera move -> remount camera? All I really want to do is be able to zoom the camera on a button press. I'd like the zoom to be smooth so I don't want to do a quick "setzoom, makecameramove(0)".

2:: What's the difference between a scenegraph and t2dsceneWindow? Where do I name the scene window ( I can name the scene graph)? It was my understanding that the scene window was basically the camera.

3:: If I have a character swing a weapon, how would I animate the hit box? I heard you could not do a per frame collision poly change. Should I just make it a separate object and rotate it? Think fighter game here - I need pretty specific hitboxes and timing on these attacks. What would be the best way to go about this? Should I invest some time looking into the onFrameChange callback.

4:: As an addendum to 3, I need a way to manage my frames per second very strictly. Is there a way to make it so that the onSceneUpdate callback only executes 60 times a second? Something like whenever the gameclock % (modulus) 17 or so = 0 it would execute. I tried setting the physics fps limit, but it ended up making really jittery and glitchy movement. The scene was still updating at 200+fps but the physics was calculating slower so the player bounced around a lot.


Any and all info on these would be awesome!

#1
04/30/2007 (1:20 pm)
1: Sorry, can't help you there.

2: I'll explain the way it was explained me. I found it the perfect, most easy explanation. The scenegraph is where the objects are. Imagine a view to a landscape. The view is where the landscape is. Now imagine you see it through a window. That would be the scenewindow. Regarding the naming, you can change the scenewindow name in the gui file that loads it, usually mainScreen.gui in the gui folder. The scenegraph can be named in the edit options of the level editor. Click somewhere that does not have an object so that nothing is selected, click Edit button on the right toolbar, then scripting, you'll have a name, class and superclass there, just like any object.

3: I think you can do this in several ways. You can create scene objects with no sprite and then mont it on your object, using the sceneobjects size and collision methods and callbacks. The movement is the tricky part in my opinion. Another way is to have a separate object. There's a thread about a fighting game idea in the forums that discusses this.

4: I honestly don't know, but I've solved clocking problems with schedules and state engines. Can you elaborate? Maybe we can find a solution. :)

Hope this helps.
#2
05/01/2007 (11:10 am)
I plan on having a character move around and kill things (sounds basic). I want him to be able to perform different attacks that have varying animation lengths and downtimes etc.

What I'm not sure about is how scheduling works. If I schedule my character to enter the state of "swinging_weapon" and schedule him to come out of it (neutral state) in exactly 2 seconds, what happens if he gets hit or something else changes his state? Can you cancel a schedule? If not, he may interrupt his "getting_hit" state and revert to "neutral" when the first schedule finishes.

Really I guess I just want a better explanation of scheduling.
#3
05/02/2007 (4:28 pm)
You can cancel a schedule or use a collision callback or even a animation callback.

When you schedule, you are creating an event that will call a function of a specific object. For instance:

%object.eventID = %object.schedule ( %time, %function )

You can cancel it:

cancel ( %object.eventID )

If you want something to happen that cancels it, be it collision, or frame change or even some check on a frame change use the appropriate callback.

Hope this helps.