Game Development Community

Terrain Questions

by Michael Dimitrievski · in Torque Game Engine · 07/16/2008 (1:13 pm) · 5 replies

First off I would like to apologize for this post probably being posted all over. I've looked but havent found a good answer to my questions (which i probably just read the wrong posts). I'm new to actually making games in general and starting with torque. I bought it, looked it over, and havent done anything with it yet.

1 - How large are the maps exactly? I saw something about repeating tiles and felt like i started reading jibberish (after 4 hours of being on the computer). Can someone tell me how that works and how to stop that if so?

2 - Upon reaching the end of the map, if possible, how can I have it load the next map in my world to make a "continuous" map?

3 - If i want a player to stay in a certain area of my map, can i set a boundary box instead of just making mountains to physically stop him? For example, I'm not going to have swimming in my first games. I don't want a player to be able to go into the water (first map will probably be an island).

4 - When the player drops from a large height, can i turn off that annoying shake that the camera does and if so how? (Not a terrain issue but didnt want multiple posts)

I know these questions are above my "newb" level but i'll be on deployment soon and want to have the answers when i'm ready to work on those.

#1
07/16/2008 (2:02 pm)
1: The terrain tile is a 2kmx2km square, and the engine by default repeats it in every direction infinitely, though after a certain point floating point errors crop up.
There is an option you can change to turn off the repetition, but it's better to keep it on. Adjusting scales and movement rates can make the terrain tile effectively bigger.

2: Mission areas are your friend, it's a box you setup that has a callback when a player leaves it's boundaries. You can put the mission change code in there.
Or you could setup long trigger boxes at the edges if you need different mission for different exit areas.

3: Mission area again, there's a couple resources out there to solidify the mission bounds, either as just a wall or as a rebounder.

4: Yes, but I don't know where, I'm assuming it's in the player datablock. Check in the player.cs server script file.
#2
07/16/2008 (7:23 pm)
Ty so much.... it makes sense to me even though i havent gone into the files to look for the code. I'll definately have to keep this in mind when im getting sea sick trying to program! lol
#3
07/17/2008 (2:43 pm)
Hey Mike! Great questions!

I have an island I'm using but I don't know how to use a CVS to get us to the same stage.

E-mail me if you still want to work together.

Tony
#4
07/17/2008 (5:52 pm)
I think i found the source for the screen shaking when you hit the ground. I am working on it now in the starter.fps>server>scripts>player.cs file. Just finished compiling after changing the scripts it removed the shake. Not sure which one because they didnt work individually for some reason but follow the below changes and it gets rid of it YAY!!!! Hopefully it helps those of you with the same issue =)


groundImpactMinSpeed = 10.0;
groundImpactShakeFreq = "4.0 4.0 4.0";
groundImpactShakeAmp = "1.0 1.0 1.0";
groundImpactShakeDuration = 0.8;
groundImpactShakeFalloff = 10.0;


change to this :

groundImpactMinSpeed = 10.0;
groundImpactShakeFreq = "0.0 0.0 0.0";
groundImpactShakeAmp = "0.0 0.0 0.0";
groundImpactShakeDuration = 0.0;
groundImpactShakeFalloff = 10.0;
#5
07/18/2008 (6:45 am)
For preventing someone from leaving the mission area... i found this code snippet on the forums (.... add to your player.cs file in the function Armor::onLeaveMissionArea(%this, %obj) section..... it prevents them from going outside it and bounces them back slightly like they ran into a wall! kinda neat.. not exactly what i was looking for but works nonetheless!! TY goes out to "HUGO DE LA VEGA"

%force = 10;
%min_x = getWord(MissionArea.area, 0);
%min_y = getWord(MissionArea.area, 1);
%max_x = %min_x + getWord(MissionArea.area, 2);
%max_y = %min_y + getWord(MissionArea.area, 3);
%x = getWord(%obj.getPosition(), 0);
%y = getWord(%obj.getPosition(), 1);
%vx = 0;%vy = 0;%vz = 0;
if (%x<(%min_x+10)) %vx = %force;
if (%y<(%min_y+10)) %vy = %force;
if (%x>(%max_x-10)) %vx = -%force;
if (%y>(%max_y-10)) %vy = -%force;
%vec = %vx @ " " @ %vy @ " " @ %vz;
%obj.setVelocity(%vec);


Also... if you want to turn off the repeating terrain..... in world inspector, click on the terrain block then scroll to bottom of the list and uncheck "tile". be aware that if you do and your player manages to get outside your terrain... it's a nice fall!!!! haha