Differences

This shows you the differences between the selected revision and the current
version of the page.


wmebook:ch1_3 2007/12/05 22:53 wmebook:ch1_3 2008/01/10 11:27 current
Line 1: Line 1:
====== 1.3. Scene Editor ====== ====== 1.3. Scene Editor ======
-As both scenes in the demo have too many things going on, we’ll start something simpler. In the Project Manager right click the folder **scenes** and choose Add scene. From the left side choose a template “Empty Scene 800x600” and name the scene warehouse. +As both scenes in the demo have too many things going on, we’ll start with something simpler. In the Project Manager right click the folder **scenes** and choose Add scene. From the left side choose a template “Empty Scene 800x600” and name the scene warehouse. Then locate the folder warehouse in your sandbox->scenes folder and copy the contents of Chapter 1 resources inside. Double click on the warehouse.scene in the Project Manager to open a Scene Editor.
-Then locate the folder warehouse in your sandbox->scenes folder and copy the contents of Chapter 1 resources inside. Double click on the warehouse.scene in the Project Manager to open a Scene Editor.+
{{wmebook:s1.jpg|}} {{wmebook:s1.jpg|}}
-As you can see in the section 4, your scene can consist of many layers, but we’ve selected the main layer for now and we’ll get to the purpose of multiple layers later. Also you see there Waypoint groups and Free entities. Let’s demonstrate how to use them after we get used to the logic of our Scene editing.+You can see in the section 4 that your scene can consist of many layers, but we’ve selected the main layer for now and we’ll get to the purpose of multiple layers later. Also you see there Waypoint groups and Free entities. Let’s demonstrate how to use them after we get used to the logic of our Scene editing.
For now we’ll focus on sections one and two: For now we’ll focus on sections one and two:
Line 21: Line 20:
  - To block actor from entering certain places.   - To block actor from entering certain places.
  - To decorate actor with a color (for example if there is a blue light from the sign player can get blue when entering the region.   - To decorate actor with a color (for example if there is a blue light from the sign player can get blue when entering the region.
-  - To make a trap region – upon entering some game event is triggered.  +  - To make a trap region – upon entering the region some game event is triggered.  
-  - To help determine where actor stands. This is crucial for z-order to know when actor stands in front of objects and when behind.+  - To help determine where actor stands. This is crucial for engine z-sort to know if actor stands in front of objects or behind them.
-Some time there is confusion with region entity, but I’ll try to clarify the difference. So again note the reason why we have regions -> **Only for actor’s movement on the screen**.+Some time there is confusion with region entity, but I’ll try to clarify the difference. Again note the reason why we have regions -> **Only for actor’s movement on the screen**.
Next to it you find a yellow icon which lets you select between **sprite entity** and **region entity**. It also has written sound entity, but this one is grayed out (you can use it as a free entity only). Next to it you find a yellow icon which lets you select between **sprite entity** and **region entity**. It also has written sound entity, but this one is grayed out (you can use it as a free entity only).
Line 40: Line 39:
**Item** allows you to couple the entity with an inventory item. More about this will come when we’ll be playing around with inventory. **Item** allows you to couple the entity with an inventory item. More about this will come when we’ll be playing around with inventory.
-**Scripts** are here for attaching (dramatic pause) scripts to our Node. This way we’ll be handling interactions.+**Scripts** are here for attaching (dramatic pause) scripts to our Node. This way we’ll be handling most of the interactions.
-**Custom** is here for setting custom attributes to regions. For example you can to regions set the surface type so the actor can have surface dependent sound of steps. But I don’t want to rush too fast ahead.+**Custom** is here for setting custom attributes to regions. For example you can set custom attribute of the surface type to regions so the actor can have surface dependent sound of steps. But I don’t want to rush too fast ahead.
**Pos** is position of the sprite entity on the screen. **Pos** is position of the sprite entity on the screen.
Line 52: Line 51:
**Colorable** means that the Node is affected by the decoration region. **Colorable** means that the Node is affected by the decoration region.
-Next line is dedicated to the actor. Let me explain why it’s here. Normally, when you click on the object, the actor walks to some place, maybe turn to the object and comment or interact with it. To make this process faster, WME offers the way how to handle the situation with ease. Either you can fill in position of the actor manually, or you can use the following trick:+Next line is dedicated to the actor. Let me explain why it’s here. Normally, when you click on the object, the actor usually walks to some place, maybe turn to the object and comment or interact with it. To make this process faster, WME offers the way how to handle the situation with ease. Either you can fill in position of the actor manually, or you can use the following trick:
In section 5 click on the black figure and navigate to “data->actors->molly->molly.actor” In section 5 click on the black figure and navigate to “data->actors->molly->molly.actor”
-Molly appears on the screen. Notice, that if you bring her outside of the floor region, she turns red. Click with her anywhere in the screen, and use the <button. Her position gets filled automatically. If you no longer need her in the screen, simply click on the crossed out black figure in section 5.+Molly appears on the screen. Notice, that if you bring her outside of the floor region, she turns red. Click with her anywhere in the screen, and use the "<" button. Her position gets filled automatically. If you no longer need her in the screen, simply click on the crossed out black figure in section 5.
Now you can only select which direction actor should be facing upon reaching the place and you’re set. Also there’s another button “>” which position actor to the coordinates written in Walk to. Now you can only select which direction actor should be facing upon reaching the place and you’re set. Also there’s another button “>” which position actor to the coordinates written in Walk to.
-**Sound panning** means that if the entity has sound attached to it pans from left to right according to the entity position on the screen.+**Sound panning** means that if the entity has sound attached to it, sound pans from left to right according to the entity position on the screen.
**Ignore items** is here for the case that you don’t want the entity to interact with inventory items. **Ignore items** is here for the case that you don’t want the entity to interact with inventory items.
Line 82: Line 81:
Let’s get back to our Node discovery and let’s try to add the last kind of Node. It’s the **Region Entity**. Let’s get back to our Node discovery and let’s try to add the last kind of Node. It’s the **Region Entity**.
-In section 1 click on the yellow icon and select **Add Region Entity**. Immediately a red rectangle appears. Now it’s something in between Region and Sprite entity. You can manipulate it in the scene as you can the region by adding or removing vertexes and positioning it, but you can set the properties similarly to the Sprite entity. So what’s the purpose?+In section 1 click on the yellow icon and select **Add Region Entity**. Immediately a red rectangle appears which acts as something in between Region and Sprite entity. You can manipulate it in the scene as you can the region by adding or removing vertexes and positioning it, but you can set the properties similarly to the Sprite entity. So what’s the purpose?
It’s one of the most useful nodes in WME. Imagine you have a door in this scene and you’ll never want to include them in the game design in other way then making actor say something like “This door is welded shut.” If you had to use Sprite entity for such interaction your game would gradually become very large. By using region entities you can exactly define what in the screen is interactive and what not. Also there are much more benefits coming from the fact that Region Entities are independent on the graphics which will become obvious when we’ll start doing a little game together. For now practice a bit and make this region entity you’ve just created cover the door and set its name to Door. **Save your scene**! It’s one of the most useful nodes in WME. Imagine you have a door in this scene and you’ll never want to include them in the game design in other way then making actor say something like “This door is welded shut.” If you had to use Sprite entity for such interaction your game would gradually become very large. By using region entities you can exactly define what in the screen is interactive and what not. Also there are much more benefits coming from the fact that Region Entities are independent on the graphics which will become obvious when we’ll start doing a little game together. For now practice a bit and make this region entity you’ve just created cover the door and set its name to Door. **Save your scene**!
Line 98: Line 97:
Now I know I am a bit ahead of you, but also I don’t like when you do something you don’t understand. scene_init.script is the file, which gets executed right when the scene is loading. So it’s the entry point of every scene. What we did was changing the actor position so it’ll be in the floor region which means that it will be able to walk. If your actor is positioned outside the region, it’s stuck in place and can’t move. You already played with actor positioning in the scene edit so you can easy see, that the provided values are reasonable for our floor region. Now I know I am a bit ahead of you, but also I don’t like when you do something you don’t understand. scene_init.script is the file, which gets executed right when the scene is loading. So it’s the entry point of every scene. What we did was changing the actor position so it’ll be in the floor region which means that it will be able to walk. If your actor is positioned outside the region, it’s stuck in place and can’t move. You already played with actor positioning in the scene edit so you can easy see, that the provided values are reasonable for our floor region.
-Ok, save the file and close it. Now in the Project Manager set the Startup Scene in Debugging settings Section to our warehouse.scene (browse for it). And let’s try our nice scene. Press f5 and walk around with molly. Of course ignore the bubbles, they’re here from the global demo setup, but focus on two things:+Ok, save the file and close it. Now in the **Project Manager** set the Startup Scene in Debugging settings Section to our warehouse.scene (browse for it). And let’s try our nice scene. Press f5 and walk around with molly. Of course ignore the bubbles, they’re here from the global demo setup, but focus on two things:
1. Door is interactive now. If you move over it with the mouse, the cursor change and the caption Door appears. Neat, isn’t it? 1. Door is interactive now. If you move over it with the mouse, the cursor change and the caption Door appears. Neat, isn’t it?
-2. Ah-oh, you can walk directly through the boxes. That’s too bad. Gamers will throw some rotten tomatoes on you, unless we fix it.+2. Ah-oh, you can walk directly through the boxes. That’s too bad. Gamers will throw rotten tomatoes at you, unless we fix it.
-Before we can fix it, I have to tell you a secret about WME rendering. When WME draws a scene for you, it looks in the layer, starts with the first node and draws it (in our case background), then it looks below and draws the next over it, then the next etc. So what do we have there? A way how to put objects in front of others! But how about our poor actor? How does she get sorted correctly? That’s where regions come in! You can see, that our actor must be positioned on some region otherwise she’ll refuse to walk. But this region is also positioned in the layer (see section 1). So let’s try a little experiment: add a sprite entity to our scene (yellow icon in section 1). Set the sprite to crates.jpg and position it exactly over the crates so it will replace them. +Before we can fix it, I have to tell you a secret about WME rendering. When WME draws a scene for you, it examines the layer, starts with the first node and draws it (in our case background), then it looks below and draws the next over it, then the next etc. So what do we have there? A way how to put objects in front of others! But how about our poor actor? How does she get sorted correctly? That’s where regions come in! You can see, that our actor must be positioned on some region otherwise she’ll refuse to walk. But this region is also positioned in the layer (see section 1). So let’s try a little experiment: add a sprite entity to our scene (yellow icon in section 1). Set the sprite to crates.jpg and position it exactly over the crates so it will replace them.
Trick: sometimes the positioning is a bit tricky. But you can use keyboard (arrow keys) to move entities around and also you can switch the reference background by pressing the space key. If you press space, your entity is invisible and this way you can very fast bring it to the correct position. Trick: sometimes the positioning is a bit tricky. But you can use keyboard (arrow keys) to move entities around and also you can switch the reference background by pressing the space key. If you press space, your entity is invisible and this way you can very fast bring it to the correct position.
Line 131: Line 130:
And theoretically we’re set. So let’s save our scene and try it again! And theoretically we’re set. So let’s save our scene and try it again!
-Hmm, something is rotten. Molly doesn’t seem to find her way around the scene anymore. Why is that? Let’s introduce a new concept – WME pathfinding. +Hmm, something is rotten. Molly doesn’t seem to find her way around the scene anymore. Why is that? We have to introduce a new concept – WME pathfinding.
I’ll start to introduce this concept by two images: I’ll start to introduce this concept by two images:
Line 163: Line 162:
You can see 4 waypoints (red crosses) around the crates. It’s enough for actor to find her way around the whole scene. Just save and try it for yourself. You can see 4 waypoints (red crosses) around the crates. It’s enough for actor to find her way around the whole scene. Just save and try it for yourself.
-But there is still something rotten. It seems that the actor is sometimes not correctly covered with crates. Why’s that? Remember our hot spot discussion in the Sprite editor chapter? Well, that’s the cause! So let’s fix it. In the project manager add new sprite to the warehouse folder.+But there is still something rotten. It seems that the actor is sometimes not correctly covered with crates. Why’s that? Remember our hot spot discussion in the Sprite editor chapter? Well, that’s the cause! We're going to fix it right now.
-Insert one frame (crates.png) and move the hotspot to the bottom of the crates. This hotspot falls in some region (our block region) and we can easily set the scene sorting order. +In the project manager add new sprite to the warehouse folder. Insert one frame (crates.png) and move the hotspot to the bottom of the crates. This hotspot falls in some region (our block region) and we can easily set the scene sorting order.
{{wmebook:s16.jpg|}} {{wmebook:s16.jpg|}}
Line 171: Line 170:
Save your sprite and then in Scene Edit change the sprite entity from png file to sprite file. Save and test the scene. Finally it works. That was quite some work, wasn’t it? Save your sprite and then in Scene Edit change the sprite entity from png file to sprite file. Save and test the scene. Finally it works. That was quite some work, wasn’t it?
-But I promised to show you a shortcut, didn’t I? The shortcut is called a free entity and it’s useful for smaller scene objects, so the crates are serious contender for that.+But I promised to show you a shortcut, didn’t I? The shortcut is called a free entity and it’s useful for smaller scene objects, so the crates are serious contenders for that.
-But what are the **free entities**? They are entities which (in the similar way to your actor) are being drawn depending on where in the scene they are placed (in other words, in which region is positioned their hotspot). +But what are the **free entities**? They are entities which (in the similar way to your actor) are being drawn in respect to their position in the scene (in other words, in which region is positioned their hotspot).
Let’s try it. First select the “Behind” region and delete it (red X), then delete “Crates” sprite entity (red X). Resize the floor region so it covers the whole ground. Now switch to the layer called **“Free entities”** and create a sprite entity in the way you’re already used to. Name it crates and use the sprite file we’ve created earlier. Position it to the correct place, save your scene and test the game. See? It works in exactly the same way as before. Let’s try it. First select the “Behind” region and delete it (red X), then delete “Crates” sprite entity (red X). Resize the floor region so it covers the whole ground. Now switch to the layer called **“Free entities”** and create a sprite entity in the way you’re already used to. Name it crates and use the sprite file we’ve created earlier. Position it to the correct place, save your scene and test the game. See? It works in exactly the same way as before.
Line 199: Line 198:
On the layer bar you can also see two green lines. One is horizontal and one vertical. **The horizontal green line is for defining scale**. Your scene already contains two of those scale lines. In the real world you see something which is called perspective which is the reason why people far away appears to be smaller than they really are. In WME when using 2d actors we have to simulate how much gets the actor smaller when she walks to the camera or away from the camera. Setting scale lines is pretty simple. Either right click on existing scale line to adjust its properties or remove it altogether or simply drag is around to adjust y position. Let’s try some down-the-rabbit-hole effect. Select the scale line which reads 70%, set its properties and set the scale to 20. Then drag this scale line so it goes through the middle of the crates. Create a new scale line which goes through the light above the warehouse door. Set its value to 5. Now save your game and test it. Neat, eh? On the layer bar you can also see two green lines. One is horizontal and one vertical. **The horizontal green line is for defining scale**. Your scene already contains two of those scale lines. In the real world you see something which is called perspective which is the reason why people far away appears to be smaller than they really are. In WME when using 2d actors we have to simulate how much gets the actor smaller when she walks to the camera or away from the camera. Setting scale lines is pretty simple. Either right click on existing scale line to adjust its properties or remove it altogether or simply drag is around to adjust y position. Let’s try some down-the-rabbit-hole effect. Select the scale line which reads 70%, set its properties and set the scale to 20. Then drag this scale line so it goes through the middle of the crates. Create a new scale line which goes through the light above the warehouse door. Set its value to 5. Now save your game and test it. Neat, eh?
-The **vertical green line** is for defining rotation. This may be useful for someone as it can emulate the infamous fish eye camera effect but I don’t think I’d ever use it and it’s up to your experiments to play with it. Only note, that if you’re going to use this feature, you have to set the “Rotatable” attribute for your actor. We’ll get to it later.+The **vertical green line** is for defining rotation. This may be useful for someone as it can emulate the infamous fish eye camera effect but I don’t think I’d ever use it and it’s up to your experiments to play with it. Only note, that if you’re going to use this feature, you have to set the “Rotatable” attribute for your actor. We’ll get to it in the actor's chapter.
The last issue covered in this chapter is **“Properties”** tab located on the layer. The last issue covered in this chapter is **“Properties”** tab located on the layer.
Line 205: Line 204:
{{wmebook:s20.jpg|}} {{wmebook:s20.jpg|}}
-Here you can look at the scripts which are attached to the scene (by the default template you’ll find there always scene_init.script and scene.script. You can set some custom attributes for the scene, you can set if the Scene in the game remembers changes to the nodes (typically you want for example to hide some sprite entity and if you reenter the scene you want that it’s still hidden). You can pick colors for depicting scene elements in the editor, set the margins and finally set up what elements should be visible in the editor.+Here you can look at the scripts which are attached to the scene (by the default template you’ll find there always scene_init.script and scene.script). You can set some custom attributes for the scene, you can set if the Scene in the game remembers changes to the nodes (typically you want for example to hide some sprite entity and if you reenter the scene you want it still hidden). You can pick colors for depicting scene elements in the editor, set the margins and finally set up what elements should be visible in the editor.
On closing of the scene editor chapter I want to stress that I on purpose didn’t touch the 3D options. We’ll get to them much later when you’ll have the basics of the wme game covered. I know that some of you may be impatient to start your great 2 1/2 D games, but trust me, everything will be much faster if you went through the basics without skipping to much more complicated tasks. On closing of the scene editor chapter I want to stress that I on purpose didn’t touch the 3D options. We’ll get to them much later when you’ll have the basics of the wme game covered. I know that some of you may be impatient to start your great 2 1/2 D games, but trust me, everything will be much faster if you went through the basics without skipping to much more complicated tasks.
 
wmebook/ch1_3.1196891623.txt.gz · Last modified: 2007/12/05 22:53 by metamorphium
Recent changes RSS feed Creative Commons License Driven by DokuWiki