Setting the Scene

From Web-Adventure-Kit-Wiki

Jump to: navigation, search

The information of the scenes of the adventure is stored in the file “adventure/scenes/Scenes.xml”. The Scenes.xml has the following structure.

Image:SceneStruct.png

AdventureScenes can hold as much Scenes that your game needs. And inside each Scene tag you define the properties and attributes of your Scene. Each scene must have an unique Id which you will use to apply any operation or modification where the scene is involved.

... <Scene id="room"> ...

In the case of the SkeletonProject the scene id is “room”.


Contents

[edit] Debuging the Scene

Each scene has a debug mode that you can enable or disable by setting the debug tag to true :

<DebugScene>true</DebugScene>

When the scene is in debug mode it displays some helpful information that can be used to edit the same:

Image:DebugScene.png

In Debug mode you will see the grid used to calculate the path finding, and the blocked tiles for walk marked in red. In a corner you can see the mouse coordinates (x,y) inside the scene and the coordinates displayed in tiles. A tile picking utility also is available in debug mode, if you press “Ctrl” and click on a tile this will be painted as yellow, the marked tiles are sent to the clipboard so you can paste the coordinates in the <BlockedTiles> section from a Scene in Scenes.xml .


[edit] Scene Background

One of the first things that you might want to change from a scene is the background. You can change this by writing the resource id of the image that you wish to set as background, to know how to add resources to a WAK project check the previous tutorial here. If the background image is bigger than the stage size, the scroll is enabled automatically.

[edit] Walking Area

To define the walk area the first thing you have to do is define the size of the tile used in the pathfinding grid editing the tag:

<TileSize>16</TileSize>

By default the SkeletonProject comes with the TileSize in 16 which means that the tile used will be a square of 16 pixels X 16 pixels. The size of the grid is automatically set from the size of the image used as background. The criteria used in WAK for the walking areas is that all tiles are walkable unless you say it is not. And you say which tiles are blocked for walking by adding the blocked tile's coordinates into the <BlockedTiles> section from the Scene . For example if you want to block the tile (9,10) you must add the following line inside <BlockedTiles>:

<BlockedTiles>

<IntPoint x="9" y="10"/>

</BlockedTiles>


WAK will have an scene editor in the near future but in the while you can use the built in tile picking tool, which is enabled when the scene is in debug mode, to collect the tiles that you want to block. These tiles are sent to the clipboard in format: <IntPoint x="9" y="10"/>

So you can paste them easily into the <BlockedTiles> section.


[edit] Ambiental Audio.

The <AmbientalAudio> is an ambiental sound or music that will be started when the player enters into the scene, and stoped when the player exit the scene. You have to use the resource id of an audio/music file between the <AmbientalAudio> tag in order to use the ambiental audio feature.

[edit] Hotspots.

The hotspots are areas which triggers certain events upon some player's

[edit] Gatespots.

The Gatespot are exit and entry points into a scene. The Gatespots are connected among them. If you exit from a scene A to the scene B your character will go to the Scene B and it will be placed over the gatespot which Destination is the Scene A.


 <GateSpot enabled="true">
   <Name>Creepy forest</Name>
   <Destination>forestRight</Destination>
   <Position x="0" y="220"/>
   <Size w="20" h="60"/>
 </GateSpot>	


Name: The <Name> field of a GateSpot is a Label or description of the scene where the player will going to be.

Destination: Is the Scene id where the player would be taken if the player's character stand up over the gatespot' area.

Position: Is the position's coordinates of the gatespot on the scene.

Size: Is the width and height of gatespot's the rectangular area .

[edit] ActionSpots.

