Game Development Community

Dynamic Cloud Coverage

by Andrew Edmonds · in Torque 3D Professional · 09/14/2010 (11:58 am) · 2 replies

Hi - I'm working on a basic dynamic weather system for our game. I've created a function to add a precipitation object and start raining over a specified time period. However, before it starts to rain I want to increase the cloud cover.

I've added two new consolemethods to the CloudLayer object called getCoverage() and setCoverage (F32 c) which get and set the mCoverage value. In the console, this works:

echo(DynamicClouds.getCoverage());
0.2
DynamicClouds.setCoverage(0.8);
echo(DynamicClouds.getCoverage());
0.8

However, the clouds themselves do not update. It looks like CloudLayer::PackUpdate and ::UnpackUpdate are only called once - when the object is created (which may be part of the problem).

Has anyone already done this? Any ideas?

Andy

About the author

Formed in 2005, EiKON Games is an indie games development project based in the UK working on the tactical first person shooter "Epoch: Incursion". See the Join Us or Contact Us pages at http://www.eikon-games.com/


#1
09/14/2010 (1:15 pm)
You're right, your change isn't being sent across to the client. So you'll want to make sure to call your setCoverage on the server object, then call setMaskBits( CloudLayerMask ) in setCoverage to have it do the pack/unpack, which will get the values to the client. That should do the trick (I haven't tested it or anything, but that sounds like the issue). If you are concerned about bandwidth, you might make some sort of secondary mask for the CloudLayer that you can check in pack/unpack to only send the values you care about.
#2
09/14/2010 (2:16 pm)
Perfect! Works a treat - thanks Ross!

Andy