Building Engine for Unity3D - usage

1. Plan your building

- Sketch it

- divide your building into stories

Stories are rectangular container for one layer of rooms.

- divide each story into rooms

Rooms are rectangular container of walls, floor and ceiling.

2. Set up architectural properties

Select the BuildingEngine gameObject in the Hierarchy. If not present, you can find it in the package BuildingEngine in your project, in the prefabs folder.

Expand the BuildingEngine gameObject in the Hierarchy and select the builder gameObject.

- choose the value for wall depth, story height and texture pixel resolution in the architectural properties component.

For a majority of games, good values are :

wall height = 3

floorHeight = 3.4

wallDepth = 0.1 (by room. Two adjacent rooms make a wallDepth of 0.2)

facadeDepth = 0.1

floorDepth = 0.4

It's not real-life dimensions but these work well in game. You can also use the menu GameObject -> BuildingEngine -> Game architectural properties. All dimensions are in Unity3D units.

pixels by unit is a value to determine the texture resolution on your building. It's means "use x pixels wide to cover one Unity3D unit. This value depends of yours textures. It's a general value, so make sure all your textures have the same resolution. Textures in the Building Engine package are intended to use 128 pixels to cover one unit.

- choose the default material for facades, roofs, walls, floors, ceilings, and the default builder for roofs in the architectural properties component.

- (optional) Add roof builder component to the builder gameObject.

RoofBuilders are scripts located in the scripts/RoofBuilders folder in the Building Engine package.

- (optional) add depth builders according to your use.

Depth builders are scripts you can find in the scripts/RoomDepthBuilders folder (for meshes of depth by room), or scripts/StoryDepthBuilders folder (for depth meshes at a story level). For top-down games, use TopDepthMeshesBuilder, for doll-house/ant-farm games, use AntFarmSouthDepthMeshesBuilder, for old-school rpg or tactical games, use FloorDepthMeshesBuilder, SideWallDepthMeshesBuilder and WallDepthMeshesBuilder. For FPS, use none.

- (optional) add prefabs to the props list, in the prop list component.

3a. Create your building with the in-editor inspector

- Create the shape of the building

Select the BuildingEngine gameObject in the Hierarchy. Hit Play button, a menu appears in the inspector.

Hit the "NEW MAP" button. The inspector of the Map object appears.

Important : if you select a gameObject in the Hierarchy or the Scene View, the Inspector of the Map object disappears. To retrieve it, select the BuildingEngine gameObject in the Hierarchy, then hit the "SHOW MAP" button.

Hit the "ADD BUILDING" button. A Building (named BD0) object is added to the Map object. The Inspector changes for the Building Object. A Story object (named S0) is automatically added to the Building object.

Use the Inspector to change the values of your building. If a materail is not defined, it will use the default value as defined in step 2.

Now hit the "SHOW" button right to the S0 label. The inspector of the story S0 appears. Give it the values you want.

If you need anothers stories, then hit the "BACK TO BUILDING" button, then "ADD STORY", then "SHOW" right to the label of the story to change its values. Repeat this action if necessary.

- Add room to your building

In the intended story, hit the "ADD ROOM" button to create the room. Change the values, then hit "RETURN TO STORY" to repeat the operation if necessary, or go back to building to choose another story.

- Add portals

In the Inspector of the intended room, hit the "ADD PORTAL" button. Give it the value needed. Use "RETURN TO ROOM" button to go back to room. Repeat if necessary.

- Add vertical portals

In the Inspector of the intended room (the lower one), hit the "ADD VERTICAL PORTAL" button. Use "RETURN TO ROOM" button to go back to room. Repeat if necessary.

3b.Create it with code (alternative option)

See the Building Engine coding coventions for more infrmations.

4a. Get a prefab of your building

Go to the GameObject Menu -> BuildingEngine submenu and select the "Crete Prefab From GameObject" command. A window appears. Type a name for your prefab in the textField, and hit the "TURN TO PREFAB" button. After computation, a folder named "MapPrefabs" appears (if it didn't exist already). Inside, a prefab with the chosen name was created.

4b.Save data for rubtime loading (alternative option)

Select the buildingEngine gameObject in the Hierarchy, hit the "SAVE MAP" button, and give it a name in the textfield that appears. Then hit the "SAVE' button.

© 2017 Magyc Pixel. All rights reserved | Design by W3layouts