Game Development Community

Level Bounds?

by Scottie Sirius · in Torque 3D Professional · 03/19/2010 (3:17 pm) · 16 replies

What is that?
I would like to stop players from going past my mountain range with an invisible wall of some type. What's the best solution? And don't say an invisible wall! Well, maybe that's it...any other ideas?

#1
03/19/2010 (3:30 pm)
Dense forest, a rock formation, a river, minefield ;-). Depends a bit on the limitations of your player and your genre.
#2
03/19/2010 (3:38 pm)
A "soft" version of invisible walls is to steer the player back into the playing field, i.e. the more he/she moves out of it, the stronger the game will reorient the player.

//BTW, the solution employed by the original Tribes is also a good option in some cases. They infinitely wrapped the terrain around so the player could just walk on and on and on. There was just simply nothing there anymore (plus the terrain had these telltale marks of the lightmap being repeated by having object shadows show up where there were no objects anymore).
#3
03/19/2010 (3:51 pm)
I'm a fan of minefields or laser-grid deaths -- with no extra geometry they're the cheap and lazy way to block players! Also drops/cliffs of doom, with an extra kill trigger or minefild at the bottom to make sure you get 'em!

HL2 just used a forcefield to block the player ... now that's lazy.

How about for a fantasy setting where a monster/dragon swoops out of the sky and eats the player if they stray past a big sign saying "No entry: Dragon Country!"
#4
03/20/2010 (11:17 am)
So, the Level Bounds doesn't do what I'm looking for? What does it do exactly?
#5
03/20/2010 (1:22 pm)
It defines a box volume in the level that if left by the player, will trigger a "onLeaveMissionArea" callback on the player datablock (and an "onEnterMissionArea" callback when re-entering the area).
#6
03/20/2010 (3:42 pm)
What does that mean exactly? How would I use it?
#7
03/20/2010 (5:58 pm)
You could make it display a message when teh player leaves the area ... but I "think" there is a resource (might be TGEA but I believe it converts) which turns the mission bounds into a collideable object which stops players. Do a search through resources
#8
03/22/2010 (2:59 am)

@Scot
You place a MissionArea object in the game (called "Level Bounds" in the creator tabs) and then set its "area" property to define the region in your level (in 2D) that represents its bounds. There was/is as an extra editor for doing this but I'm not exactly sure about its current status. Will probably work.

Otherwise you can just edit the "area" property directly.

As soon as you have a "GlobalMissionArea" MissionArea object in your game, Player will continuously check on moves whether it is still in the area. If it crosses outside of the 2D region, it will trigger an "onLeaveMissionArea" callback on the datablock associated with the player. If crossing back inside the 2D region, it will trigger an "onEnterMissionArea" callback on that datablock.
#9
03/22/2010 (9:50 am)
you could do a lot with the onLeaveMissionArea such as send a message to the player that they have Left the area, and 2 you can check hook in time out of the mission area, and you can call a kill function on the player if they are out of the area for a set amount of time, it takes a bit of scripting but the onLeaveMissionArea callback is quite useful for controlling your player. For example Ive seen it used in situations were the player tries to swim out of the mission zone you could then hook into the call back, and print a message to the hud warning him to turn back with a countdown. then another function that when the countdown hits zero you kill the player, or you could just start applying damage to the player as the counter counts down for example, its not as much fun as say a mine field or a giant shark leaping out of the water to swallow the player whole but entirely possible to use the call back for a variety of different activities.
#10
03/22/2010 (10:39 am)
Konrad is turning into an all in T3D hero for me these days, some perfect;y timed resources and products :)

anyway this resource (http://www.torquepowered.com/community/resources/view/17423), is one ive used, if you combine this with a treeline or road or my personal fave... and uncrossable stream then you have all the makings of creating level constraints without adding 'invisible' walls which tend to be big and straight and awkward to add to irregular boundries
#11
03/23/2010 (12:59 am)
I have added the missionarea to my level, but the onLeaveMissionArea and / or the onEnterMissionArea are not triggered when the player leaves or enters the specified area. Is there a script file associated with the Level Bounds? I browsed the scripts but I did not find anything. I like to see it work, but for now I have setup a trigger on the 4 sides of my terrain, which displays a message on entering the trigger to the player, telling him that he is trying to leave the area, and then turn him around atomatically. As said, it works, but the MissionArea might be a better solution.

@Rene:
The editor is commented out. I had it back in, but when I select it then from the menu, the engine crashes. It is not a big deal and not a real need, but it might be nice to have the option to render it, so you can see what part of the terrain will be the missionarea (just a visible check).

Edit: Forgot to mention, I am using T3D 1.1 Beta, and the problem occured with the full template.
#12
03/26/2010 (1:34 am)
Just debugging the source. In the player.cpp there is function called checkMissionArea. Put in some breakpoints and I noticed that the code for checking the bounds is never executed. The strange thing I see is that there is a search for a GlobalMissionArea at the start of this function with

Sim::findObject("GlobalMissionArea").

After 45 minutes of stepping through this code, I do not have the idea that this was found. So I changed GlobalMissionArea to MissionArea but still no success.

Someone have any ideas?

Thanks
#13
03/26/2010 (7:00 am)
Try naming the mission area "GlobalMissionArea" in the mission file.
#14
03/26/2010 (8:06 am)
Doh, just read your whole post. Really need to stop looking here before coffee.
#15
03/26/2010 (11:22 am)

@Richard
Hmm, not sure what the problem there would be. Checked it here and it's all working as it should.

What's your control object? It *is* a Player, right? (Sorry, dumb question)

And the MissionArea object has the name "GlobalMissionArea"?
#16
03/26/2010 (1:01 pm)
@Ryan, Rene:

Thanks. I had named it Level Bounds. After renaming it to GlobalMissionArea the problem was solved.