27 ratings
*Updated 9/8* Teleglitch Module Editor: Unlocking and General Use
By Gul'Dukat
Hidden inside of the Teleglitch LUA files is the potential to unlock an ingame editor which allows you to create your own modules and edit original ones. This guide will start by covering how to enable the editor and the basics of using it. Down the line I will add more information on how to connect modules for random level generation.
Rate  
Favorite
Favorited
Unfavorite
About This Guide
This guide is a work in progress, please check back often or contact me if you have any questions!


I recently decided to dive into some of the Teleglitch LUA files after reading about people changing weapon stats and the recent Chaos Mod that was posted. The Editor.lua file contains tools that are disabled by default (in several files) that grant the ability to edit ALMOST every aspect of the modules that are used to build the levels in Teleglitch.

As far as I know these tools are unsupported, and at this time I haven't heard an official response from the devs about its functions. While the editor can technically create every aspect of a module that you would need to make complete levels, there are some functions that are either somewhat of a hassle to implement or are not fully integrated into the editor. I would not say that it was ever designed to be the most user-friendly to use, but the tools are there!

If you love this game and would love to see things like total conversions, new campaigns, and other awesome content then this is the place to get started.

Just as a disclaimer, if you decide to use this guide then you will be required to modify several lua files that can completely crash the game if messed up. For this reason I highly suggest you back up your files!

This guide is also a work in progress, as I am learning new things about using these tools often ;)
What The Teleglitch Editor Can and Sort of Can't Do
This editor was never intended to be fully released as a public tool, as such it seems that there are some features that are either incomplete, missing, or removed. Since this is all a learning process some of these features may change.

Easy to do:
  • Load and edit existing game modules
  • Paint BMP textures (floors)
  • Add "objects" Walls, decorations, trees, consoles, switches, etc. (does not include items and monsters!)
  • Add ambient and triggered sound effects.
  • Add color variations to all in-game objects.
  • Create levels or modules from scratch.
  • Create and edit pathing maps for enemies

With some effort:
  • Create modules that can be effectively integrated into the level generation process
  • Add doors (currently surprisingly hard to do), loot spawns, dynamic patrols spawns
  • Add enemies and placed static loot drops (these have to be copied and pasted or added through the console)


Once you have a decent understanding of how the editor and the other level creation files work the possibilities are endless! It does seem rather strange though that there is no simple way to add enemies,doors and loot without copypasta, but its still rather easy to do.
Turning On The Editor and Viewing Pathtest
Enabling the editor is fairly simple to do. Just follow these steps.

First navigate to your Teleglitch folder (Typically in your steam\steamapps\common\TeleglitchDME unless you installed elsewhere). Find the settings.lua file in the main directory and open it with any text/code editor (notepad works fine). Find the variable labeled ["editorenabled"] and set it to true (it should look like the image below). If your settings.lua doesnt have this line then add it.



Next is a very important step! Right click on settings.lua and change its attributes to read-only (seen below). Many times when I was trying to get the editor to work it seemed that the game was overwriting my settings file to disable it.



I highly reccomend setting the game to run as administrator from the compatibility tab and running teleglitch from the exe and not from steam.
If everything worked ok then when you start the game and go to New Game you should see the following.



Pathtest is a very helpful module as it contains a copy of every item and enemy in the game which you can easily copy and paste from, it is a completely self contained module and does not randomly generate anything. This shows it is completely possible to create self-contained non random levels.

You can see an image of it below.



And now on to learning how to use the editor!
Editor Key-Bindings and Navigation


If you haven't loaded up the pathtest map yet then go ahead and do so. It is a good map to learn most of the basics of the editor (and you dont risk accidentally messing up your vanilla modules).

First things first I would suggest pressing F6 once, F6 toggles enemy agro on and off. The pathtest map does have enemies on it and you can die while you are editing. While there is a godmode it is somewhat of a hassle to enable from what I have been able to find, so disabling agro works fine. Keep in mind that if you walk in melee distance most enemies will still hit you, however this is usually something you wont have to worry about as you can move the player wherever you like to keep him safe.

There are two edit modes plus in-game mode which all share some keys.

