Studio › Manual › 3D rooms

Works with BBMOD

BBMOD is a free, open-source 3D library for GameMaker (MIT licence, https://github.com/blueburncz/BBMOD): PBR materials, shadows, post effects, animation. Studio works with BBMOD 3.26 two ways, as Room 3D does: it writes 3D rooms for BBMOD to draw, and it opens BBMOD's model files. Studio isn't made or endorsed by BBMOD's authors.

3D Output: BBMOD. File > 3D Output: BBMOD (⇧⌘7; hover over it for what carries over) writes the project's 3D rooms for BBMOD instead of Room 3D's kit, after asking. The choice is kept with the project (.studio/bbmod/state.json). It writes:

  • BBMOD itself, when the project hasn't got it yet (no BBMOD_Model script): its scripts, shaders and sprites in the folders BBMOD and ColMesh2, and its primitive models in datafiles/Data/BBMOD/Models. A project that has BBMOD already keeps its own copy. BBMOD's Windows-only DLL extension isn't added: scr_r3d_bb_d3d11 stands in for its two functions (delete it if you add the extension yourself);
  • the loader: scr_r3d_bb and the objects o_r3d_bb_scene, o_r3d_bb_thing and o_r3d_bb_light, in the Room3D folder, written again each time;
  • each model the 3D rooms use, in datafiles/bbmod/<model>/: <model>.bbmod (BBMOD file format 3.4), a .bbmat material per material with its picture, a .bbanim per animation (with its marked events), and <model>.json (clips, size, collision triangles). Characters keep their skeleton (at most 128 bones: a model with more isn't written, and the message says so) and play exactly as in the kit; each painted grid becomes a still model grid_<room>_<grid> (with its triangles for collision when it's solid);
  • each room's file datafiles/bbmod/rooms/<room>.json (the sun, ambient light, fog, glow, vignette, the view, the room's lights) and its sky, <room>_sky.png;
  • the notices: datafiles/bbmod/THIRD_PARTY_NOTICES.txt, LICENSE-BBMOD.txt and LICENSE-ColMesh.txt. Keep them with your game, and credit ColMesh (by TheSnidr, CC BY 4.0), which the loader uses for collision;
  • the rooms in BBMOD's form: the scene an o_r3d_bb_scene, models and grids o_r3d_bb_things, lights o_r3d_bb_lights, with the same creation code settings (model, anim, z, rot_x, rot_y, rot_z, size, col_*, light_*). Your own objects in the room stay as they are. Everything is listed in the project's included files.

Not carried over: particle effects; the player and ridden vehicles (their models are placed, they don't move); pickups, keys, doors and exits (their models are placed); paths; game cameras (kept in the room's file; the room's view is used); attached and held things (placed where they are); 3D text, screen text and shapes; light flicker; height fog and colour grading. The message says which of these the rooms had.

Editing. A room written for BBMOD opens in the 2D room view. Choose 3D Output: BBMOD again (⇧⌘7) to go back to Room 3D's kit: each room is put back as it was (Studio keeps it in .studio/bbmod/kit_rooms/), and things moved, turned or resized in the BBMOD room (in GameMaker's room editor, say) move the same way. Edit in 3D, then turn BBMOD output on again.

In the game. Models load in the background and show when they're in. Solid things' collision shapes (box, sphere, capsule, mesh, a solid grid) become a ColMesh world when the room starts. From your own code: r3d_bb_play(inst, "Walk", true) plays an animation; r3d_bb_collider(x, y, z, radius, height) and r3d_bb_move(collider, dx, dy, dz) walk a capsule through the room; r3d_bb_raycast(x1, y1, z1, x2, y2, z2) finds what a line hits; global.r3d_bb_colmesh is the room's ColMesh; r3d_bb_renderer() and r3d_bb_camera() give BBMOD's renderer and camera. The view turns with the right mouse button and zooms with the wheel (cam_controls = false in the scene's creation code turns that off; cam_turntable = 20 turns it by itself). BBMOD output is for GameMaker's standard runtime (Mac, Windows, the web).

Space. GameMaker's units (64 a metre), z up. BBMOD's camera mirrors its view, so the rooms are written mirrored across x: a thing's y, rot_x and rot_z have the other sign from the kit's. The room looks the same in the game as in Studio's 3D view.

Opening BBMOD models. Room > 3D View > Import Model… (⇧⌘I), dropping a .bbmod on the 3D view, or Save Model to GameMaker opens a .bbmod with its materials (<model>_<slot>.bbmat or <slot>.bbmat beside it: colour, picture, both sides, see-through, pixel filtering) and its animations (<model>_<clip>.bbanim beside it, or the clips its notes file names), and bakes it like any model. A model Studio or Room 3D wrote comes back at its size; any other is taken as BBMOD's Blender add-on writes them (Z up, X mirrored, 1 unit a metre).

Keys are shown as on the Mac: ⌘ Command, ⌥ Option, ⌃ Control, ⇧ Shift. Studio for Windows shows its own keys beside each menu item.