Game Development Community

Making Projectile Render with RTSCamera

by Dumbledore · in RTS Starter Kit · 05/13/2008 (9:41 am) · 4 replies

I guess I don't need to comment about the disappointing documentation for the RTSSK.

My goal is to make the Projectile class (NOT RTSProjectile) visible with the RTSCamera. I need the actual projectile class for my project and I'm prepared to go to any lengths to make it work properly in the RTSStarter.

If someone knows what I need to do please tell me as I will be sure to document my work carefully and post it as a resource.

If someone knows what to do but is pressed for time, at least tell me in point form the things you can think of.

Thanks very much!

#1
05/13/2008 (10:10 am)
I think that the problem here is that the RTSCamera doesn't do everything that it's needed to do.

It looks like the overridden onCameraScopeQuery of the RTSCamera only deals with the scoping of RTSUnits to the clients and ignores anything else in the world.

To hack around this, you can force things to be always sent to clients by setting their netflags to ScopeAlways. This is not really a good solution, as it means that these objects will be unnecessarily using up bandwidth by being scoped to clients that do not need to see them.

So, in
Projectile::Projectile()
change the line that reads
mNetFlags.set(Ghostable);
to
mNetFlags.set(Ghostable | ScopeAlways);

and you should be able to use them

I think that this kind of hackery is also required if you want to use explosions, particleEmitterNodes, items, precipitation.........................................
#2
05/13/2008 (12:23 pm)
Thanks Guy Allard, I did not actually realize that simple fix. However eventually I will need a properly implemented RTSCamera, so if there are thoughts on what I must do to change the RTSCamera (and anything else related) please feel free to point out anything you can think of.

I have noticed that a lot of the torque classes are highly coupled (meaning they share each other's resources and functionality) and this makes life difficult as a change to one class can lead to many problems elsewhere in the code. Since I'm very new to Torque, I foresee many of such circumstances arising in my future.

At current, I feel like simply adding another non-rtsunit simset within RTSConnection and RTSCamera that will deal with the scoping of non-rtsunits. It's not elegant, but it shouldn't be too complicated. Thoughts?
#3
03/25/2010 (12:20 pm)
Projectiles are client side (only) ... the RTScamera seems to ignore them on the pack/unpack ... and making them scope always just causes a invalid packet and crash to desktop.

Any more ideas how to get the projectiles to show up ... or is this old rts kit a lost cause and I need to just wait couple years until the T3D version comes out ???
#4
11/17/2010 (2:12 pm)
Surprisingly I know the answer to this one off the top of my head. You can do it and it is acctually quite easy if you know where to look.

What you want to do is modify RTSCamera::onCameraScopeQuery

that function is what ultimately decides what the camera does and does not want to scope. If you add in

Parent::onCameraScopeQuery(cr, query);

at the top of the function this will pass the call to it's parent letting it scope all objects normally for the RTS camera. Of course if you wanted only specific ones to show up you should write your own modifcations in there on a type by type basis if you notice it has the code for making RtsUnits visible for instance.