Editor Keys: F3 - Selection Mode : F4 - Edit Mode
The first edit mode is a selection mode, you can turn it on by hitting F3. You will know its active because you will see two values in the upper left corner that show the X and Y values of where your mouse cursor is. Entering select mode will also disable the in game shadows that walls cast. Selection mode is used to edit the placement of in game objects and delete them.

The second mode is Edit Mode which you can access by hitting F4. Edit mode allows you to cycle through multiple modes. The Tab key will show the key bindings for the different modes in Edit Mode. All the edit modes will be covered more in depth later.

Edit Modes
Sound Emitters - Allows you to place sounds
Paint Colors - Allows you to adjust hue, saturation, and brightness of objects. It is used like a paintbrush.
Place Objects - Allows you to place predefined objects that are defined in the objects.lua folder. These include walls, decorations, floor clutter, hidden walls, etc. Doors can be found in the objects palette but they WILL NOT function if placed as objects.
Place Holes - "Holes" are the black teleglitch anomalies, you can draw them with the mouse in this mode.
Paint BMP - Allows you to "paint" the floor of the module by selecting textures from a bitmap in the gfx folder, by default it will appear solid black in game.
Place Triggers - A little more complicated than it sounds. Allows you to place and name object triggers for scripting. Also allows placement of switches, terminals and map markers by cycling with F5. I thought that you would be able to place working doors using these various tools, but it doesn't seem that you can.
Pathfinder - This tool is used to draw out polygons or vertices to mark pathing for enemy AI. You can build an entire level without pathfinding, but enemies that chase you will not know how to get around objects that are in their way.



NOTE: Do not under any circumstance delete the player character, if you delete the player object the game crashes right away and will not save anything you have done!

Editor Keys:

Arrow Keys - Move Camera
Left Click - Select (drag to box select)
Right Click - Hold to move selected objects
Middle Click - Hold and move mouse to rotate objects (not mousewheel up or down)
Tab - Switch camera between last free camera placement and player location (Select Mode). Show key shortcuts for current mode (Edit Mode)
Enter - Duplicate selected objects (objects duplicate on top of each other, most placeables will separate upon returning to game mode)
Space - Displays the palette for Object and BMP modes


1 - Select objects only from current selection
2 - Select BMPs only from current selection
3 - Select ALL (this key ends up being important)
4 - Move player character to cursor location (this is handy as well, just dont drop yourself in the black distortions!)
6 - Spawn testweapons.lua at 0,0... This spawns all of the items listed in the testweapons.lua in your lua folder at the origin point of the map, this is handy for testing purposes and to an extent level building.

F1 - Toggle Console
F4 - Edit Mode
F5 - FPS meter on/off - Cycle through place triggers types
F6 - Enemy Agro on/off
F7 - Save Selected to Module... This brings up a console prompt to save selected content to the modules file. If you do not press "3" to select all before saving then you will just save a blank level!
F11 - Show bounding boxes
F12 - Module Select Screen - Navigate with arrow keys, start typing a module name to narrow the list. When you switch modules it does not save the current module that you are working on, be sure to save your work if you are switching around.

C - Copy selection to copypaste.lua - Copying takes whatever you have selected and adds it to a separate module called copypaste.lua, it is overwritten every time you it "C"
V - Paste contents of copypaste.lua to cursor location
Q - Swap depth of selected objects (a little wonky, but allows you to change what object appears on top of another to an extent)
N/M - Cycle Edit Modes while in Edit Mode

Numpad 1 - Zoom out to Map Distance (only works in game mode, appears to flatten depth in editor mode)
Numpad 3 - Show current ammo counts
Numpad 4 - Show enemy agro borders
Numpad 5 - Toggle pathing overlay
Numpad 7 - Show player stats
Numpad 8 - Highlight Camera Angle Triggers
Numpad 9 - Show Realtime Pathing (you wont see anything if you have agro off)
Numpad 0 - Zoom camera in to a depth just slightly closer than regular play
Numpad -/+ - Zoom camera in and out (does not work in game mode)
Numpad / - Toggle Sound Emitters

Escape - Menu / return to game mode
The Canvas Module
Let's get started learning how to build our first module. It will be simple but we can easily cover the most used tools and create a small room that we can easily insert into the level generation of the game.

The first thing to do once the editor is enabled is to hit F12 to bring up the module select screen. The first module at the very top "Uued_moodulid" is essentially the palette and canvas module.



