Game Development Community

Programmatic Terraforming?

by Eyesgood · in Torque 3D Professional · 12/23/2009 (7:30 pm) · 10 replies

This is my first post, having just recently bought Torque to prototype my game idea. I have two related questions. Any help would be greatly appreciated.

1. Can terrain height and angle be manipulated with Torque programmatically? I mean, could scripting allow the player to, say, right click on a coord of the terrain and "dig", with real-time raising/lowering of portions of the terrain?

2. If digging is possible, what about opening a cave and tunneling in rock by "mining"? Are these concepts possible with Torque 3D's game engine?

Thanks,
Eyesgood
a new Torque owner

About the author

Recent Threads


#1
12/23/2009 (11:48 pm)
Well...terraforming can be done in real time using the terrain editor. You could probably come up with similar processes for your game. However, I'm not sure how that would work out in a multiplayer game, i.e. how the terrain changes would be presented to all clients. Someone smarter than me will have to chime in. :)
#2
12/28/2009 (1:17 pm)
Joe is correct.

The terrain editor already does these things, so you just need to cut and paste some code to get the effects you need.

For multiplayer you would have to send NetEvents with the nessasary commands to replicate the changes on the server to all clients.

This should all be fairly easy to do if you have some moderate C++ and Torque experience.
#3
12/28/2009 (3:18 pm)
Thanks Joe and Tom. I envisioned writing TorqueScript funtions triggered by the user to change the angles of the terrain based on where they click on their screen. You mentioned C++. Are you implying that such functions cannot be done in TorqueScript?
#4
12/28/2009 (5:44 pm)
It may be possible.

How it works currently the TerrainEditor is what changes the terrain based on mouse inputs and brush modes. You could manipulate the terrain editor from script to get the results you want and use a commandToClient() to get the client to do the same. It would build up undo events and stuff... but it would work.

A simpler and more efficient way would be to add new C++ NetEvents which do exactly the maipulations you need without any undo data or unnessasary editor bookeeping. You then fire those off from script to get the changes you want.

I guess it all depends on your needs. If you want a terrain editor... just use the terrain editor and hack it to only expose the features you need. If you want to blow craters into the ground on exposions then NetEvents would be better.
#5
12/30/2009 (7:44 pm)
Quote:I guess it all depends on your needs. If you want a terrain editor... just use the terrain editor and hack it to only expose the features you need.

Doesn't this run into issues with the license? Or are there specific exceptions and conditions of what can and cannot be used and how it's used, in a shipped game? I was under the impression that if I wanted any functionality that the editors gave, I'd have to write my own.
#6
12/30/2009 (8:40 pm)
Jason,

I plan to write my own code. The terrain editor is part of the Torque IDE and I don't plan to reverse engineer anything with that. What I do need is a way for a player to be able (in the game) to manipulate the terrain to simulate terraforming in an MMORPG. That's my goal.
#7
12/30/2009 (10:37 pm)
I wasn't trying to comment on your plans, Eyesgood. My apologies if it seemed that way. I was merely asking the question based on what Tom had said.
#8
12/31/2009 (12:20 am)
Sure, Jason. I am curious as well to know why using the terrain editor would even be a viable solution... In the end, I need code to do in the game what the editor does during design. Thanks for your interest. No offense taken at all.

#9
12/31/2009 (1:04 am)
Nobody is saying to use the terrain editor itself. What we're saying is to use the terrain editor as an example of how to do real-time terrain deformation. However, since you have licensed only the binary, that would probably be difficult for you to determine.

Quote:
I need code to do in the game what the editor does during design

Note that you are already running "the game" while designing with the editor. Sure you don't have any real game logic or anything going on when you begin with the examples that come with T3D, but even if you had a full-fledged MMO running you'd still be able to use the terrain editor functionality if you didn't remove it. You would be using it in real-time, with your game running. That is why I say use the terrain editor as an example of how to do the real-time deformation.
#10
12/31/2009 (7:40 am)
Thanks Joe. I am sure it will become more clear to me as I dig deeper into the game development cycle with Torque. Your help is much appreciated.