Garry's Mod

Garry's Mod

80 ratings
Cinema - Mapping Tutorial
By Sam and 1 collaborators
Step-by-step tutorial for creating a map for the Cinema gamemode available on Steam Workshop.
Theatron Map
If you'd like to make edits to the cinema_theatron map, feel free to download the original VMF[].

Please remember to credit the original author, Mr. Sunabouzu.
Hammer Entities
To get started creating maps for the Cinema gamemode it's recommended to download and add the Cinema FGD[] to your Hammer configuration. The FGD includes definitions for entities required for the gamemode. Listed below are descriptions for each entity and how to configure them in your map.

theater_screen (Point entity)
This entity is used to display the 3D2D theater screens found in-game. It should be placed at the top-left corner of where a screen should appear, pointing outwards.

Example placement of theater_screen entity in Hammer's perspective view.

"Theater Name" (name) : theater name displayed on the scoreboard and thumbnail
"Flags" (flags) : describes which type of theater it is
"Screen Width" (width) : screen width in hammer units
"Screen Height" (height) : screen height in hammer units
"Thumbnail" (target) : refers to the targetname of the corresponding theater_thumbnail entity; note that if you don't want a thumbnail entity, you don't have to provide a value for this

Example keyvalue configuration for theater_screen entity.

theater_thumbnail (Point entity)
Each theater in the Cinema gamemode may be complemented by a thumbnail entity which displays the theater's current playing video. This can be placed anywhere in the map. It's recommended to place it outside of a theater to serve as a preview for what's playing.

"Name" (targetname) : See the Valve Developer Wiki entry for a detailed description. This is required to match the corresponding theater's target keyvalue, case-sensitive.

Example keyvalue configuration for theater_thumbnail entity.

theater_door (Point entity)
The cinema_theatron map uses a door system to traverse through theater locations. If you would like to use this as well, which you certainly don't have to, you may place this entity in your map with a complementing info_teleport_destination entity. Note that this is only a one-way door system. In order to travel in both ways, you would need to setup two separate doors. The model used by the door is completely up to you.

Example keyvalue configuration for theater_door entity.

Example keyvalue configuration for info_teleport_destination entity.
In-Game Locations
After compiling your map and starting up the Cinema gamemode, you'll be greeted by this message:

The Cinema gamemode relies on a Lua locations system to prepare theater videos for players and describe where in the map a player is located. Naturally, the next step in setting up your map is to configure the locations within your map. Luckly for non-programmers, we've prepared a debug system to help mappers add support for their own maps. Feel free to ask questions if anything below is too confusing.

For this part of the tutorial, I will be using the map theater_gcinema as an example. To begin, you'll want to define bounding boxes within the map as part of specific locations. There are two console commands which you'll need to use to do so. The first is cinema_loc_start, this command is used to begin defining a new 3D space. The second command is cinema_loc_end, this is used when the you're ready to save the currently defined location space. Follow the steps below to define a location; it helps to imagine that you will be "blocking" out your map into locations.

1. Noclip to a starting location, or corner, for a location in your map.

2. Enter cinema_loc_start into the console.

3. Noclip to the opposite corner of the new location. You'll notice a wireframe 3D cube being formed as you move around. This is a preview of the location boundaries which will be used. It's important to try to be efficient as possible when defining a new location as there's currently no way to define priority for overlapping locations.

Location preview described in step 3. The above image shows myself defining the entrance location for the theater_gcinema map.

4. Enter cinema_loc_end into the console.

5. Following entering the commands to define a new location, a configuration will be copied into your clipboard. Open up your favorite text editor and paste it inside of it. It should look something like this,
[ "Name" ] = { Min = Vector( -1446.9011230469, -2250.2802734375, 54.014091491699 ), Max = Vector( 1445.0450439453, -840.00933837891, 413.30743408203 ), },
Name should be changed to whatever you would like to label that location as (e.g. Entrance).

6. The above steps (1-5) will need to be repeated for all locations within your map. Each location configuration should be posted one after the other until you eventually have a list of them.

7. After defining each location in your map, you must now add them to the gamemode. Start by creating a new Lua file named the same as your map (e.g. theater_gcinema.lua). Next, paste your list of location definitions within the template below and replace theater_gcinema with your map name.
Location.Add( "theater_gcinema", { *** Locations list goes here *** } )
In the case that you have gotten the gamemode code from Github, you'll need to save the map configuration as garrysmod/gamemodes/cinema/gamemode/maps/mapname.lua However, in the case that you would like to release your map as standalone, such as on workshop, you'll want to modify the template above as so,
hook.Add( "InitPostEntity", "theater_gcinema", function() if !Location then return end Location.Add( "theater_gcinema", { *** Locations list goes here *** } ) end )
In this case, you'll need to save the file as garrysmod/lua/autorun/mapname.lua. You can refer to the file included with the gamemode for further reference.

8. Finally, you can test out your map to see if everything works. Remember to post any questions in the comments if you're confused about anything. The final outcome should look something like this,

In-game locations displayed with the cinema_debug_locations console command set to 1.
Manual Theater Configuration
In the case that you have definined locations for a map which is already compiled and is not properly built for Cinema, you'll also need to define the theater screen locations, etc. manually. If you have setup your map as shown in the Hammer Entities section, you do not need to follow this section. This section is sort of complex, so if you have the option to, setup your map in the way described in the first section.