When you first open the module it will seem like a completely blank module, zoom out (num-) and use the arrow keys to navigate the camera to the left. You will see there is an enormous space that includes virtually every module prebuilt in the game, plus every individual asset. Once your camera is over the palette you can easily use Tab to switch back and forth from where the player is located to the palette area.


This area is not only great for reference and pulling prebuilt assets like hallways, but it is essential for placing some very important entities. This area is the quickest method of placing doors, items, enemies, loot spawns, camera angles, map markers, module connectors, camera angles, and many other very important things. We will come back to these items later, for now lets focus on the tools.
Tools: Paint BMP
Now that we know about the canvas module, we can take a look at each individual tool and start building our simple training module. The Paint BMP tool allows you to box select portions of textures located in the gfx\set1.png file. This file has plenty of blank space in it in case you wish to add your own textures. Anything placed by this tool represents the FLOOR and the floor only, this is essentially the lowest layer of depth the game will register. This means all objects and entities will be placed on top of these textures. As a note you do not have to paint the floor, if left blank it will appear as black in game, however the character can still walk on it without any issue.

Lets begin! Enter Edit Mode by hitting F4 on your keyboard, cycle through modes with N and M until your mouse cursor looks like a sandstone tile, this is the default brush for the Paint BMP tool.


If you hold Tab the upper left corner will show the keybinds for the BMP tool.

Hold Space = Show Palette
Z,X = Rotate bitmap
U,I = Change Radius
J,K = Change Count

The last two keybinds apply to the multiplier. If you hold down Control you will notice that it multiplies and mirrors the current brush, this can be used to quickly cover areas and create unique patterns.

For now hold spacebar and you will enter the palette. The palette is large and you can navigate it using WASD while holding spacebar. To create a brush you simply box select the area you want to use and then let go of the spacebar.



In the image above you can see I have box selected some scattered dirt texture. Once it is selected clicking with your mouse simply paints it onto the ground. I selected this dirt texture to show that black in the palette retains transparency as seen below.




Next we will try using the multiplier by holding control. For this I have selected a blue tile. By holding control and adjusting the variables with U,I,J,K,Z and X we can see a few different interesting patterns.





An important thing to know is that all painted textures are there own entity that can be selected, deleted, moved, and rotated in Select Mode. If you go to Select Mode (F3) and highlight the painted textures you will see they each have their own bounding box.




In the image above you can see the player is selected as well (the player appears red like an object). Always be sure you NEVER delete the player by accident. If you do the game will instantly crash and your work will not be saved. As a reminder you can easily move the player to the mouse cursor by pressing 4.

---------------

Now that we understand some basics of how the texture tool works we can create the floor for a simple room module we will insert later on into a level. There is absolutely no need to copy what I do exactly, I put this room together rather quick and was not focused much on design. Below we have the basic floorplan of our room. I used the multiplier tool to create some interesting patterns on the floor, and then placed a different blue tile texture for where our exits will be.




The exit tiles look a bit funny floating over the rest of the tiles though, so we will adjust the depth so that they are below the other tiles. The last thing that you place will always be on the top of the depth that its placed at. While all floor tiles are technically at the lowest depth on the floor, they can be cycled if they are not placed in the order that was desired (this applies to objects as well).
To adjust the depth simply select the intersecting textures in Select Mode (F3) and press Q. Every time Q is pressed it will cycle all of the objects selected depths. To acheieve the look you want you may have to press Q multiple times.






There, that looks a bit better! This is a good base floorplan. Keep in mind almost every in game object (walls, doors, terminals etc.) have their texture located in the palette for the Paint tool as well. This means that you can use those textures as decoration without having the effects of an object (drag, clipping, depth etc.).

Now time to add some walls!
Tools: Objects Tool and Other Objects
Now that we have our floor layout finished we will add some objects. There are many objects in the game all with different properties. These values are set in the lua\objects.lua file, so they can be altered if desired. Some of these values determine whether an object has drag (can be walked over but slows player), is solid, is movable, creates shadows, etc. For our module we are making right now we will simply use a basic wall object.

The Object tool is very similar to the Paint tool. Select the Object tool by cycling with N and M until your cursor looks like a little box with a circle in it. This is the Object Tool.




