Damned
Otillräckligt med betyg
Damned: Exporting custom models into the game using Blender
Av Sweats
This guide explains how to add in custom models into the game.
   
Utmärkelse
Favorit
Favoritmarkerad
Avfavoritmarkerad
Introduction
In this guide, you will learn how to do the following things:

  • Setting up your tools
  • Exporting a model made with Blender into the game.
  • Creating an object file for your exported OGRE mesh.
  • Giving your exported mesh collision.



Setting up your tools
There are 3 different tools that you need:

  • Blender
  • A plugin for Blender called blender2ogre
  • Command line tools that the plugin calls to actually export your mesh from blender into an OGRE mesh.

Blender:

To install Blender, do the following:

1. Go to this link https://download.blender.org/release/Blender2.79/blender-2.79b-windows32.msi

2. Download it.

3. Run the downloaded file and follow the prompts.

Once that is done, you are now ready to install the plugin blender2ogre.

blender2ogre:

To install this plugin, do the following:

1. Go to https://github.com/OGRECave/blender2ogre

2. Click on the green button that is labled "Clone or Download".

3. Click on "Download ZIP".

4. Extract the zip file to a location of your choice.

5. Navigate inside the extracted zip archive and look for a folder called "io_ogre" and copy that entire folder (not just the contents) into the scripts/addons folder within blenders directories.

6. Launch Blender.

7. Go to "File" at the top left in Blender.

8. Click on "User Preferences..."


You should see a new window pop up:


9. In the search bar at the top left of the window that pops up, type in "ogre".

You should see ogre pop up. If not, make sure you extracted the plugin to the correct directory.


10. If the checkbox is not already checked, check it.

(Optional) 11. Click on the down arrow on the left of the plugin name and change the settings there to your liking. If you choose to not set a custom directory, then you will have to install the command line tools to the root of your C drive.



That is it. Next, we have to download the command line tools that the plugin calls to export your blender mesh into an OGRE mesh.

Command Line Tools

1. Download the zip file from the link below:

https://cdn.discordapp.com/attachments/273609091497197578/614221224125530112/OgreCommandLineTools.zip

2. Extract the zip archive to the location where you told the plugin to look for the exe in step 11.

If you did not do step 11, extract the zip archive to C:\

Congratulations! You have installed all the tools you need to export Blender models into a Damned mesh!

In the next section, you will learn how to export a custom mesh that I have found on a website into Damned.


Exporting a model from Blender into Damned.
In this section, we will take this model from the link below and add it into Damned.

https://free3d.com/3d-model/watch-tower-made-of-wood-94934.html

Before we begin, make sure you download the model and extract it to a folder somewhere. Next, double click on its blender file to open the model in Blender.

You should see something like this:


Look at the top right. You should see a small panel there:


Scroll down in that panel and look for "watchtowerHigh" and click on it. You should see an outline around the watchtower in Blender.



Side Note: When you are creating your own model in Blender, make sure you name the mesh itself in Blender and not just call it "Cube". This is because when you go to export your model later, it will be properly named within the mesh itself. This is not a Blender tutorial so if you know how to make a model in Blender, you should know what I mean. I picked the watchtower for this guide because it is already properly named. Now back to the guide.

The reason why we do this is because when we opened the model in Blender, it selected the whole scene. If we were to export that into OGRE, it would export the entire scene which is not what we want. We want to export just the watchtower itself.

Now that you have "watchtowerHigh" selected, go ahead and click on "File" at the top left and move your mouse over to "Export" and then click on "Export Ogre3d (.scene and .mesh)


You should see something like this:


Once you have selected a location where you want your exported mesh to be, click on "Export Ogre"


If nothing went wrong, you will see the menu close and you will be looking at the model again. Yay!

You should see 4 new files in the directory where you exported the mesh.







Out of the 4 files, you will only need 2 of them. These are:

watchtower.mesh
watchtower.material

The mesh file is the mesh itself. The material file tells OGRE (the engine Damned uses) how to render the mesh in game. For example, you can add in "lighting off" in the material file so when the mesh is loaded into the game later, it will have no lighting which means that the model will be 100% fully lit.

Open up watchtower.material file in Notepad:


See the the two texture unit properties? This basically tells the game that for every time the model is rendered in Damned to take the texture file next to "texture" and slap it onto the model. Doing that twice is very inefficient because what will happen is that it will take the first texture and apply it to the model and immediately after apply the next texture. If you were to move these 2 files into the Damned directories, you will only see the second texture in game. Make sure your Blender model only has one texture so you don't have to delete texture_units in your generated material file.

With that being said, delete the second texture_unit and save the file.

For more information about properties found inside .material files, look at the OGRE documentation here:

https://ogrecave.github.io/ogre/api/1.10/_material-_scripts.html

Take both watchtower.material and watchtower.mesh and copy them into the data_001 zip that is found within your Damned directory. Take the texture file Wood_Tower_Col.jpg and copy it into the data_001.zip archive.

Congratulations! You have successfully taken a model made in Blender, exported it, and installed it into the game!

Next, we have to create a object file for your new Damned model. Onto the next section!
Creating an object file for your new model
Now that you have your new mesh in a format that Damned can understand and installed into the game, you are ready to create an object file.

Creating an object file is very easy. All you have to do is make a new text document and copy and paste the following:

object watchtower{
mesh watchtower.mesh
shape none

mass 0
mask 0

animations 0
}


Save the file as "watchtower.object". When creating your own object file for your own model, use this as a template. Just rename "watchtower" to whatever the name of the exported mesh is. Be consistent with naming your object, material, and mesh files

Save the object file and copy it into the data_003 zip file AND into DamnedData\Resources\Objects. This allows both the game and the terror stage editor to find the object so it can load them into the game and the stage editor.

Now that you have created an object for your mesh, we will talk about the properties found inside an object file.

mesh: The mesh this object will use. Self explanatory.

shape: The collision that this mesh will use. More on this later. For now, you can put in "none" which means that the mesh will have no collision.

mass: As far as I know, the only thing this does is make the mesh harder to move in game. The higher the number, the harder it is to move the object.

mask: I am not sure as of this writing.

animations: Must have something to do with animations but when I looked at the other objects for the game, they are always set to 0. Just keep it as 0.

There are additional object properties that are not in the watchtower template:

casts_shadows: Can be true or false. Self explanatory.

collision_sound_effect: What sound sound file will play if a survivor tries clicks on the object when they don't have the key for the object? If the object is a trap, what sound file will play when it is triggered?

unlock_sound_effect: What sound file will play if a survivor unlocks this object with a key? If the object is a trap, what sound file will play when the monster arms it?

Adding collision to your model (WIP)
TO DO: Figure out how to add in collision to a model in blender so it is exported along with the mesh itself.
Final result
If everything went smoothly, you should be able to place the new object into a stage and then load the stage in Damned and see your new model.