Game Development Community

Mission/Terrain Wrapping

by Jason "fireVein" Culwell · in Torque Game Engine Advanced · 02/03/2009 (11:32 pm) · 19 replies

Okay, if I recall correctly, back in the earlier days of Torque(pre-TSE) the engine would create a 3x3 area of the base terrain block with the base terrain block being in the very center. If a player traveled far enough the mission would eventually wrap around and the player could end up back at the base terrain.

What I am looking to do is restore this functionality, or even better make the mission wrap around either at a set size or with a single terrain block only.

I've browsed through some of the source files but being that I've never tinkered with any of the mission or terrain source files I am somewhat at a loss of how to do this, or where to start, or even if it is within my capabilities to accomplish. Searching yielded nothing of usefulness.

Anyone have any suggestions? Or a copy of Torque 1.2/1.3 laying around somewhere? A good push in the right direction would help a lot and I am willing to share with the community.

Thanks!

About the author

http://www.microdotproductions.com - I am a self taught programmer that has been hacking away at code for a little over 10 years now. I am a very passionate and persistent programmer, and gamer. I love challenges and problem solving.


#1
02/04/2009 (6:55 am)
This feature was never removed and still exists in both TGE and TGEA. I think it only works for Legacy terrain however, and not Atlas or Mega Terrain.
#2
02/04/2009 (7:07 am)
I see. I will have to do some digging around in the source. I am fine with Legacy terrain, it suits my needs just fine. The reason why I couldn't get back to the base terrain no matter how far I went was probably do to the fact that I was testing on Mega Terrain with tile enabled. Didn't expect it to work with Atlas, though.

Legacy terrain is still in 1.8, right?
#3
02/04/2009 (7:13 am)
Yeah, Legacy is still in 1.8. The easiest way to see it is to add some static shapes or interiors to the mission area, relight, disconnect the camera from the player with F8, bump up the camera speed in the editor and then just move in one direction high above the terrain. Eventually you should see the shadows from those objects on the terrain again.
#4
02/04/2009 (7:33 am)
You misunderstood what my intentions are(or I misconveyed :P). I understand what you mean, and I am aware of it, but what I am trying to do is get back to the base terrain(with all the difs, dts, ect..) by going in one direction - not a tile of the base terrain. I believe this was possible in earlier versions of Torque, but I could be wrong.
#5
02/04/2009 (7:38 am)
Actually, and ultimately, I want a single terrain block that wraps around. I.e. you reach the edge of the terrain block and you can see the opposite side of the same terrain block - difs, dtses, and all.
#6
02/04/2009 (7:40 am)
It's actually more than a 3x3 area since it repeats infinitely in all planar directions. But if you get far enough out you'll start seeing precision errors and camera jitter.
#7
02/04/2009 (7:45 am)
Quote:Actually, and ultimately, I want a single terrain block that wraps around. I.e. you reach the edge of the terrain block and you can see the opposite side of the same terrain block - difs, dtses, and all.
Quote:what I am trying to do is get back to the base terrain(with all the difs, dts, ect..) by going in one direction - not a tile of the base terrain.
Hmm... that will be tricky actually. The simple(st) solution would be to teleport the player to the "beginning" of the map edge once the "end" is reached, just make of use of the tiling feature to show the landscape continuing into the distance.
#8
02/04/2009 (7:57 am)
Ah, I see what you meant now. I can't remember if that feature existed or not back then. I seem vaguely remember something about repeating Mission Area, but its been so long since I worked with that codebase.
#9
02/04/2009 (8:02 am)
Quote:It's actually more than a 3x3 area since it repeats infinitely in all planar directions. But if you get far enough out you'll start seeing precision errors and camera jitter.

Thats why I want to try to revert back to pre-TGE1.4 terrain when it was a 3x3 area. At least I believe it was, but don't remember exactly. I remember doing a test and coming to this conclusion.