You will notice that below this box there looks to be a blue grating on the floor. While the blue grating is an object you can place which has drag, I painted a couple of these plus a ladder using the Paint tool to spruce up the room a bit. Since they are textures and not objects though, they have no properties and therefore have no effect on the player.
Again the keys are visible by holding tab, and control will apply the multiplier just like it did with the Paint tool. To start, lets bring up the palette with spacebar.



You can scroll through the palette using W and S, the mouse is used to actually highlight an object, you will see that these objects are all named and have specific boundaries applied. By clicking an object you will select it, there is no box select like the texture palette. For our walls I am going to use a simple grayblue wall (named sein_sinine in the palette). Placing objects works almost identically to placing textures and are manipulated in the same way. The only difference is that objects have properties applied to them. Below you can see I have started placing down walls on one side of the room, simply adjusting the rotation as I go.



If we return to game mode by hitting escape and walk around to the other side we can see that this wall object will create the FOV Shadows that limit your vision in game. This is a good start!



Lets say I am in a hurry to finish the walls, I am going to finish the rest of the room using the multiplier. By doing this i can cover far more area much quicker, although this is somewhat sloppy. I can easily go back and touch up the unneeeded objects later. The shot below shows the rest of the walls finished, I have turned on the bounding boxes by pressing F11 so you can see how the objects are simply overlapped to create complete walls.




We should take a look and see how it looks in game, and see if there are any gaps we need to fill. By pressing escape you can quickly return to game mode and walk around.





This looks alright for now. Next we are going to add some objects that you CANNOT place using the Object tool, this is where the Canvas module comes in handy.



-------------
OTHER OBJECTS

If you didn't already, move your camera with the arrow keys over to this section of the Canvas. You can see the coordinates in the upper left if you are having trouble finding it. This little space contains some of the most essential non-placeable objects you will use in a module.




NODES
The first special type of object we need to learn about is the Node. The node is essential to create functional mods and there are multiple types with various purposes. Nodes are used by the level generation code to put together the level when the player starts the game. Without them the level will not be assembled correctly, and many of the random elements of the game will be missing.

Nodes have a number variable in the level generation code that correspond to their type and purpose.

0 = module connection point
1 = ordinary item spawn point
2 = rare item spawn point
3 = module boundary point
4 = patrol point
Plus Secrets, Map Markers and Camera Angles which do not have a number assigned.

Because they are so important, we will cover each one and its in-game graphic so you can learn how to begin using them.



Node: Module connection point
Value: 0
----------------
These little rectangular boxes are one of the most essential parts of how the level generation works. The level generator will load the selected modules for a level and then assess their connection points and orientation, these are essentially the places where each module snaps together. A connection point is required in any instance where your module may possibly connect to another. For our sample room we are working on we will need two of these. The line pointing outwards faces where another module should connect. We will look at these in our module in just a bit.



Node: Module boundary point
Value: 3
----------------

These boundary points are not used in every module, they are more of a safety measure. By placing boundary points in your module the level generator will create a polygon by connecting all of these points that tells the level generator that it CANNOT place another module within these points. This is mainly used for very large or oddly shaped modules so that the level generator does not accidentally place two modules that intersect incorrectly.



Node: Ordinary item spawn point
Value: 1
---------------
This node is used to generate ground items such as ammo or canned food by the level generator. Just because you place one does not mean that an item will ALWAYS spawn there, you can place the item manually if you want it to always be available.



Node: Rare item spawn point
Value: 2
---------------
This node is used to spawn a rare item, it is mainly used in the game for spawning the loot that is in secret areas.



Node: Patrol Point
Value: 4
--------------
These nodes are used to spawn random enemies. The enemies that can appear hear are dictated by the objects.lua file in the specific levels folder



Node: Secret Area
Value: N/A
--------------
These nodes are used to trigger the secret area found message, define a module as a secret area, and also add to the score at the end of the level.



Node: Camera
Value: N/A
-------------
This node is used to adjust the orientation of the camera when auto rotation is turned on. The line will dictate the orientation of the camera when the character passes over this node.


Node: Map Marker
Value: N/A
-------------
This node is used to place a big white dot on the map after its been found by the player. This is how the teleporters are shown on the map.

