Roblox Game Development/Introduction
ROBLOX is a user-generated gaming site. This means that users can make games that other users can play. ROBLOX allows you to use its game engine and scripting interface to create games of all kinds that other people can play. The games are in 3D and use building blocks that could be accurately compared to Lego blocks. These blocks can be customized, resized, positioned and manipulated using the studio. Games can also contain various other objects, including particles (smoke, fire, etc.) and graphical objects (text labels, buttons, etc.), and users can write scripts to add more functionality to their games.
Most users on ROBLOX both create games and play games, but many only frequently do either of these. While most users do have one or many games they improve regularly and work on, most are not seasoned game developers and they see ROBLOX as a toy rather than as a game development platform.
Creating an account Edit
You will need an account to create games and use the website. If you don't have one yet, you can create one easily. You need to navigate to the following URL with your web browser: https://www.ROBLOX.com/Login/Signup.aspx. There, you need to indicate your birth date and gender and to choose a username and a password. You will get a character: there are many ways to customize that character and use the social aspect of ROBLOX, but this book will focus solely on the game development aspect, although some of it overlaps with the social aspect. If you have never used the site before, you should explore around it enough to be able to find your way on it when you'll need to. You should also play some places (games on ROBLOX are frequently called "places") to see some examples of what can be done on ROBLOX.
You will need the ROBLOX client to play games (it can be downloaded on the site by clicking on any place's play button), and you will need the ROBLOX studio (which comes with the client) to create and modify games. Note that the ROBLOX software only works on Windows and Mac OS X. There are workarounds to make it work on Linux with Wine using a [patch]. Do note that this wrapper currently does not, and that you will need to run a Virtual Machine with Windows or Mac OSX on it in order to play ROBLOX on Linux.
David Baszucki had founded Knowledge Revolution, a company which concentrated on educational physics and mechanical simulation software. He had been joined by Erik Cassel, who worked with Baszucki on the software. Keith Lucas, the current ROBLOX vice president of engineering and operations, had later joined the company in 1997. Afterwards, Knowledge Revolution had been acquired by MSC Software Corporation, and they both left some years after to create ROBLOX, in 2004.
ROBLOX was launched in 2005. The name is a combination of the words "robot" and "blocks". It started with only some hundreds of users and, today, it has many millions of users, and it is still growing. This book will cover many features that were added to the game engine and scripting API over the years since ROBLOX's creation; however, it will be impossible to cover them all due to the vast amount of features embedded into ROBLOX and the rapid rate of changes and additions that occur routinely, almost every other week.
The website Edit
This book will not describe the entirety of the ROBLOX website or even most of it, but instead offer guidance on many core aspects of developing a game. You are encouraged to explore the rest of the website yourself. You can navigate through the site using the menu bar at the top of the page.
You can see your places on your profile, which you can find by clicking on the profile link in the menu. Unless you upgrade your account to a premium membership, you can only have one place (you don't need more than one place or any of the premium features to complete this book). You can also find your places on the places page or on the build page.
ROBLOX Studio Edit
ROBLOX Studio, which should have been downloaded on your computer when you installed the ROBLOX client, is a tool that can be used to create and develop ROBLOX models, scripts, and, when you put the two together, places. Once opened, it should display a page on the ROBLOX website. You should log in from that page (it is not necessary to log in to use the studio, but some features require it). Once logged in your account, you can open a new place by opening the File menu and choosing New. You can also edit one of your current games by browsing to the game's page on the website and clicking on the game's edit button.
If you can't find a panel, open the View menu and click on the corresponding button to make it visible.
The game view displays the current game environment. When you open a new place, it should look like an empty sky and be in the middle. It will display your game in the same way as the players would see it when playing. You can move the camera by using the arrow keys.
The explorer panel, commonly called the explorer, is a panel that displays all the objects currently in the game in a hierarchy. Clicking on an object in the hierarchy will select it. An object that is included in another is called a child of that object (the terrain object is a child of the workspace) while an object that includes another object is called the parent of that object (the workspace is the parent of the terrain object). An object can have many children, but can only have one parent.
You can perform many actions on an object by clicking on the corresponding button in the object's context menu (which is shown when right-clicking on the object). You can also move objects by dragging them into another object (some objects cannot be moved).
The property panel is a panel displaying the properties of the object that is currently selected. Properties are values that you can modify to change the behavior of the object.
There are many object types. These are called classes. Not all classes have the same properties, however, all have certain properties in common. The ClassName property is common to all objects, and its value is the name of the class of the object. For example, the class of a part would be "Part". The Name property is also common to all objects, and its value is the name of the object. Each object needs to have a name. The Parent property is yet another property common to all objects, and its value is the object the current object is included in.
The toolbox is a panel allowing you to insert models fabricated by other users. These models, also called "public domain models" or "free models" can be searched for with the toolbox. There are also models featured by ROBLOX. Your own models (you can publish your own models for other people to use) are also shown in the toolbox.
The advanced objects panel is a panel allowing you to insert objects into the game hierarchy by double-clicking on the item's name. The object will be inserted in the object that is currently selected. The panel will display the available items in columns. If the checkbox is checked, it will select the object automatically after it is inserted. You can also search for a specific object using the search bar at the top of the panel.
The command bar is a toolbar that can be used to run short lines of code. It is frequently used with the output to see the result produced by a certain piece of code. It is also frequently used to automate tasks in your game or to do things that cannot be done with the studio's interface.
The output is a panel that displays output generated by scripts, as well as warnings and other information from the engine. It is an essential tool for finding errors in scripts and correcting them. It can also be used together with the command bar to execute code and see the result.
The script performance panel is a panel that displays information concerning the performance of the scripts running in the game. Scripts labelled as "[Unknown]" are usually either core scripts (internal scripts used by ROBLOX) or removed scripts, so they can be ignored. While the script performance panel isn't frequently used, it can help identifying scripts that are expensive in performance and it can be useful when evaluating the performance of a script.
The diagnostics panel is rarely used, but it is useful to know about it. Most of the information in it is very technical and useless to the average user. It can tell you the number of parts in the game, the number of connections handled by the physics engine, the frames per second (FPS) and some other things, but this information will rarely be needed.
The clipboard toolbar can be used to copy, cut, duplicate and paste game objects or script code. Additionally, it can be used to undo or redo actions. Keyboard shortcuts are available for all of these actions; they can be viewed by leaving the mouse pointer over the buttons.
Camera manipulation Edit
The camera may be hard to get used to for a person who has never used it before. It is possible to unzoom with the mouse wheel or the I and O keys. The camera can be moved forward and backwards by using the up and down keys or the W or S keys. It is possible to rotate the camera by right-clicking and dragging the mouse.
Game hierarchy Edit
The game hierarchy is the hierarchy of objects in the game. It can be seen and manipulated through the explorer, as explained above. Top-level objects (objects that have no visible parent in the explorer) are called services. Not all services are shown in the explorer (in fact, many classes are hidden by default).
The workspace is the place where all the scripts (the objects that allow you to run code in your game) and the visible parts (parts are also called "bricks" or "blocks") in your games are located.
The Players service is the place where Player objects (objects that represent players) will be located. You don't need to worry about this service right now, as you will only use it when writing scripts.
The Lighting service is the place where skyboxes, which give a different appearance to the sky, are stored. It also carries many properties that can be modified to change the lighting of the place.
The StarterGui service contains GUIs, 2D elements that you can put in your game to create menus, buttons, etc. The GUIs contained in this service will be given to players when their character spawns. Without scripts, not much can be done with GUIs, so this book will not talk again about them until later, when we get into scripting.
The StarterPack service contains tools. Tools are used by players to do things. For example, a sword would be used to attack other players, a key would be used to open a door, etc. These tools will be given to players when their character spawns. Again, without scripts, you can't do much with tools.
The ROBLOX studio offers many ways to test games that are built with it. When a game is edited using the studio, it is initially in an idle state. This means that the physics are not simulated (i.e. parts will not fall, explosions will have no effect) and that scripts are not running. The run button can be used to put the game in the running state. This will enable the physics and make all scripts run. The game can then be put again in idle state with the pause button; alternatively, the reset button can be used to reset the game to its state at the time it started running and put it back in the idle state.
Often, these tools will not be enough, and a character will be necessary to test the game. For this, there are three options. The first is to test the game online. Unfortunately, this requires publishing the game to the website and entering it, which can take some time and does not give you access to all the debugging tools available in the studio.
The second option is to play the game without a server (in solo mode). This will create a pseudo game environment with access to the output and to the full studio. It gives the user a character and runs the game. However, there are many differences between this simulation environment and a real game environment, so this option quickly loses in usefulness as the game tested becomes more complex.
The third option is to start a server locally, with one or many players. This starts an instance of a server on your computer and also starts a client connected to that server for each player. The server and all the clients are accessible through different windows, each with the full studio. This option provides a more complete and normal game environment than the other options, but it is more expensive in computer resources since many ROBLOX instances are open at the same time. Furthermore, some features like badges or data persistence only work online and can not be used locally at all.
Saving games Edit
The game currently opened can be saved either by using the standard toolbar or the File menu. Games are saved with the '.rbxl' extension and use a binary format. They previously used a XML format with the same extension. The legacy XML format is still supported, and games can be saved in XML with the '.rbxlx' extension. They can be opened again by using the open button in the File menu or the standard toolbar. Files saved on a user's computer or created in the studio can be uploaded to the website with the "Publish to ROBLOX..." option in the File menu. Games opened directly from the website will prompt the user to save before closing.
Physical objects Edit
In virtual worlds on ROBLOX, there are different types of objects that appear physically.
The most common physical object on ROBLOX is the part. Parts are also called bricks and blocks. They can have three shapes: the shape of a block, of a sphere, or of a cylinder. The shape of a part has an effect on how it behaves physically. Cylinders behave physically like spheres because simulating a cylinder is too expensive in computer resources and would slow down games that use cylinders extensively.
The appearance of parts can be customized with materials. The default material for parts is the plastic material, which makes the parts have a homogeneous color with a slight concrete appearance; the smooth plastic material can be used to have a perfectly homogeneous color. The plastic material is fine for some cases, but more customization can be needed to improve the look of buildings. Materials, when applied to a part, change the texture of that part. They also change that part's density, which has an effect when the part is put in water terrain: parts of some materials (like wood) will float in water while parts of other materials (like slate) will not.
The fifth button of the customization toolbar can be used to change the material of a part. It allows you to pick the material you want from a list of available materials and then to click on parts to apply that material to them. There aren't many materials, but they are sufficient for most purposes. Custom textures, which are described some sections below, can be used when more customization is wanted, but are less common.
Form factors Edit
All parts have a form factor, which defines what sizes the part can take. The default form factor is the brick form factor, which requires the height of the bricks to be a factor of 1.2. The symmetric form factor requires all the dimensions of the block to be factors of 1, while the plate form factor requires the height to be a factor of 0.4. The custom form factor allows a very low factor for all dimensions.
Surface types Edit
Each surface of a part has a type. By default, the top surface has studs on it and the bottom surface has inlets on it. There are 11 surface types. Surfaces can form bonds with other surfaces, which allows parts to stick together and not fall where they normally would due to gravity. They also affect the appearance of the part if the part's material is plastic. Otherwise, the material texture is used instead of the surface texture.
The behavior between the surface types is described in more detail in this table:
Decals and textures Edit
Decals are objects which can be put on the surface of a part to display an image on that surface. They are useful for billboards, ensigns, flags and in-game screens. When a image should be displayed for the purpose of changing the appearance of the surface, a texture can be used instead.
Textures are the same thing as decals, but the image is repeated instead of being scaled to fill the entire surface. This gives results that are far better than what can be obtained by using a decal, because the quality of user images on ROBLOX is restricted.
If you want a sign that shows an advertisement, you should use a decal. If you want to put a brick texture on a wall, then you should a texture. Texture objects, like all other objects, including decals, can be found in the advanced objects panel.
Games sometimes need to contain objects that are more complex than simple blocks, spheres and cylinders. Meshes can be used for this purpose. They are objects that can be put in parts and that, when put in parts, make these parts have a different shape that can be very complex. There are some predefined meshes, and many others that are uploaded on the website. All hats and gear in the catalog, for instance, use meshes for their appearance. Meshes by themselves have no color or texture, and only a shape, but they are generally given a texture. Meshes only have an effect on the appearance of the part they are used with, but the part's physical behavior is still defined by its shape and surface type. Because of this, meshes are best used for small objects, or objects that are out of the reach of the players.
Meshes do not support outlines. They can be scaled and moved away from their physical part (using an offset). Scaling is necessary because their size is not adapted to the size of the physical part. Moving it away from the physical part can be useful to create hologram effects and other similar effects.
Parts can contain particles of different types. It is possible to create custom particles, but many predefined types are provided and offer some properties that can be customized.
Sparkle objects can be inserted in parts to make sparkle-like particles appear and move from the inside of the part to the outside of it, and then disappear at some distance. The color of these sparkles can be customized.
Fire objects can be used to make fire particles appear over a part. Fire does not necessarily need to be orange or red, it can be of any color. Its heat (the longevity of the particles) can be set, and so can the color of the particles when they are close to disappearing.
Smoke objects can be used to make smoke appear over a part. Smoke will generally go up, but it can also go down: it will go in the direction of the top surface of the part it is located in, so by changing the rotation of the part, it is very possible to make smoke go to the left, or in any direction. The color of smoke can be changed, and so can the velocity at which the smoke rises. The size can also be changed, as well as the opacity.
Trusses are mostly identical to parts, but have a different appearance, can be climbed by characters, and have size restrictions. They must always have a width and depth of two studs, while their height is unrestricted. They support materials, surfaces, and everything parts support with the exception of decals and textures. They are available in three different styles: without supports, with alternating supports and with bridge-like supports.
When a character is standing next to a truss and starts walking in its direction, he will start climbing the truss in the same way he would climb a ladder (when many parts are stacked with a small gap between each of them, characters will go up when walking in the direction of the stack of parts). This also works when many trusses are stacked in their horizontal position. Sometimes, it will be desirable to put many trusses together to make climbing them easier. However, in many cases, it may be desirable to use a ladder instead of a truss, as trusses are primarily real building materials, rather than tools used to climb structures, which is the purpose of ladders.
Spawn locations Edit
Spawn locations are identical to parts and behave in the same way, with the exception that characters can spawn on top of them. Spawn locations can be configured so that only players in a team will have their character spawn on them. They can also be configured to make a force field appear around the character of users who spawn on them for a limited amount of time to prevent characters who have just spawned from dying immediately.
The number of parts that can be used in a game is limited by the computer resources available. Terrain can be used to create beautiful and complex landscapes that it would not be possible to create using parts because of the limit of the computer resources. Terrain is implemented as voxel terrain. Voxels are atomic volumetric units that can be thought of as the tri-dimensional equivalent of pixels, or simply as cubes. These cubes can be put together and given a different appearance.
Terrain cubes currently have a material, a shape and an orientation. Unlike parts, they are not objects, are not visible in the explorer and can not be grouped into models. However, you can have millions of them on an average computer, while parts on average computers are limited to around one hundred thousands, at which point the game is very slow.
Terrain is usually created using the terrain toolbar, which is shown at the top of this section. The first tool in that toolbar is the landscape generator, which is used to generate landscapes. The two tools that follow are used to create and destroy individual terrain blocks. The next two are used to change the elevation of the terrain by dragging up and down at a certain location. The following tool is used to create craters, and the tool with an intersection of roads as its icon is used to create roads. The one that follows is used to paint large areas of terrain quickly, while the penultimate tool can be used to insert terrain blocks (and also other objects). Finally, the last tool is used to fill an area of terrain with voxels of a certain material and is generally used to create lakes or rivers. Each of these tools has its own integrated help which is available by selecting the tool and clicking on the button with an interrogation mark on it, so they will not be described here.
Seats work identically to parts, but players can sit on them. There are many types of seats: simple seats, vehicle seats and skateboard platforms. Simple seats are simply parts that users can sit on. Scripts can be used to make these seats have various functionality. Vehicle seats are used to create vehicles that work with a motor and wheels and that can be controlled by the user without any script being needed. Skateboard platforms, finally, are used to control vehicles that are generally smaller (hoverboards, skateboards, surfboards and generally anything that describes a vehicle and ends with "board") and easier to control. Skateboard platforms need scripts to work, but handle the animations that happen in different events, such as when the character on the skateboard platform turns, jumps, accelerates and so on.
Building, on ROBLOX, is the art of putting physical objects together, manipulating them and customizing them. The studio offers many tools to facilitate this process. By being able to change the size, position and appearance of parts and other physical objects and putting them together, it is possible to build almost anything. From small buildings to very detailed rooms and to complex mechanisms, it is possible to create a lot of things.
Models are used to group together parts, scripts and other models. They are indispensable for organization. A big game without any organization can quickly become very hard to maintain, so you should always use models to organize objects in your game. When many objects together form something bigger, they should be grouped together (a bed, a house, a car, etc.). Parts can be grouped and ungrouped by using the explorer's context menu or the group and ungroup buttons in the Format menu (as well as the corresponding keyboard shorcuts). You can also use the corresponding button in the Format menu to select all the children of a model, which is very useful in certain cases.
For example, suppose you were building a tower, like the one on the right. Suppose it had a door and stairs to get to the top. You could group the parts that form the stairs together and do the same for the parts that compose the door. You could group the parts that compose the ramparts together and you could group all of the rest into a model called 'Walls'. Then, you could group all of these models together and call that model 'Tower'. The place would then surely be better organized than it would be if you had just kept all these parts scattered around without any organization!
Manipulating parts consists of moving, resizing and rotating them. In the studio, manipulation of parts is usually done by using the toolbar shown above.
- The first tool can be used to select parts by clicking on them and to move them, by dragging the mouse once they are selected. Parts can also be selected and dragged by using any of the other tools.
- The second tool can be used to move parts. It works like the first, but also shows dragging handles, which allow you to move a part on a particular axis.
- The third tool can be used to change the rotation of parts. This one is a bit harder to use, but it should still be easy: just use the handles to change the rotation of the part.
- The fourth tool can be used to change the size of parts by using the handles and dragging them, the same way as you would move the part with the second tool.
- The three buttons following the separator are used to change the grid used and the increment when moving, resizing or rotating the part. The best way to learn to use them is to experiment with them.
- Finally, the last button allows you to choose whether parts should be welded together when moved on other parts. If it is enabled, then parts will stick together. Otherwise, they will not stick together and they may fall when the game runs.
ROBLOX uses a unit called 'studs' for positioning and calculating distances. A stud is the equivalent of one of the squares with the R logo in them on a part. A meter is equal to 20 studs.
Customizing parts consists of changing their appearance and behavior. Like manipulation, it is, in the studio, generally done by using a toolbar, the toolbar shown above. Some customization can only be done by changing properties manually from the property panel.
The first button can be used to anchor or unanchor a part. Anchoring a part means setting its position so it will not change due to gravity, collisions or other physical events. Anchored parts can not move in a running game unless their position is modified by game scripts, but they will collide with other parts, meaning characters can walk on them, for example.
The second button can be used to lock or unlock a part. Locking a part makes it unable to be manipulated by building tools, both in the studio and in building games. This can be useful when you don't want players to be able to manipulate certain parts in a building game and it can also be useful to prevent yourself from moving a part by mistake.
The third and fourth buttons are used to change the color of parts. The first allows you to choose the color in a color palette, while the second allows you to pick the color of an existing part by clicking on it.
Finally, the fifth button can be used to change the material of a part, by picking the material you want from a list of available materials.
If you take a look back at the tower presented in the section about models, you notice it uses a lot of parts in its walls. While this isn't exactly bad, in order to make the game faster (by reducing the number of parts), it is usually better to use a texture of repeated bricks.
Other tools Edit
In addition to all the toolbars, the studio also offers additional tools for building. In addition to some options available in the menu, there is an axis widget that can be used to quickly find the position of the X or of the Z axis, and there is a 3D grid that can be used to quickly find the height of the position zero and to build parts on it. These two tools are rarely used, but they can be useful to identify which axis is the X axis and which is the Z axis. All part customization and manipulation can also be done directly by editing the properties of the parts with the property panel after having selected them.
Help sources Edit
ROBLOX has many help sources where users can get help on various subjects. One of these is the forums, where users can ask questions. There are two help forums for game development:
Before posting in the forums, users can check many other online help sources. The first is Builderman's help, which can be found in the website's menu (the Help button). It contains information about the website, the rules and various other things.
The main information source, however, is the ROBLOX wiki. It can be found through some links hidden on the website or by pressing F1 in-game. The wiki, written by editors selected by ROBLOX staff, contains documentation about building and scripting. It is a very useful source of information and documentation for ROBLOX.
There are some questions you can answer to verify that you have understood the material in this chapter. Note that finding the answer to some of those questions could require having knowledge that is not presented in this chapter. This is normal: the quizzes are part of the learning experience, and they can introduce information that is not available elsewhere in the book.
- The output can be accessed while playing an online game through the developer console, which can be opened with the F9 keyboard key, or by clicking the Log button in the help section of the game menu. All players can access the developer console, but only the game's owner can see the output on the server (other players can only see the output on their own client).
- It is also possible to start a server without any player.