The ActionSpots are polygonal interactive areas on the scene which are invisible and behave like an item on the scene.

 <ActionSpot id="ANightSky">
   <Name>Dark blue sky</Name>
   <Description>A beautiful night sky</Description>
   <Position x="200" y="5"/>
   <DefaultAction>Lookat</DefaultAction>
   <Shape>
     <IntPoint x="0" y="0" />			
     <IntPoint x="250" y="0" />
     <IntPoint x="250" y="100" />
     <IntPoint x="0" y="100" />
   </Shape>
   <InteractionPoint>
     <IntPoint x="200" y="248"/>	
     <behaviour>standingright</behaviour>
   </InteractionPoint>		
 </ActionSpot>

Every ActionSpot must have an Id and unique name to identify, by convention I usually us the prefix “AS” (for Action Spot) before the name to know that that name is an ActionSpot.

Name: Is the name that will be displayed in the interface, is not an Id is just a text to show in the interface or conversations.

Description: Is the description of the action spot, in some adventure systems this will be the text to display when the players look at this item with the “Lookat” action.

Position: Is where you set the scene's coordinate for this ActionSpot in pixels.

DefaultAction: Is the default action to use when no action was selected previously. For example in the old Scumm system you can use the default action by pressing right click on an object, and this action is highlighted on the actions menu when you mouse over the object. In WAK you can use the default action by holding the Shift key and left clicking over an object (there is no right click in flash).

Shape: Is a collection of point which defines the polygonal area of this ActionSpot.

InteractionPoint: In some adventure systems like Scumm or SCI some times, the player should walk to some special spot in the scene in order to interact in some way with an item on a scene. Once the player is standing over that specific spot then the interaction starts, the interaction could be anything, look, talk, pick up, etc. That spot where the player walks is called by WAK the InteractionPoint in Scumm all the actions are started after the player's character walked to the InteractionPoint. And the player always will walk to the interaction point first, before start whatever action that the player started. In SCI is different and I leave that choice to the adventure's author if he or she has choosed to use the SCI system, is up to the author to make the player walk to the interactionPoint or not. That is because in the Sierra adventure games there is plenty of action that can be done by only being in the same room of an object. For example you can look any item in a room without to walk to the item. The <behaviour> field inside the InteractionPoint is an Animation Behaviour that will be set after the player's character finished the walk to the Interaction point. For example you want that the character looks at the same direction that the object what is looking or talking.

[edit] PlayerCharacter

The <PlayerCharacter> is the id of the character that the player will use for this scene.

[edit] StartingPoint

Is the position in tiles on the scene where the player's character will start the first time that the player enters the scene. This is usually used for scenes which are the first scene in the game otherwise the player's position will be determined by the gatespots when the player changes between scenes.

[edit] Walk speed

The <WalkSpeed> tag is the movement speed value of the player's character for the scene.

[edit] ScaleRate

ScaleRate is the scaling speed ratio for the player to give the sensation of depth in the scene, it is a very sensitive value, small values make great difference so start trying from small values like 0.01 .

[edit] ScaleBase

Scale Base is the scaling percentage multiplier for the maximun scaling value applied to the player's character display.

[edit] WalkBehinds

The walk behinds areas are images which are cutted pieces of the background image. These pieces has a depth which is managed by the scene. So if you have two objects in the scene and one is closer to the camera than the other , the object closer to the “camera” will be displayed over the second object. You do this using the <WalkBehindArea>.

 <WalkBehindArea>
   <DisplayObject>wbeh1</DisplayObject>	
   <Baseline>340</Baseline>
   <Position>
     <IntPoint x="0" y="275"/> 				
   </Position>
 </WalkBehindArea>


DisplayObject : is the resource id of the depth managed image.

Baseline: Is a coordinate on the vertical axis Y. The vertical axis has its zero value in the top border of the screen. So any object with an Y coordinate lesser than Baseline value will be displayed behind the <WalkBehindArea> and vice versa. If any object or character in the scene has a greater value on Y (or in other words, is closer to the bottom border of the screen than the WBArea.) this will be displayed over the WalkBehindArea . If you not set a value for the Baseline, a default value will be calculated using the position and the <DisplayObject>'s height.

