Success! I have finally discovered how to use portals so that they don't cause problems in the map!
Took me 3 days of testing to figure this out:
- When you make an sbsp in 3ds Max, you must include portals in your design.
- Portals are planes which can have any number of certain uses, as applied in Sapien after building the sbsp tag with Tool.
- The basic workflow for making a level in 3ds Max includes:
1. Making a simple, small box and giving it the name
frame and placing it at the coordinate world center or some other unobtrusive location away from where your level will be located.
2. Importing an existing level using a separate application (bsp extractor from HaloMaps.org) which converts it to .obj format
or
2. Creating a new terrain using the sealed-world rules (basically, making an enclosed polygon)
3. Creating materials; each object in your level can have only materials from a single material group assigned to it (copy materials between material groups if you must).
4. Designing the level bsp as you so choose. You should start by inverting all the faces of the level so that the player can be "inside" the glorified box which is the environment. You can attach and detach objects from each other so you can manipulate them better according to the sealed-world rules. You typically end up welding vertices and doing some beveling and extruding along with scaling and moving vertices, edges and faces.
5. Applying material groups to objects, applying material IDs to the faces of one object at a time, applying a UVW Wrap modifier and setting the bitmap to tile as desired over the surfaces -- or using UVW Unwrap to more specifically skin an object -- and finally converting the UVW Wrapper back to editable mesh so the object keeps the proper UVW appearance.
5a. The material group you are using on your level's terrain should also include a separate material with the name
+sky which does not reference any bitmap file. Apply this material ID to the faces of your level that the player would not touch and where you want the sky to render. The +sky material cannot normally be made render-only (applying the "!" flag to that material name does not remove its collision) and the player cannot pass through it but projectiles that touch it will disappear.
6. Create some portal volumes. There are two portals:
+portal and
+exactportal. Both can be used in basically the same ways. +Portal volumes are used to generally parse the map into segments so that the game engine can handle it. They more dramatically affect rendering occlusion than +exactportal volumes. Generally, though, you can use both types of volumes to create environment areas that in Sapien can have unique Sound Environment (snde), Background Sound (lsnd) and Weather (wind and rain) tag references. Portal volume areas are created by making faces and planes whose face normals (frontside or backside of the faces of a mesh) face a certain direction, or whose polygons are parallel.
Creating +portal volumes
To start, zoom out so your entire level is visible. Now view the level directly from the left or right side, and make a perfectly vertical plane on the left side of the level, outside of the level. The plane can be very simple and have only four vertices. Delete any faces on the backside of the plane so that you are left with face normals facing in a single direction only and so you have a single, flat wall for a plane. Move the plane to the outside of the level and extend its edges so they pass beyond the size of the entire level. Now shift-move this plane to duplicate it, dragging the new plane to the opposite side of the level, again outside the level. Do the same process with two more planes exactly perpendicular on the front and back sides of your level. You should now have what is effectively four separate walls around the outside of your level, encasing it like a box without a top or bottom. Adjust these portal planes so their corners slightly intersect each other but do
not weld their vertices into actual corners; you just want the portal planes to surround your map like four walls, but have the edges of the walls pass through each other a little bit. Double check to make sure the walls do not enter the level environment bsp. Finally, make a new material group and create a sub-material called +portal and apply that material to the four portal planes you made. This is all you need to do to make the level actually compile properly, as far as portals are concerned. (If your level is huge, you might need to drag-copy one of those planes into the center of the map, but this tactic will create some slight rendering anomalies if you also use +exactportal volumes in the map.)
Creating +exactportal volumes
This is much more logical to make. Basically, here's what you do:
1. Select the level.
2. Find some places where you want to create a separate environment, such as the doorway or entrance to a base, tunnel or cave.
3. Carefully create some faces to cover that "hole".
4. Flip the faces of that cover so they face the "outside" of the volume. The volume might be a hallway or doorway to a base, in which case you would flip the faces so they face the outside of the base or hallway, so they would be facing you as you entered the base or hallway area and so after you entered the base and turned around you would see the backsides of the faces you just passed through.
5. Within that designated area, do the same thing with any other "holes" or doorways to that area.
6. When the bsp is compiled, the game engine recognizes both the terrain walls and the +exactportal faces you make as boundaries of your individual +exactportal volumes. It also recognizes as a separate portal area those spaces
between each +exactportal volume you create. With bloodgulch, for example, each base has a front entrance, a back entrance, and a large hole in the top at the middle. If you wanted to designate a separate portal environment for the bases in the level, you would make an outward-facing cover for each of these "holes" in the bases. If you wanted to divide the base up into even more environments, you would create some more polygonal covers within your existing +exactportal volume, for example, to distinguish between the hallways and the center area of each base. However, it's poor form to "nest" +exactportal volumes within each other. Instead, create separate volumes for each specific area; the space between those volumes will also be defined as a separate portal volume, since the level conforms to sealed-world rules. You only need a single +exactportal cover at any one location -- do not create at the same place an +exactportal facing in one direction and another facing in the opposite direction, or else you will end up making just another portal area in the slight wedge area between the faces of those separate planes. Just make a single cap for a single hole, and face it outwards of the volume you are trying to define.
7. Create a new material ID called +exactportal, making it of the same material group as the +portal material.
8. Detach the portal objects you created from the level terrain into one or more new objects, name them, select them, apply the material group to them, select all their faces, and apply the new +exactportal material ID to them.
Make sure that the +portal planes do not enter inside the map... and if you decide to bisect your map with a +portal plane, make sure that this particular plane does not enter an +exactportal-defined volume.
You should now basically have a single +portal volume spanning your entire map which will allow the level to be parsed by the game engine and several +exactportal-defined areas of the map which will get specific environmental attributes as earlier described.
7. Link everything you want in the level to the
frame object. Check your hidden objects also, to make sure you unhide everything that you want included in the level. If you hide and then unhide something, you will probably need to re-link it to the
frame object. Save and export the level to a .jms file, saving it within your level's "models" folder found in the data folder of your Halo CE directory.
8. Run in cmd, for example, "tool structure levels\test\bloodgulch bloodgulch_test" to build the "bloodgulch_test" sbsp tag. (Use the path to your own saved .jms file instead.)
9. You should get something like the following:
Code: Select all
C:\Program Files\Microsoft Games\Halo Custom Edition>tool_pro structure levels\test\bloodgulch bloodgulch_extreme
Couldn't read map file './toolbeta.map'
building intermediate geometry...
building collision geometry...
reducing collision geometry...
building collision bsp...
reducing collision bsp...
verifying collision geometry...
verifying collision bsp...
building portals...
### WARNING: portal outside the bsp. [see magenta in error geometry]
### WARNING: portal outside the bsp. [see magenta in error geometry]
### WARNING: portal outside the bsp. [see magenta in error geometry]
### WARNING: portal outside the bsp. [see magenta in error geometry]
### WARNING: portal outside the bsp. [see magenta in error geometry]
### WARNING: portal outside the bsp. [see magenta in error geometry]
### ERROR: portal does not define two closed spaces. (see yellow in error geometry)
building render geometry...
building subclusters...
building pvs... building pvs... indoor maximum (from sky levels\test\bloodgulch\bloodgulch) is 120.000000 world units
building structure lens flares...done
structure bsp "levels\test\bloodgulch\bloodgulch_extreme"
BSP has 11001 nodes, 5362 leaves
5503 surfaces and 4842 vertices in 54 material groups
119 portals, 26 clusters
635Kb collision data (43Kb vertices, 183Kb edges, 59Kb surfaces)
532Kb render data (192Kb vertices, 134Kb surfaces,
148Kb nodes/leaves, 43Kb clusters)
0Kb pathfinding data
----------------------
1231Kb (without debug information)
...which means that you now have a successfully-compiled sbsp tag!
10. Make a .scenario tag with Guerilla, reference your sbsp tag all the way at the bottom of the scnr tag, quit Guerilla and open the .scenario tag with Sapien.
11. Wait for Sapien to load the level. Adjust your windows if necessary. Click on the Game view window. Hold the middle mouse button and press the tilde ~ key.
12. Type:
radiosity_start
13. Wait until you see some colored faces of the level. Interrupt the process by holding the middle mouse button and pressing the tilde key again.
14. Type:
radiosity_save
15. You should now see your level, and you should not see any rendering anomalies, but the entire level should appear properly. Press the shift key 4 times to adjust camera speed to 60, use the WASD RF keys while holding the middle mouse button over the game window to navigate your map and make sure you don't get any stupid white splotches occluding the appearance of the level from any vantage point. If you have problems, re-read what I said about +portal and +exactportal volumes and try again in 3ds Max.
16. Next, in Sapien, bring your camera within some portal volumes and press space bar to add some cluster data to each portal volume. First, you create some references in cluster templates and you select them in the "tool" window, you deselect a selection box around whatever you were clicking on in the "tool" window, then you go back to the game window and move the camera into a volume area and apply some sound environments, background sounds (both are necessary before sound will play in the level) and weather to the +exactportal and +portal volumes you made. But right after you add new items to the cluster template, with the clusters folder still selected, save your sbsp and quit sapien so it will play the new sound references you added as you add them. Then come back and actually apply them to the portal volumes.
17. If you got this far, you might want to do "radiosity_quality 0" or a final "radiosity_quality 1" and then "radiosity_start", wait for the lightmaps to render better, then save your sbsp and add some stuff to your scenario and save your scnr.
18. Quit Sapien. Go back to Guerilla, open the sbsp tag and give it a vehicle ceiling and floor (both are optional). Save.
19. Run "tool build-cache-file levels\test\bloodgulch\bloodgulch_test" (use your level's path and name). Your map should compile fine.
20. If Halo crashes, it's a problem with your scenario tag, not with your scenario_structure tag.
Either you are groping for answers, or you are asking God and listening to Jesus.