minimap questions
by Kevin James · in Torque Game Builder · 07/29/2010 (2:47 pm) · 5 replies
I'm making a minimap in my next game. I made a new level called minimap.t2d and defined its window like this:
Next, I entered these lines in game.cs:
I edited the camera to equal the full size of the tilemap in the main level which is 750 x 500. This puts a small window in the upper left-hand corner of the main window, as expected. However, performance is dog slowwwww. The map being rendered is 2 tilemaps of 150x100 tiles. The first tilemap is the walls and the second one is the fog of war that gets peeled back as the player explores.
I tried to turn off layers 1-31 but that had no effect. In fact, I still see the player in the minimap which is on layer 1. For that reason, I don't understand the layer management functionality for the level.
Is there a more efficient way to make a minimap?
new t2dSceneWindow(mmWindow) {
canSaveDynamicFields = "0";
Profile = "NonModalContentProfile";
HorizSizing = "bottom";
VertSizing = "right";
Position = "600 0";
Extent = 200 SPC 150;
MinExtent = "8 8";
canSave = "1";
Visible = "1";
lockMouse = "0";
useWindowMouseEvents = "1";
useObjectMouseEvents = "1";
};Next, I entered these lines in game.cs:
mmWindow.setUseObjectMouseEvents( true );
mmWindow.loadLevel("game/data/levels/minimap.t2d");
sceneWindow2D.setUseObjectMouseEvents( true );
sceneWindow2D.loadLevel(%level);
mmWindow.setSceneGraph(SceneWindow2D.getSceneGraph());I edited the camera to equal the full size of the tilemap in the main level which is 750 x 500. This puts a small window in the upper left-hand corner of the main window, as expected. However, performance is dog slowwwww. The map being rendered is 2 tilemaps of 150x100 tiles. The first tilemap is the walls and the second one is the fog of war that gets peeled back as the player explores.
I tried to turn off layers 1-31 but that had no effect. In fact, I still see the player in the minimap which is on layer 1. For that reason, I don't understand the layer management functionality for the level.
Is there a more efficient way to make a minimap?
About the author
Computer security, digital forensics, and platform jumper enthusiast. shells.myw3b.net/~syreal/
#2
07/29/2010 (7:15 pm)
I see that you are doing something very similar, but you are loading a separate level for your Minimap. This is not necessary, and is probably what is causing such a slow down.
#3
Btw, how do you tell the scenewindow not to render a specific layer?
07/29/2010 (7:46 pm)
Setting the zoom rather than camera size; I'll give that a shot.Btw, how do you tell the scenewindow not to render a specific layer?
#4
You can tell a scenewindow not to render specific layers by using the
SceneWindow.setRenderLayers() method. It will only render the layers that you specify.
07/29/2010 (8:14 pm)
I think I use the setCurrentCamerArea() method, not the zoom method, to get the camera to display the area I want in the minimap.You can tell a scenewindow not to render specific layers by using the
SceneWindow.setRenderLayers() method. It will only render the layers that you specify.
#5
07/29/2010 (11:55 pm)
SceneWindow.setRenderLayers() works like a charm. Thanks Ken! I won't know until tomorrow if performance is improved.
Torque Owner Kenneth Rodgers
MiniMap.setSceneGraph(SceneWindow2D.getSceneGraph());
where "MiniMap" and "SceneWindow2D" are t2DSceneWindows.
You can then set the Minimap scenewindow to only render the layers that you want to see on the minimap.
For example on my minimap I allow the my terrain tiles to render, but I hide trees, buildings, and other structures. Also I don't render enemies on my minimap, but I instead render a large Square that is mounted to enemies.
On my main window(SceneWindow2D) the large squares mounted on my enemies are hidden and only the enemies show.
This technique has worked pretty well for me so far.