Player affects
by John Coyne · in Torque Game Engine · 08/14/2005 (3:57 pm) · 5 replies
Hi
I have the radar resource up and running and am trying to build an EMP item which will shut down all the radars for a length of time.
I'm thinking of having a variable someplace on the server side, lets say "empTimeRemaining" which will be reduced every second or so, then having the clients check the value of that variable every tick. If the variable not equal to 0, dont let them display there radars, otherwise, let them do whatever they like.
I'm wondering if this is a good way of doing things, and where to store the empTimeRemaining variable.
I have the radar resource up and running and am trying to build an EMP item which will shut down all the radars for a length of time.
I'm thinking of having a variable someplace on the server side, lets say "empTimeRemaining" which will be reduced every second or so, then having the clients check the value of that variable every tick. If the variable not equal to 0, dont let them display there radars, otherwise, let them do whatever they like.
I'm wondering if this is a good way of doing things, and where to store the empTimeRemaining variable.
About the author
#2
Other than that, does anyone think I am way off the mark design wise?
08/16/2005 (4:30 am)
I was hoping to use scripts but resigned myself to having to use C++ fairly quickly :SOther than that, does anyone think I am way off the mark design wise?
#3
08/16/2005 (7:03 am)
Is you're not conrcerned about blatant hacking... write a clientCmd to toggle the radar on/off, and have the server call that on all clients. In a real-world scenario, you'd need to have the server feed the clients the radar data, and stop sending that data when the radar is disabled. No amoount of client hacking can make them view things that are not being sent by the server.
#4
Well they could hack the radar so it displays the scope of the client. That's been done before (Anarchy Online, for instance).
That's about the same thing as a server-fed radar in functionallity, and you can't really kill the scoping :)
08/16/2005 (7:42 am)
Manoel,Well they could hack the radar so it displays the scope of the client. That's been done before (Anarchy Online, for instance).
That's about the same thing as a server-fed radar in functionallity, and you can't really kill the scoping :)
#5
I've spend most of the day so far checking out the source code for ideas on what to do.
The best i've come up with so far is a "WorldAffect" class which will extend the gamebase object (and could maybe also be used for other affects, such as to scoring, player speed).
I'm guessing it would go something like this:
class WorldAffect : public GameBaseData {
private:
timeRemaining
updateTime
maxtime
public:
affectOn() //set timeRemaining to maxTime
updateTime() //called each tick? / reduces timeRemaining
bool returnTime() //for when we have to check if the affect is active or not
}
I had though of then putting a line in GuiRadarCtrl.cc just before the radar gets rendered:
if (!EMPaffect.returnTime) (EMPaffect being a wolrdAffect obj on the server, not sure yet how to get to this method yet though)
{
render the radar
}
After reading todays posts i'm thinking maybe i'll have to code in a server side radar as well. This isnt as complete a post as i'd like but i need to get ready for work pretty soon :(
08/16/2005 (8:14 am)
Thanks for the responses.I've spend most of the day so far checking out the source code for ideas on what to do.
The best i've come up with so far is a "WorldAffect" class which will extend the gamebase object (and could maybe also be used for other affects, such as to scoring, player speed).
I'm guessing it would go something like this:
class WorldAffect : public GameBaseData {
private:
timeRemaining
updateTime
maxtime
public:
affectOn() //set timeRemaining to maxTime
updateTime() //called each tick? / reduces timeRemaining
bool returnTime() //for when we have to check if the affect is active or not
}
I had though of then putting a line in GuiRadarCtrl.cc just before the radar gets rendered:
if (!EMPaffect.returnTime) (EMPaffect being a wolrdAffect obj on the server, not sure yet how to get to this method yet though)
{
render the radar
}
After reading todays posts i'm thinking maybe i'll have to code in a server side radar as well. This isnt as complete a post as i'd like but i need to get ready for work pretty soon :(
Torque Owner Stefan Lundmark
Unfortunatly, it's not feasible for a multiplayer game (IMO) when people can hack it so easily.