As with the previous section, I will be using the map theater_gcinema as an example. On top of the location system used in Cinema, theater entities can either be defined by adding them through Hammer, or they can be defined in Lua code manually. Follow the steps below to manually define theater information,

1. Open the locations configuration you created in the previous section. Adding a theater is as simple as adding additional information to a location entry. Use the following template as a guide,
[ "Private Theater #1" ] = { Min = Vector( 720.68334960938, 1403.3217773438, 270.52685546875 ), Max = Vector( 1246.5190429688, 2150.435546875, 524.49401855469 ), Theater = { Name = "Private Theater 1", Flags = THEATER_PRIVATE, Pos = Vector( 1180, 1415, 488 ), Ang = Angle(0,180,0), Width = 396, Height = 192, ThumbInfo = { Pos = Vector( 698, 1950, 340 ), Ang = Angle(0, -180, 0) } } },
The theater defined above will appear when a user enters the location. It's important to setup the theater correctly so that it will be visible in the correct location.

2. After adding the above addition to your location code, you may enter the location and notice that the theater doesn't appear. You'll need to supply the correct 3D coordinates and angles for displaying the theater. A useful command, cinema_loc_vector, is available for outputting your correct player location and copying it to your clipboard. Use it and enter the value as the entry for Pos under Theater, NOT ThumbInfo. By using trial-and-error, you can tweak the vector values to place the screen in the desired location. The position used is the topleft corner of the theater screen.

If the theater screen is not facing the correct direction, you can change the second value for Ang under Theater. For example,
Angle(0,90,0) OR Angle(0,0,0)
This is referred to as the yaw[] of the theater screen.

3. Once you're satisfied with the orientation of the theater screen, you can now change the resolution to fit the area needed. You can change the Width and Height properties to set the resolution in world/hammer units.

Theater screen with correct orientation and dimensions

4. If you would like to add a thumbnail display for the theater outside of its entrance (or anywhere else), you must properly configure the Pos and Ang properties under ThumbInfo. Otherwise, the ThumbInfo block can be removed to disable spawning a thumbnail entity. Follow the same trial-and-error process as described in step 2 for setting the correct orientation.

Theater thumbnail setup outside its entrance.

5. Finally, the last properties you'll want to set are Name and Flags. Name is the name that will appear in the scoreboard for relaying the theater's current video information. Flags is used to define which type of theater you're adding. The available options are listed below,
  • THEATER_REPLICATED : a public theater which is open to all, only admins can administrate it
  • THEATER_PRIVATE : a private theater which is controlled and administrated by an owner
  • THEATER_PRIVILEGED : can be used to specify a VIP-only theater
  • THEATER_NONE : similar to a public theater, but it doesn't appear in the scoreboard

At this point the theater you've setup should be working properly. Repeat the steps to define any other theaters for a location. Note that only one theater can be defined per-location.
< >
PAmadman3 Dec 10 @ 12:27pm 
What Botton Do I Press To Make A Level?
Ⓕⓨⓡⓔ Nov 4 @ 2:00am 
Do i have to to do all of this on the official map?
Sam  [author] Jul 20 @ 4:18pm 
Neldonax Jul 20 @ 6:38am 
Does this teach me something? no
ViruS ™ Sep 19, 2016 @ 11:00am 
@SAM @Mr.Sunabouzu I want to make my map public from my comment before but there is one problem.
I can't get the screens to work, no where.
PatchesIX (O'Hoolahan) Sep 19, 2016 @ 7:19am 
i keep getting this in console, it also says the map isnt supported by the gamemode...

[ERROR] lua/autorun/ragdollmover.lua:30: attempt to index a nil value
1. fn - lua/autorun/ragdollmover.lua:30
2. unknown - lua/ulib/shared/hook.lua:110

this is my lua file:
hook.Add( "InitPostEntity", "Aquious_Theater", function()
if !Location then return end

Location.Add( "Aquious_Theater",
[ "Respite Block" ] =
Min = Vector( 6.0715465545654, -259.2760925293, -19.15097618103 ),
Max = Vector( 281.04336547852, -13.446474075317, 139.37347412109 ),

} )
end )

perhaps somthing is flawed?

HG | Great Leader Kevin Sep 18, 2016 @ 7:37pm 
How does the seating in Cinema work? I tried moving the origin of the entity prop_vehicle_prisoner_pod but it keep bringing me to the original origin of the entity.
Sam  [author] Sep 5, 2016 @ 10:48am 
Hi Virus, we don't have any plans to update cinema_theatron. I'd suggest releasing your map on workshop though.
ViruS ™ Sep 5, 2016 @ 3:23am 
@SAM @Mr.Sunabouzu I have made a remake of your map if that is oke, right now there is an outside area and some new room's like VIP/admin/public piano room.
Maybe there is a way that u can provide me with some prop's or that we can work together in a way that this map may be the 2.0 version of your map?
I would like to add you and talk about this subject if you think that is oke.

Much love to your modding mapping and scripting.
Pork Aug 21, 2016 @ 1:14pm 
Every time I try to compile a map