Ember Tutorial World Editing
- 1 Editing the world in Ember
Editing the world in Ember
This is a short tutorial of how to edit the world in Ember. You will learn how to log in as admin, how to create new entities in the world, how to create matching model definitions for your entities and finally how to edit the terrain.
Note: the information here is currently outdated and needs to be updated to better reflect the way Ember currently works.--Erik 17:43, 25 March 2008 (CET)
Logging in as admin
N.B. If you're going to edit the world, you must have access to a server where you have the ability to log on as admin. Please refer to http://wiki.worldforge.org/wiki/Installing_Cyphesis for information on running your own server.
Note: The Public Sandbox Server is an open server which allows newcomers to try out the world editing features of WorldForge using the Ember game client. Please refer to the page listed for details on how to access the administrative accounts on the open server.
The first thing you'll see when you start up Ember is the server browser
Once you're connected to the server, you need to log in. All cyphesis servers by default comes with an "admin" account. The password for this can be set on the server by running the "cypasswd" command without any arguments, or running "cypasswd -s admin".
The admin accountThe admin account is a bit different from other accounts as it allows you to create characters of many different classes, whereas any other type of account is restricted to a few (currently "settler" and "skeleton"). However, when we want to edit the world we want to log in as a "creator". Ember therefore provides a quick button labelled "Use creator"
This will create a new character of the type "creator". This entity differs from most other entities in that it's given almost unlimited ability to edit the world. Additionally, the entity is automatically destroyed upon disconnection (note that everything in the inventory of the creator entity is also destroyed. In Ember it's represented by a flame. Note the "Admin" window that has appeared down to the left. This provides some quick shortcuts to the most common tools you'll be using when in admin mode.
The first thing we want to do is to switch to a free flying camera, so we're not bound to the entity. Click on "Switch camera" to toggle between free flying mode and bound mode. When in free flying mode you can move the camera around using the regular "wasd" key combination. Also, the keys "r" and "f" can be used for moving up and down.
The object of this tutorial is to create a castle, so we'll look for a large expanse of flat land. There's such a place in the distance. We now have to move our creator entity over to this place.
In order to move an entity, left click on it. This will bring up the entity action menu. Select "move" in the menu. While in "entity movement mode", mouse movement will move the entity. Using the scroll wheel will rotate it around the y-axis. Pressing "shift" while moving will shift the rate of movement. You can still click the right mouse button to switch to "camera movement mode", allowing you to reposition the camera while moving. Pressing "esc" will cancel the whole move operation. So, left click on the creator entity and move it over to the intended spot. Pressing "shift" will probably help.
Once we're in position, it's time to bring up the Entity Creator. Press the "Entity creator" button in the admin menu. This will display a tool that helps with creating new entities. All current available entity types will be shown in a listbox. You can also give the new entity a name by entering it into the textbox. In this tutorial we'll start by creating an outer castle wall. The entity type "castle_outer_wall" would be excellent for that. Click create to bring it into the world.
A new entity has now been created, but there a problem: there's no corresponding model for the entity. Whenever Ember is asked to create a new entity for which it has no model to show, it will automatically create a placeholder model, shown as a black box. Clicking on the box will bring up the action menu. Select "Inspect" to inspect this entity. In the inspect window now shown, click on the "Eris bbox" button which will show how the server defines the entity. We want to make sure that our model lines up to this box as much as possible. This will naturally lead us to the next step of the tutorial: using the model editor.
Using the Model editorPress the "Model editor" button to bring up the tool
Removing and adding meshesA model can be made up of zero or many different meshes. A mesh will also be called a "submodel". These meshes can then be divided into parts, each part containing one or many submeshes. This is shown in the smaller listbox. Autogenerated models such as this one have a placeholder mesh added to them by default, with a part named "main". Our first order of business is to remove this placeholder. Therefore, select the placeholder mesh in the list and click on "Remove submodel".
As you can see, a mesh has been added to the model. It has one part named "main" comprised of one submesh with the index 0. Let's take a look how this will look in the world. Click on "Reload models", which will reload all models in the world which uses this model definition. Then double click on the title bar of the window to roll it up. As you can see the castle wall has been updated, but there are still some things wrong with it.
- It's the wrong scale
- It's the wrong orientation
- It has no texture
We'll deal with these problems in order. Double click on the rolled up window to show the model editor again. The wrong scale issue is most easily fixed by telling Ember to use the width of the model as a reference scale. The meshes in the client will seldom match up exaclty to the bounding box defined in the server, so you'll probably have to experiment with different settings. For now, select "width" in the "Use scaling" drop down.
As we can see in the model preview the mesh is by default oriented askew. Click on the "Down" button in the preview window which will pitch the model 45 degrees. After clicking it twice the model will be more correclty aligned. Now click on the "Rot. from preview" button. This will update the model's rotation to be of that shown in the preview window. You could of course manually enter the rotation, but it's cumbersome unless you're a 3d math wiz. Click on "Reload models" once more, and roll up the window once more. As you can see the model is now correclty aligned to the ground, but it's not yet completely fitting with the server bounding box. We need to rotate it 90 degrees around the z-axis. Bring up the model editor once more and press twice on the "Roll right" button. Then press "Rot. from preview", "Reload models" and roll up the model editor. The model now appears to fit with the server representation as it should!
Setting materialsOn to the last problem then: the absense of texture. Bring up the model editor. As previously mentioned, each Model is made up of different meshes. Each mesh then have one or many submeshes. A submesh is basically a part of the mesh that has a material defined for it. So a mesh which requires two different materials would then have two submeshes. In this case however the outer wall mesh only has one submesh. The submeshes are shown in the smaller listbox in the third level (first level is the mesh, "outer_wall.mesh", the second level shows the part, in this case only the autogenerated "main" part, and the third part shows the submeshes (by index, "0" in this case). Select the "0" submesh.
Saving model definitions
The castle walls now look correct, don't they? We've now created a model definition, so we want to save it. Bring back the model editor, select the model and click on the "Save" button. This will save the model defintion to disc, more precisely to the directory ~/.ember/user-media/modeldefinitions (on windows it's c:\Document and Settings\$user\Application Data\Ember\user-media\modeldefinitions). All media placed in the "user-media" will override the default media. Next time you start up Ember it will load our model defintion for the castle outer walls.