Game Development Community

Load Order: Terrain & Ray Casting

by Steve Bilton · in Torque Game Engine · 01/14/2008 (12:11 pm) · 4 replies

Hey guys,

In init.cs on the server, I call a terrain file and mission file generator that produce a .ter and .mis respectively. The mission file relies on being able to do some ray casts to place objects on the ground.

The problem I am having is that I cannot find a location to place the .mis creation function. If I place it after the terrain generation at the end of initServer(), then I cannot ray cast; it does not find a collision between the spawn point and the terrain using $TypeMasks::TerrainObjectType.

If I place it later such as in game.cs, then the pathfinder that relies upon the mission file fails in initClient(). If I place the generator in initClient() it also fails. Thus, I need to know either:

- When I will be able to do a ray cast against the terrain using $TypeMasks::TerrainObjectType, so I can call my function after that point, or
- Where the InteriorInstances in the mission files are created, so I can do the ray cast at creation.

Hopefully I have explained that properly. Thanks in advance.

#1
01/14/2008 (8:02 pm)
As a simple workaround, you could do a 2 step creation:

1. Create your mission totally and store it.
2. Then load it and init the path finder.
#2
01/15/2008 (4:55 am)
The problem was that I couldn't totally store the mission without first being able to ray cast onto the underlying terrain. So I do not know at what stage I would be able to ray cast and what prerequisites are needed to be able to successfully do so, so I do not know at what stage to create and then load the mission.
#3
01/15/2008 (5:38 am)
You could totaly store the mission, and then place the objects and (assuming this is a mission creator/random level genorator, not just loading a level) save the mission again.
#4
01/15/2008 (9:18 am)
Where are the regular objects read from the mission file and placed? For what I need, I could probably do the bulk of what I need doing in there, but I can't find where the InteriorInstances are read from the mission file and then created. =(