Thats a lot of info! For now we will copy and paste 4 boundary nodes, 2 connector nodes, and 2 doors from the palette.
Other Objects Cont.
To just finish covering a couple things from where we left off. The doors can be found right near where all of the nodes appear on the palette. A functioning door cannot be created with the objects tool, it must be copied from the palette or inserted using the console (which is far more time consuming). In the previous image of the palette you can see that I am selecting one of the doors.

We will switch to select mode (F3) and move our nodes around by slecting them and using right mouse button to drag, and middle mouse to rotate. Place the boundary nodes to make a simple square around the whole of your module, and then orient the connector nodes to where you feel your module should "snap" to another. I then simply placed the doors just behind where these connectors are.



Those look pretty good, now is also a good time to just go through and remove some of the wall clutter I placed before when I was using the multiplier. So far I havent seen any performance impact in Teleglitch when having a ton of objects like walls in a level, but I have only played it on a fairly high end desktop.






Much better! Before we move onto the sound tool, I just wanted to leave a quick note about containers. Containers (or chests) do not appear to be randomly spawned, they are a separate placed object like nodes and doors. You can find then just down and left of where you found the doors. They look like this.



Their contents seems to be determined by weapon tables that are set up separately from the editor. I wont go into major detail about how that works until later. However if you wish to place them in your module you can find them close to the other nodes.
Tools: Sound Emitters and "Holes"
Technically our module would function in the game right now without any problems. However we have a few more tools to cover so lets add some sounds and some black goo!

Using N and M select the Sound Emitter tool, it will have dialog in the upper left saying Sound Emitter with a bunch of variables. Again pressing tab allows you to see the keys bound to the sound emitter tool.

A,Z = change inner radius
S,X = change outer radius
D,C = change max volume
F,V = change sound
G,B = change pitch
P = Preview



When you use the Sound Emitter tool you are given an inner and outer radius. This allows you to fade sound effects essentially. This gives you the ability to create a sound that can be heard very faintly from very far away, or a consistent volume. If you look at the image above I have selected BG3 as the sound, a relative white noise sound. I have adjusted its pitch and volume to what I found suitable by testing the sound holding the "P" key. The circle in the middle shows where the sound will play consistently at max volume.The outer circle shows the fall off of the sound. Essentially as you walk outside the inner circle the volume will go from 100% to 0% by the time you get to the outer circle.

I don't have much depth to go into about sound emitters at this time since I have not used them too extensively yet. However I am sure you can achieve many interesting things by layering them and using triggers, which I will write about later on.

--------

Next lets add a "Hole" or black goo, or teleglitch, to our level so we can try the tool out. I suggest you move your character far away from where you are doing this, if your character accidentally dies then you will be removed from the map you are working on and your module will not be saved!!!

Select Place Holes by cycling through your tools with N and M. Next you simply left click your mouse to begin drawing a line, once you make the shape of your goo all you do is click your right mouse button and the game will complete it and fill it for you!




In Game:


An important thing to note is that the game does not automatically assign the black goo sound to black goo holes, you have to do this yourself. So using our knowledge of the sound emitter we can quickly go through and add an emitter to the goo area to make sure people are in grave danger the closer they get!




One more view of everything in game with bounding boxes turned on:




Now that we briefly touched on emitters and holes, lets quickly cover one more simple tool!
Tools: Paint Colors
The color painter is a very simple tool that can be used to help create unique looking environments or objects.
Select the color painter with N and M and your mouse cursor should appear as a black circle, in the upper left you will be able to see variables for hue, saturation, value, and radius. Pressing tab will show you the keys for this tool

F,V = change radius
Z = Hue
X = Saturation
C = Value

While holding Z X or C an on screen guide will appear, the value is then changed by using the mouse wheel.







By playing around with these settings it will change the color of your brush on your mouse, which then will basically tint any object or texture you brush over. It seems that this applies for things like doors and enemies as well!. Below you can see I have created a blue color and painted some of the wall tiles and floor tiles. As far as I know the only way I know of to undo using the paint brush is to set it 100% transparent under value and paint over things you have already painted.









I wouldn't say it looks great, but its just an example ;)

Now lets go ahead and move on and save our module so that we can insert it into the game.
Saving a Module and Adding to a Level
Now that we have a simple functioning module we need to save it. Move your player outside of the area of your module and select everything by drawing a box around it in select mode (F3). It should look like it does below.



