Game Development Community

Zoom Resource Issues

by Chris "C2" Byars · in Torque Game Engine · 11/05/2005 (8:28 am) · 3 replies

I'm having trouble with my zoom resource.

How it works: A client calls a server function that checks to see if the client has a scope-able weapon mounted, and if so, sends a client command which will zoom in the specified amount for that weapon and display the specified scope HUD for that weapon. (If you are not holding a scoping weapon, it will not zoom or do anything)

There was a little exploit I found in it, though. If you are holding the zoom button down and switch weapons, the zoom scope and the field of view would still be functioning as if you were zoomed in, as long as you held the button down. Basically I need a way to prevent the swapping of weapons while the client's zoom is on, or to turn the zoom off if they switch weapons.

Glancing through the resource will shed light on how it functions and what exactly I'm trying to prevent from happening, but I can't get it to do what I want it to do.

Situation:
Server player holds zoom button down. Client player switches weapons. Server player is forced to zoom out and the scope hud to disappear. (Bad)

It would seem that since the inventory.cs script is server side, and it is not the client that is calling the function when someone switches weapons, but the server, when a client switches weapons, it will call the commandToServer to zoom out, but it only affects the server player. Since the cycling of weapons is handled in the server side script "inventory.cs". :/

#1
11/05/2005 (4:34 pm)
It seems to me that you should be doing the zooming on the server and just send the client a FOV to change to. At least, that's how I do it.
#2
11/05/2005 (4:42 pm)
Not really. You version uses zooming capability for all weapons does it not? I am limiting the zoom function to only two weapons, and each weapon has an individual scope image overlay. Thus it must be set up this way. If the client wishes to zoom by pressing the zoom key, it sends the command to the server to check which weapon is mounted on that specific client, then the client gets that message and if it is the XM8 or Sniper Rifle, it zooms and overlays the correct scope for that weapon.

From Matt Sanders, Harold Brown, and my point of view, this is the best way to set up and limit scoping capability, and give each one a separate zoom FOV and image overlay. The only issue with the resource is that there needs to be a way to prevent weapon switching while image on/zoomed in, or to turn off the zoom/image when weapons are switched.
#3
11/05/2005 (5:25 pm)
I believe I may have solved it. By adding in script client side in with the binds which will turn off the zoom if the client switches weapons.

Will test out networked in a moment, but logic says it will work. :) I will update my resource if this is indeed successful.