Game Development Community

Terrain Changes in Multiplayer

by Jules · in Torque 3D Professional · 05/13/2011 (9:47 am) · 3 replies

If I make changes to the terrain in multiplayer (live) would all clients see this change? If so, whats the best way to expose some of the terrain tool functions to script, so if I wanted to make a big hole in the terrain from an explosion using a projectile and applying co-ordinates, plus scale and pressure atrributes could this be done easily and be seen on all clients?

Anyone seen any references to tools and exposing them to script in the documentation?

#1
05/13/2011 (10:42 am)
Quote:If I make changes to the terrain in multiplayer (live) would all clients see this change?

Nope. Terrain data is loaded from a local file and terrain editing isn't networked.

Quote:If so, whats the best way to expose some of the terrain tool functions to script, so if I wanted to make a big hole in the terrain from an explosion using a projectile and applying co-ordinates, plus scale and pressure atrributes could this be done easily and be seen on all clients?

The most efficient way probably would be to send the edits as networked events to the clients and then run them locally.

In T3D, all terrain modification happens within the editor code (terrainEditor.h/cpp and terrainActions.h/cpp) and isn't readily available outside of it. However, nothing prevents you from either adapting those routines or writing your own against the raw modification methods exposed by TerrainBlock.
#2
05/13/2011 (11:26 am)
Thanks Rene, saved me a bit of testing time there :) I couldn't remember if you could change the terrain on the fly. But what you have said with regard to making the change client side makes perfect sense. I have done something like that for objects so it will be easily adaptable for terrain. I'll probably have a master account that can make terrain changes which then replicates down to clients on loading the game up as an update before the mission loads.
#3
05/13/2011 (11:29 am)
Don't suppose you'd know if there would be a problem if I downloaded new terrain files on the fly every few minutes to update what the player is seing on a scheduled event? Would they refresh or would it just crash?

edit: actually I have probably answered this myself, thinking about it... If the master copy had an updated terrain and the other clients didn't then it would probably cause a CRC type error?