Next after everything we want to save is selected hit F7 to bring up the save dialog in the console. By default it will be the name of the module you are already in, which is most likely the canvas module. Type in whatever name you want and hit enter. It will save as a lua file in the mods folder of your teleglitch directory. You can hit F1 to bring up the console to doublecheck and make sure it saved ok.




Now that our module is saved lets stick it in a level and see what happens!

-------

I am still learning a great deal about how levels are built and categorized by the game. For the time being adding a module to an existing level in the game is one of the best ways to test it. Lets just add our new module to level 1 so we can see where it goes.

Open up the level1 folder in your teleglitch directory and open the objects.lua file. As seen below we are going to add a line in the modules section with the name of our module. In my case I simply added "GuideMod", after the 2nd module. As far as I have found, adding the same module twice will cause issues with level generation, the 2nd time the module is added it will be placed in sort of a trash area on the map, and will cause some dead ends to be open. If you wish to place multiple of the same module, currently it seems the best way is to just make copies and append the end of the name with a number.




Now that we have added the module to the objects.lua we can start the game and go to level 1. Once in game we can easily swap over to edit or select mode with F3 or F4 and fly around the map and see where the level generator placed our module.





There it is! You can see where the generator snapped the module to the other two where we placed the connector nodes, in some cases one of these areas may lead to a dead end instead of another room or hall.





Testing these modules in the game is a good way to see how connector placement works, we dont want to have any seams or places the character may get stuck!
While this module clearly doesnt blend in with the rest of the level we now have a chance to see how easy it is to add our own modules into the game!
Coming Soon!
-More information about the trigger and pathfinding tools
-More information about module placement and level generation
-Teleports, Consoles, and Changing levels
-Making your own level with 100% of your own modules!

Thanks for reading, Ill post more when I have the time :)
17 Comments
< >
dekkon Feb 5 @ 3:20pm 
Thanks for the brilliant guide! It's a shame that one cant access the modules in ubuntu. :(
Xangi Nov 3, 2013 @ 6:59pm 
Oh do I ever know that feeling.
Gul'Dukat  [author] Nov 3, 2013 @ 12:21am 
@xangi
I'd love too, I just have been really busy with work. I will try to this upcoming monday and tuesday while I'm off.
Asdasing_evansealife Oct 31, 2013 @ 2:48am 
now i freaking understand what the fraking problem was. i was running it from steam when i realy had to do it fro the .exe!
NoBrain Oct 23, 2013 @ 8:52am 
You can type "godmode(1)" in console to prevent you from dying while editing. This doesn't prevent you from deleting the player.
Xangi Oct 22, 2013 @ 9:16pm 
Man you gotta continue this guide. It's excellent in every way so far.
Asdasing_evansealife Oct 19, 2013 @ 3:55am 
ok fine thanks anyway. ill try do everything myself then. keep up the good work :)
Gul'Dukat  [author] Oct 19, 2013 @ 12:21am 
Theres a chance that in your demo version the editor.lua file which controls a lot of the aspects of the editor as well as the module browser has certain things commented out or is an entirely different file all together. I have no experience with the demo version so I would have to say thats most likely the cause.
Asdasing_evansealife Oct 18, 2013 @ 9:35am 
thank you i did rebind the snapshot key to p but the problem is that when i do hit f12, it does bring up the module selection screen but does not show any of the modules. i travelled through every level and even 'pathtest' and hit f12 to see if it would work but i just get a module selection screen with no modules showing up. i have a demo version of teleglitch that was out a year ago and i has every thing there and all the modules, but its a demo and you wont expect to see everything. if you dont know whats causing this, its fine and i do still like your guide. well done for your work :)
Gul'Dukat  [author] Oct 18, 2013 @ 2:41am 
@evansealife
Rebind your screenshot key in steam to prevent the screenshots, but that probably isn't whats causing your problem. Make sure steam/teleglitch are both running in administrative mode, depending on where it's installed I guess it could be a permissions thing. Other than that the only other thing I could think of would be that if you hit F12 and accidentally hit a key or type something it will start filtering the results of the F12 Module screen (typing l1 shows modules that start with l1) there's a chance you could have hit a key or spacebar or something. If you hit F12 and the editor is enabled the screen should at least darken from the overlay that comes up from picking a module. Does the screen at least do that when you hit F12? Hope you can get it working!