Little Weather Challenge
by Robert Fritzen · in Torque 3D Professional · 02/20/2012 (12:10 pm) · 12 replies
Hiya folks, first of all I'm back (for a bit), and I'm still kicking down hard on the port to T3D 1.2. I wasn't expecting the transfer of my authentication system out of TGEA to T3D to be this.... "Interesting"... but non-the-less this is not why I'm here.
I have a little fun task at hand, and I'm not quite sure how to go about this as it involves some trickery I have not heard of being done in Torque before.
So, I'm working on a little RPG side project for fun, and it involves servers hosted by players with favorable count sizes of maybe 10 - 20 players. I want to have different areas of my large-ish world map to have different skies. So for example, someone in the fire area would be affected properly, while someone in the further northern side of the map could be affected by a blizzard.
My first thought is to transmit the sky to be handled by the clients directly, but I'm not entirely sure how to proceed. Any advice?
I have a little fun task at hand, and I'm not quite sure how to go about this as it involves some trickery I have not heard of being done in Torque before.
So, I'm working on a little RPG side project for fun, and it involves servers hosted by players with favorable count sizes of maybe 10 - 20 players. I want to have different areas of my large-ish world map to have different skies. So for example, someone in the fire area would be affected properly, while someone in the further northern side of the map could be affected by a blizzard.
My first thought is to transmit the sky to be handled by the clients directly, but I'm not entirely sure how to proceed. Any advice?
About the author
Illinois Grad. Retired T3D Developer / Pack Dev.
#2
I understand what you are trying to accomplish but myself being an artist, I wouldnt even begin knowing how to script that.
I would love to know the answer to this as well, because my map is large.
Another thing i would suggest is to model each area accordingly. The winter parts looking snowy, etc... Then use particle emmitters for the weather in each area.
Im still in the prototyping stages of my game. so im not sure of the lag that the particle emmiters will cause, but that seems like a very easy way to control area weather instead of rewriting the whole source code.
@Paul :Maybe generating client weather according to players position? So there isnt really a "server" weather. Just each client will generate weather depending on global pos?
So each individual player wouldnt be counting on the server to generate weather, but instead the client would just grab the players current location and generate weather accordingly? Is that possible?
02/21/2012 (3:51 am)
I think the easiest route would be to have seperate maps/levels for each zone. I understand what you are trying to accomplish but myself being an artist, I wouldnt even begin knowing how to script that.
I would love to know the answer to this as well, because my map is large.
Another thing i would suggest is to model each area accordingly. The winter parts looking snowy, etc... Then use particle emmitters for the weather in each area.
Im still in the prototyping stages of my game. so im not sure of the lag that the particle emmiters will cause, but that seems like a very easy way to control area weather instead of rewriting the whole source code.
@Paul :Maybe generating client weather according to players position? So there isnt really a "server" weather. Just each client will generate weather depending on global pos?
So each individual player wouldnt be counting on the server to generate weather, but instead the client would just grab the players current location and generate weather accordingly? Is that possible?
#3
02/21/2012 (5:04 am)
yes, but i was running across issues with establishing weather patterns and then i got pulled off to a more important project. A weather server is on my "to do" list though!
#4
The sky is already rendered on the client side, so why not make the sky Object controlled by the client? That's what I'm trying to accomplish.
02/21/2012 (9:24 am)
@Jordan: The client weather according to position is what I was getting at in my initial post. That's what I was trying to get at. Since there are client-side objects, I was wondering if anyone had any suggestions as to how to get the weather type objects to be readily available to be committed as a client-side thing that the server could then just send down clientCmd's based on position (or a trigger object) to change it.The sky is already rendered on the client side, so why not make the sky Object controlled by the client? That's what I'm trying to accomplish.
#5
Do you think the particle emmitter idea would work though? I know its kind of a ghetto fix, but it should work fine
02/21/2012 (9:46 am)
@robert: yea thats what i figured. Im not raelly sure how you would code that though, you guys would know better than me. Do you think the particle emmitter idea would work though? I know its kind of a ghetto fix, but it should work fine
#6
02/24/2012 (7:48 am)
uh thinking outside the box a little... havent looked into it myself, but using the colour correction postFX surely theres a way to tie that to a trigger and script it to change when entering the areas that need a colouring change, although i think that may change the colour hue of everything while in that area, not just the skies. Might be an alternative...
#7
Here's a simple example that works for the Mars demo in 1.2:
To do things like add and remove precipitation might be a bit more of a challenge, as would changing skyboxes (nicely, that is - like, with a smooth fade between two images) - but the principle is there!
02/25/2012 (12:30 am)
Robert - I think the solution is conceptually simple, but the sky objects aren't set up to be modified client-side at the moment (nor during gameplay). When the player travels a significant distance (or enters a trigger, or however else you want to detect regions), send a commandToClient telling them about the local weather conditions. when the client receives that, they simply call console methods on their Sky object, which should change what they see.Here's a simple example that works for the Mars demo in 1.2:
function clientCmdChangeWeather(%weather)
{
AlienSky.skyBrightness = AlienSky.skyBrightness * 2;
}This code is specific to ScatterSkies named AlienSky, of course. In Armor::damage I added:...
if (%obj.getState() $= "Dead")
%client.onDeath(%sourceObject, %sourceClient, %damageType, %location);
// Change the weather?
commandToClient(%client, 'changeWeather', "");Then if you go jump off the towers or shoot grenades at yourself, you'll see the sky get brighter and brighter.To do things like add and remove precipitation might be a bit more of a challenge, as would changing skyboxes (nicely, that is - like, with a smooth fade between two images) - but the principle is there!
#8
02/25/2012 (7:01 pm)
.... really? that simple... wow.
#9
02/26/2012 (12:15 pm)
What about changing the fog? Would that be doable along these same lines?
#10
02/26/2012 (3:51 pm)
I haven't tried it, but I don't see why not. Also, if anyone remembers back to the days of TGE - the demo itself had real-time fog and precipitation modifications. Admittedly, it was a scripted sequence, but it aptly demonstrated that you could change the weather in realtime.
#11
Thanks again guys for those tidbits!
02/26/2012 (4:17 pm)
Paul Yoskowitz's scattersky fog and also Richard Marrevee's method to change fog in script would probably fit into this topic....Thanks again guys for those tidbits!
Torque 3D Owner Paul Yoskowitz
WinterLeaf Entertainment