Position: Is the position's coordinates for the area, in pixels.

[edit] Scene Items

WAK makes difference between items in a scene ands items on an inventory. The items that you can find on a scene are called SceneItems. And is in the <SceneItems> section of the Scene where you define the items that a scene will have. You add every particular item by adding an <SceneItem> tag to the <SceneItems> section.


 <SceneItem id="SIShovel" visible="true">
   <Name>Shovel</Name>
   <Description>A shovel left in the road.</Description>
   <Views>
      <DisplayObject state="default">stash</DisplayObject>
   </Views>
   <DefaultAction>Pickup</DefaultAction>
   <StartingPoint>
     <IntPoint x="123" y="248"/>
   </StartingPoint>
   <InteractionPoint>
     <IntPoint x="173" y="248"/>	
     <behaviour></behaviour>
   </InteractionPoint>
   <Baseline>5</Baseline>
 </SceneItem>


Every SceneItem must have an Id and unique name to identify, by convention I usually us the prefix “SI” (for Scene Item) before the name to know that that name is an Scene Item. An item could start hidden to be show up later after some player action, you set the visibility of an Scene item setting the “visible” attribute to true or false.

Name: Is the name that will be displayed in the interface, is not an Id is just a text to show in the interface or conversations.

Description: Is the description of the scene item, in some adventure systems this will be the text to display when the players look at this item with the “Lookat” action.

Views: You can have multiple views or DisplayObject for an item, the attribute "state" is an id to assign a relation between an state and a DisplayObject and then ask to the item to switch between states. The only built-in state is "default" beside that you can use any name for your states.

DisplayObject: Is the resource id used to represent the item on the scene in a certain state.You can have several DisplayObjects in for differents states.

DefaultAction: Is the default action to use when no action was selected previously. For example in the old Scumm system you can use the default action by pressing right click on an object, and this action is highlighted on the actions menu when you mouse over the object. In WAK you can use the default action by holding the Shift key and left clicking over an object (there is no right click in flash).

StartingPoint: Is where you set the scene's coordinate for this SceneItem in pixels.

InteractionPoint: In some adventure systems like Scumm or SCI some times, the player should walk to some special spot in the scene in order to interact in some way with an item on a scene. Once the player is standing over that specific spot then the interaction starts, the interaction could be anything, look, talk, pick up, etc. That spot where the player walks is called by WAK the InteractionPoint in Scumm all the actions are started after the player's character walked to the InteractionPoint. And the player always will walk to the interaction point first, before start whatever action that the player started. In SCI is different and I leave that choice to the adventure's author if he or she has choosed to use the SCI system, is up to the author to make the player walk to the interactionPoint or not. That is because in the Sierra adventure games there is plenty of action that can be done by only being in the same room of an object. For example you can look any item in a room without to walk to the item. The <behaviour> field inside the InteractionPoint is an Animation Behaviour that will be set after the player's character finished the walk to the Interaction point. For example you want that the character looks at the same direction that the object what is looking or talking.

Baseline: Is the same concept of base line used for the WalkBehindareas. It is a Y coordinate to know how to set up the SceneItem's depth on the scene.

[edit] Scene Characters

If you want add others characters which are not the character used by the player to the scene, you must add them to the <SceneCharacters> . This section is to describe the character's positions in the scene.

 <Character x="100" y="300" behaviour="standingleft">
   <CharId>GuybrushClone</CharId>
   <InteractionPoint>
     <IntPoint x="180" y="290"/>
     <behaviour>standingleft</behaviour>	
   </InteractionPoint>
 </Character>	


The X and Y are coordinates in pixels of the character's position on the scene. The behaviour attribute is to set an animation behaviour for the character.

CharId: Is the character's id, the same which is assigned in Characters.xml .

InteractionPoint: Is the same concept explained for sceneItems. A coordinate in the scene where the player will walk in order to interact with this character. The behaviour of the interaction point is an animation behaviour that the player's character will have after the walk.