I was pondering a custom solution using teleporting, the mission area, and render to texture. I think it just might work. But I need to get my hands on at most an old school TGE 1.3 to see what I can do with it, first.
#10
02/04/2009 (8:02 am)
No, there has never been a setup where the player will wrap around. The terrain (terrain only) will endlessly wrap until like Michael said you get precision errors and camera jitter after reaching a very large distance out.

But TGE and TGEA have never had mission wrapping in the sense that you can wrap around a mission from one side back to the other.

Best bet would be to use a trigger / teleport when the player hits the edge of the map to teleport them back to the other side.
#11
02/04/2009 (8:04 am)
Quote:I seem vaguely remember something about repeating Mission Area

Thats pretty much what I need, a seamless wrapping mission.

You got a version of TGE 1.3/1.2 laying around anywhere? Anyone?
#12
02/04/2009 (8:06 am)
I have copies all the way back to TGE 1.0 and it doesn't have what you are asking. Like I said a bove the engine just does not do it. This is why there is a mission bounds box in the engine. Like Tribes 2 when you got outside the box if you did not reenter after a certain time you would die. This is because the engine did not wrap the items within the level around like it does the terrain. (Its there for looks only)
#13
02/04/2009 (8:12 am)
Thanks, Thomas, for the clarification. Not really sure what I was thinking back then. I must have been high.

Well, time to roll a custom solution. Thanks for the help, guys.
#14
02/04/2009 (8:12 am)
I might have a copy of it somewhere, but I'm not certain. I'll see what I can dig up.
#15
02/04/2009 (4:13 pm)
I've always wanted this feature too. I wonder if you could do it with giant portals or something... o_O

If you find anything out, let us know :-p
#16
02/05/2009 (8:05 am)
I would suggest using triggers and teleporting. Since there is no size limit on triggers. You can extend a trigger along each edge of the terrain.

All you need to do then is when a player enters the trigger teleport them to the other side of the map. Since you can get the location on the player once he enter the trigger. Just take this information and keeping the same horizontal and/or vertical position (based upon what way the player is moving). And teleport them alot that same horizontal and/or vertical coord to the other side of the map.

There's other more complicated ways of doing it. If your missions are large enough you could create a complete sphere with mega terrains or atlas and then using the resource http://www.garagegames.com/community/blogs/view/16149
(Free-rotating Player with quaternions) and apply the resource in such away that you could create gravity so that the player is always being pulled into the center of the sphere. This way the player is always on the ground no matter where he stands on the sphere map.

I mention if your mission is large enough try the above. Because if its just a small mission then it will be easy to tell the map is a sphere. If its large enough then the sphere effect is less noticable and it just seems like a wrapping mission. There was a great space video afew years back where atlas was used to create the planets and you could fly from outerspace to the planets surface and land. Move about on foot and/or in a vehicle and it was just as if it was a mission all of its own. Except with several different planets you could visit all in realtime. (Wish I could remember the name of the blogs that had it shown)
#17
02/05/2009 (10:34 am)
The only problem with that solution would be the visuals...

For instance, a player walks to the edge and another player is on the other side. The players wouldn't see eachother until immediately after the teleportation. A more obvious thing would be if you were chasing someone down, they could randomly disappear by passing over the edge. That'd damage the suspension of disbelief.

Really, you need some way to universally "image" everything over all of the seems in the terrain (as well as image collisions, etc). I'm sure there's a way to do this if you were motivated enough (e.g. it's the main feature of your game, or your game almost definitely requires it). Awhile ago I thought about implementing this, but when I was thinking about it, I wasn't nearly as good at C++ as I am now (this would have to be done in C++ in order for it to be great). After I get done with my current project, I might look into implementing something like this in either TGEA or T3D, if no one has done it at that point. Don't expect that for a while, though, because it may take some time for me to finish this game up and get it selling.
#18
02/05/2009 (10:40 am)
Triggers are definitely the easiest to use to set up teleporting boundary edges. I had actually been doing something similar by using the Mission Area boundary since it already has a script callback -- too lazy to place triggers ;)

@Thomas: do you mean Bill Vee's Blogs?
#19
02/05/2009 (11:32 am)
Yes, Bill Vee's Blogs show the sphere terrain. :) Thanks Michael.