RenderWare Studio
RenderWare Studio
Version 2.0.1
Published 07 September 2004
© 2002-2004 Criterion Software Limited. All rights reserved.
RenderWare Studio User Guide
Contents
What's new 8
Version 2.0.1 9
Version 2.0 11
Upgrading from version 1.2 20
Database conversion errors 25
Database format differences 26
Retaining Workspace customizations 27
Known issues 30
Version 1.2.2 31
Version 1.2.1 32
Version 1.2 34
Version 1.12 46
Version 1.11 50
Version 1.1 51
Version 1.01 58
Version 1.0 60
Version 1.0 RC1 62
Introduction
What is RenderWare Studio? 66
What does RenderWare Studio do? 69
Basic concepts 71
Game database 73
Game database XML files 76
Customization 80
System requirements 82
Getting started 85
First steps 86
Requesting a permanent license 95
Getting started with VBScript 96
Designing games
Creating and editing a project 97
Creating a new project 98
Importing assets 101
Asset properties 102
RF3 files 104
Controlling the camera 108
Camera flight controls 111
Moving the camera in orbit mode 113
Setting camera sensitivity and frame rate 115
Using keys to control flight 117
Creating and working with entities 119
Selecting entities
3
RenderWare Studio User Guide
4
RenderWare Studio User Guide
5
RenderWare Studio User Guide
6
RenderWare Studio User Guide
7
RenderWare Studio User Guide
Release notes
8
RenderWare Studio User Guide
Installation
The installation program will update an existing installation of RenderWare Studio
2.0. Alternatively, you can install a complete version of RenderWare Studio 2.0.1
from scratch.
New features
Maya-like flight controls in Workspace
Workspace's Design View now supports flight controls like those in Alias's
Maya software, as well as those in Discreet's 3Ds Max. For example:
Alt+left mouse button selects orbit mode
Alt+middle mouse button pans the camera
Alt+right mouse button dollies the camera
Bugfixes
Excessive Workspace memory requirements
Under some circumstances, RenderWare Studio 2.0 loaded the same
texture many times, resulting in high memory usage. This has been fixed in
2.0.1.
Failure to import a level from another project
If the entity/asset GUIDs of a level being imported matched those of the
open project in Workspace 2.0, importing that level would fail. This has been
fixed in 2.0.1.
Workspace hangs if /close is specified on the command line
Using /close to terminate Workspace automatically after running from the
command line caused RenderWare Studio 2.0 to hang. This has been fixed
in 2.0.1.
9
RenderWare Studio User Guide
10
RenderWare Studio User Guide
Overview
RenderWare Studio 2.0 incorporates some significant changes over previous
versions to improve usability, multi-user database modifications, customization,
and performance. Several new Workspace tools have been added, such as the
Sequencer for animation and cut-scene authoring. These release notes describe
the new features, changes, and information for users upgrading from previous
versions.
Workspace
New tools
Sequencer
The new sequencer tool (p.317) is a general-purpose editor for animating sets
of entity attributes over time. You can use this to create cut scenes, for
example, or as a way of creating easily playable coordinated sequences
within the main game play.
Trigger editor
A new general-purpose volume editor (p.130) lets you interactively create
arbitrary box volumes in the Design View. While Genre Pack 1 interprets
these as trigger volumes, their usage is completely customizable by the
game. Different textures can be applied to the volumes, and build rules
modified to extract the relevant information for the game.
Light mapper
A new tool that ties together several elements of RenderWare Studio
allowing you to set up and preview light maps in the Workspace Design
View. This includes the ability to create and position lights, or to tag
11
RenderWare Studio User Guide
12
RenderWare Studio User Guide
13
RenderWare Studio User Guide
zoom in and out, the magnification steps could be too great, and you could
zoom past the entity too quickly. To fix this, the magnification steps now get
progressively smaller as the camera zooms in. You can also adjust the
sensitivity of the mouse wheel: select Options Flight.
Freeze entities to avoid unwanted selections
To make it easier to select only the entities you want, you can now “freeze”
entities, so that they can no longer be picked: right-click entities in the
Design View or Game View window, and then select Freeze.
Cut, copy, and paste entities
To create a copy of one or more selected entities, right-click the selection in
the Design View, select Copy, point where you want the new copy to
appear, and then right-click again and select Paste. The new entities have
the same name as the originals, with “Copy of ” prepended. (Instead of
right-clicking, you can press Ctrl+C to copy and Ctrl+V to paste.
Similarly, you can cut an entity, and then paste it elsewhere (this has the
same effect as simply moving the entity).
Spline editor: adjustable node size and offset
New Spline Options dialog (Options Spline) allows you to set the offset
position of new nodes, and the display size of nodes, when creating a spline
curve (p.128).
Game database
Load on demand brings speed improvements and scaleability
Users with large databases (p.76) will gain performance benefits from the new
load-on-demand mechanism that loads only the parts of a database that a user is
interested in. The mechanism has been designed to provide good scaling
behavior as games move towards next-generation consoles with very large data
sets.
Existing users who have their own custom controls that access the game
database should refer to the section on upgrading existing customizations.
RF3 enhancements
When you open a project, the Message Log window now tells you if you have not
set the RF3 project template path. The Build Log window shows more information
about the progress of RF3 exports.
The RenderWare Exporter RF3 project and asset template editors are now
available as windows in Workspace.
Persistent properties
This new feature allows you to attach user-defined property data to any database
14
RenderWare Studio User Guide
node. This allows you to add arbitrary data to assets, for example. The data can
optionally be persisted. The data is accessed through an API, also available at
the automation (script) level.
PurgeDeleted tool
The PurgeDeleted tool, supplied in
Studio\Programs\Tools\PurgeDeleted, deletes database XML files left
over from previously deleted objects (p.177).
NXN alienbrain
RenderWare Studio 2.0 requires NXN alienbrain (p.187) version 7.
Change set functionality included
You can now use change sets for atomic multi-change submissions
Multiple checkouts
You can now check out more than one object at a time or select single
objects to check in or revert.
alienbrain properties and version history
Context menu options allow you to view the alienbrain properties and
version history directly from Workspace.
Custom columns
You can customize the alienbrain Manager client window to show the Name,
Description, and Type tags of a game database (p.76) XML file.
Script-based integration
The interface between RenderWare Studio and alienbrain is now managed
by script within the REN file.
Removal of “local edit” feature
The provision of multiple checkout support means that the Local Edit
feature, introduced in RenderWare Studio 1.2, is redundant and has been
removed.
15
RenderWare Studio User Guide
Customization
Split REN files
The powerful customization mechanism that enables users to add their own
controls and logic to Workspace has been extended. Before RenderWare Studio
2.0, the REN file was a monolithic entity containing the definition of Workspace's
user interface and its corresponding VBScript code. In version 2.0, this
information is split into a set of application source files (p.426) that are managed
together as a project.
REN projects
In version 2.0, you still open a REN file in Enterprise Author when you want to
customize Workspace. However, that file now has the same role as the .vcproj
file in Visual C++, or the .rwstudio file in RenderWare Studio. Each control in
Workspace's user interface has its own, dedicated configuration files. As well as
providing greater modularization and easy browsing, this scheme simplifies
deployment of customizations and handling of updates.
API changes
Extension object: add .dff files into Design View
The new LoadStream method allows you to add .dff files into the Workspace
Design View window.
16
RenderWare Studio User Guide
RWSSaveFlags Flags);
RWS_API RWSID RWSProjectImport(const RWSChar* const szProjectFilename,
const RWSChar* const szFolderGUID);
RWS_API RWSID RWSLoad(const RWSChar* const UID, RWSIDType Type);
RWS_API void RWSSave(RWSID ID);
Note: The last two items allow the loading and saving of individual objects. They
also have script equivalents in RWSScript.
The version control functions are now in VersionControl.js.
IsProjectManaged()
GetLatestVersion()
IsPathManaged(strPath)
GetPersistStatusInformation(ID)
GetFileStatus(strFilename)
GetFileVersionString(strFilename)
GetFileUsersString(strFilename)
CheckOutFile(strFilename, bOnlyIfLatest, bShowDialog)
UndoPendingChangesForFile(strFilename)
SubmitPendingChangesForFile(strFilename)
ImportFile(strFilename)
CheckOutAPIObject(oAPIObject, bOnlyIfLatest, bShowDialog)
UndoPendingChangesForAPIObject(oAPIObject)
SubmitPendingChangesForAPIObject(oAPIObject)
GetLatestVersionOfAPIObject(oAPIObject)
SubmitDefaultChangeSet()
UndoDefaultChangeSet()
OnPermit(ID, RefID, Action)
Broadcast events
The new broadcast mechanism (p.450) in RenderWare Studio 2.0 simplifies adding
custom controls to the Workspace user interface. It allows code in any control to
call methods with the same name in every other control in the application.
Workspace uses this mechanism to create a set of “standard” method calls that
are guaranteed to be broadcast when certain events occur (such as the
application starting up, or a project being saved). If a control should take action
when such an event takes place, it just needs to implement a method with the
appropriate name. Failure to implement a “standard” method does not result in an
error.
New documentation
As well as extensive updates that reflect feature changes, the RenderWare
Studio 2.0 documentation includes new topics and tutorials on customizing
Workspace (p.423), and on the relationship between Workspace and the Game
Production Manager.
17
RenderWare Studio User Guide
been updated. They now install into and generate code for Visual C++ 7.1, which
ships with Visual Studio .NET 2003.
Stand-in control
It can happen that a control required by an Enterprise Author-generated
application is unlicensed, or unregistered, or wrongly located. The new stand-in
control means that Workspace, for example, can continue to operate—in a
restricted mode—in this situation. The stand-in control takes the place of the
missing control in the user interface, reports its name, handles calls to methods
on the missing control without raising errors, and causes warnings to appear in
the Message Log window.
Game Framework
.NET projects supplied, VC6 dropped
The Game Framework source is now supplied with Visual Studio .NET
project files (.vcproj), not Visual Studio 6 project files (.dsw and .dsp).
Sequencer behaviors
Game Framework includes behaviors for use with the sequencer (p.180).
Fast attribute system
Provides a table of offsets to behavior data, allowing you to set values
directly, rather than using the slower method of sending an entire array of
values.
Bugs fixed
A number of bugs from previous versions have been fixed as part of the 2.0
development. The following list simply highlights those that have been raised as
particularly important customer issues, rather than an exhaustive list of what has
been done.
• Wrong context menus (right-clicking sometimes displayed the incorrect
context menu)
• Fixed destruction order (game database objects are now destroyed in
reverse order of their construction.
• File Save Project As... copies build rules (project\Build Rules
folder)
18
RenderWare Studio User Guide
• Game Explorer closing folder leaves selection (closing a folder with selected
sub-items now clears the selection)
• Texture dictionary generation now works with non-embedded assets
• Attribute editor scrolling fixed
• Undo stack no longer cleared by a save
• Attribute window display speed improved
Upgrading
To upgrade from RenderWare Studio 1.2, see the detailed, step-by-step upgrade
procedure (p.20).
19
RenderWare Studio User Guide
Summary
The recommended approach is to upgrade the alienbrain server first, and then let
your team continue working with RenderWare Studio 1.2 and the alienbrain 6
client. Meanwhile, a system administrator tests the upgrade to RenderWare
Studio 2.0 and the alienbrain 7 client on one PC, using a snapshot of the
database. When the system administrator has completed testing, they instruct the
team to check in all files and stop working. Then the system administrator gets
the latest database files from the server, converts them to 2.0 format, and then
replaces the 1.2 database files on the server. Finally, each team member
upgrades their PCs to RenderWare Studio 2 and the alienbrain 7 client, and then
resumes work.
Use the table below to familiarize yourself with the overall procedure. The table
presents an abridged version of the procedure; to perform the upgrade, follow the
detailed steps presented after the table.
Note: In this topic, project.rwstudio refers to the RenderWare Studio project
that you want to upgrade.
20
RenderWare Studio User Guide
21
RenderWare Studio User Guide
If you want only a single period of downtime, rather than the two described
above, then you can upgrade the alienbrain server (stage 1) during stage 4.
However, there are benefits to upgrading the alienbrain server in a separate,
initial stage:
• It minimizes the number of changes that you are making to your system at
the same time, making it easier to diagnose problems.
• The idea of stage 2 is to test the upgrade on a single PC before rolling it out
to the game development team. If you leave the alienbrain server upgrade
until later, then stage 2 will not be a true test of the upgraded environment;
you will not be able to test the alienbrain functionality, because RenderWare
Studio 2.0 does not work with alienbrain 6.
22
RenderWare Studio User Guide
11. Resolve any database conversion errors (p.25) reported in the Message Log
window.
12. Build the game data stream and connect to a target. Check that the game
still runs.
23
RenderWare Studio User Guide
24
RenderWare Studio User Guide
</RenderWareStudio>
25
RenderWare Studio User Guide
You do not need to know these details to follow the upgrade procedure, but it's
useful to note that there are only a few differences between RenderWare Studio
1.2 and 2.0 game databases:
• In RenderWare Studio 1.2, if a database object had children, then the
object's guid.xml file contained <ObjectReference> elements that
referred to those children. In RenderWare Studio 2.0, these are now
<ChildReference> elements:
<ChildReference id="guid" type="object type">
where object type identifies the type of child object referred to by the guid
(for example, an entity typically has one or more RWSAssetID children).
• If a database object has parents, then the object's guid.xml file contains
new <ParentReference> elements that refer to its parents:
<ParentReference id="guid" type="object type">
where object type identifies the type of parent object referred to by the guid
(for example, RWSFolderID).
• The XML file for the global folder has been renamed from:
project\Folders\guid.xml
to:
project\Folders\RWS_GlobalFolder.xml
• The following new XML files store the hierarchies shown in the Assets,
Attribute Shares, and Templates windows, respectively:
project\Folders\RWS_AssetHierarchyFolder.xml
project\Folders\RWS_AttributeShareHierarchyFolder.xml
project\Folders\RWS_TemplateHierarchyFolder.xml
• The value of the version attribute, in the root <RenderWareStudio>
element of each XML file, has been changed from “1.2” to “2.0”:
<RenderWareStudio version="2.0">
26
RenderWare Studio User Guide
Customization strategies
In general, customizations to Workspace fall into four categories:
• Changes to the positions of windows in the application at startup, including
the creation of new layouts
• Modifications to Workspace's supplied menus and toolbars
• Creation of new objects (controls, menus, toolbars, etc.) for Workspace
• Alteration of the supplied default script code to incorporate new objects
Layout changes
The new version of Workspace introduces new windows, gets rid of some old
ones, and comes with a range of built-in layouts. It also stores information about
window positions and layouts in a different format. For these reasons, it is not
possible to take old layout specifications and turn them into new ones.
27
RenderWare Studio User Guide
If Workspace's built-in layouts do not cater for your needs, you can recreate your
custom ones (or equivalents of them) by hand in Workspace itself, or in
Enterprise Author. When you've created a new layout for Workspace, distributing
it to users just involves copying .Layout files from your computer to theirs (p.335).
Custom objects
If you've created custom objects (ActiveX controls, pages, or menu bars) for
previous versions of Workspace, the process of loading and saving the old REN
file will generate the .RENobj and .vbs files (p.426) that you need in order to install
them into the new version. This is a big step towards reproducing your old
customization, and depending on how the object works, it may even be all you
need to do. In general though, there will be further considerations (usually
involving script code—see the next section), and there will certainly be steps that
you can take to make customization easier in future.
Note: In most cases, ActiveX controls that you've written for earlier versions of
Workspace will work in the new version without recompilation. Should you want
to update these custom controls, you should consider recreating them using the
new version of the RenderWare Studio ActiveX control wizard (p.477).
ActiveX controls
Custom ActiveX controls can perform many different tasks, but their interactions
with Workspace tend to be similar. It's a common requirement for them to
initialize themselves or change their appearance in response to things happening
28
RenderWare Studio User Guide
Pages
In terms of their interactions with Workspace, pages need to be notified of the
same events as ActiveX controls, and there is no difference in the way this
should be dealt with. If you've previously added code to the supplied scripts, you
should try to transplant it to the .vbs files of your custom pages.
Menu bars
The new technique for customizing default menus was described earlier, but
there are also changes to the way that menu item selections are handled. If
you're creating a new menu, you should not use the IDs of items to determine
which one has been selected. The new version of Enterprise Author allows you to
specify the name of an event to be fired by each menu item (p.467), and you should
deal with selections by handling these events in your code.
29
RenderWare Studio User Guide
Known issues
This section contains known issues and workarounds that have been identified in
RenderWare Studio 2.0. These issues are current as of May 2004.
30
RenderWare Studio User Guide
This release fixes some installation and NXN alienbrain issues, and one minor
user interface bug. The installation program will update existing RWStudio 1.2
and 1.2.1 installations, or alternatively can install a complete version. To update
versions prior to 1.2, please see the release notes for that version.
Changes
Installation fix
The system search path was being modified such that in certain instances it
was found to interfere with the licensing of RenderWare Graphics. This new
install supersedes the manual fix suggested to customers who had this
issue.
NXN alienbrain speed issues
A number of alienbrain-related performance issues have been resolved. Any
customers that used the emergency patch DLLs from CSL support should
update to RWStudio 1.2.2, which contains more complete changes.
Attribute share drag and drop
The ability to create attribute shares by drag and drop has been restored to
this version.
31
RenderWare Studio User Guide
Overview
This release of RenderWare Studio is primarily to address database load times,
bugs and documentation issues found subsequent to the release of version 1.2.
A small number of minor feature requests have also been included.
Installation
The setup process will upgrade existing RenderWare Studio 1.2 installations to
version 1.2.1.
If RenderWare Studio has not been previously installed on a machine, then the
setup process will install a full version 1.2.1., therefore it is not necessary to
install 1.2 before 1.2.1.
Note: If a version of RenderWare Studio earlier than 1.2 is installed, then users
should follow the upgrade instructions in the 1.2 release notes (p.34).
New features
Faster load
Database load time has been significantly improved. The improvement
factor varies considerably with the database, but tests have shown typical
gains of between 2x and 5x over previous versions.
Fewer steps required to create an asset
A quick way to bring a new asset into the game database is available from a
context menu in the asset view. Right click in the window and select New
Asset.
Build All and Clean All options
The Build operation in the 1.2 Workspace simply built the currently active
level. The entire game database can now be rebuilt from the Workspace
using new “Build All”, and “Rebuild All” options. A corresponding “Clean All”
operation is also provided.
Command line options
The clean and build options in the Workspace can now be run from the
command line for batch build processes, to clean and/or build all folders in
the game. For example:
C:\RW\Studio\Programs\RWStudio.exe /game
"C:\RW\Studio\Examples\Example Alpha Sort.rwstudio" /clean
"Connection2"
Connect without build
In version 1.2, selecting “Connect” to a console caused the Game
Production Manager (GPM) to check if any streams needed rebuilding, and
then invoke a build if necessary. Even if nothing had changed, the check
processing itself caused unwarranted delays. To alleviate the delay, the
“Connect” operation has been changed so that it no longer does this initial
check, and a new menu has been added called “Build and Connect” that
works like the old mechanism.
32
RenderWare Studio User Guide
Note: Since the decision to check on data validity has now been left to the
user, the success of the “Connect” operation depends on the database not
having changed significantly. If problems occur, simply execute “Build and
Connect”.
Game Production Manager documentation
The introduction to the GPM has been extended, and a simple tutorial
added. (More GPM documentation will be included in the next release,
including details on the supplied build rules.)
Game Framework
Changes to the game framework have been minimal for this release. These
include:
Warnings generated on Maximum level with ProDG now removed
Some small changes have been made to the Game Framework files to
remove warnings that were generated at maximum warning level setting
when compiling with SNSystems™ ProDG for the PS2 target.
33
RenderWare Studio User Guide
Overview
RenderWare Studio 1.2 contains many changes with major enhancements in the
following areas:
• The introduction of a fully customizable and flexible game build process
• Structured game databases
• Improved 3D interaction
• Memory and performance tools
The new features are explained in more detail below. Existing users should read
the notes on upgrading existing installations.
The Game Framework is largely untouched since velease 1.12, except to show
and exploit some of the new features such as the memory and performance
diagnostic tools, linear memory manager, and global entities.
New features
Game Production Manager (automated asset management and image
production pipeline)
The major feature of this release is a customizable and flexible mechanism
for transforming original game data (assets, entities etc.) into the final
deliverable format. The Game Production Manager (GPM) handles
dependencies, custom processing and stream creation. It forms the core of
all the game data processing and sits at the centre of the whole game
development process.
The GPM offers the following capabilities:
• Ensures consistency of data across all team members.
• Rule-driven asset dependencies and transformations. This enables, for
example, automated creation of texture dictionaries.
• Incremental in-game asset handling managed by an integral
“make”-like component.
• Completely customizable.
• Support for asset validation (the facility to abort the build based on
custom rules).
• Batch-driven capability to enable automated, repeatable full builds of all
or parts of the game.
• Easy custom network packets/command definition.
• Rapid development of the final build process.
34
RenderWare Studio User Guide
.rf3 support
RF3 files contain platform independent intermediary export data in XML
format. Unlike .rws files, which are RenderWare Graphics optimized binary
files, .rf3 files contain no rendering optimizations, and are simply a
snapshot of the raw 3D data. RenderWare Platform developers can compile
these .rf3 files into optimized platform-specific RenderWare Graphics
binary files, (.rws, .rp2, .rg1, .rx1 etc.) using a custom tool.
With this release of RenderWare Studio, the compilation process is handled
by the Game Production Manager transparently. A benefit of this is that
original art assets can be stored as .rf3 files, and automatically converted
to platform-optimized files without extra processing steps required by artists
and designers.
3D interaction interface
The user interface for interacting with the 3D Design View has been
overhauled to make it much easier to mix selection and movement
operations. Using a set of modifier keys, artists and designers can quickly
35
RenderWare Studio User Guide
move around objects of interest without having to use menus and toolbars to
change modes.
Various related enhancements have also been made to the dragging
mechanism; for example, there is a new selection lock feature, and a mode
to drag objects along a surface.
RenderWare Studio Manager COM interface (for script programming)
In addition to the existing C++ API, you can now program the RenderWare
Studio Manager via a COM interface. This allows you to use the
RenderWare Studio Manager in script applications, including:
• Enterprise applications (.ren), such as the RenderWare Studio
Workspace
• Visual Basic applications
• HTML applications (.hta)
This feature enables easier and more powerful customization, and has been
used as part of the implementation of some of the other features such as the
database search tools. It is also extensively used by the Game Production
Manager.
XML format for .ren files
The customizable user interface is described by a .ren file, which defines
the ActiveX controls, menus, scripts, and dialogs used by the Workspace.
Prior to version 1.2, this was a custom format binary file, but is now XML.
This provides easier tracking of changes, particularly for the user interface
scripts that tie everything together, in addition to making it easier for more
than one person to edit the user interface at the same time. See notes below
on updating your existing .ren files to the new format.
Graphics and animation preview tool
The new Preview tool for the Workspace lets you inspect graphics objects
and animations. You can either drag objects from the current game
database, or drag asset files from Windows Explorer (without having to
import them into the game database). The Preview tool also provides
relevant statistical information such as number of triangles and bones.
NXN alienbrain integration changes
The alienbrain integration has been enhanced to provide several new
features:
• Option to automatically import assets into alienbrain when added to the
game database.
• When getting the latest version of the database from alienbrain from
within Workspace, users are offered the option of getting all the latest
assets.
• Identify who has what checked out from alienbrain by displaying a
“Checked Out” column in the Game Explorer window.
Structured database
Earlier versions of RenderWare Studio provided a limited form of structuring
the game database that has been completely overhauled and replaced with
a structured database hierarchy. This removes the idea of fixed,
level-oriented containers; now you can organize entities, assets, and
templates into nested folders. Key elements of this new database structure
36
RenderWare Studio User Guide
are:
• “Folders” replace “Collections”. The folder is similar in concept to the
earlier collection idea, except that it can now contain other folders. The
folder also replaces the previous “Level” object, as it offers the same
functionality. For certain situations, typed folders can be created that
restrict the contents of the folder.
• “Attribute Shares” replace “Attribute Collections”, which is effectively a
dedicated Manager API object type.
• Multiple references (shortcuts) to objects and folders can be created.
Existing users should note a slight change to the Asset window. In previous
releases, double-clicking an asset thumbnail showed an in-place 3D
preview, allowing the object to be zoomed and rotated. Since assets can
now be arranged into hierarchies, double-clicking has been chosen as a
natural way to open the asset folder. To preview thumbnails, you now
right-click the thumbnail and then click Activate Preview.
Global entities
Within the new structured database hierarchy, there is always one folder
that can be used to store entities and assets that are “global”. This global
folder is not removed from the console when the active folder is changed.
Typical uses of this are for game engine-type entities that exist for the entire
lifespan of a game, rather than being level-dependent.
The global folder is automatically added to new projects.
Database search
A facility has been added to run a number of common search operations
over the database. For example, to find all entities that reference a particular
asset, or all objects that match a particular name. As these searches are
written using the scripting interface to the RenderWare Studio Manager API,
you can easily extend the searches for your own needs. For your
convenience, all the searches are in a script module called “Searches” that
you can find by loading the CustomInterface.ren file into Author. Most
searches are initiated by context menus defined in the .ren file.
Entity and folder game reset
A new feature that allows a subset of entities to be reset in the design build
of the game has been added for this release. This is useful when tweaking
game play, and the designer just wants to reset something before trying a
different value. This feature can also operate on folders, so that entire parts
of the game can be reset just by sending the entity attribute packets, rather
than resending all of the assets.
Linear Memory Allocation
This new game framework optimization exploits the Game Production
Manager to create contiguous memory buffers for looking after multiple
entities of the same type. This can be enabled on a per-behavior basis, and
helps prevent memory fragmentation.
Event editing and viewing enhancements
The event handling user interface has been improved. In addition to
substantial changes to the Event Visualizer window (now called Event Map)
to enhance clarity and navigation, a new Events window has been created
to allow browsing of all event messages in the system. Event messages can
be dragged from this view and dropped in the relevant attribute editor slot.
37
RenderWare Studio User Guide
38
RenderWare Studio User Guide
With an object selected in the 3D Design View, you can find it in the main
Game Explorer window by right-clicking to display the context menu and
selecting the relevant option.
Automatic texture dictionary update
This facility is part of the new Game Production Manager.
Raytest API in 3D User Extensions
The 3D user extensions API now provides a method to manage raytests
within the 3D view.
Folders in folders
This is part of the new structured database feature.
Template collections / set piece dragging
Part of the new structured database, folders can be turned into templates.
Dragging a template folder into the Design View instantiates a copy of all the
contained items into the view.
Removed large flat entity and asset lists
As part of the structured database development, the game database view
(now called “Game Explorer”) has been simplified to remove the large flat
lists of entities and assets.
Flattened attribute editor
The attribute editor now defaults to showing the exposed attributes for all
subclasses, while retaining the facility to filter this as before.
.NET project files for Game Framework on Xbox
The Xbox projects for the Game Framework are all provided as .NET
projects.
Unique attribute packet identifiers
Some customers have been using levels as ways of creating different
streams for use at various parts of the game, and had to work around the
issue that attribute packet IDs were unique only within a stream. This is now
fixed. See below for changes needed to attribute handler code.
Default timeout value
The default network send timeout for connections has been set to 10000ms
(10 seconds). If this timeout period expires whilst the workspace is sending
data to a connected target, the connection will be dropped. If you wish to
debug your connected target code during a data send, you should check the
“infinite” timeout checkbox in the connection properties dialog. This stops
the connection being dropped whilst you are debugging for more the timeout
period.
Choice of IDEs for viewing source
You can now set which editor should be used when viewing source code
from within Workspace. The choice is between Visual Studio 6, Visual
Studio .NET, and CodeWarrior. Alternatively, if you just use the system
default association, Workspace will attempt to locate the editor that is
associated with C++ header files. Users should note, however, that in some
circumstances this means that the file can be loaded but the correct line will
not be selected. It is recommended that you explicitly set your editor of
choice from the Options Workspace dialog to ensure proper navigation
within source files.
DirectX9
39
RenderWare Studio User Guide
40
RenderWare Studio User Guide
Texture dictionaries
Since the GPM now creates texture dictionaries automatically, there is no longer
any need to explicitly add these to the game database. You should remove any
texture dictionaries as part of the database update process.
41
RenderWare Studio User Guide
42
RenderWare Studio User Guide
Attribute handlers
Attribute handlers are now identified by the unique persistent ID rather than the
ID, so in the attribute handler code you will see code like:
void Add(unsigned int instanceId);
static void Remove(unsigned int instanceId);
static CAttributeHandler* Find(unsigned int instanceId);
changed to:
void Add(RWSGUID & instanceId);
static void Remove(RWSGUID & instanceId);
static CAttributeHandler* Find(RWSGUID & instanceId);
This means that the attribute handlers are globally unique eliminating the
problems with loading multiple streams. To make use of this you need to ensure
you have run GUID enforcer on any databases created before RWStudio release
1.1 (see above).
Resources
RWSGUIDs are now used to identify resources in a similar way to the attribute
43
RenderWare Studio User Guide
handlers. The UID of an asset in the game framework will be the same as the ID
used for the resource in the workspace.
Stream changes
The format of the data in the RwStream objects for assets and entities has
changed due to the unique IDs mentioned previously, and also for the flagging of
objects as global. The functions that have been updated accordingly are:
CreateEntity() in attribhandlerstrfuncs.cpp
LoadAsset() and LoadEmbeddedAsset() in resourcemanagerstrfunc.cpp
Memory profiling
To take advantage of the new memory profiling tool in the metrics layout in
the workspace, add the following files
core\memoryhandler\memoryprofile.cpp
core\memoryhandler\memoryprofile.h
Allocation policies
You will need to add the following files to handle the new linear memory
manager feature
core\attributehandler\Allocation
Policies\dynamicallocationpolicy.h
core\attributehandler\Allocation
Policies\linearallocationpolicy.h
core\attributehandler\linearallocationpolicy.h
core\attributehandler\linearallocationpolicy.cpp
44
RenderWare Studio User Guide
…\console\game_framework\source\modules\fps\fpstriggers\MyBehavior.h(63) :
see declaration of 'MyBehavior'
…\console\game_framework\source\modules\FPS\FPSTriggers\MyBehavior.cpp(54)
:
error C2065: 'UseLinearMemory' : undeclared identifier
In 1.2 the class factory has been modified to optimize memory allocations
for entities. For each behavior you will need to choose an allocation policy.
We have provided two allocation policies: LinearAllocationPolicy and
DynamicAllocationPolicy. We suggest the LinearAllocationPolicy as this will
minimize fragmentation and the overhead of an allocation per class
instance. To fix the compiler error you need to derive the behavior from one
of the allocation policies. That is:
class MyBehavior : public CSystemCommands, public
CEventHandler, public CAttributeHandler
{
}
change to:
#include "framework/core/attributehandler/allocation
policies/LinearAllocationPolicy.h"
45
RenderWare Studio User Guide
This release provides a new refactored game framework and a number of bug
fixes to the Workspace.
Installation
1. If you are installing from a CD-ROM:
a. Insert the CD-ROM.
b. The setup program should start automatically. If it does not, then run
Setup.exe in the CD-ROM root folder.
If you are installing from a download:
a. Download the 1.12 update .zip file.
b. Extract the zipped files to a temporary folder of your choice (for
example, C:\RWS_Update).
c. Run Setup.exe.
2. Click Next.
A dialog box informs you that a backup of the existing game framework
console folder will be created.
3. Click OK.
A dialog box informs you that a backup of the custom interface .ren file will
be created.
4. Click OK.
The setup program completes the installation.
5. Click Finish.
46
RenderWare Studio User Guide
Game framework
The most significant change to this release is the refactoring for the game
framework to make it easier to include just those services that your game
requires. For the purpose of providing the simplest RenderWare Studio
framework application, a new empty framework is also provided. These are
described below.
As part of the refactoring, a number of framework and documentation bugs have
been fixed.
Refactored and empty frameworks
RenderWare Studio consists of two parts:
• The Workspace that runs on the PC
and
• The game framework that is the source code that developers are
expected to use to create their game
The game framework projects contain many toolkits and behaviors that can
be confusing to developers when trying to extract the code they actually
want to use. Dependencies within the core have also caused problems.
Based on the feedback from existing developers, for version 1.12 we have
refactored the game framework and created an empty framework.
By refactoring the game framework, we have solidified the core
components, reduced the dependencies within the core, and moved the less
generic components into toolkits. The refactored framework makes the
distinction between the core, toolkits, and behaviors much clearer and
allows developers to select just the components of the framework that they
need much more easily.
In addition to this, rather than providing a large code base and expecting
developers to strip this down to what they need, we have also provided the
empty framework. This is a much smaller code base providing just enough
functionality to boot up the consoles and connect to the Workspace. The
game framework can be considered a specialization of the empty framework
for the purpose of demonstrating a wide range of game behaviors; it is also
a good starting point for getting a game up and running very quickly. For
developers already using the game framework, upgrading to the refactored
framework should be fairly painless, depending on how much the core of the
framework has been modified. Details of the changes can be found in the
change list installed in the framework directory, but an overview is provided
here.
47
RenderWare Studio User Guide
For behaviors, the majority of the changes required will be to the include
paths (for example, in FPSRender.cpp) as well as a few class and function
name changes.
#include "../../../framework/core/Macros/debugmacros.h"
#include "../../../framework/core/MainLoop/render.h"
#include "../../../framework/core/DebugTools/DebugTools.h"
#include "../../../framework/core/World/CRwCamera.h"
#include "../../../framework/core/World/CRpWorld.h"
are now:
#include "framework/core/macros/debugmacros.h"
#include "framework/mainloop/render.h"
#include "framework/toolkits/debugtools/debugtools.h"
#include "framework/toolkits/world/clevel.h"
#include "framework/toolkits/world/helpers/worldhelper.h"
As you can see from the paths some of the components that were part of
the core are now toolkits; also, the projects have been set-up with a path to
the source folder, eliminating the need for complex paths.
New framework installation issues
During installation you will be asked to change the location of the existing
installed game framework source. This is to prevent possible overwrites of
changes developers have made to their local copies, and also provide a
point reference to difference against the new framework. New users who are
using RenderWare Studio for the first time can ignore this, as they will not
have any modifications since earlier installations. It is recommended that the
installed game framework is copied to a folder that is not under the
installation folder.
SN-TDEV for Nintendo GameCube users
This release of RenderWare Studio supports the SN System's
implementation of the T-DEV device. See the procedure for connecting (p.214)
RenderWare Studio to an SN-TDEV.
Broadband adapter support for GameCube
Support is provided for the GameCube broadband adapter. Apart from a
good performance boost in connection times and design-time interactions,
using the broadband connector means that the GameCube Commserver
application is no longer necessary.
Area Trigger behaviors
The new framework provides some simple area triggers and an example
(p.517) showing how they are used.
48
RenderWare Studio User Guide
Workspace changes
While there are no significant new features in Workspace, a few usability
changes and a number of bugs have been fixed.
Entity visibility persisted between sessions
The visible/hidden state of entities in the 3D edit view is now saved in the
user's local game settings. Note that the information is not saved to the
game database.
Alienbrain changes
Extra checks and validations provide better feedback with alienbrain. The
speed of check-ins has also been considerably improved.
Improved diagnostics
The Message Log window (p.297) provides better feedback on what is
happening in the system, making it easier to identify problem assets and
entities. This also helps to identify instabilities related to viewing asset
thumbnails in the Assets window (p.264). For any persistent asset-related
problems, contact Developer Relations for assistance and the latest
information on solutions available in the RenderWare Graphics active build.
49
RenderWare Studio User Guide
This release is a minor release that fixes some bugs and works with version 6.0
SR1 of NXN alienbrain.
Installation
Users should uninstall previous versions of RenderWare Studio before installing
1.11.
Changes
Bugfix - Windows XP Install
The software now installs under Windows XP correctly.
Bugfix - Failed load causing all subsequent loads to fail
If the last file being parsed contained a <Deleted> tag, then subsequent
loads would fail. Fixed.
Bugfix - Workspace graphics crash with textured wire frames
In some circumstances a crash could occur in the workspace when one of
the ortho view display modes was set to textured wire frame. Fixed.
Bugfix - Intermittent Workspace crash
The fix to the crash caused by the vector attribute control that was
previously available with a post 1.1 patch has been included in 1.11.
Bugfix - Files missing for Maestro exporter
The installer has been updated to include texdict.c and texdict.h, which were
missing from the 1.1 install.
alienbrain 6.0 SR1
alienbrain integration is now linked to 6.0 SR1 (124) NxN libraries.
Users are advised to upgrade alienbrain servers and clients to 6.0 SR1.
Updating to RenderWare Graphics 3.5
RenderWare Studio has been tested against RenderWare Graphics 3.4.
However, to enable users who upgrade to later versions, RenderWare
Graphics 3.5 will now install compatible versions of the RenderWare Studio
components required to handle files exported from the latest builds of
RenderWare Graphics. This means that customers will no longer have to
wait for an update to RenderWare Studio to handle the Active Graphics
releases.
The game framework has been modified to compile against beta versions of
RenderWare Graphics 3.5 (in addition to 3.4), and so will require a minimum
of modification (if any) for when the final release of 3.5 is made.
50
RenderWare Studio User Guide
Version 1.1 contains many changes since Version 1.0. This topic outlines
installation issues, new features, and information for users upgrading from earlier
versions of RenderWare Studio.
Please refer to the rest of the documentation for more detailed descriptions of the
new features.
Installation
Upgrading from earlier versions of RenderWare Studio
Existing users should uninstall previous versions of RenderWare Studio
before installing Version 1.1. Information on game database changes and
framework code changes can be found below.
NXN alienbrain 6
This version of RenderWare Studio will work with version 6 of NXN
alienbrain. Existing users of NXN alienbrain 5 must upgrade to version 6
before installing RenderWare Studio Version 1.1.
Fixed period trial license
The licensing mechanism has been changed to install a trial license for a
fixed period after installation, rather than timing out on a fixed date. This
allows new users to get started with the software immediately. Please note,
however, that you should still apply for a full license in the normal way in
order to use the software after the trial period, which is set at 10 days.
When the license is a few days away from expiring, a message will appear
every time you run Workspace. You should use this as a reminder to apply
to CSL for a full license using the License Manager application supplied.
Please note that attempting to change the clock on your PC will not work,
and in fact may prevent RenderWare Studio Workspace from starting at all
until a full valid license is installed.
When you do receive your license, simply copy it into the Programs folder.
Workspace
Shared attributes
Shared attributes provide an elegant and natural solution to many games
design problems, such as changing universal parameters in a single
operation. RenderWare Studio uses attribute collections to provide a
powerful mechanism of sharing sets of attributes among many entities.
Custom platform flags for build and console link
With 1.0, data streams sent to the console could only be customized with
some hard coded flags which differentiated the platforms (e.g. PS2, Xbox
etc). Release 1.1 extends this by allowing the flags to be customizable.
When sending data to the console, objects are only sent if a target's flags
are a subset of the entity or asset.
Validation of attributes and behaviors
Class definitions change as a game evolves. For example, attributes may be
added, removed, or have their types change. To prevent the data in the
game database getting out of step with the game source code, a new
51
RenderWare Studio User Guide
52
RenderWare Studio User Guide
Framework
The following list is a fairly high level view of the changes made to the game
framework. For more detail see the target_changelog.txt file installed with the
software.
Improved particle behaviors
The particle behaviors have been enhanced to provide texturing support and
better performance. In addition, the classes have been refactored to make it
easier to customize particle systems using derived classes. The
CFX_PartSpray behavior has been updated with new controls to allow use
of the texturing and to allow rendering mode and blend modes to be
specified.
Improved audio behaviors
The exploitation of RenderWare Audio has been enhanced to ease the
integration of audio content in to a game. It is now possible to use events to
fade the output device and individual voices. Notification events are sent
when the fade has completed. The reverb has been factored out of the
AudioGlobalMixer behavior allowing multiple reverbs around the world which
can be triggered by events. The built in default reverb types can be derived
from to create custom types. The AudioSound3D behavior has been
enhanced to utilize features from RenderWare Audio 2, like virtual voice
priority, virtual voice bias and Min/Max distance attenuation. A new
AudioGroup behavior can put Wave Dictionaries into separate sound
groups. Using the AudioGroup behavior can fade sounds in these groups.
Debug flags have been added to AudioSound3D, AudioGlobalMixer and
AudioReverb in order to view all parameters and channel strip details on the
PS2.
Support for RenderWare G3x pipelines
A set of behaviors have been written that encapsulate the high speed G3x
pipelines in RenderWare 3.4 and later. Use of these can make significant
performance improvements on the Playstation 2 platform.
Support for MatFX plugins and vertex shaders
New behaviors exploit the RenderWare MatFX plugins for effects such as
environment and bump mapping. This mechanism also applies to vertex and
pixel shaders where relevant for each target platform. See the environment
map example (p.514).
Skydome behavior
FPSSkyDome has been supplied to provide skydome rendering support to
games. See the sky dome example (p.514).
Translucency sorting
FPSRender can now handle sorting of atomics for displaying objects with
translucent surfaces.
Support for ATWINMON on PS/2 Test Station
Users of the Playstation 2 Test Station can use Sony's "ATWINMON" utility
to load executables from the host PC, rather than having to cut new CDs
every time a change to the software occurs. It is also possible with this utility
53
RenderWare Studio User Guide
Game Database
Users of RenderWare Studio with databases created before version 1.0 may find
that they have objects with IDs such as "Asset1", "Entity6", etc. Such IDs were
also used in example data supplied with 1.0 and 1.01. To ensure future
compatibility with RWStudio tools, and the newly introduced "Import level"
54
RenderWare Studio User Guide
feature, it is recommended that you run the GUIDEnforcer tool over your data.
This will convert all objects with non-GUID IDs and update all references,
renaming files where appropriate. For further information on the use of
GUIDEnforcer please see the accompanying help.
Game Framework
Below is a list of the changes that will have the greatest impact on developers
upgrading from 1.01 to 1.1 i.e. those that may require changes to their own code
or projects.
Handling missing behaviors
Modified ClassFactory to issues warnings if a behavior is requested that is
unavailable on the target platform. Should you get such a warning then
select properties on the entity in the workspace and select the target
platform, or add the missing behavior to the project. The reason for the
warning is that it helps with debugging when working with multiple platforms
or projects.
logical.h
Removed logical.h that means that RWS_implies and RWS_iff are no longer
defined.
macros.h
The file:
core/macros/macros.h
has been moved and renamed to:
core/CAttributeHandler/attributemacros.h
CAttributeHandler.h includes attributemacros.h so there should be no need
for a behavior to include it specifically. CattributeHandler/attributemacros.h
contains the definitions of the macros used for attribute tweaking i.e.
RWS_BEGIN_COMMNDS, RWS_ATTRIBUTE etc.
Renamed function
The function:
void ClumpHelper::ClumpRenderVisible(RpClump * clump);
Karma Initialization
CKWorldObject::SetWorld() method added to enable you to set up the
collision world for Karma once the world is loaded. This used to be done in
the constructor for CKWorldObject but this is called before the world is
loaded. SetWorld is now called from CKarmaParams.
Use the CKarmaParams behavior with a world asset to specify the collision
world to use with Karma.
New particle system
As described above, there is a new textured particle system. Basically,
rewritten the particle system to allow more code reuse on derived systems
(i.e. the textured system). Supports various rendering modes (to remove
interparticle and or intersystem problems) and now allows blend modes to
be modified. Texturing can be animated using sub-textures.
55
RenderWare Studio User Guide
BugFix/Enhancement in CResourceHandler
The following code:
virtual void *Load(const RwChar *psName, const RwChar *psType,
const RwChar *psResourcePath, RwStream* pStream, RwUInt32
uiStreamSize) = 0;
This enables a ResourceHandler to "return" the size of the resource that has
been loaded which is stored by the resource manager within the CResource
class for each resource.
Handling transparency
FPSRender now supports depth sorting of atomics, this is useful for sorting
translucent atomics. CRpLevel has been extended to contain by default two
RpWorlds - an opaque world and a translucent world. CRpLevel also
provides functionality for attaching a hint to an atomic or clump which
indicates which world they should be added to. A new behavior
CSetCRpLevelHint is provided which can set this hint value.
In order for CRpLevel to add atomics/clumps to the correct world CRpLevel
provides the following RpWorld equivalent functions AddAtomic, AddClump,
AddLight. For a detailed description of CRpLevel please refer to the help
files.
A new alpha sort example (p.514) has been provided which demonstrates three
ways to setup a world and make use of the depth sorting functionality of
FPSRender, and RpWorld management of CRpLevel.
The code in CEntity to move objects from one world into the new world has
been removed as a result of the changes to CRpLevel. Worlds must now be
created before objects are added to them.
Important note: entities that need to be added to the world must be created
after the world is created (CRpLevel::SetOpaqueWorld() being called), i.e. if
using FPSRender this should typically be the first entity in the hierarchy list
shown in the workspace.
CAnimSet change
Extended CAnimSet to store the name of the animation.
CAnimSet::AnimData structure now has an extra member:
const RwChar *pName_;
The constructor for AnimData now takes an extra param which is the name
of the animation:
AnimData( const RpHAnimAnimation* pRawData, const RwChar*
pName );
56
RenderWare Studio User Guide
HandleSystemCommands
HandleSystemCommands for CatomicPtr, CclumpPtr, and ClightPtr are now
implemented in AtomicHelper, ClumpHelper and LightHelper so that they
can be used without using CatomicPtr etc. I.e.
CAtomicPtr::HandleSystemCommands calls
AtomicHelper::HandleSystemCommands(RpAtomic *pAtomic).
Restructured startup folder
Startup folder within core has been restructured to now contain sub folders
for each platform.
Filename case convention
All source files for the framework are now lower case, and all #include
references to them have also been changed to ensure lower case. This also
applies to the folder names.
57
RenderWare Studio User Guide
The main feature of Velease 1.01 is support for RenderWare Graphics 3.4. The
only other changes are further documentation and bug fixes, described below.
Support for RenderWare Graphics Version 3.4
RenderWare Studio no longer supports versions of RenderWare earlier than
3.4.
CodeWarrior users
You might have to change the values of the environment variables RWGSDK
and RWASDK defined by the RenderWare 3.4 setup program. The setup
program uses forward slashes ('/'), but CodeWarrior expects backslashes ('\').
To change these values:
• Click Start Settings Control Panel System Advanced
System Environment Variables
Licensing
This install comes with a license that will expire on 1 October 2002. To
continue to use the product after then you need to use the supplied License
Manager application
Revised lightmapping sample
The lightmapping sample has been changed slightly so that the lights used
to generated the lightmap are in a similar position to those modelled in the
scene. The sample also uses colored lights.
Bug fixes
• RWSMemory.cpp and Karma classes fixed to prevent potential crashes
when using the memory diagnostic tools.
• The ProDG project files for Gamecube are now included in the install.
• Save now removes deleted objects when RWStudio used without NXN
alienbrain.
• Project saves without NXN alienbrain installed no longer generates
spurious error message.
• Save of write-protected project without NXN alienbrain now behaves
correctly.
• View mode is now saved in the settings file.
58
RenderWare Studio User Guide
59
RenderWare Studio User Guide
This page details the major changes since Release Candidate 1 (RC1).
Installation
You should uninstall any previous versions of RenderWare Studio before
installing. Users wishing to be able to customize the Workspace should select the
Custom Install option when prompted. Alternatively after a standard install, you
can add optional components using Add/Remove Programs from Control Panel.
Any existing game databases created with versions of the software earlier than
RC1 will need to be upgraded before they can be used. See below for details.
RC1 databases will not require any modification to work with the final release.
This version of RenderWare Studio will only work with RenderWare 3.3.
If NXN alienbrain is installed prior to RenderWare Studio then Studio's integration
will be enabled automatically. If you install alienbrain after Studio then you will
need to rerun the install using Control Panel Add/Remove Programs, select
RenderWare Studio Change/Remove, choose the Modify option, and then select
the Alienbrain component.
60
RenderWare Studio User Guide
Framework changes
Programmers should look at the framework change log for technical details on all
the changes to the framework code.
Change to FX lights
Between RC1.0 and RC2.0 the hierarchy of the FX lights classes was
changed. This means that any old databases that use the FX light classes
will need to be updated. There is no quick and easy way to update a
database to fix the problem - you have to go through each light and set up
the parameters again.
Documentation
The documentation has been further enhanced. The main help file available from
the Help menu in Workspace provides a single point of access to the four
separate RenderWare Studio help files:
• Workspace (also supplied as printer-friendly Acrobat PDF)
• Game Framework API reference (online Help only)
• Manager API reference (online Help only)
• Enterprise Author (also supplied as printer-friendly Acrobat PDF)
We value all feedback on the documentation; please use the envelope icons at
the bottom of each page to provide direct feedback to our technical authors.
61
RenderWare Studio User Guide
Release Candidate 1 contains nearly all the functionality of the final 1.0 release.
This page details the major changes since the last development release
(RWSDevRel 1.08a). Users should also read the change log files that get
installed with this release for a more detailed view of the changes.
Installation
You should uninstall any previous versions of RenderWare Studio before
installing RC1. Users wishing to be able to customize the Workspace should
select the Custom Install option when prompted.
Any existing game databases created with previous versions of the software will
need to be upgraded before they can be used. See below for details.
Game database
The game database has been substantially enhanced since the last release.
Refer to the documentation for details of the structure, which includes an entity
relationship diagram that shows how different parts of the database relate to each
other. It also describes how the file structure is persisted.
.rwstudio file extension
The extension for the top level game file has been changed from .xml to
.rwstudio.
Collections
There are two types of collections - one for assets and another for entities.
This allows you to arbitrarily group your data to suit your own uses.
Templates
With entity templates you can set up a single entity's behavior, assets, and
parameters, and save that as a template object. This template can then be
used to easily create multiple instances of that entity.
Database upgrade tool
Any existing games databases from earlier versions of RenderWare Studio
will need to be upgraded. An automatic tool called
RWSDatabaseConverter.exe is provided in the bin folder of your RWStudio
installation. On running this application you will be asked to provide the
location of the database to convert. You have the option to create a new 1.0
version in a different location. Upgrading is a safe operation as none of the
original data will get overwritten by the conversion process.
Integration with alienbrain
Support for alienbrain now includes the capability to check in changes from
the RWStudio Workspace, and to synchronize the latest version of a game
with the central alienbrain server. Support for reverting edits is also
provided. Users are informed if they attempt to modify parts of the game
locked open by other users.
Tray dog icon no longer required
62
RenderWare Studio User Guide
The “dog” icon that appeared in the system tray when a database was
loaded has been removed. The database server is no longer a separate
application, but has been moved to be in-process to provide better
performance - particularly on large datasets.
3D navigation
The mechanism for users to navigate around their scenes within Workspace has
been radically enhanced. In addition to the existing Camera Flight mechanism, an
alternate user interface has been provided that will be more familiar for artists to
use. The documentation describes how to use this new feature. To support the
new modes for easy navigation and inspection, a number of hot keys have been
added. For example, F3 will fit the camera to the currently selected object, and
will also reset the orbit centre. If the 'O' key is held down while picking in the view,
then the orbit centre will change appropriately.
Framework changes
Programmers should look at the framework change log for technical details on all
the changes to the framework code.
Category and description macros
63
RenderWare Studio User Guide
64
RenderWare Studio User Guide
• macro RWS_IMPORT_COMMANDS
This allows you to create a class factory which easilly instance a specific
behaviour with a specific asset and attributes on the console at run time,
using the CAttributePacket data as if the workspace had created it.
Documentation
The documentation has been substantially enhanced, and is now provided as
compiled HTML files. The main help file available from the Help menu in
Workspace provides a single point of access to the 4 separate books -
Workspace, Framework API reference, RWStudio Manager API reference, and
Enterprise Author user guide. Separate printer-ready PDF versions are also
installed on your disk.
We value all feedback on the documentation - please use the envelope icons at
the bottom of each page to provide direct feedback to our technical authors.
The main focus of the period between RC1 and full release is the fixing of bugs,
and more documentation. Customer feedback is welcome.
65
RenderWare Studio User Guide
66
RenderWare Studio User Guide
67
RenderWare Studio User Guide
Game database
All information about the game (except the Game Framework C++ source) is
stored in a database of XML files (p.76).
RenderWare Studio supports version control and team development of
game databases with the integrated NXN alienbrain (p.187) asset management
tool (supplied with RenderWare Studio).
68
RenderWare Studio User Guide
• RenderWare Studio takes the designer programmer loop out of the edit
cycle by allowing real-time viewing on the console of changes made in the
editor. The programmer can test new behaviors before passing them to the
designer.
• RenderWare Studio also cuts out the need for the games designer
programmer tools developer cycle, as RenderWare Studio dynamically
generates the user interface for new behaviors.
• RenderWare Studio generates the user interface that the designer needs to
set parameters and manipulate new artwork and behavior in the editor,
eliminating the need for code to pass via the tools programmer to the
designer. Behavior code becomes an asset like any other that can be
viewed and used in the RenderWare Studio Workspace. Pre-made modules
that have been tested to work within a standardized framework mean that a
lot of the back and forth between the programmer and the designer is taken
out of the equation. As long as the standard for interaction between objects
is adhered to modules can be guaranteed to work together.
• The PC-hosted RenderWare Studio Manager ensures all new art, sound
and code assets are made available to the whole team from the moment
they are checked in.
• Real-time dynamics and collision give instant feedback as to how collisions
and forces will react with the game world.
• RenderWare Studio deploys an intuitive “drag and drop”, object-based user
interface, which facilitates the rapid prototyping and sequencing of all game
events and behaviors, from camera views through to in-game characters.
• RenderWare Studio allows you to “decorate” your game code with attribute
tags, from which the RenderWare Studio Manager automatically creates
menus, sliders and buttons, to represent adjustable parameters within the
Workspace. Example: With a particle effect you could adjust and save its
color, gravity and spread. These tags are then automatically removed for a
final release.
• Artists and designers can create real-time atmospherics by placing, then
adjusting, lighting setting and special effects within the game worlds for each
platform. Example: They can tune and save “fog” settings to appear exactly
how they want it.
• With the fully integrated alienbrain ™ asset management software by NXN,
the entire team will be working on actual game parameters in real time, on
the target console, with optimal results.
• Developers can observe when in-game parameters change via the GUI, for
powerful, efficient play testing and debugging by any team member. All four
run-time applications can then be generated “on the fly”, so there is always a
latest build with the latest settings, for all the team to use.
• RenderWare Studio can handle source code from any version control
system. Asset importer plugins link RenderWare Studio with your preferred
art package. Developers can extend the coverage of any import path, as all
69
RenderWare Studio User Guide
70
RenderWare Studio User Guide
Basic concepts
71
RenderWare Studio User Guide
Behaviors are defined in the C++ source of the Game Framework. The
Game Framework contains the game logic.
3 Values for the entity attributes.
An attribute is a parameter that controls the behavior.
Many behaviors have a “transformation matrix” attribute that defines the
position and orientation of the entity in the scene.
By default, attribute values apply only to a particular entity, and are stored
with that entity. However, you can also share (p.170) attribute values between
entities.
72
RenderWare Studio User Guide
73
RenderWare Studio User Guide
1 Except for behaviors and commands, each object in the game database is
stored in its own individual XML file (p.76). The solid lines in the diagram
above indicate the persistent links between these objects. An entity refers
to the name of the C++ class that defines its behavior. The Workspace
adds behaviors and their commands to the database when it parses the
Game Framework source.
(The Workspace parses the source each time you open a project, create a
new project, or click the toolbar button.)
2 A child behavior refers to the base class of its parent. For example, in the
game database, CSystemCommands is a child behavior of CEntity; in
C++ terms, CSystemCommands is a base class of CEntity. This
parent/child relationship reflects the hierarchy shown in the Game Explorer
window and the Behaviors windows of the Workspace.
3 An attribute can belong to zero or more attribute shares.
4 Only assets created from .rf3 files can have child assets.
74
RenderWare Studio User Guide
Asset
Identifies data that can be used by an entity. Among other properties, an
asset contains the relative paths of:
A primary asset file
Contains the “primary” data for an entity (for example, a .dff or .rf3
file, defining the geometry of an entity).
A dependencies folder
The folder containing data files required by the primary asset file (for
example, texture bitmaps).
Several entities can use the same asset. You can attach assets to an entity
either one by one, or you can group assets into asset folders, and then
attach a mix of individual assets and asset folders to an entity.
Note: In general usage, the term asset is sometimes used to refer to a
primary resource file. However, in RenderWare Studio, the term asset refers
to an object in the game database that points to a primary asset file, not to
the primary resource file itself. Like any other object in a game database, an
asset is stored in an XML file.
Attribute
Stores the value of a parameter that controls the behavior of an entity. For
example, a vehicle entity might have an “exhaust color” attribute that
controls the color of the exhaust smoke that its behavior causes the entity to
emit. Each entity can either have its own individual attribute values, or use
attribute shares to share the same attribute values as other entities.
To change attribute values, use the Attributes window.
Behavior commands and entity attributes are closely related. Commands
define the attributes that an entity can have. Attributes store the values of
the command parameter values for an entity.
75
RenderWare Studio User Guide
RenderWare Studio stores the database for each game in a set of XML files:
Note:
• In the diagram above, only the files shown as are considered to be part
of the game database. If you use NXN alienbrain (p.187), then these are the
only files that Workspace checks in or out. Other files are shown here for
completeness.
• For general information about XML, go to www.w3c.org/xml/
(www.w3c.org/xml/).
76
RenderWare Studio User Guide
MyGame.rwstudio
The RenderWare Studio project file. This is the file that you specify when you
want to open a game, or save a game. When you save a new game for the first
time, or you save an existing game to a new location, then, in addition to creating
a new .rwstudio project file, RenderWare Studio creates a new folder
structure, as shown in the diagram above.
The .rwstudio project file points to the location of the folders that contain the
guid.xml files (described below).
File Save As copies the XML files from their current location to the new
location (relative to the new .rwstudio project file). On the File menu, click Save
As, and enter the new file name (NewGame). RenderWare Studio creates the
new project file and folder structure, and copies the related XML files.
77
RenderWare Studio User Guide
MyGame.settings
Contains the game properties (p.98).
guid.xml
Each guid.xml file defines an object in the game database (p.73).
Note: The RenderWare Studio Name column takes its data from the <name>
elements of the game database XML files.
78
RenderWare Studio User Guide
it.
• The XML parse of individual objects is quick enough so as not to produce a
perceived delay when data is requested.
• Minimal changes should be required in workspace/ tool code.
Certain Manager API calls cause one or more XML files to be loaded:
RWSGetFirst
May be called to enquire on the first object of the specified type.
Caution: Calling this function can slow down loading the game as it loads
and allocates memory to every object of the given type.
RWSChildAdd
Results in a load of both parent and child.
RWSChildRemove
Results in a load of both parent and child.
RWSChildSwap
Causes the parent to be loaded.
RWSChildGetFirst
Causes the parent to be loaded.
RWSParentGetFirst
Causes the child to be loaded.
RWSObjectGet
Causes the object to be loaded.
RWSTagGetData
Causes a load for any tags that are serialised—global folder, template entity
and folder type.
RWSPropertySet
Causes a load of the object.
RWSPropertyGet
Causes a load of the object.
RWSPropertyGetFirst
Causes a load of the object.
79
RenderWare Studio User Guide
Customization
Building upon well-known technologies such as ActiveX (COM) and Active Script,
the component-based nature of RenderWare Studio makes the software highly
customizable. There are a wide variety of modification options to suit the
workflow, practices, and custom tools of a games development team.
This topic describes some of the different kinds of customization possible, and
provides pointers to sources of further information.
80
RenderWare Studio User Guide
• To process the assets that make up a game into game-ready data, you need
build rules. For new asset types, you can modify existing build rules, or
create them from scratch.
Among the built-in rules is TextureDictionary.rule, which produces a
list of all the textures used by every asset in a game, and generates a
stream file containing it. To do this, the rule uses a tool called texdicgen.
You can find the modifiable source code for this tool in RenderWare Studio's
Programs\Tools directory.
81
RenderWare Studio User Guide
System requirements
Hardware
Minimum hardware requirements:
Display adapter
3D hardware acceleration, such as NVidia GeForce 2 (or better) or ATI
Radeon.
Must support the following display drivers:
DirectX 9 (www.microsoft.com/windows/directx/)
To run the Workspace.
OpenGL or DirectX 9 (www.microsoft.com/windows/directx/)
To run the Game Framework on PC targets.
Display resolution
1024 x 768 (1280 x 1024 recommended).
Processor
1 GHz.
Memory
1 GB RAM minimum.
Disk space
375 MB free disk space, of which approximately 275 MB is used by the
program files and 100 MB is used by the examples supplied with
RenderWare Studio.
Operating system
Either:
• Microsoft Windows 2000, Service Pack 2 or later
or
• Microsoft Windows XP
To install RenderWare Studio 2.0, you must have administrative privileges on the
operating system.
82
RenderWare Studio User Guide
Consoles
Nintendo GameCube
The SN-TDEV (p.214) development system.
Sony PlayStation 2
You will need a Broadband Ethernet adapter or a USB Ethernet connection
(both supported via the net000.cnf file).
Tip: We recommend the SCPH-10350 network adapter for the broadband
ethernet connection to the PS2 Test deck or, for the USB ethernet
connection, the list of compatible USB adapters found by navigating to the
release notes for the AN986 Ethernet Driver in the USB Ethernet Drivers
section of the PlayStation 2 Developer Network (www.ps2-pro.com).
Microsoft Xbox
Xbox Development Kit (XDK) December 2003 (or later) for both the Xbox
console and the development PC.
C++ compilers
RenderWare Studio has been tested with the following C++ compilers:
83
RenderWare Studio User Guide
Other software
Microsoft Forms 2.0 ActiveX controls
These controls are supplied with Microsoft Office; they are also available for
free from Microsoft, as part of the Microsoft ActiveX Control Pad.
If either of these two packages is installed on your system, then you already
have these controls.
If you do not have these controls, then you need to download and install the
Microsoft ActiveX Control Pad:
1. Go to the Microsoft Developer Network (MSDN) website
(msdn.microsoft.com/).
2. Search for Knowledge Base article 224305, which contains a link to the
ActiveX Control Pad page.
3. Install the ActiveX Control Pad on your computer.
Microsoft Internet Explorer
Version 6 (supplied on the RenderWare Studio setup CD) or later.
Adobe Reader
Supplied on the RenderWare Studio setup CD.
RenderWare Studio user documentation is supplied in Acrobat PDF and
Microsoft HTML Help (.chm) formats. To view the Acrobat PDF files, you
need to install Adobe Reader.
RenderWare AI
Version 3.71 or later
RenderWare Audio
Version 3.7 or later.
RenderWare Graphics
Version 3.7 or later.
RenderWare Physics
Version 3.7 or later.
NXN alienbrain
If you use alienbrain (p.187) to manage your RenderWare Studio projects, then
you must use alienbrain version 7.
84
RenderWare Studio User Guide
Getting started
If you have not used RenderWare Studio before, then we recommend that you:
1. Read What is RenderWare Studio? (p.66).
2. Complete the First steps tutorial (p.86).
Note: If you have just installed RenderWare Studio, then you will be using a
temporary license. To continue using RenderWare Studio when the temporary
license expires, you need to request a permanent license (p.95).
85
RenderWare Studio User Guide
In this tutorial
You step through the following basic tasks:
1. Opening an existing project.
2. Flying around the game world.
3. Adding an entity to the game.
4. Moving and rotating an entity.
5. Viewing the game on a target.
In RenderWare Studio, the term target refers to a console or PC platform
for which you are developing a game. In this tutorial, you view the game in
a separate window on the PC running RenderWare Studio.
6. Attaching a behavior to an entity.
7. Setting the behavior attributes.
The behavior that you attach in this tutorial causes the entity to rotate; you
set attributes that control the rotation speed.
8. Saving the project.
86
RenderWare Studio User Guide
87
RenderWare Studio User Guide
To dolly into the game world, for example, point to the top half of the
perspective view, and then hold down the left mouse button. The closer to
the edge of the perspective view you point, the faster you go.
8. Try the other camera control buttons (p.108): (Orbit Camera), (Pan
88
RenderWare Studio User Guide
12. Drag the “Large Alien” asset from the Assets window to the Design View
window. Drop it in a clear space in the game world.
A new “Large Alien” appears in the window.
89
RenderWare Studio User Guide
Dragging an asset into Design View creates a new entity (p.71). At this
point, the behavior of the entity will be the default CEntity behavior, and its
name will be something similar to Entity<nnnn>.
Tip: To delete an entity, expand the game folder in the Game Explorer (p.288)
window, right-click the entity name, and then select Delete (p.177). This does
not affect the asset.
90
RenderWare Studio User Guide
15. Drag a rod to move the entity along an axis; drag a square panel to move
the entity in any of the x, y, or z-planes.
16. Try the (Pick only), (Pick and Rotate) and (Pick and
The Targets (p.330) window shows the targets on which you can view your
game. Specifically, it shows target connections, defining how RenderWare
Studio connects to each target.
19. In the Targets window, right-click either the Local PC - DirectX or Local PC
- OpenGL connection, depending on which display drivers your computer
91
RenderWare Studio User Guide
supports (see note below). The context menu for the connection appears.
20. Click Launch. A new window, named RWS Console, appears on the
desktop. This window shows the loading screen of the RenderWare Studio
Game Framework.
92
RenderWare Studio User Guide
27. Drag the CTutorial3 behavior to the entity in the perspective view. In the
console view, the entity starts rotating.
An entity can have only one behavior; the CTutorial3 behavior causes its
entity to rotate.
Tip: Another way to attach a behavior is to right-click the entity in the Game
Explorer window, and then select Properties. Now select the required
behavior from the drop-down list of behaviors.
93
RenderWare Studio User Guide
The Attributes window shows the controls for editing the behavior attributes
of the selected entity. Attaching a behavior to an entity also selects the
entity, so this window shows the attributes of the CTutorial3 behavior for
the entity that you have just added.
The CTutorial3 behavior has three attributes that define the number of
degrees its entity rotates per frame in each axis: X Rotation, Y Rotation and
Z Rotation.
When you create a behavior (p.337) in the Game Framework, you specify an
RWS_ATTRIBUTE macro for each of its attributes. This macro defines the
attribute's parameters, including its name, the type of editing control, and the
range of allowed values. To see the code for this attribute, right-click the X
Rotation attribute, and then select View Source. The appropriate header
file appears in your code editor, containing the line:
RWS_ATTRIBUTE(CMD_rot_x, "X Rotation", "Specify the x axis
rotation", SLIDER, RwReal, RANGE(0, 0, 360))
94
RenderWare Studio User Guide
Each time you start RenderWare Studio, it checks its Programs folder for a file
named lservrc (with no file extension). This file contains information about your
license to use RenderWare Studio. When you install RenderWare Studio, you will
be using the supplied temporary license file. To continue using RenderWare
Studio after the temporary license expires, you need to replace this file with a
permanent license file.
To request a permanent license file, visit the Fully Managed Support Services
(https://support.renderware.com/licensing/) website. To login to the FMSS
website, you will need your customer username and password.
Tip: If you installed RenderWare Studio in the default location, then the path of
the Programs folder is C:\RW\Studio\Programs.
95
RenderWare Studio User Guide
If you want to customize either the RenderWare Studio Workspace user interface
or the Game Production Manager build rules, then you will need to know how to
program in the Microsoft Visual Basic Scripting Edition (VBScript) language.
VBScript documentation
The best place to begin learning VBScript is the Microsoft Scripting website
(msdn.microsoft.com/scripting/). At the time of writing, you could download
VBScript documentation in an HTML Help file called Microsoft Windows Script
5.6 Documentation. If you have the Microsoft Developer Network (MSDN)
Library, then you already have this documentation: look in Web Development
Scripting SDK Documentation Windows Script Technologies.
There are also many good books on VBScript, such as VBScript in a Nutshell
(ISBN 1565927206, published by O'Reilly & Associates (www.ora.com/)).
96
RenderWare Studio User Guide
97
RenderWare Studio User Guide
98
RenderWare Studio User Guide
and, optionally,
• A dependencies folder (for example, where textures for the
primary asset file are stored)
The Workspace uses the resource root folder to resolve these relative
paths into absolute paths.
RF3 Project Template
The absolute path of the template used to convert RF3 files into
streams that Workspace can display.
If you installed RenderWare Studio in the default folder
(C:\RW\Studio), then the supplied template files are in:
C:\RW\Studio\Examples\Export Templates\Project
Volume texture root
The absolute path of a folder containing textures that may be assigned
to any box and trigger volumes you create in your game. The files in
this folder appear in a drop-down menu when you click the Texture
selection button.
4. Click OK.
A new project opens in Workspace.
5. Begin developing your game. The first step is to import assets (p.101).
99
RenderWare Studio User Guide
100
RenderWare Studio User Guide
101
RenderWare Studio User Guide
To set asset properties, right-click the asset, and then click Properties.
Platform
The platforms to which this asset applies. For each target, the game data
stream includes—or refers to—only those assets that apply to the target's
platform.
If this object applies only to some platforms, then deselect the other
platforms.
Name
The name of this asset. Must be unique for assets in the game. For
example, you can have an asset and an entity both named “Alien”, but you
cannot have two assets named “Alien”. This name can include numbers,
spaces and letters in any combination of uppercase and lowercase. If you
import an asset by dragging its primary asset file into the Assets window,
then Workspace gives the asset the same name as the file (excluding the
file extension; for example, Large Alien.dff becomes an asset named
“Large Alien”).
102
RenderWare Studio User Guide
Model (optional)
Not currently used by RenderWare Studio; you can use this to store your
own custom information about the asset.
Tip: To set the dependencies folder for several assets at once, select the assets,
right-click one of the selected assets, and then click Properties. Any changes
you make to the properties are applied to all of the selected assets.
103
RenderWare Studio User Guide
When you import an RF3 file into RenderWare Studio (say, by dragging it from
Windows Explorer to the Assets window), Workspace uses the RenderWare
Exporters to convert the RF3 file into a RenderWare stream (.rws file) that
Workspace can display. To create this stream, the Exporters use the RF3 project
template that you specify in the game properties (p.98). The path of this template
is stored in your project .settings file (p.76), in your project folder.
Similarly, when you build the game data stream for a target, Workspace exports
the RF3 file to a platform-specific RenderWare stream that the target can display.
This stream is created using the RF3 project template that you specify in the
connection properties (p.199) for the target. The path of this template is stored in the
RWStudio.settings file, in the RenderWare Studio Programs folder.
Tip: The image above shows the tree view of the Assets window; this is useful for
viewing RF3 assets. To see this view, right-click in the Assets window, and then
select View Tree.
Even if the RF3 file contains only one asset, Workspace creates an asset
hierarchy with a single child asset.
The Build Log (p.297) window displays the progress of the creation of each asset.
</Generic>
<PS2/>
<Xbox/>
<GameCube/>
</Platform>
104
RenderWare Studio User Guide
If the generic platform options are not enabled, then the Exporters will not create
a stream that Workspace can use, and Workspace will not be able to display
RF3-based assets.
If you are developing your game for a target that also uses generic platform
options (for example, you are developing a DirectX PC game), then Workspace
and your target reuse the same stream file.
105
RenderWare Studio User Guide
template options instruct the Exporters to embed any of this additional data, then
Workspace processes the exported stream, and creates another stream that
contains just the clump data. This stream is stored in the same folder as the
original exported stream, with the clump index as a suffix. For example
predator1.rws
This is the stream that is actually used by Workspace, or included in the game
data stream.
If your RF3 export template options do not embed any additional data, so
exported streams contain only clump data, then Workspace detects this and uses
the exported streams, and does not create another stream.
All users should refer to the same RF3 project template file
names
In a multi-user environment—for example, if you are using NXN alienbrain (p.187) to
manage files—all users should refer to the same RF3 project template file
names. Otherwise, if different users re-import updated versions of the same RF3
files, then the exported stream files will be created under different paths, resulting
106
RenderWare Studio User Guide
Build engineers: For details on how RF3 files are exported to streams, see the
RF3Asset.rule build rule, stored in the RenderWare Studio
Programs\Workspace\Build Rules folder.
107
RenderWare Studio User Guide
To control the camera in the Design View window, you can use a mouse or a
keyboard.
Mouse controls
To control the camera with a mouse, you can choose between the following
camera modes:
Fly
Fly the camera by pointing in the view, and then
pressing and holding down a mouse button. This
camera mode has separate controls for the
perspective view and the orthographic views.
Orbit
Orbit the camera around a point by dragging.
By default, the orbit center is the entity that you most
recently selected (p.121). You can move (p.113) the orbit
center to a different entity, or to an arbitrary point.
To constrain the orbit to a particular axis, begin
dragging inside a or rectangle.
Pan
Pan the camera by dragging.
To constrain the pan to a particular axis, begin
dragging inside a or rectangle.
108
RenderWare Studio User Guide
Zoom
Zoom (dolly) the camera in and out by dragging.
Tip: You can use all the quick access modes except orbit mode in all
orthographic views as well as in the Design View window.
Caution: When using the middle mouse button in this way, you cannot use the
boxes described above to constrain the orbit or pan to a particular axis.
Special tips:
• To reset the view to its original state in any of the quick entry modes, click
and release the right mouse button as you are dragging with the middle
mouse button.
109
RenderWare Studio User Guide
• You can also toggle between camera mode and pick mode by pressing F9.
Keyboard controls
In any camera mode (and even in pick mode), you can use the keyboard to fly
the camera:
Tip: If the keyboard controls are not working, it means that one of the other
windows has the keyboard “focus”. To correct this, click in the Design View
window.
110
RenderWare Studio User Guide
Fly camera mode (p.108) has separate controls for the perspective view and
Perspective view
In the perspective view, you can use the mouse to fly the camera around the
game world:
For example, to dolly (zoom) into the game world, point to the top half of the
perspective view, and then hold down the left mouse button.
Note:
• The closer to the edge of the view you point, the faster you go.
• The center of the perspective view is a “null zone”; clicking here has no
effect.
Orthographic views
In the orthographic (plan, front and side) views, you can use the mouse to pan
and zoom:
111
RenderWare Studio User Guide
Note:
• The closer to the edge of the view you click, the faster you pan.
• The center of each orthographic view is a “null zone”; clicking here has no
effect.
112
RenderWare Studio User Guide
There are three orbit modes in RenderWare Studio. To change mode, first ensure
that you are in orbit camera mode, then press the relevant button on the
Selection toolbar. The camera behavior differs in each mode depending on
whether or not an object is selected:
Camera arc
The yellow circle changes appearance depending on the orbit mode and object
selected.
2. Press and hold the letter O key, and then click in the perspective view:
113
RenderWare Studio User Guide
The Workspace determines the new orbit center by drawing a ray from the
camera viewpoint through the point marked by the you clicked on the view
plane. The new orbit center is the first geometry that the ray strikes.
Note: The last orbit center that you set is always remembered until you
set a new one. Pressing the O key without clicking the mouse button toggles
the last remembered orbit center on and off.
114
RenderWare Studio User Guide
To set how finely the camera responds to mouse movement or key presses, or to
set a minimum frame rate for camera motion:
• On the Options menu, click Flight...
General options
Mouse Sensitivity and Keyboard Sensitivity
Controls how finely the camera responds to the mouse and the keyboard.
The finer the sensitivity, the greater the camera's response to the same
mouse movement (or duration of key press).
115
RenderWare Studio User Guide
Display interrupt
If your game contains many entities, or you have a relatively slow computer, then
camera motion can become jerky. This is because, by default, your computer
renders each frame completely. If frames take a long time to render, then the
camera position can change significantly between each one, resulting in jerky
camera motion.
For smoother camera motion, you can set a maximum time limit for rendering
each frame; if a frame is not completely rendered in that time, then your computer
begins rendering the next frame. This sets a minimum frame rate for camera
motion, at the expense of not always completely rendering every frame.
Enable
Interrupts the rendering of any frame that takes longer than the time
specified by Period, and begins rendering the next frame.
If you leave this check box deselected, then your computer renders each
frame completely, regardless of how long it takes.
Do full redraw when inactive
Renders the entire frame after the camera stops moving, regardless of how
long it takes.
If you leave this check box deselected, and display interrupt is enabled, then
the frame might not be completely rendered after the camera stops moving.
Period
Sets the maximum time for rendering a frame (in seconds). For example, a
value of 0.0416 sets a minimum frame rate of 24 frames per second.
116
RenderWare Studio User Guide
The Flight Keys dialog appears listing the primary keys assigned to flight
movement.
To list alternate keys assigned to the same movement, click the Alternate tab.
117
RenderWare Studio User Guide
To change the key for a particular action click the > button adjacent to the
appropriate movement, such as Move Forwards or Turn Left. RenderWare Studio
prompts you to press the key you want to use:
Press the key you want to use. The key you choose displays in the dialog next to
movement.
118
RenderWare Studio User Guide
Creating an entity
2. The new entity appears in the Design View window, and is listed in the
Game Explorer window.
Special tips:
• Another way to add an entity is to drag a behavior directly from the
Behaviors window to the appropriate folder in the Game Database window.
• Holding down the Ctrl key while dragging the asset constrains it to moving
up and down the Y axis.
Attaching a behavior
By default, Workspace attaches the CEntity behavior to new entities.
To attach a different behavior to an entity:
1. Drag the behavior from the Behaviors window to the entity in the Design
View window.
119
RenderWare Studio User Guide
2. If you connect to a target, then you can dynamically view the behavior in the
game.
After attaching a behavior, you can set its attributes (for example, the speed and
color of the pulsation) in the Attributes window.
For descriptions of the behaviors supplied with RenderWare Studio, see the
Game Framework Help.
120
RenderWare Studio User Guide
Selecting entities
Before you can move, rotate, or scale an entity, or edit its properties or attributes,
you must first select it.
Note: You cannot select multiple entities that are in different folders. If you do
select multiple entities in the Design View window that are in different folders,
only one of the selected entities will be highlighted in the Game Explorer window.
Deselecting entities
To deselect all entities, either:
• Click an empty area of the Game Explorer window.
or
• Press Esc. (This works only if the Design View window has the keyboard
121
RenderWare Studio User Guide
“focus”. To set the keyboard focus to the Design View window, click in the
Design View window.)
Tip: When this toolbar button is indented, the selection lock is on.
122
RenderWare Studio User Guide
123
RenderWare Studio User Guide
Tip: To reset any of the move, rotate, or scale operations as you perform them,
click the right mouse button while you are dragging. Be aware that if you use this
method, you are resetting the operation and your changes will not be added to
the Undo Stack (p.251).
124
RenderWare Studio User Guide
While you are dragging a new entity into the Design View window, the
Workspace uses a point on the bounding box of the new entity as a collision test
point. You cannot drag the new entity into existing entities past that point.
By default, the collision test point is at the bottom center of the bounding box.
This allows you to easily align the new entity with a floor surface:
However, this is not always the most suitable location for the collision test point.
For example, it allows you to move the entity into walls:
To change how the new entity aligns with existing entities, you can move the
collision test point. For example:
125
RenderWare Studio User Guide
You can move the collision test point to the following locations on the bounding
box:
To move the collision test point while dragging a new entity into the Design View
window:
• To cycle around locations in the X plane, press 1.
• To cycle around locations in the Y plane, press 2.
• To cycle around locations in the Z plane, press 3.
This applies only while you are dragging a new entity into the Design View
window. The next time you move (p.123) the entity, no collision testing occurs;
you can move the entity freely to any location.
126
RenderWare Studio User Guide
Rather than creating an entity from an asset—and then attaching a behavior and
editing its attributes—you can start with a special type of existing entity, known as
a template.
Tip: If you want identical entities in different folders, then, rather than creating a
new entity each time, you can refer (p.174) to the same entity.
To create a template:
1. Create an entity (p.119) that you want to use as the template.
2. In the Game Explorer window, right-click the entity, and then click Create
Template.
This creates a template (effectively, a copy) of the entity in the Templates
window. It does not affect the original entity.
The new entity is a copy of the template: it begins with the same assets,
behavior, and attributes as the template. Unless the template uses attribute
shares (see below), each entity you create from a template is completely
independent.
127
RenderWare Studio User Guide
Splines can be used for moving game objects, such as a camera as in the Spline
camera example (p.545), or non-playing cars controlled by AI in a racing game,
along predetermined paths.
Creating a spline
To create a new spline asset, right-click in the Assets window and select New
Spline.
You can also right-click in the Assets window and select New Asset and then:
• Right-click the newly created asset
• Select Properties
• Browse to the spline asset file in the File field of the Properties (p.102)
dialog that appears and then click OK.
Note: New spline assets can be checked in and out of NXN alienbrain (p.187) in the
same way as any other asset.
After the spline asset is created, drag the new asset from the Game Explorer
window to the Design View window. This automatically creates a new entity in the
active folder.
In the Game Explorer window, right-click the new spline asset, and then select
Edit; the Spline toolbar (p.251) becomes active.
drawing the spline. Each time that you click in the Design View, a new node
(or spline control point) is inserted and the segment between both nodes is
joined together by a line.
2. After you have created as many nodes as required, to link the node
segments that you have created into one loop as in the Spline Camera
example, click on the Close node button. (To re-open the loop for
128
RenderWare Studio User Guide
3. To alter the position of the nodes in the Spline Editor, click on one of the
pick buttons such as the Pick and Drag button, then click the relevant
node in the Design View window. After the drag axes (p.123) have
appeared, drag the node as you would any other object until that segment of
the spline curve is the desired shape.
129
RenderWare Studio User Guide
Box volumes are simple cuboid entities that you can place into your game without
the need to import an asset. They can be used as placeholders for entities that
will be created in the future, or (more commonly) as the basis for trigger volumes.
or
• To create a box whose axes are aligned with those of the game world,
click the Create axis-aligned box volume button .
2. Click the Texture selection button , and choose the appearance of the
130
RenderWare Studio User Guide
4. Without clicking, move the cursor up or down to change the height of the
box. To fix the height, click the button again.
131
RenderWare Studio User Guide
Light mapping
This section of the documentation demonstrates how light mapping entities can
be added to the game world using RenderWare Studio.
RenderWare Studio has a number of special facilities to aid in the effective light
mapping of a level, including a custom layout designed specifically for
implementing light mapping entities within the game world.
The effects of added light entities can be previewed in the Design View window
of RenderWare Studio. Once the various parameters have been set to your
satisfaction, the light map files required to light the level can be generated.
The following sequence of tutorials introduces the components of the
RenderWare Studio user-interface related to light mapping and also
demonstrates how to create and control light map entities. In addition, features
such as the ability to control the interaction of materials with light are also
introduced, as well as the subject of creating area lights.
132
RenderWare Studio User Guide
In this tutorial
We introduce you to the basic light mapping facilities of RenderWare Studio,
showing how to set up for light mapping and indicating some of the most useful
menus and windows.
In this tutorial, the Genre Pack 1 project is used throughout. The tutorial is split
into a number of lessons:
• Selecting the light mapping layout.
• The light mapping toolbar.
• Viewing the Light Map Preview Settings.
• The Scene Light Map window.
• The Asset Light Map window.
133
RenderWare Studio User Guide
5. Use File Save Project As to save the project to a new project called:
GP1_light.rwstudio in the same directory.
6. On the main menu select View Layouts Light mapping. This layout
tailors the user interface to the needs of light mapping by:
• Eliminating unnecessary toolbars.
• Adding a light map toolbar.
• Adding a panel for scene light map.
• Adding a panel for asset properties.
134
RenderWare Studio User Guide
135
RenderWare Studio User Guide
1. On the main menu Options Light map can be used to view and modify
light map preview settings. These affect the previewing of a level as seen in
the Design View window.
Alternatively, select the settings button from the light mapping toolbar.
Further details on the Light Map Preview Settings window can be found in the
Light Map Preview Settings window (p.294) topic.
136
RenderWare Studio User Guide
for the scene. The following procedure shows how to bring up the Scene Light
Map window for a specific scene.
1. Right-clicking on a “scene folder” in the Game Explorer window will show
an Edit Lightmap option.
To demonstrate this, in the Game Explorer window, right-click on the folder
Military Lab and then select the Edit Lightmap menu option as shown
in the following figure:
Clicking the Edit Lightmap option will activate the Scene Light Map
window. This will appear as a tabbed window in the Scene Light Map
properties window. This is also shown in the following figure:
137
RenderWare Studio User Guide
Note: If light mapping is enabled for a scene folder, light mapping will be applied
only to objects within the folder itself or a sub-folder of it.
Further details of the Scene Light Map window can be found in the Scene Light
Map window (p.313) topic.
138
RenderWare Studio User Guide
139
RenderWare Studio User Guide
This will activate the Asset Light Map tabbed window in the Scene Light
Map properties window. This is also shown in the following figure:
Further details of the Asset Light Map window can be found in the Asset Light
Map window (p.267) topic.
140
RenderWare Studio User Guide
In this tutorial
We show you how to:
• Prepare objects for light mapping.
• Modify parameters associated with the light map plugin window.
141
RenderWare Studio User Guide
142
RenderWare Studio User Guide
Area Light
Selecting the Area Light check box makes this material act as an area light. The
following options can then be selected and modified.
Calculate Area Light Color
If selected the color will be calculated based on the color of the texture and
the material used for the area light.
143
RenderWare Studio User Guide
144
RenderWare Studio User Guide
In this tutorial
We show you how to set up and manipulate entity lights by:
• Creating an entity light.
• Setting the attributes of a light entity.
Overview
There are two main types of lighting option to consider when designing a level:
Entity light
Entity lights are created from a “LightMap Light” template. They can be
located and manipulated within the game world in a way similar to other
enitites. This tutorial shows how to create and modify entity lights.
Area light
Area lights are actually made up of a number of point lights. Area lights are
discussed in the Area lights tutorial (p.149).
145
RenderWare Studio User Guide
This will create a template called “LightMap Light” and this template will be
added to the list of available templates in the Templates tab of the Game
Explorer window.
These light entities can now be dragged and dropped into the scene as
shown through the Design View window.
Note: By default no platform flags are set, so this will not affect the console.
Since the light is an entity, this can be overridden as required.
3. Drag the new light template into the Design View window as illustrated by
the following figure:
146
RenderWare Studio User Guide
Caution: The light mapping algorithm will only be applied to lights found in, or
below, the folder where light mapping was enabled. So, for example, the light
entity created might be moved, using the Game Explorer to the Scene folder.
147
RenderWare Studio User Guide
148
RenderWare Studio User Guide
Area lights
In this tutorial
You learn how to create and manipulate area lights.
Overview
An area light is set up by specifying a material as a light source. These materials
could represent, for example, fluorescent tubes, skylights and windows. An area
light actually consists of a number of point lights. The accuracy of lighting
produced by an area light will improve as the number of point lights in an area
light increases.
Area lights
In this mode materials can be tagged as light source emitters such as fluorescent
tubes, windows and skylights.
1. Load the RenderWare Studio project GP1_light.rwstudio that was
created in the Light mapping user interface tutorial (p.133).
2. To tag a material as a light source emitter, switch to material pick mode by
selecting Selection Pick Materials from the main menu.
3. Select a material, to which plugin data has been added, to act as a light
source. Right-click and select Show Asset Stream Contents.
4. Right-click on the material chosen in the previous step. You can then edit
the material's properties in the Stream Properties window, as illustrated in
the following figure:
149
RenderWare Studio User Guide
5. Click the Light Map Preview button to view the effect of the lighting.
150
RenderWare Studio User Guide
In this tutorial
We show you how to modify the light map preview settings.
In the Light mapping user interface tutorial (p.133) we showed you how to display
the Lightmap Preview Settings window. For detailed information about this
window please see the Light Map Preview Settings window (p.294) topic.
151
RenderWare Studio User Guide
4. Now click the Light Map Preview button . The following screenshot
5. Now display the Lightmap Preview Settings window again and select a
lightmap texture size of 128×128 and a Density of 1.0.
6. Click to view the results. The following screenshot shows an example
152
RenderWare Studio User Guide
Note: The settings in the Lightmap Preview Settings window only affect what is
seen when is clicked. If the Generate Light Maps button is clicked,
the scene settings are used to generate what is seen in the Design View
window.
153
RenderWare Studio User Guide
In this tutorial
We show you how to control light levels in the Design View window, through
use of the Lighting panel.
154
RenderWare Studio User Guide
Lighting
Apply lighting to
This drop down list box allows the world lighting to be applied to one of:
• Worlds and atomics.
• Worlds objects only.
• Atomics only.
• No objects.
To see the lighting as it will appear in the game, select No objects.
Brightness
This slider bar allows the general level of brightness of the entire world to be
easily adjusted. Reducing the brightness level to zero has the same affect
as selecting 'No objects' in the Apply lighting to list box. In this case, the
level is illuminated by the light objects you have set within the world.
155
RenderWare Studio User Guide
Note the uniformity of lighting throughout the level, making it easy to see all
parts of the world and ensuring easier placement of objects.
156
RenderWare Studio User Guide
By way of contrast, here is the same view with the Apply lighting to option
set to None. Notice how the darkness of the level would make it difficult for
you to navigate:
157
RenderWare Studio User Guide
Workspace Options
Workspace Options
Options related to the Workspace layout:
Open with last layout on startup
When RenderWare Studio is restarted, the previous layout used will be
restored.
Load last project on startup
When RenderWare Studio is restarted, the previous project used in the
Workspace will be reloaded automatically.
Remember docking positions
When RenderWare Studio is restarted, the position of all of the windows will
be restored.
158
RenderWare Studio User Guide
Edit Options
Options related to editing a game:
Remember selection settings
When RenderWare Studio is restarted, the last used pick/flight mode will be
restored.
Restore camera location
When RenderWare Studio is restarted, the last level will be made active and
the last viewpoint in the Design View window will be restored.
Restore hidden entities
When a project is reloaded, any entities that were marked as hidden during
the previous load would be hidden.
Source viewer
Set which viewer/editor is used to edit any source code. This relates to the
context menu option, View Source, on a behavior.
159
RenderWare Studio User Guide
Display options
To set the display properties of the Design View window (such as solid or
wireframe rendering):
• On the Options menu, click Display...
Display Mode
Sets the rendering display mode in each of the views using the following options
from the drop-down lists:
Solid
Draws the scene by filling in the triangles so that it appears solid.
Wireframe
Draws the scene with only the triangle edges drawn as lines so that it
appears as a wireframe.
Textured wireframe
Draws the scene as a wireframe using the texture from the polygon's
associated material.
Untextured
Draws the scene as a solid using the base color from the polygon's
associated material.
160
RenderWare Studio User Guide
Options
Aspect Ratio Display
Overlays a semi-transparent letterbox on the perspective view, indicating the
area that would be visible on a display with that aspect ratio:
161
RenderWare Studio User Guide
Snap options
Enable drag snapping
When you move an entity, it steps between positions whose intervals are
defined by Snap resolution.
Note: These intervals are relative to the current position of the entity, not to
the world coordinates.
162
RenderWare Studio User Guide
If this check box is deselected, then you can move entities freely to any
position.
Snap resolution
Sets the distance between each snap interval.
Enable rotation snapping
When you rotate an entity, it steps between angles whose intervals are
defined by Snap angle.
If this check box is deselected, then you can rotate entities freely to any
angle.
Snap angle
Sets the interval for rotation snapping, in degrees.
For example, if you enable rotation snapping and set the snap angle to 30,
then entities snap to angles of 30°, 60°, 90°, 120° etc.
Display options
Show grid in perspective view
Show a grid around the selected entity. The grid fades as it recedes from the
entity, depending on the radius you set.
Color
Sets the grid color. To set the color, click the block of color. This displays the
Color dialog.
163
RenderWare Studio User Guide
In a game, you sometimes have a very dark or a very light scene. To see
the grid clearly, choose a contrasting light or dark color.
Fixed radius
Sets the grid to a fixed size.
164
RenderWare Studio User Guide
This keeps the drag axes at a usable size, regardless of your distance from
the selected entity.
If you select this check box, then you can resize the drag axes by pressing +
or - (on the main keyboard, not the numeric keypad).
Align axes to object's local coordinate system
Keeps the drag axes aligned to the world grid as you rotate an entity.
If you leave this check box deselected, then the drag axes turn as you rotate
an entity.
Locate drag axes
Allows you to locate the drag axes at the selected object's local origin, or the
center of the selected object's bounding box.
165
RenderWare Studio User Guide
You can use folders (p.73) to organize your game database in the same way you
use folders in Windows Explorer to organize files on your PC.
For example, you could have the child folders of the game corresponding to the
levels in a typical video console game. Several of the examples (p.514) reflect this
organization (in the example topics, the terms “folder” and “level” are
interchangeable).
You might equally want to organize your folders to correspond to the different
parts of a race-track in a driving game. For example, you might have one folder
for the crowd and its corresponding entities, another folder for each of the cars
involved, and another for the different areas of the track.
To create a folder:
1. In the Game Explorer (p.288) window, right-click the game icon or an existing
folder, and then click New Folder as child.
A new folder appears with the default name “Folder” followed by a number.
2. Type a name for the folder, and then press Enter.
To delete a folder, right-click it, and then click Delete.
To rename a folder, right-click it, and then click Rename.
Tip: To make a folder of references to entities containing a certain asset or
behavior, for example to select all entities in a project containing the door asset:
• Create a new folder in the Game Explorer window and call it Doors.
• Right click on the door asset file in the Assets window, and then select
Search Entities Using Asset(s) from the context menu.
• Go to the Search Results tab (p.315), and then highlight all the entities that
have been found.
• With the Alt key held down, drag the selected items to the Doors folder.
• Now that you have created this set of references to the entities in one place
you can work on them as a group. For example, to make them all impossible
to select, right-click the folder icon, and then select Freeze from the context
menu.
166
RenderWare Studio User Guide
Tip: To optimize loading time for a game, it is better to design your database
(p.76) to use a deep folder structure that uses nested folders that contain fewer
entities, than to have fewer folders containing large numbers of objects.
167
RenderWare Studio User Guide
The global folder is a special type of folder containing objects that are persistent
throughout a game (not just one level of a game). A game has one, and only one,
global folder. The contents of the global folder are sent to the target console
before any other folders. A global folder can contain the same types of object as
a normal folder (assets, entities, other folders etc.), but the global folder cannot
be nested inside another folder.
The global folder has the same functionality as any other folder in the game
database. The only difference to a normal folder is that it has some extra data
identifying it as the global folder.
Any assets or entities positioned in the global folder, for example a high score
table for keeping a permanent record of the player's scores regardless of the
level being played, would remain in memory even when you move to a different
level later in the game.
Other important features to note about the global folder are:
• Entities in the global folder are not destroyed when the current game level
changes. They are only destroyed when the entire game is destroyed.
• When a new game is created, an empty global folder will be created
automatically.
• The global folder is sent once, before any other folders when connecting to
a target. It is not re-sent when the active folder is changed.
Tip: For a demonstration of a global folder, open the supplied multiple levels (p.538)
example.
168
RenderWare Studio User Guide
Currently, only the design build configurations of the Game Framework allow you
to easily change between levels in your game, by right-clicking the folder in the
Game Explorer window of the Workspace, and then clicking Active Folder.
In future releases of RenderWare Studio, we plan to include support for changing
levels in non-design (stand-alone) build configurations.
For now, however, you need to develop your own code for changing between
levels in a stand-alone game.
A good approach is to develop a class that manages the overall control of the
levels. This level control class is essentially a state machine that controls which
game level folder is loaded, based on certain rules (for example “has player got
blue key to exit level?”).
You could make this class inherit from CEventHandler and use events to
trigger level changes, or you could use direct function calls to trigger the levels:
169
RenderWare Studio User Guide
By default, attribute are “local”: they apply only to a particular entity, and are
stored with that entity. However, you can also share attributes between entities,
by creating attribute shares.
An attribute share is a set of attributes that can be referred to by many entities.
Changing an attribute in an attribute share affects all of the entities that refer to
the attribute share.
Entities can contain a mix of local attributes and attribute shares.
170
RenderWare Studio User Guide
This dialog lists the attributes of this entity that can be shared.
3. In the top drop-down list, select a behavior containing attributes you want to
share.
4. Select the attributes. Either:
• Click the check boxes next to each attribute name
or
• Click Select All
5. Click Create new attribute share.
6. In the Name box, type the name of the new attribute share (or leave the
default name as-is).
7. Click OK.
A new attribute share appears under the entity, replacing the local attributes that
you have now shared.
The new attribute share also appears in the Attribute Shares (p.269) window.
171
RenderWare Studio User Guide
172
RenderWare Studio User Guide
Under each of the entities that used this attribute share, the previously shared
attributes appear as local attributes.
173
RenderWare Studio User Guide
You can share entities and folders by creating references to them in other folders:
1. In the Game Explorer window, select one or more entities or folders that you
want to share.
2. Press and hold down Alt, and then drag the selected entities or folders to
another folder.
If an entity or folder has multiple references, then the Game Explorer window
displays a small × next to each reference.
References are not copies; each reference points to the same entity or folder
object in the game database. Changes to one reference are reflected in the
others. For example:
• If you create multiple references to a folder, and then you add an entity to
one of the references, the entity appears under all of the references.
• If you create multiple references to an entity, and then you change the 3D
position of the entity in the scene, then all the references to the entity move.
For a demonstration of entities and folders with multiple references, open the
supplied “Multiple Levels” example project.
Tip: To create entities that are similar, but not identical, use a template (p.127).
Or simply copy an existing entity (by dragging with Ctrl instead of Alt).
174
RenderWare Studio User Guide
You can import game level folders and templates from another project into your
current project. You might want to do this if you build game level folders of a
game in different projects, and need to merge them together or to use game level
folders from one project in another.
Note: You could equally import a folder which does not correspond directly to a
level if your game database is organized (p.166) in a different way.
When you import a game level folder, the Workspace copies the game level
folder and all of its children (entities, assets and templates) into your current
project.
Note: If you import a game level folder whose item IDs match items in the current
project, then the Workspace assumes that they are the same items, and does not
import them. If these are not the same items, and you do want to import them,
then rename the item IDs before you import them.
To import one or more game level folders, and optionally import all templates,
from another project:
1. On the File menu, click Import.
The Open RenderWare Studio Project File dialog appears.
2. Browse to the .rwstudio project file from which you want to import items.
The Import dialog appears.
175
RenderWare Studio User Guide
Tip: If you want to import the templates from another project without
importing any game level folders, then select the Import templates check
box, but do not select any game level folders.
Importing game level folders or templates creates game database items in your
current project. It does not copy primary asset files to your current project, or
even verify that the primary asset files required by imported assets exist in the
resource root path of your current project. To verify that the required primary
asset files exist in the appropriate locations, use the Database Validation (p.193)
tool.
176
RenderWare Studio User Guide
“Delete” and “remove” are different actions that you can perform on the game
database:
Delete
Erases an object from the game database, and all references to the object.
Deleting an object in Workspace does not delete its corresponding
XML file. When you save a project, rather than deleting the XML file for a
deleted object, Workspace replaces the file contents with a <Deleted/>
tag. This allows you to use RenderWare Studio with version control systems
that do not delete client files (such as NXN alienbrain and Microsoft
SourceSafe).
To delete these files, use the PurgeDeleted tool, in
Studio\Programs\Tools\PurgeDeleted.
Remove
Erases a reference to an object in the game database (not the object itself).
Any other references to the object are not affected.
1. Select the object or reference.
2. Right-click the object or reference, and then click Delete or Remove.
If you attempt to delete an object that has multiple references, then a
confirmation message appears.
Note: An object can still exist in the game database, even if no other objects refer
to it.
For example, if you remove a reference to an asset from an entity, then that asset
would still exist in the Assets window, and any references to the asset in other
folders or windows would also still exist. However, if you delete the asset (from
the Assets window), then the asset, and any references to that asset, are deleted
from the game database.
177
RenderWare Studio User Guide
3D sound
To use 3D audio in Renderware Studio drag an object into the scene and place a
AudioGlobalMixer behavior onto it. Then right-click on this in the world lister and
select New Asset. Set the asset type to be rwaID_WAVEDICT, and add the
file path to a RenderWare Stream file (.rws). You can now attach an
AudioSound3D behavior to an object and tweak its parameters. If you want to
add 3DSound functionality to your own behaviors you can either derive from
AudioSound3DInterface, or you can contain the Audio toolkit class in your code.
Streamed audio
To play streamed audio, specify the .vag file in the AudioStreamInterface.cpp file.
After the stream loads, you can use the behavior to start and stop the audio.
Virtual voices
RenderWare Studio supports Virtual Voices. This allows you to have hundreds of
voices in a scene, but only map to a few hardware voices. Audio streams cannot
use virtual voices, so stream voices are mapped to the last 16 voices in the real
voice list.
178
RenderWare Studio User Guide
179
RenderWare Studio User Guide
A sequence is a predefined set of actions that always take place in the same
order. In a sequence, the attributes of existing entities may be modified together
over time, and new entities may be created and controlled. Sequences can be
put to uses such as:
• Ending a level, or joining two levels together, with a piece of animation (a
“cut scene”) that features the entities in your game.
• Making a game character perform some repeated actions while waiting for
the player to provide input.
• Synchronizing the changing attributes of a set of entities over a short period,
as in the lift example from the Genre Pack 1 tutorial.
2. Right-click the asset and choose Edit. The Sequencer window will come to
the foreground, displaying the contents of your (currently empty) sequence.
180
RenderWare Studio User Guide
Note: If the Sequencer window is not in the current Workspace layout, it will
be opened as a floating window.
3. Drag the entities that you want to appear in the sequence from Game
Explorer or the Templates window to the left-hand pane of the Sequencer
window.
For each entity, a dialog will appear asking you to specify which attributes
you want to be able to modify during the sequence. You can edit your
selections later through the Sequencer window's context menu.
4. Use the features of the Sequencer window (p.317) to add keyframes,
interpolations, and events to the timelines of the attributes you've chosen.
3. In the Attributes window for the new sequence entity, specify a Start event
for your sequence.
181
RenderWare Studio User Guide
Now you can arrange for another entity in your game (a trigger volume, for
example) to send this event. When the sequence entity receives it, the
sequence will begin to run.
182
RenderWare Studio User Guide
You can save data from a target console out to permanent files on your hard disk
via a network connection to the Workspace. As an example, you might want to do
this to save the lighting data in a game level out to files to be used later as light
maps in another level during another session of RenderWare Studio. An ActiveX
Control in the Workspace listens for the data coming from the console.
RenderWare Studio saves this data as temporary files and displays them in the
Target Files (p.329) window. These temporary files are available only during the
current session. Before ending the session, you select which files to write
permanently to the hard disk for later use.
183
RenderWare Studio User Guide
If you are developing a game for multiple platforms, then, typically, there are
some differences between the games on each platform.
For each item in the game database (p.73) (under the game item), you can
specify the platforms to which the item applies.
The game data stream includes only those items that apply to the target platform.
By default, items apply to all platforms.
To specify the applicable platforms for an item:
• In the Game Explorer window, select (p.288) one or more items.
• Right-click one of the selected items.
• Select or deselect the check box for each platform.
The changes you make apply to all of the selected items.
184
RenderWare Studio User Guide
The properties for each object in the game database also specify a set of
platform flags. RenderWare Studio includes an object in the game data stream
only if the platform flags for the object include all of the platform flags for the
target.
You can create a custom target platform by editing this settings file. For example,
you might want French and English versions of your game to use different art
assets. To do this, you would define new “French” and “English” platform flags,
and then define new target platforms that require these flags. This is described
below.
When you define new platform flags, they become available in object property
sheets the next time you start RenderWare Studio Workspace:
185
RenderWare Studio User Guide
By default, objects have all property flags selected. When you define new
property flags, then existing objects with all property flags selected also have the
new flags selected. However, if an existing object has any property flags
deselected, then the new flags will not be selected.
After defining new platform flags, you can define custom platforms that require
these flags.
</OBJECT>
</OBJECT>
<OBJECT NAME="French Playstation 2">
<PARAM NAME="Default Port" VALUE="5611" />
<PARAM NAME="Platform Flags"
VALUE="PS2,French" />
</OBJECT>
186
RenderWare Studio User Guide
If you simply store your game database XML files in a shared folder, and you
allow multiple users to access the files concurrently, then the users' changes will
overwrite each other, and you might lose data.
To overcome this issue, and allow team development, the NXN alienbrain
(www.alienbrain.com/) asset management tool is supplied with RenderWare
Studio.
187
RenderWare Studio User Guide
188
RenderWare Studio User Guide
Change sets
Change sets are automatically managed lists of files that are waiting to be
checked in to the alienbrain server. Automatic change set management comes
into play when you:
• Create any type of new object—for example, an entity, a folder, or an
attribute share—in an alienbrain-managed project.
• Make an object reference a resource that is currently unused—for example,
a .dff, .bsp, or .rf3 file—and in a managed location.
Note: You can have more than one change set waiting for check-in at a time, but
all automatic actions take place in the default change set.
' To ask user if they want to change default change sets, uncomment
this code.
' Dim bManageChangeSets
' bManageChangeSets = MsgBox ("Default change set is '" & _
' DefaultChangeSetName & _
' "'. Show alienbrain explorer to manage
change sets?", _
' vbYesNo + vbQuestion, "Version Control")
' If bManageChangeSets = vbYes Then
' VersionControl.ShowProjectInExplorer
' End If
End If
End Sub
189
RenderWare Studio User Guide
Refresh
Refreshes the alienbrain status indicators on icons:
indicates that the object is in an alienbrain-managed folder, but
is not checked out.
indicates that the object is checked out by you.
indicates that the object is checked out by someone else.
indicates that the object is due to be imported into the game
database.
Show history
Opens the history window for the selected file, allowing you to see the
list of previous versions of the file and difference them against the
current version on your local disk.
Properties
Opens the alienbrain properties window for the selected file.
190
RenderWare Studio User Guide
Special notes:
• All of the above context-menu actions can be selected for an individual
asset or resource by selecting Studio Asset or Resource and then the
appropriate action from the context menu.
• When you check in the object or resource using this method, the object or
resource is taken out of the default change set in alienbrain
• When using alienbrain change sets, you need to be careful that you don't
check in an entity that references an asset that is saved on your client, but
not on the alienbrain server. Make sure that both the asset and its parent
entity file are checked in.
191
RenderWare Studio User Guide
This window is a scaled-down version of the NXN manager client window that is
hosted by RenderWare Studio. It allows you to perform all the version control
operations on your game database that you would in the full alienbrain client
manager window.
To launch the window, select File NXN alienbrain Show NXN Explorer.
If you use the alienbrain client to get the latest version or rollback while a related
project is open in the Workspace, then Workspace will not automatically update
to reflect changes to your local copies of the files (you will need to re-open the
project). Whereas, in Workspace or the NXN Database Explorer, performing a
“get latest” does update Workspace to reflect any changes.
192
RenderWare Studio User Guide
As you develop your game, the source code evolves and your class definitions
change. You might add and remove attributes, and sometimes an attribute's data
type might change. Thus, any data for an attribute that is already saved in the
XML code becomes invalid. Using the Validate Database tool, you can check the
integrity of attribute data. You can also use this tool to check other parts of the
database, such as whether entities or assets are unused in the game.
• On the Tools menu, click Validate Database...
The Validate Database dialog appears listing the database items that you can
check for integrity.
193
RenderWare Studio User Guide
exist in the database. This option examines each entity's attributes and
determines whether a corresponding command exists for each attribute.
RenderWare Studio generates a warning for any attributes it finds which
have no corresponding command.
Check that no private attributes are shared
It is possible that attributes that were shareable might have at some time
been made private in the source code. This option checks any attributes
within folders to ensure that their corresponding commands are not private.
The source parser tags any private attributes.
Look for unused entities
RenderWare Studio queries the parents of each entity in the database. If an
entity has no parent, or is a child of an orphaned entity folder, RenderWare
Studio generates a warning.
Look for unused folders
RenderWare Studio queries the parents of each entity folder. If a folder has
no parent, RenderWare Studio generates a warning.
Look for unused assets
RenderWare Studio queries the parents of each asset in the database. If an
asset has no parent, or is a child of an orphaned asset folder, RenderWare
Studio generates a warning.
Look for unused attribute shares
RenderWare Studio queries the parents of each attribute share. If an
attribute share has no parent, RenderWare Studio generates a warning.
194
RenderWare Studio User Guide
RenderWare Studio groups each error under an appropriate tab, for example,
Attributes without source code, Unused items, and so on. Each error displays
under columns for repair and for parameters appropriate to the database item,
such as name, type, parent entity, and so forth.
In the case of database items which cause RenderWare Studio to display a New
Behavior column, you can click the list box to display different behaviors. If this
action will correct the error, then use the check box under the Repair column to
fix it.
Click the box in the Repair column if you want to fix the problem. For example,
the action to repair might be Delete, clicking the box will repair the error by
deleting the database item. By default, RenderWare Studio displays all check
boxes in this dialog as unchecked.
Repairing missing behaviors
Changes missing behaviors to CEntity for all affected entities.
Repairing attribute data types
Deletes attributes with incompatible data.
Repairing private attribute sharing
Removes shared private attributes from their shared parent folder.
Repairing unused entities
Deletes unused entities.
Repairing unused entity folders
Deletes unused entity folders.
Repairing unused assets
195
RenderWare Studio User Guide
196
RenderWare Studio User Guide
While you are developing a game, you can view it simultaneously on several
different targets:
You can also view the game in a separate window on the same computer as
RenderWare Studio:
While viewing the game on a target, you can continue using RenderWare Studio
Workspace to develop the game. Any changes you make (such as adding,
moving or deleting entities, or changing behavior attributes) are dynamically
reflected on the target.
To view your game on a target:
1. Create a connection (p.199) to the target.
197
RenderWare Studio User Guide
2. (GameCube design builds only.) Start the GameCube Comms Server (p.210).
3. Start the Game Framework (p.212) on the target.
4. Connect (p.213) to the target.
198
RenderWare Studio User Guide
By default, the Targets window contains a connection for each type of target
that RenderWare Studio can connect to.
You can choose to edit an existing connection, or create a new connection.
2. Either:
• Click Properties... to edit the connection that you right-clicked.
or
• Click New... to create a new connection.
This displays the Properties dialog for the connection.
199
RenderWare Studio User Guide
200
RenderWare Studio User Guide
201
RenderWare Studio User Guide
IP port number
The Workspace sends data to the IP port number defined in the
rwstudio.settings file (in the RenderWare Studio Programs folder):
<OBJECT NAME="platform type">
<PARAM NAME="Default Port" VALUE="port number" />
The Game Framework listens for data on the platform-specific port number
defined in the network.cpp file (in the gfCore library).
For example:
#if defined (_XBOX)
RwBool bOK = NetStream::Init (5610);
To use different port numbers, edit these two files to match the new numbers.
If you use an Internet Connection Firewall (ICF), then you need to ensure that it
allows communication via these ports (see your firewall documentation).
Remote platform
The general type of target to which you are connecting:
• GameCube
• DirectX (PC)
• OpenGL (PC)
• PlayStation 2
• Xbox
202
RenderWare Studio User Guide
Remote target
The specific type of target, depending on the platform. For example, for
a PlayStation 2 target, you can choose Development Tool or Test
Station.
Resource location
Specifies how the target gets data (p.204) from primary asset files and
their dependencies. (If you select the Embed assets check box, then
the Workspace embeds asset data in the game data stream; otherwise,
it sends only the asset pathnames.)
Network timeout (ms)
The number of milliseconds that the Workspace waits for a response
from the target before disconnecting. If you select the Infinite check
box, then the Workspace waits indefinitely.
Target RF3 Template
The template that Workspace uses to generate streams from RF3 files,
for inclusion in the target's game data stream.
4. Click OK.
The Properties dialog closes.
203
RenderWare Studio User Guide
Targets get asset data either from the Workspace (via the game data stream) or
from files on the target's own file system, depending on the Embed assets check
box in the target connection properties (p.199):
• If this check box is selected, then the Workspace sends asset data to the
target in the game data stream.
• Otherwise, the properties specify a Resource location. This is the absolute
path of a folder on the target's file system that contains the primary asset
files and their dependencies. The Workspace concatenates this absolute
folder path with each asset's relative file path, and sends the resulting
pathname to the target in the game data stream. The target uses this
pathname to find the file on its own file system.
204
RenderWare Studio User Guide
205
RenderWare Studio User Guide
To find the primary asset file and its dependencies, the Game Framework
combines the resource location with these relative paths.
206
RenderWare Studio User Guide
Before connecting to the target, ensure that the primary asset files and
dependencies exist in the location that you have specified.
207
RenderWare Studio User Guide
You can add custom actions to this menu for each target platform (similar to the
Launch action for some targets).
Caution: The following procedure involves editing the RenderWare Studio
settings file. If you introduce errors into this file, then RenderWare Studio might
not correctly initialize some controls.
To add a custom action:
1. Exit RenderWare Studio.
2. Create a backup copy of the RWStudio.settings file (stored in the
RenderWare Studio Programs folder), so that you can return to this copy
later if you introduce errors.
3. Open the RWStudio.settings file in a text editor.
This XML file contains an <OBJECT NAME="TargetLink"> section that
defines the platforms and their parameters, the different types of target for
each platform, and the actions for each target.
The following excerpt shows the PlayStation 2 platform, its parameters, and
its two types of target: Development Tool (DTL-10000) and Test Station.
Note that only the Development Tool target has an action defined
(“Launch”).
<OBJECT NAME="TargetLink">
<OBJECT NAME="Platforms">
<OBJECT NAME="Playstation 2">
<PARAM NAME="Port" VALUE="5610">
</PARAM>
208
RenderWare Studio User Guide
To specify a value, click in the Value column next to the variable name, and
then enter a string value. If you select the check box, then the value is saved in
the settings file.
209
RenderWare Studio User Guide
This topic applies only if you are not using a broadband adapter (p.215).
Before you can view a design build of your game on a GameCube, you need to
start the GameCube Comms Server on the PC that is connected to the
GameCube (the “host” PC).
The GameCube Comms Server (supplied with RenderWare Studio) enables the
Workspace to send the game data stream to the GameCube.
You can run the Workspace either on the same PC as the GameCube Comms
Server:
Note:
• Either way, you need to install RenderWare Studio on the host PC.
• You can also run the compiler on a separate PC (so far, we have only tested
this with ProDG).
A GameCube icon appears in your system tray (typically, this is at the bottom
right of your screen):
If there is a problem with the GameCube Comms Server, then a red cross
appears on the icon. Resetting the server usually fixes the problem: either
right-click the icon and then click Reset, or double-click the icon.
210
RenderWare Studio User Guide
If you start the Game Framework on the GameCube before starting the
GameCube Comms Server, then the console screen will be blank. To fix this,
start (or reset) the GameCube Comms Server.
If you attempt to connect to the GameCube, but the GameCube Comms Server is
not running, then the “Connecting to Console...” progress bar will not complete,
and will eventually time out. Start (or reset) the GameCube Comms Server, and
then try connecting again.
211
RenderWare Studio User Guide
212
RenderWare Studio User Guide
Connecting to a target
This topic assumes that you have already created a connection (p.199) to the
target, and that you have started (p.212) the Game Framework on the target.
If you want to connect to a design build on a GameCube, then you also need to
start the GameCube Comms Server (p.210).
To connect to a target:
1. In the Targets window, right-click a connection name.
2. Click Connect.
After a few seconds, the game appears on the target.
213
RenderWare Studio User Guide
214
RenderWare Studio User Guide
215
RenderWare Studio User Guide
This topic describes the steps you need to complete to run the RenderWare
Studio Game Framework under AtWinMon on a PlayStation®2 Test Station with
a USB-to-ethernet adapter.
You can download AtWinMon from the PS2 Devnet
(www.ps2-pro.com/projects/gt-at-monitor/) website (requires user ID and
password). You will need the latest version of the alternative monitor and the
Windows client tools. At the time of this writing, the Window client tools include
atwinmon113v2 and atwin070.
For an explanation on how to use AtWinMon and how to build and burn a CD,
see the readme file (ReadMe.txt) located in the directory where AtWinMon was
installed. In addition, you might find the following notes useful.
• The Game Framework was tested with the Inet version of AtWinMon; this is
the most current version. The older configurable version should also work
but has not been tested.
• The version of the IOP BIOS and .irx modules used by AtWinMon should be
the same as the ones used by your executable (the precompiled version in
atwinmon113v2 use the 2.54 versions). When you download AtWinMon,
there is a a batch file called getiop.bat which simplifies this process.
• The network settings used by AtWinMon can be set in two ways:
1. By hard-coding the settings in config.c and rebuilding AtWinMon.
2. By burning a CD with AtMon on (the original Sony monitor program)
and running it. It will allow you to set the network configuration when
running on the console, and save the settings to a memory card. If this
memory card is plugged in when AtWinMon is used then the settings in
it will override any hard-coded settings in config.c.
• All of the files to be put on the CD for AtWinMon are put into the Target
directory. The batch files, getiop.bat and put.bat does this automatically.
216
RenderWare Studio User Guide
installed.
Complete the following steps to run the Game Framework with AtWinMon.
1. If using the Inet version of AtWinMon, add ATWINMON to the list of project
defines for the gfCore (Game Framework core) project.
• For SN Systems ProDG, add ATWINMON to the list of preprocessor
defines for the gfCore project in Visual C++.
• For Codewarrior, add the line below to Prefix_PS2_RW.h:
#define ATWINMON
2. Note: This define stops the Game Framework from loading up the Inet
modules because AtWinMon has already loaded them.
Replace the project crt0.s file with the one in the Atdev directory.
• For SN Systems ProDG, the crt0.s file will be in the same directory as
the game_framework Visual C++ project file. Make a backup of the
original before copying the crt0.s file.
• Metrowerks Codewarrior uses Sony's crt0.s file located in
usr\local\sce\ee\lib. Make a backup copy of this before copying
the AtWinMon crt0.s file.
3. Do a full rebuild of the game_framework project.
217
RenderWare Studio User Guide
218
RenderWare Studio User Guide
To debug your game, build the Game Framework using one of the debug build
configurations (p.408).
Note: RenderWare Studio displays debug messages when you connect to a
debug console. If you work with a debugger, such as the Visual Studio debugger,
then RenderWare Studio still displays debug messages in the Message Log
message box.
219
RenderWare Studio User Guide
Note:
• The horizontal axis shows the frame number.
• The vertical axis automatically scales to include the minimum and maximum
values.
220
RenderWare Studio User Guide
This sends the value of the variable Time to a buffer on every sixth call. The
value appears on the Metric Graph with the caption “CPU_Time” (captions cannot
include spaces or tabs).
Each call to RWS_TRACE_METRIC sends the value once only (or rather, on
every nth call, according to the first macro parameter). You should insert the
RWS_TRACE_METRIC macro calls in sections of code that are called every
frame.
You can include more than one variable on the same captioned graph. For
example:
RWS_TRACE_METRIC(6,"CPU_Time",Time2);
This shows the value of the variable Time2 on the same “CPU_Time” graph as
Time (from the previous example). If you include more than one variable on a
graph, then, rather than showing a line, the graph shows a band, indicating the
range of values.
Another macro, RWS_SEND_TRACE_METRICS, sends the buffer contents to
the Metric Graph, and then clears the buffer:
RWS_SEND_TRACE_METRICS(60);
The parameter on this macro specifies the number of times the macro is called
before it sends and clears the buffer. If the buffer fills before this number is
reached, then the parameter is ignored, and the macro sends and clears the
buffer immediately. In the example above, if the Game Framework is running at
60Hz, then the Metric Graph receives updated values once every second.
Note:
• Sending too much metric data too frequently can congest your network.
• The supplied Game Framework already contains a call to
RWS_SEND_TRACE_METRICS, in mainloop.cpp (in the core library).
221
RenderWare Studio User Guide
222
RenderWare Studio User Guide
The Target Metrics tab displays a row for each target connection that
you have created since starting the Workspace. Each row contains the
following columns:
Session Id
Unique number that identifies the connection.
Start time
Frame number when the connection started.
End Time
Frame number when the connection ended.
Num Metrics
Number of graphs shown in the Metric Graph window.
Num Data Elements
Number of times that the RWS_TRACE_METRIC macro has sent
a value to the buffer.
d. On the Target Metrics tab, right-click the connection that you have just
created, and then click View.
The Metric Graph for that connection appears.
223
RenderWare Studio User Guide
In Workspace, before connecting to a target, you can start NetTest, then connect
to a target, and see NetTest describe the game data stream as it is being sent to
the target. You can also start NetTest from standalone scripts.
Listening to an IP port
To start NetTest from Workspace, before you connect to a target:
1. In the Targets window, right-click a target, and then select Launch NetTest.
Note: The NetTest window will only appear if you have edited the
connection properties (p.199) so that the Address of the Target is localhost.
224
RenderWare Studio User Guide
To start NetTest listening without running Workspace, run the following Windows
script file:
C:\RW\Studio\Programs\Tools\NetTest\Script\NetTest.wsf
[/port:value] [/bigendian]
For example:
NetTest.wsf /port:5608
starts NetTest listening on port 5608 for a little-endian stream.
By default, this script file listens on port 5607 (the default port for the DirectX -
Local PC target).
225
RenderWare Studio User Guide
Assets refer to data files, for example, textures, models, sound files. Behaviors
are C++ class files that inherit functionality from parent classes, for example,
CAttributeHandler. Attributes are properties of the entity that can be
modified in Workspace.
FPSRender Count: 1
FPSPlayer Count: 1
CWin32Keyboard Count: 3
CFXLight_2Stage Count: 1
CFXLight_Spline Count: 1
CFXSpinLight Count: 1
CFXWaveLight Count: 1
CFXColorLight Count: 1
CDirectorsCamera Count: 1
CDebugTools Count: 1
This list shows entity types and the number of entities contained within the
stream. As already mentioned, each entity may consist of one or more assets
and behaviors. Each asset in the stream file is then listed in more detail in the
following sections of the NetTest output.
Tip: While reading the following sections it might be useful to view a typical asset
properties dialog in Workspace. To do this right-click on an asset in Asset
Window of Workspace and select the Properties menu item. You will see
something similar to the following figure:
226
RenderWare Studio User Guide
Asset data
The output produced by NetTest when examining a stream file will include
information about assets:
strfunc_LoadEmbeddedAsset:
Header size: 120
Data size: 903280
Name: Map_All
ID: {F5FC6463-E8B8-4592-A3DD-E8FC70524155}
Type: rwID_WORLD
File: C:\RW\Studio\Examples\Models\Map_All.bsp
Dependencies: .\Models\Textures\
strfunc_LoadEmbeddedAsset
Specifies the function that will be used to load this particular asset from the
data stream. Note the asset in this case is actually embedded into the data
stream. Alternatively, assets may be loaded from the target's file system.
Other asset types and behaviors may use different functions to load them.
Typically these loader functions begin with strfunc_.
227
RenderWare Studio User Guide
Header size
Is the size of the instructions (strfunc commands and their data) in the
stream that informs (in this case) the target to load an asset that's
embedded in the stream. Other strfuncs may, for example, request an
entity to be created or update certain attributes.
Data size
Is the size in bytes of the asset. In this example the bsp file asset is
embedded into the output data stream. In Workspace it is possible to
deselect the "embed assets" checkbox in the connection properties
dialog. In this case only the Name would be sent via the stream, relying on a
filesystem to load the requested files.
To access the Connection Properties dialog, first select the target Properties,
by right clicking on the desired target, as shown in the following figure:
228
RenderWare Studio User Guide
229
RenderWare Studio User Guide
Entity data
The following shows data for a lighting behavior, CFXLight_Spline:
strfunc_CreateEntity:
Behaviour: CFXLight_Spline
Entity ID: {79C1E544-7AAD-4386-AC21-10F542C27D02}
Class: CSystemCommands
Attach asset, ID:
{8B0D9A81-6525-4140-8B53-042BA3885238}
Class: CFXLight_Spline
Attribute 0: [iMsgStartSystem][69 4D 73 67 53 74
61 72 74 53 79 73 74 65 6D]
Attribute 1: [ ][00 00 00 FF]
Attribute 2: [ ][00 7F 00 FF]
Attribute 3: [ ][7F 7F 00 FF]
Attribute 4: [ ][7F 00 00 FF]
Attribute 5: [ ][00 00 00 FF]
Attribute 6: [o ][6F 12 03 3B]
Attribute 7: [ ][00 00 00 00]
Attribute 8: [ ][00 00 00 00]
Attribute 9: [ ][00 00 00 00]
Class: CFXBaseLight
Attribute 0: [ ][01 00 00 00]
Attribute 1: [ B ][00 00 34 42]
Attribute 2: [ zD ][00 00 7A 44]
Attribute 3: [ ][00 00 00 00]
Class: CSystemCommands
Attribute 1: [ ][00 00 80 3F 00 00
00 00 00 00 00 00 00 00 00]
Attribute 2: [ ][FF FF FF FF]
Attribute 3: [ ][FF FF FF FF]
Attribute 4: [ ][FF FF FF FF]
Class: CAttributeHandler
Attribute 0: [ ][00 00 00 00]
The fact that CFXLight_Spline also requires an asset can be seen in the
Workspace environment. This can be seen in the following extract from the
Game Explorer window:
230
RenderWare Studio User Guide
You can see that CFXLight_Spline uses several other classes, including:
• CSystemCommands
• CAttributeHandler
• CFXBaseLight
231
RenderWare Studio User Guide
Note: Each of these attributes and its data value is also shown in the NetTest
output.
232
RenderWare Studio User Guide
233
RenderWare Studio User Guide
The startup files are stored in the gfCore library. The table below lists the
startup file names for each platform, and the default expected location of the
boot-up stream file.
If you use the global folder, then you also need to add code to load its stream file
in the startup file (similar to the existing code for the boot-up stream file).
234
RenderWare Studio User Guide
Files Description
ioprp254.img OIP image.
sio2man.irx Pad IRX files.
padman.irx
mtapman.irx
system.cnf Boot-up configuration file.
sles_000.00 Game Framework executable (must match the name in
the boot-up configuration file, above).
bootup.dff Bootup stream file (p.233).
padding.fil Padding.
inet.irx Network IRX files for connecting to the Workspace
netcnf.irx computer via the USB Ethernet adapter.
inetctl.irx Required only for the Design Release CDROM build.
usbd.irx
rwscomms.irx1 To connect to the Workspace computer via the
235
RenderWare Studio User Guide
236
RenderWare Studio User Guide
When writing your own custom resource handlers, it is important to make sure
you always adjust the position of the stream pointer to the end of the stream. The
end of the data chunk may be padded, so you need to make sure that this
padding is skipped for the pointer to properly jump to the next ID. If you don't do
this, then you can get stream corruptions during your level loading which can
cause the framework to assert when it comes across an invalid stream chunk
header.
237
RenderWare Studio User Guide
The Workspace user interface consists of a set of dockable windows (p.262) that are
children of the Workspace application window. The application window itself is a
“docking frame” that is responsible for displaying its child windows.
If you change your mind while dragging a window, press Esc to return the
window to its previous position. If you change your mind after dropping the
window, simply drag the window back to its previous position.
Layout changes are saved when you close Workspace. You can also save
different layouts (p.335), and switch between them while using Workspace (select
View Layouts). To restore the supplied layouts to their original state, select
View Restore Default Layouts.
Similarly, if you cannot see the menu or toolbar you want, select View
Toolbars. If it is not in the current layout, the menu or toolbar that you select
appears docked to the top of the application window (you cannot float menus or
238
RenderWare Studio User Guide
toolbars).
239
RenderWare Studio User Guide
240
RenderWare Studio User Guide
241
RenderWare Studio User Guide
To... Do this...
Expand or collapse a stacker Click the splitter button next to the stacker.
The stacker expands or collapses in the
direction of the arrow on the splitter button.
Stackers always collapse towards the edge of
the application window.
A collapsed (hidden) stacker is indicated by a
splitter button whose arrow points inwards,
away from the edge of the Workspace
application window.
Tip: To find out what windows a collapsed
stacker contains, move your mouse over the
splitter button.
Resize a stacker Drag the splitter that is next to the stacker.
Expand or collapse a stacker element Click the expand or collapse button in its title
bar.
Change the height of a stacker element Drag up or down in the blank area of its title
bar (between the caption and the close
button).
Move a stacker element between stackers Drag the stacker element by its grabber.
Move a tab between tabbers Drag the tab.
Move a stacker element to a tabber, as a new Drag the stacker element by its grabber.
tab
Move a tab to a stacker, as a new stacker Drag the tab.
element
Move a stacker element or a tab to a new Drag it to a stacker that is next to the work
stacker beside the work area area. Before you drop, ensure that the black
outline shows a full rectangle.
Move a stacker element or a tab to a new Drag it to a splitter. If the splitter is vertical,
stacker in a new row then dropping near the top of the splitter
creates a new stacker above the splitter;
dropping near the bottom creates a new
stacker below.
Float a stacker element Right-click its title bar, and then click Float
Window.
Dock a floating stacker element Drag it, by its grabber, to the Workspace
application window.
Set a stacker element as the work area Right-click the title bar of the stacker element,
and then click Set as client.
This moves the previous work area to a new
floating window.
Re-order tabs inside a tabber Drag them.
Convert a tabber to a stacker Right-click the title bar of the stacker element
242
RenderWare Studio User Guide
243
RenderWare Studio User Guide
Main Menu
File
New Project (p.98)
Creates a new project.
Open Project...
Opens an existing project file (.rwstudio).
Save Project
Saves the current project.
Save Project As...
Saves the current project to a different set of XML files.
File Save As copies the XML files from their current location to the new
location (relative to the new .rwstudio project file). On the File menu, click
Save As, and enter the new file name (NewGame). RenderWare Studio
creates the new project file and folder structure, and copies the related XML
files.
Import
Allows you to import (p.175) game level folders and templates from another
project into your current project.
Refresh
Refreshes the alienbrain status indicators on icons:
indicates that the object is in an alienbrain-managed folder, but
is not checked out.
indicates that the object is checked out by you.
244
RenderWare Studio User Guide
Recent Projects
Lists projects that you have recently opened. To open one of these projects,
click its file name in the list.
Exit
Closes RenderWare Studio.
245
RenderWare Studio User Guide
Edit
Undo
Undoes actions that affect game data. Actions that you can undo include:
• Adding and deleting objects in the game database (such as entities and
assets).
• Changing properties.
Redo
Redoes the action that was previously undone (see the exceptions for
Undo, above).
Show Undo Stack
Displays in the Undo Stack dialog, the operations from the current session
which you can undo and redo.
Search in Game...
Displays the search dialog allowing searches through the whole database.
View
Windows (p.238)
Shows or hides each of the dockable windows in the current user interface
layout.
Toolbars (p.251)
Lists the toolbars availalbe in Workspace and toggles them on and off when
each is selected.
Layouts (p.238)
Switches between user interface layouts. Each layout consists of mostly the
same windows, organized into different containers.
246
RenderWare Studio User Guide
Selection
Flight Camera (p.111)
Fly the camera by pointing in the view, and then pressing and holding down
a mouse button. This camera mode has separate controls for the
perspective view and the orthographic views.
The following ...Camera (p.108) menu items switch between the modes for
controlling the camera in the Design View window:
Orbit Camera
Orbit the camera around a point by dragging.
Pan Camera
Pan the camera by dragging.
Zoom Camera
Zoom (dolly) the camera in and out by dragging.
Lock Selection
Toggles between the selection lock being on and off when you select an
entity in pick mode in the Design View window (p.276). When the lock is on, it
stops you selecting other entities if you click on them by accident.
Orbit Only
Camera orbits a selection where an object is selected in pick mode,
otherwise it orbits the world origin.
Orbit Objects
247
RenderWare Studio User Guide
Toggle Pick/Camera
Toggles between the last Pick and Camera menu item clicked
Next Mode
Cycles forward to the next camera mode.
Previous Mode
Cycles back to the previous camera mode.
Locate
Moves the camera to show a close-up of the selected entity.
Aim At
Moves the camera to aim at the selected entity but does not show close-up
of entity.
Target
All Targets
Reload Game
Restarts the Game Framework on the target and resends all assets and
entities.
Reset All Entities
Resends entities to the Game Framework. This is a quicker way to reset a
game when assets have not changed.
Director's Camera
Overrides any camera control behaviors in the Game Framework. Instead,
the console view follows the movements of the camera in Workspace.
Pause Mode
Pauses the Game Framework on the target.
Clean
Deletes the stream files and other intermediate files created by the Game
Production Manager (in the Build Output\connection name\… folders
under your project).
Build
Updates any out-of-date intermediate files and then (if there were any
updates), creates new stream files (Build Output\connection
name\Folder\*.stream) for the global folder and the active folder.
Rebuild
Cleans, then builds.
248
RenderWare Studio User Guide
Cleans all folders in the project, not just the global folder and the active
folder.
Build (All Folders)
Builds all folders in the project, not just the global folder and the active
folder.
Rebuild (All Folders)
Rebuilds all folders in the project, not just the global folder and the active
folder.
Connect
Connects to the target using the last built Renderware stream.
Build and Connect
Builds, then sends the stream files for the global folder and active folder to
the target. Any subsequent changes are also sent to the target, until you
disconnect.
Tip: Double-clicking the word “Connected” or “Disconnected” in the Status
column has the same effect as selecting this option.
Disconnect
Stops sending game data to the target.
Reload Game
Stops and restarts the game, and then resends the game data stream.
(Equivalent to disconnecting, and then connecting.)
Reset All Entities
Sends all entities and their attributes, but without sending their assets. This
is a quick method of restarting the game if no assets have changed.
Synchronize camera (only enabled for connected targets)
Ensures that the camera position shown on the target matches the position
of the camera in the RenderWare Studio Workspace.
Launch
Starts the console emulator application.
Properties
Sets the target properties (p.199).
Tip: Double-clicking in the Target column has the same effect as selecting
this option.
Options
Flight (p.115)
Sets how finely the camera responds to mouse and keyboard movement,
and the minimum frame rate for camera motion.
Flight Keys (p.117)
Sets the keys used for keyboard flight.
Drag (p.162)
Sets various options for dragging entities, such as whether entities snap to
regular intervals when you move or rotate them.
Display (p.160)
249
RenderWare Studio User Guide
Sets the display properties of the Design View window (such as solid or
wireframe rendering).
Workspace (p.158)
Selects whether or not Workspace remembers various user interface
settings, such as how you have arranged the dockable windows. Also sets
whether or not Workspace automatically opens the last project when it
starts.
Light map (p.294)
Allows you to adjust various parameters that affect how light map previews
will appear in the Design View window.
Tools
Parse All Source
Parses all source for the current game.
Validate Database... (p.193)
Displays a dialog to select which parts of the database to validate. You can
then correct any problems.
Help
Workspace Help
Displays the Workspace Help.
About Workspace
Displays information about RenderWare Studio, such as the installed
version.
250
RenderWare Studio User Guide
Toolbars
Standard
Button Description Equivalent
menu option
New Project File New Project...
Creates a new project and folder structure.
Open Project File Open...
Opens an existing project file (.rwstudio).
Save Project File Save
Saves the current project.
Undo Edit Undo
Undoes actions that affect game data. Actions that you
can undo include:
• Adding and deleting objects in the game database
(such as entities and assets).
• Changing properties.
Selection
251
RenderWare Studio User Guide
252
RenderWare Studio User Guide
Active Target
Note: The following toolbar buttons are enabled only after one of the target
consoles have been Set as Active in the context menu of the Targets (p.330)
window.
253
RenderWare Studio User Guide
Light Map
Button Description
Light Map Preview
Calculates lighting according to the settings in the Light
Map Preview window. The results of applying the lighting
calculations to the scene are displayed in Design View.
Light Map Generate
Calculates lighting according to the scene settings for
density and area, rather than the settings in the Light Map
Preview window.
Light Map Settings
Displays the Light Map Preview window.
Preview window
Button Description
Play animation
Plays an animation in the Preview window (p.300) as it will
appear in the game.
Pause animation
Pauses the animation that is playing in the Preview
window.
Stop animation
Stops the animation that is playing in the Preview
window.
Repeat animation
Sets the animation in the Preview window to be played on
a continuous loop until the stop button is pressed or the
Preview window is closed.
Display skeleton
Displays the clump's skeleton and bone axes in the
Preview window.
Display bone axes
Displays the constituent bones and joints of an asset's
skeleton and the orientation of those joints at any given
point in an animated sequence.
Show object
Hides the clump so that only its skeleton and axes are
visible.
Change background color
Changes the background color that you are previewing a
clump against.
Reset object
Resets the clump to the original size and orientation it
was in when it was first dragged to the Preview window
254
RenderWare Studio User Guide
Spline
Button Description
New nodes
Creates a new node at the point where the user clicks in
the workspace and completes the segment between that
node and the previously inserted node.
Insert node
Inserts a node exactly half way between the two currently
selected nodes.
Delete node
Deletes the currently selected node.
Open node
Opens the currently selected closed spline asset allowing
further nodes to be inserted, thereby extending the loop.
Close node
Closes a set of spline control points, thereby making a
closed spline asset.
255
RenderWare Studio User Guide
Volume
Button Description
Create axis-aligned box volume
Defines a box volume whose edges are aligned with the
x- , y- , and z-axes of the game area.
Create box volume
Defines a box volume whose edges are parallel with and
orthogonal to the current viewing direction.
Center-to-corner
Specifies that when creating a box volume, the original
point clicked should be in the center of the bottom (or top)
face.
Corner-to-corner
Specifies that when creating a box volume, the original
point clicked should be in one corner of the bottom (or
top) face.
Texture selection
Displays a drop-down list allowing selection of a texture
for the surface of the box created by the other tools in this
toolbar.
256
RenderWare Studio User Guide
Keyboard shortcuts
General
Key Action
F1 Displays Help.
Equivalent to clicking Workspace Help on the Help menu.
F3 Moves the camera in the perspective view (p.276) to show a close-up of
the selected entity.
Either:
• Click an entity name in the Game Explorer window, and then
press F3 to see a close-up of that entity in the perspective view.
or
1. Pick an entity that you can already see in the perspective view.
257
RenderWare Studio User Guide
Target
Key Action
Ctrl+D Toggles the Director's Camera on or off.
Selecting the Director's Camera overrides any camera control
behaviors in the Game Framework. Instead, the console view follows
the movements of the camera in Workspace. For example, in a “first
person” game, the camera typically follows the movements of the
player. If you select the Director's Camera, then, although you can
still use your console's control pad to move the player, the console
view moves with the Workspace camera, not the player.
Ctrl+P Pauses the Game Framework, or continues running it after pausing.
Note: The keys for left-handed users and right-handed users are all active at the
same time.
258
RenderWare Studio User Guide
Key Action
Left-handed Right-handed
S Dollies the camera into the view (moving the camera
forwards, level with the "ground").
X Dollies the camera out of the view (moving the camera
backwards).
Z Turns the camera left (around its Y axis).
C Turns the camera right.
F Pans the camera upwards (along its Y axis).
V Pans the camera downwards.
> D Pans the camera right (along its X axis).
< A Pans the camera left.
T Tilts the camera up (around its X axis).
G Tilts the camera down.
Shift Increases camera flight speed:
• Press and hold down Shift while pressing one of the
flight control keys (listed above).
Picking entities
Key Action
Q Switches to Pick only (p.123) mode.
W Switches to Pick and move mode.
E Switches to Pick and rotate mode.
R Switches to Pick and scale mode.
Event Map
Key Action
F5 Refreshes the Event Map (p.284) flowchart.
Equivalent to clicking Refresh Event View on the View menu.
W Scrolls the flowchart upwards.
S Scrolls the flowchart downwards.
A Scrolls the flowchart left.
D Scrolls the flowchart right.
259
RenderWare Studio User Guide
Note: Use the + and - keys on the numeric keypad, not the keys on the main
keyboard.
260
RenderWare Studio User Guide
261
RenderWare Studio User Guide
Windows
Below is a list of the windows supplied with Workspace. Your organization may
have customized Workspace (p.423) so that it contains additional windows not listed
here. To see a complete list of Workspace windows available to you, select View
Windows.
Assets (p.264)
Lists the assets that you have imported into your project. You can use these
assets to create entities.
Asset Light Map (p.267)
Allows the type of lighting to be specified for an asset. Can also be used to
specify whether the asset casts shadows and whether or not to use the
Game-Database Matrix.
Attribute Shares (p.269)
Lists the attribute shares that you created in the Game Explorer window.
Attributes (p.270)
Allows you to edit the values of the behavior attributes for the selected
entity. Also allows you to send messages from the entity, for testing
purposes.
Behaviors (p.273)
Lists the behaviors that you can attach to an entity. The behaviors are
organized in folders by category.
Design View (p.276)
Displays four camera views of the current game: one perspective view and
three orthographic views (front, plan and side).
Event Map (p.284)
Displays a flowchart of events and the entities that transmit or receive them.
Events (p.286)
Lists events sent and received by entities in the active folder.
Game Explorer (p.288)
Lists the game database hierarchy, and the objects in the game database.
Help (p.291)
Provides context-sensitive help for behaviors.
Light Attributes (p.292)
Displays information about a light entity. Allows properties such as the color,
radius and type of light to be modified.
Log windows (p.297)
Message Log
262
RenderWare Studio User Guide
263
RenderWare Studio User Guide
Assets window
Lists the assets that you have imported into your project. You can use these
assets to create entities.
A small × indicates that the asset or asset folder is used in the project.
Context menu
To view the actions that you can perform on an object in the Assets window,
right-click an object. The following context menu appears:
View
Sets how the window represents the assets:
Small icons
Lists asset names (with a small 2D icon) across, then down the
available space in the window. (Compare with List.)
Large thumbnails or Small thumbnails (shown above)
264
RenderWare Studio User Guide
New
(This option appears only if you right-click in an empty area of the window.)
Asset Folder
Creates a new asset folder.
Asset
Creates a new asset. Displays a blank properties (p.101) dialog for the
new asset.
Tip: Alternatively, you can create a new asset by simply dragging a
primary asset file (such as a .dff) from Windows Explorer to the
Assets window.
Spline
Creates a new spline asset. Displays a dialog where you specify the
path to store the spline asset file (.spl).
Cut
Cuts the object to the Clipboard.
Copy
Copies the object to the Clipboard.
Paste
Pastes the object from the Clipboard.
Move Up
(Only for objects with previous siblings.) Moves the object above its previous
sibling.
Move Down
(Only for objects with following siblings.) Moves the object below its
following sibling.
265
RenderWare Studio User Guide
Delete
Deletes (p.177) the object from the game database.
Note: Deleting an asset from the game database does not delete the
associated primary asset file or textures from your hard drive.
Rename
Renames the object.
Activate Preview
(Asset in thumbnail view only.) Allows you to rotate and zoom the thumbnail.
To rotate, drag the thumbnail.
To zoom, hold down both mouse buttons while dragging up or down.
Reload
(Assets only.) Reloads the data from the primary asset file.
View XML
Views the object as XML code in a browser window.
Search
(Assets only.) Displays several options for identifying which entities use this
asset (or type of asset). The results are displayed in the Search Results (p.315)
window.
Properties
(Assets only.) Sets the asset properties (p.101).
266
RenderWare Studio User Guide
Allows the type of lighting to be specified for an asset. Can also be used to
specify whether the asset casts shadows and whether or not to use the
Game-Database Matrix.
Asset
This shows the asset file name.
Type of lighting
Select asset lighting type.
Light map
Enables light mapped lighting. Size, Density Factor, and Generate Density
Factor can then be selected or modified as required.
Size
Size of light map texture created in pixels. Light maps are always square.
Density factor
Refers to texel density, this is the average number of pixels in a light map
that are applied to a polygon. The higher the density the greater the detail of
the light map.
Generate Density Factor
Specifies that the density factor is to be calculated automatically.
Vertex light
Selects vertex lighting, as opposed to light mapped lighting.
None
Selects no lighting for this asset.
267
RenderWare Studio User Guide
Cast Shadows
Selects whether this asset will cast shadows or not.
Use Game-Database Matrix
Causes lighting to be calculated as per the game world, as opposed to using
any pre-existing lighting information.
268
RenderWare Studio User Guide
Lists the attribute shares that you created in the Game Explorer window.
269
RenderWare Studio User Guide
Attributes window
Allows you to edit the values of the behavior attributes for the selected entity.
Also allows you to send messages from the entity, for testing purposes.
The Behavior list (at the top of the window) shows the behavior class attached to
the selected entity, and each of the classes from which it inherits. If you select
“Behavior class(All)”, then the Attributes window shows a combined view of the
attributes for all of these classes. If you select a particular class, then the
Attributes window shows only the attributes defined by that class.
If you have more than one entity selected:
• If all of the selected entities have the same behavior, then the Attributes
window shows a combined view of their attributes. Any changes you make
affect all selected entities. If the selected entities have different values for an
attribute, then the attribute control is shown grayed out; you can still use the
control, and set a common value for this attribute.
• If the selected entities have different behaviors, then the Attributes window
shows only the attributes of the last selected entity.
270
RenderWare Studio User Guide
Editing attributes
The example window above shows a behavior that demonstrates many of the
different types of controls that you can use to edit behavior attributes.
• To show or hide the attributes under a separator, click the green separator
bar
• To expand a separated section and see the extended controls available for
a control, as shown above in the color picker control for the Ambient Light
Color attribute, click the button.
Note: For some attributes, such as the color value input boxes for the color
picker, you will need to ensure that the window is wide enough to view them
fully. For example, if the window shown were not wide enough, then you
would only see a single blank box instead of the five boxes shown.
Attribute symbols
In addition, each attribute in the window can have a symbol displayed alongside
it.
• If there's no symbol next to the attribute name, then that attribute has not yet
been given a value.
• If there's a purple lozenge next to the attribute name ( ), then that attribute
has been given a value.
• If there's a hand holding two purple lozenges next to the attribute name (
), then that attribute is shared (p.170).
271
RenderWare Studio User Guide
RWS_BEGIN_COMMANDS
RWS_ATTRIBUTE( CMD_MyBitfield, "BITFIELD", "Tip", BITFIELD,
RwUInt32, LIST(Item A|@Checked Item B|Item C))
RWS_ATTRIBUTE( CMD_MyBoolean, "BOOLEAN", "Tip", BOOLEAN, RwBool,
DEFAULT(0))
RWS_ATTRIBUTE( CMD_MyColor, "COLOR", "Tip", COLOR,
RwUInt32, DEFAULT(0xFF0000))
RWS_ATTRIBUTE( CMD_MyList, "LIST", "Tip", LIST,
RwUInt32, LIST(Item A|Item B|@Default Item C))
RWS_ATTRIBUTE( CMD_MyMatrix, "MATRIX", "Tip", MATRIX,
RwMatrix, DEFAULT(0))
RWS_ATTRIBUTE( CMD_MyVector, "VECTOR", "Tip", VECTOR, RwV3d,
RANGES((-360,0,360), (-360,0,360), (-360,0,360)))
RWS_SEPARATOR("Edits", 0)
RWS_ATTRIBUTE( CMD_MyEdit1, "EDIT1", "Tip", EDIT, STRING,
DEFAULT(Default value))
RWS_ATTRIBUTE( CMD_MyEdit2, "EDIT2", "Tip", EDIT, RwInt32,
DEFAULT(-10))
RWS_ATTRIBUTE( CMD_MyEdit3, "EDIT3", "Tip", EDIT, RwUInt32,
DEFAULT(10))
RWS_ATTRIBUTE( CMD_MyEdit4, "EDIT4", "Tip", EDIT, RwReal,
DEFAULT(10.0))
RWS_ATTRIBUTE( CMD_MyEdit5, "EDIT5", "Tip", TEXTEDIT, RwReal,
DEFAULT(Default value))
RWS_SEPARATOR("Messages", 0)
RWS_MESSAGE(MSG_MyMessage, "MESSAGE1", "Tip", RECEIVE,
"RwUInt32*", 0)
RWS_MESSAGE(MSG_MyMessage, "MESSAGE2", "Tip", TRANSMIT, 0,
"Whatever")
RWS_SEPARATOR("Sliders", 0)
RWS_ATTRIBUTE( CMD_MySlider1, "SLIDER1", "Tip", SLIDER, RwReal,
RANGE(0.01, 1.0, 100.0))
RWS_ATTRIBUTE( CMD_MySlider2, "SLIDER2", "Tip", SLIDER, RwUInt32,
RANGE(0, 180,360))
RWS_ATTRIBUTE( CMD_MySlider3, "SLIDER3", "Tip", SLIDER, RwInt32,
RANGE(-360,0,360))
RWS_END_COMMANDS;
protected:
RwMatrix *m_mat; /* Matrix used for rotating object */
CAtomicPtr m_pAtomic; /* Behavior's Atomic */
RwReal m_rot[3]; /* RwReal array for storing rotation values*/
};
For more information about these macros, see Automated Form Generation in
the Game Framework reference.
272
RenderWare Studio User Guide
Behaviors window
Lists the behaviors that you can attach to an entity. The behaviors are organized
in folders by category.
To check the Game Framework source code for changes, and update the
Behaviors window accordingly:
• Right-click an empty area of the Behaviors window, and then click Parse
Source.
273
RenderWare Studio User Guide
2. If you connect to a target, then you can dynamically view the behavior in the
game.
After attaching a behavior, you can set its attributes (for example, the speed and
color of the pulsation) in the Attributes window.
For descriptions of the behaviors supplied with RenderWare Studio, see the
Game Framework Help.
Context menu
To view the actions that you can perform in the Behaviors window:
• Right-click a behavior.
The following context menu appears:
274
RenderWare Studio User Guide
View
Sets how the window represents the behaviors:
Detail
Lists behavior names and other properties under column headings.
List
Lists behavior names (with a small 2D icon) down, then across the
available space in the window.
Hierarchy
Lists behavior names in heirarchical order under column headings.
Copy
Copies a behavior. This allows you to paste the behavior onto an entity.
View Source
Displays the source code for the behavior in the editor chosen in Workspace
Options (p.158) under “Source Viewer”.
Parse All Source
Creates a new behavior or changes an existing behavior by parsing the
source code and refreshing the display.
Search
(Behaviors only.) Displays several options for identifying which entities use
this behavior. The results are displayed in the Search Results (p.315) window.
275
RenderWare Studio User Guide
Displays four camera views of the current game: one perspective view and three
orthographic views (front, plan and side).
You can set various options (p.160) for how the Design View window displays
your game.
276
RenderWare Studio User Guide
277
RenderWare Studio User Guide
To display this toolbar click on the expander button in the top left-hand
corner of any of the four views in the Design View (p.276) window.
The top four buttons change the view mode as follows:
278
RenderWare Studio User Guide
Wireframe with
textures
Displays the scene in
wireframe view with
the wireframe colored
where surfaces are
textured.
Solid without
textures
Displays the solid
surfaces of the scene
without textures.
279
RenderWare Studio User Guide
Default
Displays the scene
with solids frames and
textures.
280
RenderWare Studio User Guide
By default the clip panes are set automatically so that all the textures and models
in the camera's view are rendered. In certain cases you may want to isolate
objects in a view because they are very close together or exclude objects that are
expensive to render in processor terms.
To do this:
1. Click on the View mode icon in the Design View window to display the
panes.
• To move the back pane, click the back button and drag upwards to
move the pane away from the camera out from the scene; and drag
downwards to move the pane nearer the camera into the scene. The
result for the scene pictured above would be:
281
RenderWare Studio User Guide
• To move the front pane, click the front button and drag upwards to
move the front clip pane away from the camera into the scene; and
drag downwards to move the pane nearer the camera away from the
scene. The result for the scene pictured above would be:
282
RenderWare Studio User Guide
Note: You may need to drag the buttons a long way before changes in
the scene become apparent.
283
RenderWare Studio User Guide
Event Map
Displays a flowchart of events and the entities that transmit or receive them.
In the simplified example below:
• Event A is received by entities 1, 2 and 3.
• Entity 1 transmits event B, which is received by entity 4.
Selecting an item in the Event Map highlights the item, its connecting attribute
names and their connecting nodes. The picture below - taken from the Alpha Sort
(p.515) example shows the “alien” event that was transmitted from the Timer Trigger
entity and received by the Alien entity. The text in brackets “RwFrame”shows the
Data format (p.286) of the event being transmitted.
Tips
• If you are using a mouse with a middle-mouse wheel and Microsoft™
Intellipoint software installed, then you can also zoom in and out of the
Event Map window by rotating the mouse wheel.
• If you select an entity in either the Game Explorer (p.288) or the
Design View
(p.276), then it is highlighted in the Event Map and vice versa.
• If you select an entity in the Event Map, its attributes are highlighted in the
Attributes window (p.270).
• If you have a game database containing a large volume of data, the Event
Map may take some time to refresh. Therefore, instead of automatically
284
RenderWare Studio User Guide
refreshing itself, the background color of the map changes signifying that the
flowchart data has changed and needs to be updated. To refresh the Event
Map, and see the most recent changes either:
• On the Edit menu, click Refresh Event View.
or
• Press F5.
will appear in the Entity Attributes window beside the attribute described by the
RWS_MESSAGE macro, if the keyword is set to RECEIVE, then the icon will
285
RenderWare Studio User Guide
Events window
Tip: If you select an event, then it is automatically highlighted in the Event Map
and vice versa.
286
RenderWare Studio User Guide
within that attribute is changed to the name of the dragged event and a new
or modified event chain is displayed in the Event Map.
287
RenderWare Studio User Guide
Lists the game database hierarchy, and the objects in the game database.
This window can display various columns of information; to select which columns
are displayed, right-click the column header. (For example, the “Checked out to”
column displays the user name of the person who has that object checked out in
NXN alienbrain.)
If an object has multiple references, then this window displays a small × next to
each reference.
Tip: To find an entity in the Design View (p.276) window, right-click the entity
name in the Game Explorer window, and then click Locate in view.
288
RenderWare Studio User Guide
Context menu
To view the actions that you can perform in the Game Explorer window,
right-click an object. The following context menu appears:
View
Changes between the several possible views of the Game Explorer window.
Cuts
Cuts the object to the Clipboard.
Copy
Copies the object to the Clipboard.
Paste
Pastes the object from the Clipboard.
View Source
(Behaviors, commands, or attributes.) Views the associated C++ source for
this object.
Move Up
(Only for objects with previous siblings.) Moves the object above its previous
sibling.
Move Down
(Only for objects with following siblings.) Moves the object below its
following sibling.
Delete or Remove
Deletes or removes (p.177) the object.
Rename
Renames the object.
289
RenderWare Studio User Guide
Share Attributes
(Entities only.) Displays the Share Attributes (p.170) dialog. This dialog
shows the attributes of this entity that can be shared.
Use Attributes
(Entities only.) Displays the Use Attributes (p.170) dialog. This dialog shows
the attribute shares, and the attributes in those attribute shares that you can
use for this entity.
Locate in view
(Entities only.) Locates and selects the entity in the Design View.
View XML
Displays the XML code for the database object in a browser window.
Create Template
(Entities and folders only.) Creates a template (p.127) entity, or (if you
clicked a folder), a template folder containing a template for each of the
entities under the folder. The new templates and template folders appear in
the Templates window.
Properties
Displays the object properties dialog.
Reset or Reset all Entities
(Entities or folders only.) Resends the selected entity (or entities in the
selected folder) and attributes to any connected target consoles, without
resending assets. This is a quick method of resetting the game if no assets
have changed.
290
RenderWare Studio User Guide
To view help for a behavior, right-click the behavior in the Behaviors (p.273)
window, and then select View Help from the context menu.
Note: This behavior help is displayed in Workspace because it is aimed at
designers as well as programmers. Currently, only the behaviors in Genre Pack 1
are supplied with this type of help.
To create help for your own behaviors:
1. Create an HTML file with the same name as the behavior and a file
extension of .htm (for example, CMyBehavior.htm).
2. Save the HTML file in the help folder under your project's source root folder
(if this help folder does not exist, then create it):
source root\help\behavior class.htm
See the example behavior help supplied with Genre Pack 1, in:
C:\RW\Studio\GenrePack1\console\game_engine_1\source\help
291
RenderWare Studio User Guide
Displays information about a light entity. Allows properties such as the color,
radius and type of light to be modified.
Behavior
Displays the currently selected behavior of the entity. Also allows you to
select the behavior of the entity from a list of options.
Color
Allows you to modify the color of the light using red, green, blue, and alpha
values. Note, the alpha value is not used in the lighting calculations.
Radius
Sets the sphere of influence of a point or spot light.
Note: Light levels drop off exponentially as distance increases. If the radius
is set at too low a value, it is possible that a light may not display as
expected. For example, a wall may not appear affected by a spot light
pointed at it, if the radius of the spot is set at just a little beyond the wall. The
reason being the light intensity has dropped significantly at the extents of the
radius. The solution, in this case, is to increase the radius of the spot light to
well beyond the wall being lit.
Type
Allows you to select the type of light from one of Directional, Point, Spot,
Soft Spot.
Directional
This type of light is used to represent a source assumed to be at a
large distance from the world. For example sunlight and moonlight
could be represented by directional lights. Setting the radius and cone
angle has no affect on this light type.
Point
Represents a point of light. Light is emitted in a sphere from the source,
292
RenderWare Studio User Guide
293
RenderWare Studio User Guide
Allows you to adjust various parameters that affect how light map previews will
appear in the Design View window.
294
RenderWare Studio User Guide
Light mapping
General light mapping options.
Size
Size of light map texture created in pixels. Light maps are always square.
Density
Refers to texel density, this is the average number of pixels in a light map
that are applied to a polygon. The higher the density the greater the detail of
the light map.
Super Sampling
This is a technique for generating light maps of better quality. If the light map
was 128×128 and the supersampling was 2, the light map would be
generated at 256×256 and scaled down to 128×128.
Sliver Threshold
Any polygon that is less than the area specified here will be ignored by the
light map generation process. This avoids spending time calculating light
mapping for polygons that will be ignored anyway.
Area Lights
Options related to area lights.
Density Factor
This alters the number of point lights for a given area light. The full formula
used to calculate density factor is:
LightMapping.density×AreaLights.densityfactor×material.arealight.densityfactor
Radius Modifier
This will change the radius of all area lights used in a scene. The radius of
an area light is:
material.arealight.radius × Lightmapping.radius_modifier
Error Cut Off
This allows the user to sharply cut off the influence of an area light. The
larger the value, the sooner the cut off point will be reached. This is
generally used to reduce light map generation times.
Maximum Sample
This is the maximum number of point lights used to emulate an area light.
Other Settings
Miscellaneous light-related parameters.
No shadow casting
Disables generation of shadows.
Light map allocation only
Selecting this check box will mean that light maps will be created, but will
not be shown in the Design View.
Use 2-sided collision detection
During the light map calculation, rays are cast from each sample point to
each light. In the default case this process is carried out for one side of a
triangle. However, if this check box is selected both sides of the triangle are
taken into consideration. This results in greater detail being possible, at the
295
RenderWare Studio User Guide
296
RenderWare Studio User Guide
Log windows
Message Log
Displays messages about activities in the current RenderWare Studio session.
Each message begins with a graphical symbol (indicating whether it is
information, a warning, or error) followed by the name of the part of RenderWare
Studio that sent the message (enclosed in square brackets). For example, in the
screen capture below, the [Local PC - DirectX] messages are from the
Game Framework (running on a DirectX local PC target) as it reads a game data
stream sent by the Workspace.
Build Log
297
RenderWare Studio User Guide
Messages are displayed in the order in which the game is built. Messages
relating to the global folder are listed first, followed by messages relating to the
active folder.
298
RenderWare Studio User Guide
299
RenderWare Studio User Guide
Preview window
Previewing an asset
To preview an asset, either:
• Drag an asset from the Assets window to the Preview window.
or
• Drag an asset file directly from Windows Explorer to the Preview window.
Tip: If the asset does not display clearly against the background, click the
Change background color button .
To pan around the Preview window, click and drag with the middle mouse button.
To orbit the asset, hold down the Alt key and then drag with the middle mouse
button. To zoom in on the asset, hold down the Ctrl and Alt keys and then drag
with the middle mouse button. You can also click the orbit, pan, and zoom toolbar
buttons in exactly the same way as you would when navigating in Design View,
and then drag with the left mouse button.
Tip: To reset the object's original orientation and size (before you began
navigating around it), click the Reset object button .
300
RenderWare Studio User Guide
To view an animation:
1. Drag the animated asset's atomic or clump to the Preview window.
2. Drag an animation asset—with a chunk ID of
rwID_HANIMANIMATION—from the Assets window to the Preview window.
The animation starts playing.
3. Click the Animation toolbar (p.251) buttons to play, pause,
Tip: You can stop the animation at any point using the slider control directly
under the Preview window. You can also drag the slider control slowly along the
slider bar to see how the asset is positioned at any particular time in the
sequence.
skeleton and the orientation of where those joints are at any time in an
animated sequence.
3. Show object button to view the asset's skeleton without rendering the
atomic or clump.
301
RenderWare Studio User Guide
will initially see the entire world asset rendered with bounding boxes representing
all the world sectors. The statistics for its sectors, vertices and materials are
displayed in the top left-hand corner of the window.
To toggle the rendering of the world, click the Render world button .
To step through the various sectors in the world, click either the Next sector
or Previous sector buttons. To view all the world sectors again, click
302
RenderWare Studio User Guide
• View just the wireframe of the sector without its textures by clicking
303
RenderWare Studio User Guide
Z-testing
To toggle Z-testing, click . Usually wireframes are overlaid over the surfaces
304
RenderWare Studio User Guide
Profiling Tools
Like the other profiling tools' windows, Memory Stats contains a list of the
sessions under Workspace's control. Simultaneous connections to multiple
targets result in multiple items in the list.
Each list item gives a summary of the memory allocated and freed by a session,
and there's a context menu that provides four options:
View Time Vs Usage
Displays a graph of time against memory usage for this sesson.
Delete
305
RenderWare Studio User Guide
The Time Vs Usage Graph window enables you to find out more about any
memory allocation event in the current session, including type, timing, and
position in the game's source code.
Metrics window
Displays custom data (usually, the properties of entities) sent back to Workspace
by the game code. Game programmers use macros to specify what data should
be sent, and how frequently.
306
RenderWare Studio User Guide
Profiler window
Provides a view of what functions are being called in the game code, and how
long each one takes to execute. Game programmers use macros to specify
which functions can be monitored in this way.
307
RenderWare Studio User Guide
The Profiler window itself contains only a list of session numbers. Right-clicking
and selecting View, however, displays the Session Profiler.
This window displays output from the Game Framework's function profiler, which
sends function timings back from the game to Workspace so that programmers
can identify bottlenecks in the code. Double-clicking one of the functions in the
list displays a further list of functions called by the first function. In this way, you
can walk the call stack of the running game.
308
RenderWare Studio User Guide
The default path for the exporter templates shown in the Asset Template Path is
the folder that the RF3 asset templates are installed in when you installed
RenderWare Studio. This path can be changed as desired.
For further information on this window, consult the RenderWare Graphics user
guide.
Note: Changes to the .rf3 files implemented by the RF3 asset templates take
precedence over those implemented by the RF3 project templates (p.311).
• To edit an existing template:
• Select one of the items in the Templates drop-down list, ensure that
the file is not set to read-only.
• Click over an Option to highlight the line.
• Select one of the values from the drop-down list in the Values list.
• To add to the existing templates:
• Click the Options button.
•
309
RenderWare Studio User Guide
310
RenderWare Studio User Guide
The default path for the exporter templates shown in the Project Template Path
is the folder that the RF3 project templates are installed in when you installed
RenderWare Studio. This path can be changed as desired.
For further information on this window, consult the RenderWare Graphics user
guide.
• To edit an existing template:
• Select one of the items in the Templates drop-down list, ensure that
the file is not set to read-only.
• Click over an Option to highlight the line.
• Select one of the values from the drop-down list in the Values list.
• To add to the existing templates:
• Click the Options button.
•
311
RenderWare Studio User Guide
312
RenderWare Studio User Guide
Allows use of light mapping to be selected for a world scene. Various light
mapping parameters can also be modified in this panel, along with the
characteristics of area lights.
The following figure shows the scene light map window:
Scene
This is the name of the scene to which light mapping will be applied.
Use Light map
Check this to enable scene light mapping.
Light mapping
Size
Size of light map texture created in pixels. Light maps are always square.
Density
Refers to texel density, this is the average number of pixels in a light map
that are applied to a polygon. The higher the density the greater the detail of
the light map.
Supersampling
This is a technique for generating lightmaps of better quality. If the light map
313
RenderWare Studio User Guide
was 128×128 and the supersampling was 2, then the light map would be
generated at 256×256 and scaled down to 128×128.
Sliver threshold
Any polygon that is less than the area specified here, will be ignored by the
light map generation process. This avoids spending time calculating light
mapping for polygon that will be ignored anyway.
Area Lights
When the light map editor finds an area light, it will create several small point
lights, within the area light surface, in order to emulate a true area light.
Density factor
This alters the number of point lights for a given area light. The full formula
used to calculate the density factor is:
LightMapping.density × AreaLights.densityfactor ×
material.arealight.densityfactor
Radius modifier
This will change the radius of all area lights used in a scene. The radius of
an area light is:
material.arealight.radius × Lightmapping.radius_modifier
Error Cut Off
This allows the user to sharply cut off the influence of an area light. The
larger the value, the sooner the cut off point will be reached. This is
generally used to reduce light map generation times.
Maximum Sample
This is the maximum number of point lights used to emulate an area light.
314
RenderWare Studio User Guide
Lists the objects you have searched for in the Game Explorer, Assets, or
Behaviors windows.
To search for entities using a particular object:
1. Right-click in the relevant window on the object (asset or behavior) that you
wish to find and select Search. Depending on the context you can then
choose to search for:
• all entities using the object
• only those entities which are “active” - being used in the Design View
window - using the object.
Note: When searching for assets, you can search for the asset itself or
the asset type.
Author: Ask Jon what asset types you can search for looks as though
sound assets cannot be searched for.
2. Switch to the Search Results window and view the entities listed. (The
number of entities found is listed in the Message Log window once the
315
RenderWare Studio User Guide
search is complete.)
Tips
• To refine your search you can right-click on an asset or behavior in the
Search Results window and search again. This could be useful where
you have searched for an asset type and then wish to refine the results
to a particular asset within the asset type.
• You can also locate the entity in the Design View by right-clicking the
entity and selecting Locate in view or Aim at in view from the context
menu.
316
RenderWare Studio User Guide
Sequencer window
Left-hand pane
The left-hand pane of the Sequencer window contains a list of the entities
involved in the current sequence. Each entity in the list can be expanded to show
the attributes that may be modified during the sequence:
• Entities with green bands were dragged into the pane from Game Explorer.
They existed in the game before the sequence began, and will continue to
exist after the sequence has finished.
• Entities with red bands were dragged into the pane from the Templates
window. They are temporary entities that exist only while a sequence is
being executed. Such entities are created and destroyed by the sequence,
and can have lifetimes shorter than that of the sequence.
In addition, entity names in the left-hand pane can appear in bold type to
represent that “updates” are enabled. When this is the case, scrubbing the
playhead in the central pane causes changes that take place in the sequence to
be reflected immediately in Design View. If a sequence changes an entity's
position, for example, you can use this feature to preview that movement in
Workspace.
Central pane
The central pane contains shaded horizontal bars that indicate the lifetimes of the
317
RenderWare Studio User Guide
The central pane can also contain four kinds of vertical line that all have to do
with time and timings:
• The gray line marks the end of the sequence. It can be dragged left or right
to make the sequence shorter or longer.
• The red line is the playhead, which represents the instant in the sequence
that's currently under scrutiny.
• Vertical blue lines show the positions of events being sent by the sequence,
to be received by any entity in your game.
• Vertical green lines show positions where the sequence will pause and wait
to receive an event from another game entity.
Right-hand pane
The right-hand pane provides one way of displaying and editing the value of the
attribute that's currently selected in the left-hand and central panes.
Toolbar
The Sequencer window's toolbar is divided by function into seven sets of buttons,
starting with the standard “new, open, save, save as” set that's typical in
Windows applications. These buttons allow for sequence assets to be edited
independently of the project currently open in Workspace.
The next two buttons in the row also perform familiar operations. They are
Undo and Redo, with the latter button not becoming active until the former
318
RenderWare Studio User Guide
Edit Mode (Move) is the default mode, and the one you'll use most of
the time. It allows you to make changes to the content and character of a
sequence, as described in Editing keyframes, below.
Edit Mode (Scale) offers similar functionality to Edit Mode (Move),
that clicking and dragging in the central pane simply scrolls the sequence in
the view.
Zoom Mode also switches off editing. With this button selected,
clicking and dragging up and down in the central pane changes the scale of
the timeline, to show more or less detail.
Tip: You can also change the scale of the timeline in either of the edit
modes, by placing the cursor anywhere in the central pane and using the
mouse wheel to “zoom” in and out.
The next two buttons provide a quick way of zooming the display in the central
pane to a sensible setting:
Zoom Extents zooms the view so that the whole sequence is visible in
type the name of the event you wish the sequence to send.
New Wait For Receive Event also opens the Event Editor dialog, this
time so that you can specify the name of the event you wish the sequence to
wait for before proceeding.
After the event buttons comes a block of four that make moving the playhead in
the central pane quicker and more accurate:
Previous Keyframe/Event moves the playhead to the time of the
319
RenderWare Studio User Guide
The last button in the toolbar is a toggle that can prevent you from creating
keyframes accidentally in some circumstances:
Toggle Design View Keyframe Generation controls whether a
320
RenderWare Studio User Guide
If you decide that you need to remove from or add to this list later in the process,
right-click the entity's name in the left-hand pane and select Properties to display
the same window.
Creating keyframes
Sequencer provides several ways of creating keyframes, all of which require you
to select the Enable/Disable Keyframe Generation button on its toolbar, and
then to drag the playhead to your preferred position in the central pane.
(Alternatively, you can type a value into the Current Time box.) At this point, with
an attribute selected in the left-hand pane:
• Type (or otherwise select) values in the right-hand pane. As soon as you
make a change, a keyframe is created using the default keyframe editor.
• (For positional attributes) select the entity that contains your attribute in
Design View and move it around. A keyframe is created in which the
attributes have their values at the end of the move.
• Double-click the attribute name in the left-hand pane, or right-click it and
select Properties. In the dialog that appears, choose the Keyframe Editor
to use for this attribute, and the type of Interpolator to be used between this
keyframe and the next:
321
RenderWare Studio User Guide
What you see on this tab depends on the attribute you're editing. In this
example, we're controlling the position of the entity in the game by adjusting
its Matrix attribute.
• Right-click on an attribute's timeline in the central pane and select Create
Keyframe. A keyframe is created at the playhead's position, with the
attribute's current value.
Editing keyframes
Editing a keyframe can mean changing its position, its value, or its relationship
with other keyframes.
• Sequencer provides for keyframes to be cut, copied, pasted, and
deleted—alone or in groups, through multiple selection. First, you must
select the keyframe(s) you want to manipulate by clicking or dragging, so
322
RenderWare Studio User Guide
323
RenderWare Studio User Guide
Previewing a sequence
By default, when you have a sequence open for editing in the Sequencer, and
the attributes you're affecting have a visual manifestation (such as an entity's
position), scrubbing the playhead back and forth previews any changes in the
Design View window.
You can switch off this behavior on an attribute-by-attribute (or entity-by-entity)
basis by right-clicking in the left-hand pane and selecting Disable Updates. If
you want to focus on one or two attributes, ensure that only those attributes have
updates enabled.
The combo box on this dialog allows you to select an event from a list, or to type
a new name of your choosing.
The vertical bars that represent events in Sequencer's central pane can be
manipulated in the same way as the circles that represent keyframes. They can
be cut, pasted, moved, scaled, and so on.
The topic on adding a sequence to your game (p.180) provides further
information about sequences, including an explanation of how to set a a
sequence in motion.
324
RenderWare Studio User Guide
Provides a way to look inside RenderWare streams, and attach custom editors to
handle the different types of data, such as MatFx and RpToon data, that have
been attached as plug-ins to assets.
Edits made to the stream data are saved in the asset's XML file, allowing them to
be re-applied if the artwork for the asset is exported again.
To see the stream viewer in action:
1. Right-click an asset in the Game Explorer, Design View or Assets window,
and then select Show Asset Stream Contents from the context menu. The
Stream View window appears showing the contents of the asset's file or the
contents of the files which together make up a .rf3 file.
2. Right-click in the Stream View window and select Show Object Type. You
can then choose from a drop down list to filter the objects displayed by
object type. To show only those objects which were given identifiers when
the asset was exported from the art package, right-click and select Hide
unnamed objects.
3. Click the Show Stream button to see the objects arranged in the same
hierarchy as in the asset file.
325
RenderWare Studio User Guide
326
RenderWare Studio User Guide
This also works in reverse so that when you select a material in the Stream
View window, any visible geometry displaying that material in the Design
View will be selected.
4. To edit an object, select it in the Stream View window, and then edit it in the
Stream Properties window.
327
RenderWare Studio User Guide
Note: The edits to the asset's plug-in data that you have made will be stored
in the asset's XML reference file in the game database. This means that
each time the game is built and sent to the console those edits will be
included “on the fly” as the asset file is included in the stream that is sent to
the console.
328
RenderWare Studio User Guide
Lists files that the target has “saved” (sent via the network) to Workspace. To
save one of these files to a permanent file on your hard disk, right-click it and
then select Save As.... Otherwise, these files last only for the current session.
329
RenderWare Studio User Guide
Targets window
Lists the targets (consoles or PCs) on which you can run your game. You can
use this window to build the game data stream for a target, then connect (send
the game data stream) to the target, so that you can dynamically view the game
as you develop it.
330
RenderWare Studio User Guide
You can also view the game in a separate window on the same computer as
RenderWare Studio:
While viewing the game on a target, you can continue using RenderWare Studio
Workspace to develop the game. Any changes you make (such as adding,
moving or deleting entities, or changing behavior attributes) are dynamically
reflected on the target.
Context menu
To view the actions that you can perform in the Targets window, right-click one of
the connnection names. The following context menu appears:
Clean
Deletes the stream files and other intermediate files created by the Game
Production Manager (in the Build Output\connection name\… folders
under your project).
Build
331
RenderWare Studio User Guide
Updates any out-of-date intermediate files and then (if there were any
updates), creates new stream files (Build Output\connection
name\Folder\*.stream) for the global folder and the active folder.
Rebuild
Cleans, then builds.
Connect
Connects to the target using the last built Renderware stream.
Build and Connect
Builds, then sends the stream files for the global folder and active folder to
the target. Any subsequent changes are also sent to the target, until you
disconnect.
Tip: Double-clicking the word “Connected” or “Disconnected” in the Status
column has the same effect as selecting this option.
Disconnect
Stops sending game data to the target.
Reload Game
Stops and restarts the game, and then resends the game data stream.
(Equivalent to disconnecting, and then connecting.)
Reset All Entities
Sends all entities and their attributes, but without sending their assets. This
is a quick method of restarting the game if no assets have changed.
Synchronize camera (only enabled for connected targets)
Ensures that the camera position shown on the target matches the position
of the camera in the RenderWare Studio Workspace.
Director's Camera
Overrides any camera control behaviors in the Game Framework. Instead,
the console view follows the movements of the camera in Workspace.
For example, in a first person game, the camera typically follows the
movements of the player. If you select the Director's Camera, then, although
you can still use your console's control pad to move the player, the console
view moves with the Workspace camera, not the player.
New...
Creates a new target, and displays a dialog where you can set the target
properties.
Delete
Deletes the selected target.
332
RenderWare Studio User Guide
Set as Active
Sets the current target as the default to launch when you select Launch
from the Targetmain menu (p.244) or the build toolbar.
Launch Nettest
Launches the Nettest tool (p.224) (only if the Address of the Target is
localhost).
Launch
Starts the console emulator application.
Properties
Sets the target's properties.
Tip: Double-clicking in the Target column has the same effect as selecting
this option.
You can define additional, custom context menu items (p.208) for a target
platform.
333
RenderWare Studio User Guide
Templates window
Lists the templates that you have created in the Game Explorer window.
334
RenderWare Studio User Guide
Saving layouts
You can create a layout (p.238) for each of the different ways you use
Workspace, and switch between layouts while using Workspace.
For example, when importing artwork and creating assets in Workspace, you
might want a different arrangement of windows than when you are testing a
running game. Creating different layouts enables you to customize Workspace for
these tasks.
To create a new layout:
1. Select View Clone Current Layout.
2. Enter a name for the new layout.
This is now the current layout; any changes that you make to the window
arrangement affect only this layout.
3. Arrange the windows (p.238).
The new layout is saved only when you close Workspace.
To switch between layouts, select View Layouts.
To restore the current layout to its most recently saved state, select View
Restore Current Layout.
To restore all supplied layouts to their original states, select View Restore to
Default Layouts.
335
RenderWare Studio User Guide
Tutorials
336
RenderWare Studio User Guide
Creating behaviors
In this tutorial
We show you how to create RenderWare Studio behaviors. A behavior provides
logic that you can attach to entities in your game. We will also see how to
create events and trigger them, and how to expose a behavior's attributes in the
RenderWare Studio Workspace.
337
RenderWare Studio User Guide
you need to be comfortable with the process of placing entities in the world,
assigning behaviors to them and altering their attributes.
338
RenderWare Studio User Guide
Description Path
Primary asset file for C:\RW\Studio\Examples\Tutorial\maps\fountain\fountain.bsp
world
Primary asset file for C:\RW\Studio\Examples\Tutorial\objects\spinner.dff
“spinner” entity
Project file C:\RW\Studio\Examples\Tutorial\Tutorial.rwstudio
C++ source C:\RW\Studio\console\game_framework\source\modules\ Examples\Tu
C:\RW\Studio\console\game_framework\source\modules\ Examples\Tu
Note: C:\RW\Studio is the default location for RenderWare Studio. You might
have installed RenderWare Studio in a different folder.
339
RenderWare Studio User Guide
If you plan to create new source files, then create a new folder under the
Tutorials folder (for example, Walkthrough). This is the folder into which you
should save the source files you are going to create. The behaviors you write
must be compiled into the target project, so you need to add them to the project
(for example, in CodeWarrior or Visual C++).
During the lessons, it is a good idea to refer to the source code files at each step,
as they contain the fully working behaviors for your reference.
In each lesson, we will create a new behavior called CTutorialx, some of which
will be based on the code we created in the previous lesson.
Start the tutorial now: Lesson 1. Creating a behavior (p.341).
340
RenderWare Studio User Guide
In this lesson
We create a basic behavior that does nothing more than appear in the
RenderWare Studio behavior list. You can attach this behavior to an entity in
the world, but it won't do anything yet.
Note: This lesson creates a behavior that relies on a CAtomicPtr object. This
“smart pointer” handles some of the functionality required to implement a
behavior, hiding the underlying RenderWare Graphics processing. Lesson 9
(p.366) demonstrates how to create a similar basic behavior, without relying on a
CAtomicPtr object.
protected:
341
RenderWare Studio User Guide
CAtomicPtr m_pAtomic;
};
Source: tutorial1.h
RWS_MAKENEWCLASS(classname) declares the functions that allow the class
factory to construct a new CTutorial1 object.
RWS_DECLARE_CLASSID(classname) declares the member variables required
to identify the object.
Our constructor takes a CAttributePacket as its parameter. When an object
is created, a CAttributePacket is provided that contains the initial set of
attributes for the object.
HandleEvents is required as it is a pure virtual method of CEventHandler.
HandleAttributes is required as it is a pure virtual method of
CAttributeHandler.
We'll discuss access to m_pAtomic in a moment. The first definition in the
CTutorial1 source file is:
RWS_IMPLEMENT_CLASSID (CTutorial1)
RWS_RETURNVOID();
}
Source: tutorial1.cpp
Here, we pass the attr parameter to the CEventHandler constructor. We use
the InitCEventHandler macro, rather than calling the CEventHandler
constructor directly, since the parameters to the CEventHandler constructor
differ between release and debug versions. This is because the event
visualization is compiled out in a final build.
Inside the constructor, the CreateAtomicInWorldFromResource function
creates an atomic (the basic node in the RenderWare scene graph). This function
extracts the information it needs (that is, the type of entity, its initial position and
transformation) from the attributes used to construct the atomic.
CAtomicPtr is a smart pointer (it's actually more than that, as we shall see
later), and will automatically delete the clone of the atomic when our entity is
destroyed; therefore, the CTutorial1 destructor is empty for now. Our basic
HandleEvents method does nothing yet, either, as we will create the behavior's
action in lesson 2:
void CTutorial1::HandleEvents(CMsg &pMsg)
{
342
RenderWare Studio User Guide
RWS_FUNCTION("RWS::Tutorial::CTutorial1::HandleEvents");
RWS_RETURNVOID();
}
Source: tutorial1.cpp
The final method to implement is HandleAttributes. Although our class does
not itself have any attributes that can be set, CSystemCommands does specify a
set of attributes that CAtomicPtr needs to process; and since CTutorial1 is
derived from CSystemCommands, we need to process them. This is simply done
by passing the commands on to our m_pAtomic member:
void CTutorial1::HandleAttributes(const CAttributePacket& attr)
{
RWS_FUNCTION("RWS::Tutorial::CTutorial1:HandleAttributes");
CAttributeHandler::HandleAttributes(attr);
m_pAtomic.HandleSystemCommands(attr);
RWS_RETURNVOID();
}
Source: tutorial1.cpp
HandleSystemCommands can process changes to the matrix, visibility state and
collision state of the entity. These are the attributes that allow RenderWare
Studio to interactively manipulate an entity in the scene.
After saving and compiling, you can see CTutorial1 in the RenderWare Studio
Workspace. Place an entity in the world, and then apply the behavior by dragging
the CTutorial1 from the Behavior List to the entity in the world.
At the moment, the entity doesn't do anything, as we have not defined an action
for the behavior. We will do this in the next lesson.
343
RenderWare Studio User Guide
In this lesson
We make our behavior do something. Our new behavior, CTutorial2, will
rotate the entity slightly every tick.
Let's move on to the event setup. For our behavior to respond to the tick, it needs
to be notified when a tick occurs. The Game Framework has certain events that it
sends at predefined points in its logic. The event we are interested in is
iMsgRunningTick.
The Game Framework sends an event only to behaviors that have specifically
requested notification of that type of event. Telling the framework that a behavior
wishes to receive an event is called “linking” to the event.
To link our behavior to the iMsgRunningTick event, the CTutorial2
constructor calls:
LinkMsg (iMsgRunningTick, 0);
The framework manages the lifetime of events in the system; before removing an
event, the framework needs to know when the event is no longer in use. That is,
when no behaviors have the event either registered (explained in a later lesson
(p.348)) or linked.
Each time the main loop starts a new frame, it dispatches an iMsgRunningTick
event to all behaviors that are linked to it. To process this event, CTutorial2
implements HandleEvents:
void CTutorial2::HandleEvents(CMsg &pMsg)
{
RWS_FUNCTION("RWS::Tutorial::CTutorial2::HandleEvents");
344
RenderWare Studio User Guide
if (pMsg.Id == iMsgRunningTick)
{
RwFrame* pFrame = RpAtomicGetFrame(m_pAtomic.ptr());
RwMatrixSetIdentity(m_mat);
RwMatrixRotate(m_mat, &XAxis, m_rot[0], rwCOMBINEPRECONCAT);
RwMatrixRotate(m_mat, &YAxis, m_rot[1], rwCOMBINEPRECONCAT);
RwMatrixRotate(m_mat, &ZAxis, m_rot[2], rwCOMBINEPRECONCAT);
345
RenderWare Studio User Guide
In this lesson
We define attributes for our behavior, that the user can manipulate in real time
from RenderWare Studio.
Our CTutorial2 behavior had an array of three RwReal variables (floating point
numbers) called m_rot, which specify the angle, in radians, to rotate the entity
around the x, y, and z axes each frame. To allow RenderWare Studio to
manipulate the m_rot attributes, we have to tell it about them.
The public section of the CTutorial3 class declaration contains the following:
RWS_BEGIN_COMMANDS
RWS_ATTRIBUTE( CMD_rot_x, "X Rotation", "Specify the x axis rotation",
SLIDER, RwReal, RANGE(0,0,360))
RWS_ATTRIBUTE( CMD_rot_y, "Y Rotation", "Specify the y axis rotation",
SLIDER, RwReal, RANGE(0,180,360))
RWS_ATTRIBUTE( CMD_rot_z, "Z Rotation", "Specify the z axis rotation",
SLIDER, RwReal, RANGE(0,0,360))
RWS_END_COMMANDS;
Source: tutorial3.h
RenderWare Studio reads everything between RWS_BEGIN_COMMANDS and
RWS_END_COMMANDS. Each RWS_ATTRIBUTE macro registers an attribute.
For more information about the RWS_ATTRIBUTE macro, see Automated Form
Generation in the Game Framework Help.
As we saw in CTutorial1, when a behavior is constructed it is passed a
CAttributePacket. This packet contains information needed to initialize our
atomic. After the object has been constructed, HandleAttributes is called to
set all the attributes to the default values expected by RenderWare Studio. This
should mean that you don't have to set initial values for your attributes, as they
will all be set by the HandleAttributes call after the object has been
constructed.
At the top of our CTutorial3::HandleAttributes implementation we should
still have the code from CTutorial1:
m_pAtomic.HandleSystemCommands (attr);
After this, we can process changes to our attributes. To do this, we add some
code to HandleAttributes:
CAttributeCommandIterator attrIt(attr,
RWS_CLASSID_OF(CTutorial3));
while (!attrIt.IsFinished())
{
switch (attrIt->GetCommandId())
{
case CMD_rot_x:
attrIt->GetCommandData(m_rot[0]);
m_rot[0] = RWDEG2RAD(m_rot[0]);
break;
346
RenderWare Studio User Guide
case CMD_rot_y:
attrIt->GetCommandData(m_rot[1]);
m_rot[1] = RWDEG2RAD(m_rot[1]);
break;
case CMD_rot_z:
attrIt->GetCommandData(m_rot[2]);
m_rot[2] = RWDEG2RAD(m_rot[2]);
break;
}
++attrIt;
}
Source: tutorial3.cpp
A CAttributePacket contains a list of attributes to be set. The
CAttributeCommandIterator class is a helper class that allows you to run through
the attributes one at a time. CAttributeCommandIterator also ensures that
you only iterate attributes that are relevant to your class.
The CAttributeCommandIterator class allows you to retrieve the value of
the attribute using the GetCommandData method. In this example, once we have
the value we convert it to radians (as the sliders are specified in degrees).
CAttributeCommand has many inline helper functions for converting the data
to whatever type you need, so in the above example we could have used
GetAs_RwReal, but the helper methods are not as type-safe.
CTutorial3 is now complete. When you attach the new behavior to an entity in
the world, you will now be able to adjust how much the entity is rotated each
frame by moving the sliders in the RenderWare Studio Workspace:
347
RenderWare Studio User Guide
In this lesson
In previous lessons, our behavior has not communicated with the rest of the
game framework. The event system lets the game send an event to any
behavior (specifically, any CEventHandler) anywhere in the framework,
allowing behaviors to communicate.
In CTutorial4, we create a new behavior that registers a new event with the
Game Framework, and sends this event when the user changes the state of a
check box in the RenderWare Studio Workspace.
The header file for CTutorial4 contains the following protected member:
CEventId m_trigger;
This will hold the event ID that we will send when the use changes the state of
the check box.
We need to add the check box as an attribute, so in the public section of the
class declaration you need to add:
RWS_BEGIN_COMMANDS
RWS_ATTRIBUTE(CMD_TriggerMessage, "Send Event", "", BOOLEAN, RwUInt32,
DEFAULT(0))
RWS_END_COMMANDS;
Source: tutorial4.h
The event we wish to send is registered in the CTutorial4 constructor by the
RegisterMsg function. RegisterMsg accepts three parameters:
RegisterMsg(m_trigger, "trigger", "RwUInt32");
The first is a reference to our CEventId that will contain the event ID for the new
message that we have registered. The second parameter is the unique name for
the event we wish to register. If this event has already been registered
somewhere else then m_trigger will be set to the ID of the original event with
that name. The third parameter is for type checking.
Along with every message you send, you can supply a parameter of type void*
(but any value that fits in the size of a void* can be cast to a void*), which is
passed through the event mechanism. Since this casting breaks the built-in type
safety of C++, the framework registers a message using both its name and its
parameter type; this is because we cannot perform the type checking that would
be done at compile time, because we are making run-time links. If another
behavior had registered a trigger event with a char*, then it would not have the
same ID as the event we have registered, making sure that we do not cast a
char* to an RwReal, or (even worse) cast a float to a char*.
In our destructor, we should unregister our interest in the event. To do this, we
call UnRegisterMsg:
UnRegisterMsg (m_trigger);
348
RenderWare Studio User Guide
CAttributeCommandIterator attrIt(attr,
RWS_CLASSID_OF(CTutorial4));
while (!attrIt.IsFinished())
{
switch (attrIt->GetCommandId())
{
case CMD_TriggerMessage:
CMsg message(m_trigger,
reinterpret_cast<void*>(attrIt->GetAs_RwUInt32()));
SendMsg(message);
break;
}
++attrIt;
}
Source: tutorial4.cpp
In response to a CMD_TriggerMessage (which the Workspace sends whenever
the check box changes state), we construct a new message with an event ID of
m_trigger (the event we registered). The second parameter to the CMsg
constructor specifies the message parameter. In this case, the function attrIt-
>GetAs_RwUint32() retrieves the parameter as an RwUInt32 (it will be zero if
the check box is cleared, non-zero otherwise), but then casts it back to a void *
(which is what CMsg expects). This is done purely for demonstration purposes to
show that a BOOLEAN attribute is accessed as an RwUInt32.
After constructing the message, SendMsg sends the message to the event
system. All CEventHandler-derived classes that are linked to our message will
be woken up to handle the event.
Currently, no objects are linked to our trigger event. In the next lesson, we will
create a behavior that responds to the event.
349
RenderWare Studio User Guide
In this lesson
We create a CTutorial5 behavior that listens for the trigger event that
CTutorial4 sends in response to the check box being clicked in the
Workspace. When CTutorial5 receives this event, it animates the entity.
In which case, the LinkMsg call would have checked that the parameter was an
RwUInt32, but since we registered the event ourselves there is no need to do
this here. If you ever link to a message ID that is registered by another behavior,
then it is recommended that you use the second parameter to LinkMsg to ensure
that a change to the original message registration does not cause a surprise type
mismatch. This applies also to globally registered events, to ensure that the data
these events expect to send or receive is the same as you intended.
As in CTutorial2, when our behavior is destroyed we need to make sure we
unlink the event from our behavior. To do this, we use UnLinkMsg in the
CTutorial5 destructor:
UnLinkMsg(m_trigger);
CTutorial5 rotates the entity whenever the attribute of the CTutorial4 entity
is checked. All of this logic is done in the HandleEvents function of
CTutorial5:
RwFrame* pFrame = RpAtomicGetFrame(m_pAtomic.ptr());
350
RenderWare Studio User Guide
if (pMsg.Id == iMsgRunningTick)
{
RwMatrixSetIdentity(m_mat);
RwMatrixRotate(m_mat, &YAxis, 0.5f, rwCOMBINEPRECONCAT);
RwFrameTransform(pFrame, m_mat, rwCOMBINEPRECONCAT);
}
else if (pMsg.Id == m_trigger)
{
RwUInt32 checked = reinterpret_cast<RwUInt32>(pMsg.pData);
if (checked == 1)
{
if (IsLinked(iMsgRunningTick) == (RwBool)FALSE)
{
LinkMsg(iMsgRunningTick, 0);
}
351
RenderWare Studio User Guide
In this lesson
We demonstrate how behaviors can transmit and receive user-defined
messages.
352
RenderWare Studio User Guide
(That is, you can enter values for Receive Event and Transmit Event, and
change the state of the Send Event check box.)
The protected section of the CTutorial6 class declaration defines the following
items:
Item Description
RwMatrix *m_mat The matrix for rotating the m_pAtomic
object (below).
CAtomicPtr m_pAtomic A pointer to the behavior's atomic (as
described in earlier lessons).
CEventId m_incoming Stores the Receive Event message ID.
CEventId m_outgoing Stores the Transmit Event message
ID.
Let's look at how the message and attribute values affect the behavior.
In the HandleAttributes function, look at the CMD_targetname handler:
case CMD_targetname:
353
RenderWare Studio User Guide
quite safe to unlink and unregister a message if the message has not currently
been linked and registered. When this has been done, the message is then
registered and linked.
All of the above steps can be performed using just one function call:
ReplaceLinkedMsg(m_incoming, attrIt->GetAs_RwChar_ptr(),"RwUInt32");
Note:
• The long-hand method is used in the supplied source code for illustrative
purposes only.
• To extract the value of the Trasmit Message attribute from the RendeWare
Studio Workspace, the RegisterMsg macro refers to the attrIt packet
(attrIt->GetAs_RwChar_ptr()).
RwMatrixSetIdentity(m_mat);
RwMatrixRotate(m_mat, &YAxis, 0.5f, rwCOMBINEPRECONCAT);
RwFrameTransform(pFrame, m_mat, rwCOMBINEPRECONCAT);
}
else if (pMsg.Id == m_incoming)
{
// When the 'incoming' message is received the link to the
iMsgRunningTick system message made
// depending on the state of the incoming data. If there is no
354
RenderWare Studio User Guide
if (pMsg.pData)
{
var = *static_cast<RwUInt32*>(pMsg.pData);
}
else
{
var = !IsLinked(iMsgRunningTick);
}
355
RenderWare Studio User Guide
Test 1
1. Select Entity A.
2. In the Entity A Receive Event, type msg1 and then press Enter.
3. In the Entity A Transmit Event, type msg1 and then press Enter.
4. Select Entity B.
5. In the Entity B Receive Event, type msg1 and then press Enter.
6. Select Entity A again.
7. Select the Entity A Send Event check box.
In the target view, both entities start rotating, as shown in the diagram
below.
356
RenderWare Studio User Guide
Test 2
1. Select Entity B.
2. In the Entity B Receive Event, type msg2 and then press Enter.
3. Select Entity A.
4. Select the Entity A Send Event check box.
In the target view, only Entity A starts rotating, as shown in the diagram
below.
357
RenderWare Studio User Guide
Test 3
1. In the Entity A Receive Event, type msg2 and then press Enter.
Leave the Entity A Transmit Event set to msg1.
2. Select Entity B.
3. In the Entity B Receive Event, type msg1 and then press Enter.
4. In the Entity B Transmit Event, type msg2 and then press Enter.
5. Select the Entity B Send Event check box.
Entity A starts rotating.
6. Select Entity A.
7. Select the Entity A Send Event check box.
In the target view, Entity B starts rotating, too.
Entity A is set to transmit msg1, and Entity B is set to receive msg1. So,
when you selected the Entity A Send Event check box, Entity B started
rotating.
Similarly, Entity B is set to transmit msg2, and Entity A is set to receive
msg2. So, when you selected the Entity B Send Event check box, Entity A
started rotating.
8. Unselect the Entity A Send Event check box.
Entity B stops rotating.
9. Select Entity B.
10. Unselect the Entity B Send Event check box.
Entity A stops rotating.
This is the end of the lesson.
358
RenderWare Studio User Guide
In this lesson
We demonstrate how to use other attribute types in your behaviors (such as
color pickers, list boxes and separators), and how to display debug information
in your developer environment when the RenderWare Studio Workspace user
modifies attribute values.
These are the attribute definitions in the public section of the CTutorial7 class
declaration:
RWS_BEGIN_COMMANDS
RWS_SEPARATOR("Attribute List", 0)
RWS_MESSAGE( CMD_testmessage, "Receive Event", "Type in event name.",
RECEIVE, "RwUInt32", 0)
359
RenderWare Studio User Guide
defaultmessage
This parameter specifies a default message (for example,
ACTN_PLAYERTOUCH)
The RWS_ATTRIBUTE macro lets you specify attribute controls like list views,
check boxes, sliders, and color pickers. For a description of each
RWS_ATTRIBUTE parameter, see lesson 3 (p.346).
Before looking at how to read values back from these attributes controls, we will
first look at how to use the debugging macros in the RenderWare Studio
Workspace to print debug messages in your development environment.
To use these debug macros, you need to include at the start of your source code
file:
1. A define that enables function tracing, allowing you to see how control
passes between functions:
#define RWS_CALLSTACKENABLE
2. A define that enables you to print your own debug trace messages:
#define RWS_TRACEENABLE
If you enable function tracing, then you can call RWS_FUNCTION and
360
RenderWare Studio User Guide
RWS_RETURNVOID();
}
Source: tutorial7.cpp
The example above prints the function name when it is called; this is useful when
tracing the flow of the behavior when it is running, especially as it can keep a
count of the call depth of the behavior, and indents the debug message in the
Message Log window. The RWS_RETURNVOID does not print anything to the
Message Log window, but it decreases the call depth counter, so you have to put
it in.
To print your own debug trace message, call RWS_TRACE. If you have function
tracing enabled, as in the example below, then the call to RWS_TRACE must be
between the RWS_FUNCTION and RWS_RETURNVOID calls:
CTutorial7::CTutorial7(const CAttributePacket& attr) :
InitCEventHandler(&m_pAtomic)
{
RWS_FUNCTION("CTutorial::CTutorial7");
RWS_TRACE ("This is my message");
RWS_RETURNVOID();
}
Now that we have seen how to print a debug trace message, let's look at printing
a debug trace message when the Workspace user changes a behavior attribute
value.
The HandleAttributes function contains the code that retrieves behavior
attribute values:
void CTutorial7::HandleAttributes(const CAttributePacket& attr)
{
RWS_FUNCTION("RWS::Tutorial::CTutorial7::HandleAttributes");
CAttributeHandler::HandleAttributes(attr);
CAttributeCommandIterator attrIt(attr,
RWS_CLASSID_OF(CTutorial7));
while (!attrIt.IsFinished())
{
switch (attrIt->GetCommandId())
{
case CMD_testmessage:
RWS_TRACE(attrIt->GetAs_RwChar());
break;
Source: tutorial7.cpp
361
RenderWare Studio User Guide
The first attribute value to get is the message trigger box. This is straightforward;
the attribute packet has accessor member functions that return the required data.
In this case, we are returning a pointer to a char, which we use as a parameter
in the RWS_TRACE function.
case CMD_testboolean:
RWS_TRACE(attrIt->GetAs_RwUInt32());
break;
Source: tutorial7.cpp
The next attribute value to get is the check box; for this we are going to use the
attrIt->GetAs_RwUInt32(). This will return either a 1 or a 0, depending on
whether the box is checked or not.
case CMD_testslider:
RWS_TRACE(attrIt->GetAs_RwReal());
break;
Source: tutorial7.cpp
The slider attribute value is just as easy to get data from; use the attrIt-
>GetAs_RwReal(). The value returned will be within the bounds described in
the header; in this case, -4000.0 to 4000.0.
case CMD_testcolor:
m_Color = attrIt->GetAs_RwRGBA();
RWS_TRACE(reinterpret_cast<RwUInt32*>(m_Color.alpha) <<" -
ALPHA");
RWS_TRACE(reinterpret_cast<RwUInt32*>(m_Color.red) <<" -
RED");
RWS_TRACE(reinterpret_cast<RwUInt32*>(m_Color.green) <<" -
GREEN");
RWS_TRACE(reinterpret_cast<RwUInt32*>(m_Color.blue) <<" -
BLUE");
Source: tutorial7.cpp
For the next attribute value, we want to get data from the color picker control.
First, you use the GetCommandData function to reinterpret the cast to the type of
the input parameter.
const RwChar* pvar1;
const RwUInt32* pvar2;
const RwV3d* pvar3;
cmd.GetCommandData(&pvar1);
cmd.GetCommandData(&pvar2);
cmd.GetCommandData(&pvar3);
The above example shows this in use: for the first example, RwChar* pvar1
casts the data in the attribute packet to a RwChar*. So in the case of our color
picker, the data from the attribute packet is being cast into a RwUInt32. Then
some shift operations are performed to extract the red, green, blue, and alpha
values into a separate RwRGBA data structure.
RWS_TRACE(reinterpret_cast<RwUInt32*>(m_Color.alpha) <<" -
ALPHA");
RWS_TRACE(reinterpret_cast<RwUInt32*>(m_Color.red) <<" - RED");
RWS_TRACE(reinterpret_cast<RwUInt32*>(m_Color.green) <<" -
GREEN");
RWS_TRACE(reinterpret_cast<RwUInt32*>(m_Color.blue) <<" - BLUE");
break;
Source: tutorial7.cpp
362
RenderWare Studio User Guide
The last property is a list box, as you can see from the attribute definition the list
box has been set up with three entries: “item1”, “item2”, and “item3”.
RWS_ATTRIBUTE(CMD_testlist, "Test List", "List Selection", LIST,
RwUInt32, LIST("item1|item2|item3"))
What we want to do is return back the number of the list element selected, so if in
the RenderWare Studio Workspace the first item is selected, we will get the
number 0 returned. To get the list element number, we will use the
GetCommandData function again to fill the data into a RwUInt32.
RwUInt32 type;
attrIt->GetCommandData(type);
The number returned will simply be the element number, so we can simply use a
switch to display a debug message stating which element has been selected.
case CMD_testlist:
RwUInt32 type;
attrIt->GetCommandData(type);
switch (type)
{
case 0:
RWS_TRACE("Selected List Element 1")
break;
case 1:
RWS_TRACE("Selected List Element 2")
break;
case 2:
RWS_TRACE("Selected List Element 3")
break;
}
break;
Source: tutorial7.cpp
To test this behavior, create an entity in the Workspace and attach the behavior
CTutorial7. Then view the game on the target.. When the data has been
transferred to the target, make sure your entity with the behavior has been
selected. Then, in the Attributes (p.270) window, change the attribute controls.
In the developer environment debug window you will see all the trace messages
displayed as you alter the controls.
363
RenderWare Studio User Guide
Lesson 8. Inheritance
In this lesson
We inherit the capabilities of the CTutorial2 behavior into CTutorial8.
(CTutorial2 rotates its associated entity around the y axis.) In CTutorial8, the
rotation will be controlled by a counter, and CTutorial8 will also grow and shrink
the entity.
protected:
void Scale_Object(void);
};
}//namespace Tutorial
}//namespace RWS
Source: tutorial8.h
As you can see, CTutorial8 inherits from CTutorial2, which in turn inherits from
CSystemCommands, CAttributeHandler and CEventHandler, so you will need to
override HandleEvents and HandleAttributes.
CTutorial8 will not directly need to know about the atomic that gets rotated in
CTutorial2, so you will not need to call CreateAtomicFromFirstResource in the
constructor and call HandleSystemCommands in Handle attributes. All you will
need to do is call the CTutorial2 HandleAttributes and HandleEvents functions, as
shown below:
void CTutorial8::HandleEvents(CMsg &pMsg)
{
RWS_FUNCTION("CTutorial8::HandleEvents");
CTutorial2::HandleEvents(pMsg);
RWS_RETURNVOID();
}
364
RenderWare Studio User Guide
CTutorial2::HandleAttributes(attr);
RWS_RETURNVOID();
}
To use this behavior, create an entity in your world, and then add the CTutorial8
behavior to it. Then, when you have connected to the console, you will see the
object rotating on its y axis and scaling in x, y and z.
365
RenderWare Studio User Guide
In this lesson
We create a new CTutorial9 behavior from scratch, without relying on the
CAtomicPtr object used in previous lessons. This involves reproducing the
functionality provided by CAtomicPtr within the new behavior class, including
cleaning up and safely destroying the atomic, and handling system attribute
commands.
In the previous lessons, the example behaviors used the CAtomicPtr class to
contain the atomic. This class is a smart pointer that also provides some extra
functionality; as well as automatically cleaning up the atomic when it goes out of
scope, it also provides a method that handles the system attribute commands.
In this behavior, CTutorial9, we will implement the same skeleton behavior as
CTutorial1; the main difference is that the atomic is contained directly by the
behavior class, and not a CAtomicPtr. The behavior therefore must implement
the code that the CAtomicPtr would have provided. CTutorial9 is declared
like this:
class CTutorial9 : public CSystemCommands, public
CAttributeHandler , public CEventHandler, public
LinearAllocationPolicy
#ifdef RWS_EVENTVISUALIZATION
, public CEventVisualization
#endif
{
public:
RWS_MAKENEWCLASS(CTutorial9);
RWS_DECLARE_CLASSID(CTutorial9);
RWS_CATEGORY("Tutorial");
RWS_DESCRIPTION("Tutorial9", "Tutorial 9");
#ifdef RWS_EVENTVISUALIZATION
virtual RwV3d *GetWorldPos(void);
#endif
protected:
RpAtomic *m_pAtomic;
};
Source: tutorial9.h
You can see that m_pAtomic is declared as a pointer to an RpAtomic, and not
a CAtomicPtr as in the previous tutorials. Since the destruction of the atomic is
not longer automatically handled by a smart pointer we have to do this manually
in the behavior's destructor function. The destructor looks like this:
CTutorial9::~CTutorial9(void)
366
RenderWare Studio User Guide
{
RWS_FUNCTION("RWS::Tutorial::CTutorial9::~CTutorial9");
RpAtomicSetFrame(m_pAtomic, 0);
FrameHelper::FrameDestroy(pFrame);
}
RWS_RETURNVOID();
}
Source: tutorial9.cpp
Here, the destructor is cleaning up any frame hierarchy before destroying the
frame attached to the atomic. It does this by removing any child frames and also
removing itself from any parent frame. This is important since the atomic may
have been attached to another frame, or had other frames attached during the
course of the application (for example, attaching a player to a moving platform).
Once the frame is destroyed the atomic is then removed from the world using
RpWorldRemoveAtomic() and also destroyed by a call to
RpAtomicDestroy().
The CAtomicPtr class handles system attribute commands in the method
HandleSystemCommands(). These system attributes will now have to be
handled explicitly within the HandleAttributes method of our behavior:
void CTutorial9::HandleAttributes(const CAttributePacket& attr)
{
RWS_FUNCTION("RWS::Tutorial::CTutorial9:HandleAttributes");
CAttributeHandler::HandleAttributes(attr);
367
RenderWare Studio User Guide
switch (attrIt->GetCommandId())
{
case CSystemCommands::CMD_LoadMatrix:
{
RwFrame* pFrame = RpAtomicGetFrame(m_pAtomic);
if (pFrame) CSystemCommands::UpdateFrame(*pFrame,
*attrIt);
}
break;
case CSystemCommands::CMD_SetSolidFlag:
{
RwUInt32 flag;
attrIt->GetCommandData(flag);
RpAtomicCollisionProperties::SetIsSolid( *m_pAtomic,
flag?true:false );
}
break;
case CSystemCommands::CMD_SetInvisibleFlag:
{
RwUInt32 flag;
attrIt->GetCommandData(flag);
AtomicHelper::SetIsVisible( *m_pAtomic,
flag?false:true);
}
break;
case CSystemCommands::CMD_SetCollisionFlag:
{
RwUInt32 flag;
attrIt->GetCommandData(flag);
AtomicHelper::SetCanCollide( *m_pAtomic,
flag?true:false);
}
break;
}
++attrIt;
}
RWS_RETURNVOID();
}
Source: tutorial9.cpp
Our HandleAttributes function is now handling the system attribute
commands to update the atomic's matrix and the various flags controlling
visibility, solid, and collisions. We now have an “empty” behavior class just like in
Tutorial 1 (p.341).
368
RenderWare Studio User Guide
369
RenderWare Studio User Guide
The diagram below illustrates the links between the RenderWare Studio
Workspace script and the attribute editor and its controls.
In order to display a custom control the following steps have to take place:
1. The Attribute editor control exposes a COM Automation interface that the
script calls when entities are selected or de-selected.
2. The Attribute editor then queries the RenderWare Studio Manager API data
for the selected entity's attributes
3. ...and finally displays the relevant controls.
370
RenderWare Studio User Guide
The attribute editor maintains a set of entities that are being edited. The first two
methods (AddSelection and RemoveSelection) are used to add and remove
entities from the selected set. The third method (AttachToDatabase) is used to
tell the attribute editor to attach to a new RenderWare Studio Manager database
(or the current database should be detached from by using an ID of zero). The
fourth method (ClearSelection) is used to clear the current set of selections.
371
RenderWare Studio User Guide
The RenderWare Studio API stores nodes in its hierarchy to represent classes
and commands, and their instanced equivalents, entities and attributes. Classes
and commands are created by the source parser toolkit when it parses the game
source header files; whereas entities and attributes are saved in the XML.
Each command structure in the API represents an RWS_ATTRIBUTE macro
between an RWS_BEGIN_COMMANDS and RWS_END_COMMANDS block in the
header file. This macro contains a number of user-defined parameters to allow
attributes to be created with default data.
372
RenderWare Studio User Guide
To create and initialize the correct controls, the attribute editor queries the
selected RWSEntity for its behavior class name, then locates the RWSClass
object whose UID corresponds to the class name. If an RWSClass object is
located, its child RWSCommands are queried, and used to create the correct
type of control.
Each RWSCommand structure contains a string member (ParamList) that stores
the parameters provided to the RWS_ATTRIBUTE macro.
For example a game-source header file might contain:
RWS_ATTRIBUTE(CMD_Movie,
"MediaPlayer Test",
"Specify a movie file to play",
RWSMediaPlayer.RWSMediaPlayerCtrl,
RwChar,
DEFAULT("C:\mssdk\samples\Multimedia\Media\Butterfly.mpg"))
A null terminator ("\0") separates each parameter in the list, and the
RWSCommand's ParamLength member specifies the total number of characters
in the string.
To create the correct ActiveX attribute control, the fourth parameter
(RWSMediaPlayer.RWSMediaPlayerCtrl) is extracted from the ParamList
member, and used as the control's ID. Each control must implement an interface
to allow the editor to communicate with it. The control is initialized via this
interface.
373
RenderWare Studio User Guide
Control Interfaces
For a control to be contained within the attribute editor, it must implement the
following COM interfaces (which are generated automatically by the RenderWare
Studio Attribute Editor wizard):
interface __declspec(uuid(“3E73B80D-D779-486d-889C-13F2CCFA6D33”))
IRWSAttribEditEvents : public IUnknown
{
public:
STDMETHOD (CreateUndo) (RWSID AttributeID) = 0;
};
374
RenderWare Studio User Guide
375
RenderWare Studio User Guide
This function must return the number of characters in the string that represents
the name of the attribute data type. The return value is used to allocate space for
the Type member in the RWSAttribute Manager API structure.
For example, if an attribute will store a user-defined structure called
“MyQuaternion”, your function must return the string length of “MyQuaternion”.
If the command your control will edit contains the "DEFAULT" parameter (5th
parameter), and you selected the "Read default data type from command" option
in the wizard, the following function will automatically be implemented for you by
the wizard-generated code.
void GetDefaultType (RWSChar * const szType,
const RWSChar * const szParamList,
RWSUInt32 nParamLength);
The GetDefaultType function must copy the default data type string into the buffer
provided (szType). This buffer is guaranteed to be one character longer than the
value returned by the GetNumDefaultTypeChars function.
RWSUInt32 GetDefaultDataSize (const RWSChar * const szParamList,
RWSUInt32 nParamLength);
GetDefaultDataSize must return the size in bytes of the default data that will
be stored with this attribute. The return value of this function is used to allocate
storage for the pData member of the RWSAttribute API structure. For more
information on the format of the attribute data, see Attribute Editor Data (p.378).
void GetDefaultData (RWSByte * const pData,
const RWSChar * const szParamList,
RWSUInt32 nParamLength);
The GetDefaultData function must copy the default data into the buffer provided
(pData). This buffer is guaranteed to be the same size as the number of bytes
returned by the GetDefaultDataSize function (above).
void CreateUI ();
This function is called to allow the control to create or initialize any user interface
items in the control.
void UpdateControls (const RWSByte * const pData);
The UpdateControls function must use the provided data buffer (pData) to
update the state of the control's user interface. For more information on the
376
RenderWare Studio User Guide
377
RenderWare Studio User Guide
To allow users to customize the data stored with their attributes, the RenderWare
Studio Manager API stores data as a stream of bytes, along with a size
parameter specifying the data length. This enables complex structures to be
stored within the API attribute data structure, and serialized correctly.
To enable the RenderWare Studio Comms network toolkit to send the data to
targets in the correct endian-order (and to narrow any Unicode strings) the
attribute data must contain special “tags” in the data. These tags contain
information about the type and size of the data. Each tag consists of two 4-byte
values. The first value defines the type of the data items that follow, whilst the
second defines the number of data items.
The data type is specified as an enumeration (RWSDataType) of the following
basic types:
The data to represent a single data value (such as an RWSInt32) would be laid
out like so:
378
RenderWare Studio User Guide
More complex structures can be stored in attribute data. For example, this
structure:
typedef struct
{
RwInt32 i[4];
RWSChar *s; // if "hello\0", then
char pad[2]; // 2-bytes of padding
RwV3d v;
} RWSGroup;
The first five data types listed above need to be located in memory so that they
start on a four-byte multiple boundary.
Therefore in this example, if you had the string "hello" plus one byte for the null
terminator, you would have the following amount of data needing space in
memory:
379
RenderWare Studio User Guide
Because the total number of bytes required is not a multiple of four there would
need to be a further two bytes of padding to ensure that the next data type (in this
example a vector incorporating three RWSReal types) starts at the next four-byte
multiple boundary.
380
RenderWare Studio User Guide
Simply call this function from within your control class (often in response to a
windows message such as WM_CHAR) to save the current state of the attribute
data. The first parameter is a pointer to the attribute data buffer (see Attribute
Editor Data (p.378)), and the second specifies the size in bytes of the data in the
buffer. The bCreateUndo parameter determines whether the helper class creates
an undo operation before saving the data.
For a practical example of an attribute control created with the wizard, see the
tutorials (p.382).
381
RenderWare Studio User Guide
You define attributes, and choose the controls for editing them, in
RWS_ATTRIBUTE macros in the header (.h) file of a behavior (p.337).
There are two types of attribute editor control:
• The ActiveX controls or built-in Windows user interface controls installed on
your system that are created in C++ —the tutorials introduced below take
you through creating these.
• The HTML attribute editor control (p.405) that displays an HTML file in the
Workspace interface.
382
RenderWare Studio User Guide
383
RenderWare Studio User Guide
384
RenderWare Studio User Guide
In this lesson
We create an attribute editor control with a basic user interface and an
extended user interface. The basic user interface is a edit box where you enter
the value of the attribute: in this case, the path of a movie file (such as an
.avi). The extended user interface uses the Windows Media Player to play the
movie.
Note: It is possible at most stages throughout the lesson to build and test the
control.
385
RenderWare Studio User Guide
Change the default parameter string to the path of a movie file on your
system.
386
RenderWare Studio User Guide
return nDataSize;
The code above calculates the data size (p.378) required for the attribute
data header, and (unquoted) default string contents.
20. Replace the contents of the GetDefaultData() function with the following
code:
ATLASSERT (szParamList);
ATLASSERT (pData);
387
RenderWare Studio User Guide
pHeaderData[1] = nChars + 1;
}
else
{
// default to empty string
pHeaderData[1] = 1;
*(reinterpret_cast<RWSChar *>(pHeaderData + 2)) = 0;
}
The above code copies the attribute data header, and default string
characters into the buffer provided (via the pData function parameter).
388
RenderWare Studio User Guide
25. Right-click the edit box control, and set its ID to IDC_FILENAME.
389
RenderWare Studio User Guide
The above code reads the provided pointer to the attribute data (pData),
and updates the filename edit box contents.
If multiple entities (with the same behavior) are being edited, and the
attribute data for each is not the same, the pointer passed in will be null to
indicate this. This is known as an indeterminate UI state.
390
RenderWare Studio User Guide
pdispMediaPlayer->Invoke (
dispid, IID_NULL,
LOCALE_USER_DEFAULT,
DISPATCH_PROPERTYPUT, &dispparams,
0, 0, 0);
}
}
The above code queries the dispatch interface for the control and, if this
succeeds, the ShowControls method is called to hide the playback
controls.
32. In RWSMediaPlayerCtrl.h, add the following member function
declaration to the CRWSMediaPlayerCtrl class:
private:
void SetMPlayerFile ();
pHeader[0] = RWSTypeChar;
pHeader[1] = nLen + 1; // number of characters
391
RenderWare Studio User Guide
SaveDataToAttributes (reinterpret_cast<RWSByte
*>(pHeader), nDataSize);
DISPID dispid;
HRESULT hr = pdispMediaPlayer->GetIDsOfNames (
IID_NULL, &szMember, 1,
LOCALE_USER_DEFAULT, &dispid);
if (S_OK == hr)
{
DISPPARAMS dispparams;
VARIANTARG vararg[1];
dispparams.rgvarg = vararg;
VariantInit (&dispparams.rgvarg[0]);
dispparams.rgvarg[0].vt = VT_BSTR;
dispparams.rgvarg[0].bstrVal = T2OLE (szText);
DISPID mydispid[1] = { DISPID_PROPERTYPUT };
dispparams.rgdispidNamedArgs = mydispid;
dispparams.cArgs = 1;
dispparams.cNamedArgs = 1;
pdispMediaPlayer->Invoke (
dispid, IID_NULL,
LOCALE_USER_DEFAULT,
DISPATCH_PROPERTYPUT,
&dispparams, 0, 0, 0);
}
}
}
}
The function above saves the attribute data, checks that the file is readable,
queries the control's dispatch interface, and calls its Filename method.
34. Add the following two calls to the ExpandUI() member function:
if (bExpand)
{
Invalidate ();UpdateWindow ();
}
These calls ensure that the media player redraws correctly when you click
the ... button to display the extended user interface.
392
RenderWare Studio User Guide
35. Add the following lines in the message map before the END_MSG_MAP
macro:
MESSAGE_HANDLER(WM_SIZE, OnSize)
COMMAND_CODE_HANDLER(EN_CHANGE, OnEditChanged)
These message map macros call member functions that we need to declare
and implement.
36. Add the following protected member declarations to the class definition:
LRESULT OnSize (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL&
bHandled);
LRESULT OnEditChanged (WORD wNotifyCode, WORD wID, HWND
hWndCtl, BOOL& bHandled);
RECT rc;
GetClientRect (&rc);
int x = LOWORD (lParam) / 2;
rc.left = x;
rc.right = rc.left + x;
rc.bottom = g_nHeightContracted - 2;
rc.top = 2;
WndEdit.MoveWindow (&rc);
GetClientRect (&rc);
rc.top = g_nHeightContracted;
WndMPlayer.MoveWindow (&rc);
return 0;
}
/*
--------------------------------------------------------------------------
*/
LRESULT CRWSMediaPlayerCtrl::OnEditChanged (WORD, WORD, HWND,
BOOL&)
{
SetMPlayerFile ();
return 0;
393
RenderWare Studio User Guide
/*
--------------------------------------------------------------------------
*/
to:
if (!m_bUpdating)
SaveDataToAttributes (reinterpret_cast<RWSByte
*>(pHeader), nDataSize);
Your attribute editor control should now be able to accept the path of a
movie file, and then play the movie:
394
RenderWare Studio User Guide
Note: To view the movie file again (after the first time), click the media
player control.
This is the end of the lesson.
Additional exercises
Some additional exercises that you might wish to try:
• Add a browse button to the user interface that pops up a file dialog asking
for the movie file path.
• Insert a different ActiveX control, or your favourite web page, instead of the
Windows Media Player control.
• Rather than saving the filename in an attribute, open the file and embed it
into the attribute data as a byte stream (type RWSTypeByte instead of
RWSTypeChar). The embedded data will be sent to a connected target
console across the network, rather than sending the file name.
• Use the RenderWare Studio Manager API from within your control to display
all the assets of a certain type that are children of the currently selected
entities. The API is fully accessible from the control code, and the particular
entities, attributes, commands, and classes are available as members of
your control class via the following (inherited) class members:
RWSID m_CommandID;
RWSID m_ClassID;
EntityToAttribMap m_EntityToAttribMap;
395
RenderWare Studio User Guide
In this tutorial
You use a Visual C++ wizard (supplied with RenderWare Studio) to create a
new type of control for editing attributes.
The new control is a drop-down list box that lists all assets in the game database:
When you select the asset name from the list, the control sends the GUID of the
asset to any connected game targets.
When you add a new asset to the game, an entry corresponding to that asset is
registered in the game database (p.76) in the form of an XML file. Each XML file
that references an asset is named using its own global unique identifier (GUID).
Note: The sample code provided here is intended to demonstrate how to build
your own attribute controls in RenderWare Studio. It is not a set of code that you
would use in practice as the list of assets generated would be too long and would
require further filtering.
To generate the control, you use the RWS Attribute Editor Control wizard (p.376).
(To generate more general ActiveX controls in RenderWare Studio you would
use the RWS ActiveX Control wizard).
396
RenderWare Studio User Guide
3. In the Project Types list, select Visual C++ Projects; in the Templates list,
select RenderWare Studio Attribute Editor Control.
4. In the Name box, type RWSAssetList. Leave all other settings at their
default.
5. Click OK.
The RenderWare Studio Attribute Editor Control wizard appears.
6. Leave all boxes in the dialog unchecked, and then click Finish to generate
the project.
7. Set the build configuration to Release:
• In the Standard toolbar, select Release from the Solution
Configurations drop-down.
Note: To use the Debug configuration:
a. Select the appropriate item in the Solution Configurations drop-down.
b. Select Project Properties...
c. In the dialog that appears, choose the Configuration Properties
Linker Input item.
d. In the Additional Dependencies box, change the file name from
RWSud.lib to RWSu.lib.
8. Build the control, which is registered automatically at the end of the process.
Tip: If you specified a different project name from that suggested in the
tutorial and need to find the name of the identifier used to create and
register the control:
• Open your project's .rgs file.
• Search for the string “VersionIndependentProgID = s”
• The project's identifier will immediately follow the string above.
397
RenderWare Studio User Guide
interface works and the data you wish to set within your control's attribute.
These functions are called as soon as you need to display your control and
the default value for its attributes in the Renderware Studio workspace, but
before any actual attribute values have been assigned. If a console is
connected to the workspace while the attribute is in this state, these
functions are called to send the data structure (p.378) for the default value to
the connected targets.
A helper class is provided to simplify implementing the necessary interfaces
that make your control an attribute editor control. The interface used by the
Workspace to communicate with each attribute editor control is defined in
RWSAttribEditIF.h. The helper class that implements this interface is
defined in the file RWSAttribEdit.h.
Note: It is not normally necessary to modify these two files, as they perform
tasks required by all attribute editor controls, for example:
• Monitoring database changes in attributes, classes and commands.
• Calling several helper functions that you must implement.
11. The first function to implement is GetNumDefaultTypeChars(). This is
one of four functions responsible for generating default attribute data that is
then sent to the game. These functions build up the RWS attribute data
structure that represents the default value of your attribute. In this example
the default value is an empty string since the list box control is empty when
first displayed.
To implement this function: In the file RWAssetListCtrl.cpp, return the
number of characters in the string that represents your default data type as
follows:
RWSUInt32 CRWSAssetListCtrl::GetNumDefaultTypeChars (const
RWSChar * const,
RWSUInt32)
{
return wcslen (L"RwChar");
}
Source: RWSAssetListCtrl.cpp
The return value of this function is used by the helper class file
(RWSAttribEdit.h) to allocate space in memory for the Type member of
the RWS Attribute structure.
12. The next function is GetDefaultType(). This is called by the helper class
to fill in the TypeGetNthParam field of the RWS Attribute structure with
your default data string as defined by the value returned above by
GetNumDefaultTypeChars . Implement this as follows:
void CRWSAssetListCtrl::GetDefaultType (RWSChar * const
szType,
const RWSChar * const,
RWSUInt32)
{
wcscpy (szType, L"RwChar");
}
Source: RWSAssetListCtrl.cpp
As this is a descriptive string that is only used for storing in the XML
database, it could equally well be any of the other possible Attribute Editor
Data Types or some other user-defined data type such as, for example
398
RenderWare Studio User Guide
MyAIdata.
13. Next, implement the GetDefaultDataSize() function as follows:
RWSUInt32 CRWSAssetListCtrl::GetDefaultDataSize (const RWSChar
* const,
RWSUInt32)
{
// 2 unsigned int header
RWSUInt32 nDataSize = 2 * sizeof (RWSUInt32);
return nDataSize;
}
Source: RWSAssetListCtrl.cpp
The attribute is not displayed in the Game Explorer panel of the Workspace
until the default value has been changed. At the stage where it is not yet
displayed, this function is called to allocate a buffer in memory to store the
value of a binary representation of the default value.
Tip: To query the default data type from the RWS_ATTRIBUTE macro, use
the functions provided in the files utility.h and utility.cpp. For
example, the function GetNthParam returns a string containing a parameter
from the source-code macro defining the attribute in your game header file.
This would be useful where you needed to change just one parameter in an
attribute containing many different parameters.
14. Replace the GetDefaultData() function with the following code:
void CRWSAssetListCtrl::GetDefaultData (RWSByte * const pData,
const RWSChar * const,
RWSUInt32)
{
// fill in first data tag header here
RWSUInt32 *pDataHeader = reinterpret_cast<RWSUInt32
*>(pData);
// specify data type
pDataHeader[0] = RWSTypeChar;
// specify the number of data items
pDataHeader[1] = 1; // just 1 item
399
RenderWare Studio User Guide
if (!m_WndCombo.IsWindow ())
{
// create the combo box control
RECT rc;
GetClientRect (&rc);
rc.top += 2;
rc.bottom = 200; // specify combo's initial drop-height
rc.left = rc.right / 2;
m_WndCombo.Create (m_hWnd, rc, 0, WS_VISIBLE |
WS_CHILD |
CBS_DROPDOWNLIST |
CBS_SORT |
CBS_HASSTRINGS |
WS_VSCROLL);
ATLASSERT (m_WndCombo.IsWindow ());
PopulateCombo (m_WndCombo);
}
Source: RWSAssetListCtrl.cpp
Place the PopulateCombo() function in an anonymous namespace near
the top of the file as follows:
void PopulateCombo (CComboBox &WndCombo)
{
WndCombo.ResetContent ();
400
RenderWare Studio User Guide
}
RWSAssetFreeData (&AssetData);
AssetID = RWSGetNext (AssetID);
}
}
Source: RWSAssetListCtrl.cpp
Tip: For faster lookup, each list box item has some data associated with it
corresponding to the asset's run time-ID (RWSID).
RWSAssetFreeData (&AssetData);
}
}
}
// update the UI
m_WndCombo.SetCurSel (nSelection);
}
Source: RWSAssetListCtrl.cpp
401
RenderWare Studio User Guide
Note: For other types of control you would need to add different Windows
message-handlers.
Complete adding this functionality with a declaration of the class member
function in the file RWSAssetListCtrl.cpp to handle the message with
the following:
LRESULT CRWSAssetListCtrl::OnSelEndOK (WORD wNotifyCode, WORD
wID,
HWND hWndCtl, BOOL&
bHandled)
402
RenderWare Studio User Guide
{
// get the item data (RWSID of asset)
RWSID AssetID = m_WndCombo.GetItemData (nSel);
ATLASSERT (AssetID);
403
RenderWare Studio User Guide
{
OutputDebugString (szAssetUID);
}
break;
}
++attrIt;
404
RenderWare Studio User Guide
You can define a custom attribute editor control that displays an HTML file. In
your behavior source code, you refer to the URL of the HTML file:
RWS_BEGIN_COMMANDS
...
RWS_ATTRIBUTE(CMD_8, "behavior name", "tooltip", HTML,
STRING, URL("file://c:\test.html"))
...
RWS_END_COMMANDS;
The HTML file can contain any code that can be displayed by Internet Explorer.
For example, it can contain simple HTML (pictures or documentation for
behaviors), dynamic HTML with script that performs user interface functions such
as buttons, list boxes, check boxes, etc., or a mixture of both.
405
RenderWare Studio User Guide
AttributeData property
Gets or sets the data for the attribute(s) being edited. If the value retrieved is null,
this indicates that multiple attributes with different data are being displayed.
RWSHTMLControl.AttributeData [= RWSData]
You can access the command ID of your control (which gives you access to the
parameters in your attribute macro in behaviour source), get and set the
attribute's data, and set the height of the user interface.
CommandID property
Read-only. Gets the command ID of the attribute(s) being edited.
Long = RWSHTMLControl.CommandID
Height property
Sets the height of the control's window.
IRWSHTMLInterface.Height [= Long]
Access to IRWSScript
You can access the Manager API's scripting interface (IRWSScript), using an
object that's automatically added to the page's namespace, called RWSScript.
For example, in your page's script you can do:
Dim oCommand
Set oCommand = RWSScript.Command (RWSHTMLControl.CommandID)
If Not oCommand Is Nothing Then
MsgBox oCommand.Name
' You can also extract parameters from the attribute macro
using the oCommand.ParamList property
' (see the IRWSCommand documentation in the IRWSScript
documentation)
End If
You can also handle events through the script interface, for example:
Sub RWSScript_OnChange (oAPIObject)
' This will be called for *any* Manager API object that
changes, unless you set the RWSScript.EventMask property!
MsgBox "OnChange!"
End Sub
406
RenderWare Studio User Guide
The Game Framework is a set of services, implemented in C++, that you use to
develop a game with RenderWare Studio.
The Game Framework is supplied with RenderWare Studio as source code. It is
designed to be incorporated into your own game code from the earliest “proof of
concept” through to the final commercial game.
407
RenderWare Studio User Guide
Source files
The Game Framework source files are supplied in:
C:\RW\Studio\console\game_framework\source
Note: C:\RW\Studio is the default location for RenderWare Studio. You might
have installed RenderWare Studio in a different folder.
Project files
To build a target executable from the Game Framework source, use the project
files supplied in:
C:\RW\Studio\console\game_framework\your platform\game_framework
where your platform depends on your compiler and your target console:
mw_sky
Contains CodeWarrior project files for building a PlayStation 2 executable.
mw_gcn
Contains CodeWarrior project files for building a GameCube executable.
sn_gcn
Contains Visual C++ 7.1 project files for using ProDG to build a GameCube
executable.
sn_sky
Contains Visual C++ 7.1 project files for using ProDG to build a PlayStation
2 executable.
Caution: Before using ProDG to compile any PlayStation 2 build, you must
add the PlayStation 2 include paths to your list of include directories in
Visual Studio (Tools Options Projects VC++ Directories). For
example:
c:\usr\local\sce\common\include
c:\usr\local\sce\ee\include
win32
Contains Visual C++ 7.1 project files to build a 32-bit Windows executable.
xbox
Contains Visual C++ 7.1 project files to build an Xbox executable.
Subprojects
408
RenderWare Studio User Guide
The Game Framework (and empty framework) project includes two subprojects:
Core (also known as gfCore)
Stored alongside the Game Framework project files in:
C:\RW\Studio\console\game_framework\your platform\gfcore
(The empty framework project also refers to this path.)
Loading screen
Stored in a separate folder structure:
C:\RW\Studio\console\plugins\loading_screen\your platform
The loading screen project creates the screen that the Game Framework
shows when it is awaiting connection to the Workspace:
Build configurations
Each supplied project defines several build configurations. These configurations
are divided into two types:
Design
Includes the code that allows the Game Framework to receive game data
from the Workspace. Design builds of the Game Framework expect to
receive a data stream from the Workspace.
Production
Excludes the code that allows the Game Framework to receive game data
from the Workspace. Production builds read a stream file, so they do not
require the Workspace. For this reason, production builds are sometimes
referred to as “stand-alone” builds.
For either configuration type, you can select between:
Debug
Includes debugging code in the target executable.
Metrics
Generates metrics data, useful for tuning the application during
development.
Release
Excludes both debugging and metrics code from the target executable.
If the build configuration name in the project does not include the word “Design”,
then it is a production build. For example, “Release” identifies a production build
that does not include any debugging or metrics code; “Design Debug” identifies a
design build that includes debugging code. (Typically, you use the “Release”
409
RenderWare Studio User Guide
410
RenderWare Studio User Guide
#define RWS_BROADBAND.
_DEBUG
Includes debugging code.
CDROM
For PlayStation 2 CD-ROM builds, as described above.
NDEBUG
Excludes debugging code.
RWDEBUG
Includes RenderWare Graphics debugging code and links with the
RenderWare Graphics debug libraries. For details, see the RenderWare
Graphics documentation.
RWMETRICS
Includes RenderWare Graphics metrics code and links with the RenderWare
Graphics metrics libraries. For details, see the RenderWare Graphics
documentation.
RWS_BOOTUP_FILE "path"
Specifies the path of the boot-up stream file (p.233) containing the game
data for the default level (the level that you want to appear when the game
starts).
RWS_BROADBAND
For GameCube design builds that connect to the Workspace via a
broadband adapter.
RWS_DEBUGSWITCHES
Enables various true/false flags useful for debugging. You can control these
switches via the CDebugTools (p.219) behavior.
RWS_DEBUGTOOLS
Enables debugging tools; these include various immediate-mode drawing
primitives such as lines, ellipses, and triangles. Requires DEBUGSWITCHES.
RWS_DESIGN
Enables the Game Framework to connect to and receive game data from
the Renderware Studio Workspace. Requires DEBUGSWITCHES.
RWS_DISABLE_MEMORY_CHECKING
Disables memory debugging tools.
RWS_EVENTVISUALIZATION
Enables the ability to overlay (p.219) the game display with the events firing
between 3D objects (atomics, clumps, or cameras) in the scene. Requires
DEBUGSWITCHES and DEBUGTOOLS.
Tip: If you override the CeventVisualisation::Get3Dpos
(CeventVisualisation.cpp) virtual function, then you can visualize the
events firing for any object that is capable of returning a world space 3D
position.
411
RenderWare Studio User Guide
WITH_AUDIO
Includes support for RenderWare Audio.
412
RenderWare Studio User Guide
After working on several games, and discussing games programming with many
other developers, you start to see that the majority of games are built in a very
similar way. This suggests that the code and data that form the building blocks of
these games is likely to be quite similar.
The RenderWare Studio Game Framework core provides the common building
blocks for developing a game of any genre; it also defines a flexible, extensible
structure for developing code that is specific to your game.
By providing this common functionality and structure, the Game Framework core
dramatically increases the potential for code reuse, saving developers time (and
therefore money).
Just as artists and audio designers create artwork and audio “assets” with which
to build the final game, one task of games programmers is to build blocks of
game code that can be associated with these assets. In RenderWare Studio,
these blocks of code are called behaviors. Behaviors share several common
traits:
• They may be instanced many times within the game.
• They have parameters or attributes that are used to initialize them.
• They often communicate with each other to create complex game play.
• They are typically associated with other data such as graphics and audio,
known in RenderWare Studio as assets (or, sometimes, resources).
Behaviors are typically written as a single C++ class, and always derived at some
level from the abstract base class CAttributeHandler (see “Attribute
handlers”, below). When behaviors are associated with geometry in the
Workspace then, on the target console, an instance of the class derived from
CAttributeHandler will be created, and a pointer to the CAttributeHandler is
maintained by the core. When an attribute of a behavior is modified in the
Workspace then, on the target, this pointer is used to call the
CAttributeHandlers virtual function HandleAttributes.
The key components of the Game Framework core are described in more detail
below.
413
RenderWare Studio User Guide
the target console. Typically, this layer sends data to the framework as binary
streams. These binary streams are the same format as the data used in the final
commercial game. This means that the code that the games programmer writes
to initialize the behavior classes during development is the same code that is
used in the final commercial game. The advantage of this is there is very little
additional code that needs to be written in order to take advantage of the
real-time tuning of RenderWare Studio.
The network communication layer is implemented by overloading the
RenderWare Graphics stream object; these streams are typically used for loading
data from files stored on a mass storage device such as a DVD. By implementing
the network layer in this way, existing code that makes use of RenderWare
streams becomes network enabled. The advantage of this is that the same code
can be used during game design and final production. Using the same high-level
method to load streams (that typically contain the game assets) ensures a similar
memory footprint for design and production versions of the game.
Attribute handlers
To remotely modify an instance of a class on the target, we needed to solve a
few problems. First, we needed to identify the instance of the class on the target.
Second, we needed to create a standard interface for communicating with the
class. The abstract base class CAttributeHandler provides this interface,
and maintains a map of IDs to instances of CAttributeHandler. These IDs
uniquely identify each instance of the class. The Workspace generates this
unique ID for each instance of a class derived from CAttributeHandler; the
target maps each ID to a pointer to the appropriate instance of
CAttributeHandler.
Data is passed to the class in a binary format and is accessed via the
CAttributePacket class; the data is generated by the RenderWare Studio
Workspace by the RenderWare Studio Manager API in a format suitable for the
target platform (that is, issues such as endianess are resolved before the data is
sent to the target). A CAttributePacket provides a method of serializing the
data required to initialize the class. The format of the serialization also enables
individual attributes to be modified without recreating the class; this is a
necessary feature during real-time editing, as it enables attributes to be modified
414
RenderWare Studio User Guide
without affecting the overall state of the behavior. The CAttributePacket also
identifies attributes associated with different classes within a class hierarchy. This
enables base classes to be specialized by derivation without any modification
regarding the attributes.
Associated with the CAttributeHandler class is the code decoration that
enables programmers to specify the attributes that need to be serialized and the
user interface controls that should be used to generate this data. This is added as
part of the game code to the class declaration and removed during compilation.
The immediate effect of automating the generation of the user interface
associated with the behavior is to reduce the need to develop and maintain
custom tools; the vast majority of the user interface controls that the programmer
requires in order to parameterize the behavior are provided by the RenderWare
Studio Workspace. Any components that is not available as standard can be
added to the Workspace as a standard ActiveX control. A more subtle effect is to
tie the definition of the user interface of the game component or behavior to the
implementation of the behavior; this means that if the game code is shared
between teams, the user interface goes with it. The code decoration is not
compiled to generate the user interface; rather, the RenderWare Studio
Workspace generates the user interface by parsing the code decoration in the
game code. If the code decoration is modified, the Workspace can reparse and
regenerate the user interface dynamically, without needing to be shut down and
restarted.
To summarize: the CAttributeHandler class, in conjunction with the
CClassFactory and network layer, enables developers to create game entities
with attributes that can be modified in real time from the RenderWare Studio
Workspace. The CAttributeHandler class does this by providing:
• A method of transferring data to the target while it is running
• Registration of game entities that can be instanced by name on the target
• A method of initializing these game entities during their construction
• A mapping of unique IDs that are used to identify an instance of a class, in
order to pass on modifications to their attributes
• An interface that derived classes can implement to receive these
modifications
Here is an example of decorated behavior code, and the resulting attribute editor
user interface (compare the RWS_ATTRIBUTE macros in the code with the
controls in the user interface):
RWS_BEGIN_COMMANDS
415
RenderWare Studio User Guide
LIST, RwUInt32,
LIST("rpLIGHTLIGHTATOMICS+rpLIGHTLIGHTWORLD|rpLIGHTLIGHTATOMICS|rpLIGHTLIGHTWO
RWS_END_COMMANDS;
416
RenderWare Studio User Guide
derived from the abstract base class CEventHandler, and must implement a
HandleEvents function. The event system maintains a list of registered events;
each registered event maintains a list of event handlers that have linked to that
event, as shown in the diagram below.
417
RenderWare Studio User Guide
Traversing the list of linked event handlers enables events to be broadcast: this is
useful where the recipients of an event are unknown to the sender. If the recipient
418
RenderWare Studio User Guide
is known to the sender, then events can also be sent directly to a specific event
handler. In this case, the HandleEvents method of the receiver is called directly
without traversing any of the lists. (This means that event handlers can receive
events that they have not linked to. They need to handle such events
appropriately: typically, this involves ignoring the event.)
Resources
The Game Framework provides a methodology for managing assets (also known
as resources). Resources are typically identified by a unique ID; access to these
resources can be obtained by reference to this ID. Accessing resources is
handled by the resource manager, implemented by the CResourceManager
class. Individual resource types are handled by specializations of the
CResourceHandler class.
Developers can easily extend the types of resources that the resource manager
can handle, without modifying the resource manager, by deriving from
CResourceHandler, and implementing the interface it defines.
The loading, unloading and referencing of resources is all data-driven, often
eliminating the need for programmer intervention when new assets are added to
the game. By empowering artists and designers, allowing them to add new
assets to the game, we remove the typical programmer bottleneck. This allows
new assets to be reviewed on the target console much quicker.
419
RenderWare Studio User Guide
The main game loop drives the event system, synchronizing the update of game
logic and rendering. By using the event system, we uncouple the main game loop
from the rest of the game code. To illustrate this, consider a game with several
levels, where each level requires different rendering techniques. One approach
would be to switch on the current level and call the relevant rendering code. By
doing this, the implementation of the rendering and the main loop are closely
linked. Further, the main loop is now game-specific making it harder to reuse.
The main loop will also need to be maintained as game levels are changed or
added which requires a programmer. By using events, RenderWare Studio allows
different rendering techniques to be attached by the game data for each level; it
becomes a data-driven process, reducing the need to modify code.
The main loop is responsible for polling a number of services and firing a number
of events, as listed below:
1. Poll network layer for data packets from the Workspace, data packets are
used to load assets, create or delete entities, modify attributes and other
tasks relating to editing.
2. If the game logic state is running:
a. Send event Pre Running Tick Event
b. Send event Running Tick Event
c. Send event Post Running Tick Event
otherwise:
a. Send event Pre Paused Tick
b. Send event Paused Tick
c. Send event Post Paused Tick
3. Depending on whether directors camera is enabled or disabled, either:
• Send event Render Director's Camera
or
• Send event Render Camera
4. Show rendered image.
References
• Gamma, E and Helm, R and Johnson, R and Vlissides, J. (2000), Design
Patterns: Elements of Reusable Object-Oriented Software
(www.aw-bc.com/catalog/academic/product/0,4096,0201633612,00.html).
Addison-Wesley.
• Deloura, M. (2000), Game Programming Gems
(www.charlesriver.com/titles/gamegems.html). Charles River Media.
420
RenderWare Studio User Guide
Class factory
For RenderWare Studio to create new behaviors and entities, we need a way of
identifying the class to create. CClassfactory maintains a mapping of
name/function pointer pairs that allow named classes to be created. To register a
class in the class factory, you need to insert the following two macros in the
header file of a behavior:
RWS_MAKENEWCLASS(classname)
RWS_DECLARE_CLASSID(classname)
These macros declare the functions required to allow the class factory to
construct a new class object, and the member variables required to identify the
object.
Resource handlers
Resource handlers for common RenderWare types such as worlds, atomics,
clumps, and texture dictionaries are provided as toolkits as part of the Game
Framework. RenderWare Studio loads resources from streams. Streams can be
loaded either from memory, from a mass storage device such as a CD-ROM, or
from across the network.
You can add your own resource handler by inheriting from CResourceHandler
and overriding the load functions.
When you derive from CResourceHandler, you have to override functions to
load, unload, and check whether the resource type is handled.
Note: By default, attribute values are incorporated into the stream, but the
RWS_ATTRIBUTE macros that generate the user interface are not retained. XML
is not incorporated into the game stream.
You can add your own resource handler by inheriting from CResourceHandler
and overriding the load functions.
When you derive from CResourceHandler, you have to override functions to load,
unload and check whether the resource type is handled.
421
RenderWare Studio User Guide
• Network source
422
RenderWare Studio User Guide
Customizing Workspace
Enterprise Author
RenderWare Studio comes supplied with an application called Enterprise Author
that allows you to customize Workspace to the individual requirements of a game
development team. Among other things, Enterprise Author allows you to:
• Change how Workspace's windows are configured by default, to suit the
needs of your organization.
• Create definitions for different interface layouts that Workspace can switch
between on request.
• Make new windows, menus, and context menus, and write code to integrate
them with the rest of the application.
• Introduce custom ActiveX controls to Workspace, and have them interact
with the default set of controls.
• Edit the script code that handles the interactions between the ActiveX
controls in Workspace's interface and stores some configuration information.
423
RenderWare Studio User Guide
Understanding Workspace
Fundamental operations
Workspace shares its core functionality with Enterprise Author because both
applications are based on an executable called EnterpriseHost.exe. This
executable lies at the heart of Enterprise Author and any application it's used to
create—including, of course, Workspace.
• It provides control hosting and visual manipulation, through features like
splitters, tabbers, and stackers.
• It processes the other files that Enterprise Author creates, turning them into
the application that users see.
• It initializes the controls in the user interface when an application is first run,
and provides the conduit for them to communicate as the application
proceeds.
• It provides Automation interfaces that make some general functionality
available to every control in an application.
Application-specific functionality
EnterpriseHost.exe provides the frame on which an application can be
hung, but it doesn't define an application. That job is done by the “other files” that
Enterprise Author creates, which describe the controls that make up the user
interface, the appearance of those controls, and the details of their interactions.
Distribution choices
When you distribute an Enterprise Author-generated application, you can choose
to compile together EnterpriseHost.exe and the files that define the
application, thereby creating a single executable file. Alternatively, you can opt to
keep the two parts separate, which means that you'll have several files to
distribute to your users. Workspace takes the second option, but another
application that you know well—Enterprise Author—takes the first. There are
good reasons for preferring one approach or the other in different situations.
Enterprise Author
In Enterprise Author, the files that define the application are compiled into the
same executable as the code that controls the application.
EnterpriseHost.exe is subsumed into EnterpriseAuthor.exe. Putting
the definition files inside the executable prevents users from performing
large-scale customization of the application, but also prevents them from
breaking it! However, users can still:
• Show and hide windows
424
RenderWare Studio User Guide
It's these application definition files that Enterprise Author allows you to edit in
order to customize the appearance and behavior of RenderWare Studio
Workspace.
425
RenderWare Studio User Guide
The files that define Workspace's specific appearance and functionality (rather
than the more general “plumbing” that EnterpriseHost.exe provides) come in
four types, and fulfil particular roles in the running Workspace application.
ApplicationName.ren
In a customizable Enterprise Author-generated application, the .ren file is
passed to EnterpriseHost.exe to identify the other files that define the
application's behavior. In this, it acts rather like one of Visual Studio's project
files, or a RenderWare Studio .rwstudio file. The .ren file doesn't contain
much information itself. Instead, it acts as a pointer to the important data.
For example, a RenderWare Studio game project is represented by a file
called GameName.rwstudio, with the data itself stored in a directory called
GameName at the same level. Similarly, when you customize Workspace
with Enterprise Author, you modify the files in a directory called
RenderWareStudio, which shares a directory with a file called
RenderWareStudio.ren.
EnterpriseHost.exe can read files at any level in the directory beneath
the .ren file, so you're free to organise the files into subdirectories
according to their purpose without fear of “breaking” the application. Shortly,
we'll consider the subdirectory structure employed by Workspace, but in
general you're free to use one that best suits your needs.
LayoutName.Layout
.Layout files (p.430) are XML files that store information about the positions of
objects in the different layouts you've defined for your application. There's
one file per layout, detailing the positions of stackers and tabbers in the user
interface, the objects contained in each stacker or tabber (and those that
should float above the application window), and the order of objects within
each containing structure.
ObjectName.RENObj
.RENObj files are XML files that describe Enterprise Author objects. The file
for a menu bar, for example, specifies things like the name of each item, any
shortcut keys to be used, whether an icon should be displayed, and the
name of the event to be fired when an item is selected. The file for a page
object specifies a set of default property values for the window, and contains
binary data for any images it requires. Here's a snippet from such a file:
...
<param name="Caption" value="Search in Game" />
<param name="Group" value="grpDialogs" />
<param name="Top" value="0" />
<param name="Left" value="0" />
<param name="Width" value="366" />
<param name="Height" value="144" />
<param name="Visible" value="1" />
<param name="Border" value="1" />
<param name="ShowCaptionBar" value="1" />
<param name="WindowSizeable" value="1" />
<param name="ShowInClientArea" value="0" />
<param name="Maximized" value="0" />
<param name="WindowControls" value="1" />
<param name="HideWindowOnClose" value="0" />
426
RenderWare Studio User Guide
ObjectName.vbs
.vbs files are VBScript files containing, at a minimum, code that handles
interactions between the user and the object (button clicks, menu item
selection, and so on). There may be further code for initializing the object
when it first appears, keeping track of changes in other objects, interacting
with the file system, etc.
Usually (and especially for ActiveX controls, pages, and menu bars), .RENObj
and .vbs files come in pairs. However, this is not a hard-and-fast rule. Some
objects (a log window, for example) may not need to communicate with other
objects. (They might just display what they're told, and leave it at that.) An object
like this will have a .RENObj file, but no .vbs file. On the other hand, a script
module has no associated graphical representation, so in that case we have a
.vbs file with no related .RENObj file.
427
RenderWare Studio User Guide
Controls
Contains files that define the appearance and operation (and sometimes the
position and size) of objects such as the Templates and Targets windows
that form part of the main user interface.
Files in this directory correspond to ActiveX control objects in Enterprise
Author's Objects window.
Dialogs
Contains files that define the appearance, operation, and state of
Workspace dialogs such as Workspace Options and Search in Game.
428
RenderWare Studio User Guide
429
RenderWare Studio User Guide
It's possible to switch between different layouts (and therefore different .Layout
files) while an application is running. It's also possible to create, edit, and delete
layouts, from both Enterprise Author and a running Enterprise Author-generated
application. To enable this functionality, .Layout files are not quite as
straightforward as they first appear.
430
RenderWare Studio User Guide
431
RenderWare Studio User Guide
Starting up
When EnterpriseHost.exe is invoked in the context of starting Workspace,
its immediate action is to load the files stored in the RenderWareStudio
directory. The first ones it loads are those connected with splash window objects,
so that the application can display a splash screen while its other components
are loading. When it has loaded and displayed the splash screen, it loads the
.RENObj and .vbs files for the other objects.
Service provision
Any piece of script code running inside EnterpriseHost.exe's script engine
has access to any other piece of script code in the application being edited. But
EnterpriseHost.exe also provides two general-purpose objects that may be
used at any time by all hosted code. These are:
432
RenderWare Studio User Guide
RENManager
Defines events that fire when the application starts up and shuts down, and
when a different layout is selected from a menu. Contains methods that
perform some file-handling duties and user-interface adjustment; and
properties for retrieving the parent window's handle, the object with focus,
and the Broadcast object (p.450).
RENHost
Contains methods to connect objects to the application's scripting
architecture, so that other script code can handle their events and use their
methods and properties.
Firing events
When all the objects in the application have loaded, EnterpriseHost.exe fires
RENManager.OnLoad, which controls can handle to perform initialization.
Similarly, they can handle RENManager.OnTerminate to perform any
necessary shutdown processing. Other events are fired just before and just after
the application's layout is changed from one preset to another, and when an
non-existent method or property is called on any object.
433
RenderWare Studio User Guide
To understand the part of Workspace that its users see (rather than the
functionality that it inherits from EnterpriseHost.exe), you need to open it for
editing in Enterprise Author:
To see the Workspace user interface in the Design window, you can either open
the RENFrame object called CSLRenderwareStudioWorkspace for editing, or go
to the Select menu and choose one of the four options there.
The screenshot above shows Workspace's General layout. This is the first item
under the Select menu, and the default layout loaded by the RENFrame object,
as dictated by its DefaultDockState property.
Tip: Since we'll be experimenting with the user interface in the topics ahead, this
is a good time to save a copy of the Workspace project files:
• Select File Save As... and save the unchanged project under a new
name. This will create a new .ren file, and a new subdirectory.
434
RenderWare Studio User Guide
Startup processing
' Allow the other scripts to receive the COM objects' events:
RENHost.ConnectObject RWSUtils, "RWSUtils"
RENHost.ConnectObject RWSScript, "RWSScript"
RENHost.ConnectObject RWSComms, "RWSComms"
...
435
RenderWare Studio User Guide
PerspectiveDisplayMode.AddItem strDispMode1
PerspectiveDisplayMode.AddItem strDispMode2
PerspectiveDisplayMode.AddItem strDispMode0
PerspectiveDisplayMode.AddItem strDispMode3
...
Away from GlobalScript, there are two particularly common reasons for
implementing an OnLoad() method in an object's script module:
• Menu bars, and especially toolbars, can contain items that make or reflect
changes in some other Workspace object. They can also offer some
feedback to the user, by showing some of their items as being selected, or
activated, or unavailable at different times. These settings can be made at
startup, but doing so requires interrogation of the “target” object, which must
be loaded when this happens. OnLoad() is therefore the right place to
perform such processing.
• Workspace includes a mechanism that keeps track of the currently selected
entity in the Design View window, and sends events to its user interface
objects when the selected object changes. Subscribing to this mechanism
requires a value that's defined in GlobalScript, and any objects wishing to
use it must be sure that it exists before they make the attempt. Subscriptions
to the mechanism typically take place in OnLoad().
436
RenderWare Studio User Guide
Normal operation
A cooperative approach
Workspace, like other Enterprise Author-generated applications, relies on the
cooperation of its constituent objects in order to work correctly. There is no
defined “entry point” (there is no compulsion to have an object named
GlobalScript, for example), so the application programmer has the freedom and
responsibility to ensure that execution proceeds sensibly.
When the user right-clicks on the Game Explorer window, for example, the
437
RenderWare Studio User Guide
GameDatabase object handles the click, does some processing, and then fires
an event called OnContextMenu. The code in the script module associated with
the object handles this event and causes the appropriate context menu to be
displayed:
Sub GameDatabase_OnContextMenu(Context, nX, nY, hWnd)
ContextMenu.DisplayListerMenu Context, nX, nY, hWnd
End Sub
Page objects
For an ActiveX control that's one of several on a page object (like the Validate
Database dialog), then the process (in terms of script code, at least) can be more
involved. In this situation, the handling code may be called upon to manage the
interactions between the controls on the page, as well as to call methods on
objects elsewhere in the application.
The code in the script module for the DBValidate object has to deal with the
actual act of a user clicking the Validate button, rather than the event generated
by a more complex control after some initial processing. Before it can call
RWSUtils.OptimizeDatabase(), the VBScript code has to check the status
of all the check boxes for itself:
Sub DBValid_OKButton_Click()
nFlags = 0
If DBValid_BehvLessEnts.Value Then
nFlags = nFlags + 1
End If
438
RenderWare Studio User Guide
If DBValid_AttribDataTypes.Value Then
nFlags = nFlags + 2
End If
If DBValid_SharedPrivateAttribs.Value Then
nFlags = nFlags + 4
End If
...
If RWSUtils.OptimizeDatabase(nFlags) Then
...
End Sub
439
RenderWare Studio User Guide
Missing windows?
There are some user interface elements (such as the Properties dialogs) that
can appear in Workspace but do not appear in Enterprise Author's Objects
window.
These are ActiveX controls that are instantiated from VBScript code in the
application, but are not permanent members of the user interface, and were not
created in Enterprise Author.
In their first columns, the following tables list the names of the graphical objects in
the default Workspace user interface (and therefore the files in the .ren file set)
that Enterprise Author manages. In their second columns, they list the names or
locations of those objects in Workspace.
440
RenderWare Studio User Guide
441
RenderWare Studio User Guide
Page objects
Page objects are typically “forms”, populated with several smaller ActiveX
controls. As such, they are often used as pop-up dialogs that request information
from the user.
442
RenderWare Studio User Guide
The common theme is that these are data about Workspace that you'd usually
want to retain when you close and reopen the application. In other words,
RwStudio.settings provides a way of making sure that Workspace looks the
same when you open it as it did when you last closed it.
and the class IDs of the plugins that are used to edit different attribute types
in Workspace's Attributes window:
<OBJECT NAME="AttributeEditorControls">
<PARAM NAME="BITFIELD" VALUE="CSL.RWSControls.RWSBitfield"
/>
<PARAM NAME="BOOLEAN" VALUE="CSL.RWSControls.RWSBoolean" />
...
<RWSScriptedSettings>
The <RWSScriptedSettings> element acts as a container for settings
that are written to RwStudio.settings by script code. The children of this
element are named by the routines that create them. Data stored inside the
<RWSScriptedSettings> element includes the default view modes of the
various list controls:
<ListerTools>
443
RenderWare Studio User Guide
<AssetLister ViewMode="Hierarchy">
<Column id="Name" width="200" />
</AssetLister>
...
<TemplateLister ViewMode="Hierarchy">
<Column id="Name" width="200" />
</TemplateLister>
</ListerTools>
and the layout that was last selected from the View Layouts menu item:
<Layouts>
<LastLayout>General</LastLayout>
</Layouts>
If you decide to create custom Workspace objects, and use script code to save
information about those objects to the RwStudio.settings file, then it will be
stored by default in a child element of <RWSScriptedSettings>. It's possible,
however, to create a new element that's a child of the root <OBJECT> element if
that's what you need.
Any script module that wants to load settings from the file must implement
Broadcast_LoadApplicationSettings(). The “root node” argument
passed into this method contains the OBJECT.RWSScriptedSettings
element, so the script can easily find the information it needs.
Similarly, the instruction that script modules should save data to
RwStudio.settings comes from a broadcast method call that's made by
GlobalScript.RENManager_OnTerminate():
Broadcast.SaveApplicationSettings XMLDoc, RWSRootNode
444
RenderWare Studio User Guide
445
RenderWare Studio User Guide
Additional initialization
When they're loaded into Workspace, objects are given three opportunities
(p.435) to initialize themselves before the user begins to interact with the
program:
1. The C++ OnCreate() method that's called when an ActiveX control is
instantiated (control host objects only)
2. Any code outside procedure definitions in an object's script module, which is
executed when Workspace first loads it, on startup
3. The OnLoad() method in an object's script module, which is executed after
all the objects in Workspace have loaded
If any further initialization is required (remember, the order in which objects'
OnLoad() methods are called is undefined, and OnLoad() will be called only
once for each object), the script code that does it is usually placed in a separate
method that must be called first by any other object that needs to use it. In
Workspace, the script modules of objects like these often contain a method called
Initialize().
For example, the handler for Workspace's Edit Search in Game... menu item
displays the Search Page object, but only after it has called a method named
Initialize() that pre-loads the dialog with settings from the previous search
operation.
(From the script module for the MainMenu object:)
Sub OnMenuSearchGame
Search.Initialize
RENManager.ShowModal "Search", "CSLRenderwareStudioWorkspace"
End Sub
446
RenderWare Studio User Guide
One of Workspace's most important features is the way it allows users to interact
with game entities by selecting them in the Design View or Game Explorer
windows, and then modifying their properties in one of the other windows. It's
vital that every object that needs to is able to change or keep track of the
currently selected entity.
You can see the selection mechanism in action by watching the Attributes
window while you select and deselect entities in Design View. The contents
change to show the settings of the most recently selected entity, and are cleared
when all selections are cleared. Similarly, the Selection Locate menu item
discovers the currently selected entity and centers it in Design View.
447
RenderWare Studio User Guide
...
End Sub
The objects are detached from the game database in a similar fashion
during shutdown processing:
Sub RWSUtils_OnDatabaseDetached()
EntityAttributes.AttachToDatabase(0)
EventVisualizer.AttachToDatabase(0)
...
End Sub
Note: This code is necessary in page objects and ActiveX controls, but
there's a subtle difference between the two. For a page object, ObjectName
is the same as we specified in Steps 1 and 2, but for an ActiveX control it's
the name of the parent object itself.
The constant used here, g_strGlobalSelection, specifies that we want
this object to receive all selection events. It's defined in the GlobalScript
script module and would not necessarily have been available during the first
round of initialization. This is a very common situation in which to use the
OnLoad() method.
4. Call methods and manipulate properties to discover and change which
entities are selected
With the Selection object set up, Workspace objects can safely use its
methods and properties. Here, for example, is the handler for the Selection
Locate menu item:
Sub OnMenuLocateEntity
If GlobalSelection.Count > 0 Then
DesignView.RWSUtility.LocateEntity
GlobalSelection.Item(GlobalSelection.Count)
End If
End Sub
448
RenderWare Studio User Guide
The Selection object's Count and Item properties are used to discover
and then view the most recently selected entity.
5. Handle the events fired as a result of selections taking place
When it comes to responding to a change in the current selection, ActiveX
controls and page objects diverge again. For the former, the wizard provides
skeleton C++ code for handling the Selection object's three events. The
latter require additional script code in their script modules:
Sub ScriptName_OnAddSelection(id)
End Sub
Sub ScriptName_OnRemoveSelection(id)
End Sub
Sub ScriptName_OnClearSelection()
End Sub
449
RenderWare Studio User Guide
RenderWare Studio's Broadcast object makes it possible for code in the script
module of any Workspace object to call a method in every other script module.
In its default configuration, Workspace uses Broadcast to invoke “standard”
methods at various intervals during execution. For example, a call to
Broadcast_WorkpaceStart() is broadcast after all OnLoad() calls are
complete, while Broadcast_PreNewProject() is broadcast before
Workspace begins the process of starting a new game project.
Any object that needs to do work on these occasions (such as loading or saving
some custom settings) can just implement the methods in question and be sure
of receiving the right call at the appropriate time.
As you can see, this looks just like calling an ordinary method of the Broadcast
object. As a result of this call, however, any script module in Workspace
containing a method called Broadcast_MethodName() that takes exactly two
parameters will have that method invoked.:
Sub Broadcast_MethodName paramOne paramTwo
' Do work in response to the broadcast method call
End Sub
450
RenderWare Studio User Guide
In the descriptions below, the names are given of the methods that are actually
called through the broadcast mechanism. The wrappers in Broadcast have the
same names and parameter lists, without the Broadcast_ prefix.
Sub Broadcast_PreLoadProject(strFilename)
Sub Broadcast_PostLoadProject(strFilename)
Sub Broadcast_PreSaveProject(strFilename)
Sub Broadcast_PostSaveProject(strFilename)
451
RenderWare Studio User Guide
Sub Broadcast_UpdateApplicationSettingsVersion(XMLDoc,
XMLRootNode, nFileVersion)
Sub Broadcast_LoadApplicationSettings(XMLRootNode)
Sub Broadcast_SaveApplicationSettings(XMLDoc, XMLRootNode)
452
RenderWare Studio User Guide
The GlobalScript module defines a range of methods and global constants that
are used by many of the other Workspace objects over the duration of the
application. It also instantiates a group of RenderWare Studio objects (making
their properties, methods, and events available to script code elsewhere in
Workspace), and implements handlers for several of these objects' events.
453
RenderWare Studio User Guide
Making changes
The topics in this part of the documentation expand on the information presented
earlier about Enterprise Author and Workspace (p.424). They provide
demonstrations of using Enterprise Author and Microsoft Visual C++ 7.1 to make
changes to the user's experience of Workspace, through a set of tutorial projects
and worked examples:
• Using Enterprise Author to create a new layout for RenderWare Studio
Workspace (p.455)
• Building a new menu bar and a new toolbar for Workspace with Enterprise
Author (p.462)
• Using a custom Visual C++ 7.1 wizard to create a Workspace-compatible
ActiveX control (p.481)
• Adding a new ActiveX control to a Workspace layout, and sending its events
to other objects in the interface (p.490)
• Writing code in a Workspace-hosted ActiveX control that allows it to interact
with the game database (p.500)
• Arranging for an object in Workspace to store and retrieve data from the
RenderWare Studio setting file (p.512)
454
RenderWare Studio User Guide
In this tutorial, you'll use what you've learned about the Enterprise Author user
interface, and creating and editing alternative layouts, to make a new layout for
Workspace. This layout is a simplified version of the built-in General layout that
demonstrates how the latter was created, and provides a starting point for future
customization.
Who is it for?
This tutorial is for users of Enterprise Author and Workspace who seek further
practice at manipulating windows in those applications. It's also for those looking
for a practical example of layout creation in Enterprise Author. Following these
instructions requires just a little knowledge of the Enterprise Author user
interface; no coding is necessary.
Note: See the RenderWare Studio documentation (p.335) for information on how
to create, edit, and delete layouts directly from Workspace.
Tutorial structure
The single lesson in this tutorial takes you right through the process of creating a
new layout for Workspace.
Creating the Simple layout (p.456)
You use Enterprise Author to create, design, and test a new layout for
Workspace. The new layout is similar in design to General, but features
fewer objects by default.
455
RenderWare Studio User Guide
In this lesson
You use Enterprise Author to create, design, and test a new layout for
Workspace. The new layout is similar in design to General, but features fewer
objects by default.
5. Repeat the process above for ObjectInformation, this time dropping the
object toward the bottom of the Workspace window:
456
RenderWare Studio User Guide
With these two objects in position, the new layout has menu bar-like
windows at its top and bottom edges, and you can move on.
If you wish, menu bars and toolbars (and any other objects that have been
installed with “toolbar-like” behavior) can be stacked several rows or
columns deep at the vertical and horizontal extremes of Workspace's
application winwdow.
457
RenderWare Studio User Guide
The next step is to begin populating the Workspace window with Workspace
objects, starting at the bottom with the Output stacker.
Note: To save time, we won't actually rename the stackers in this tutorial.
“Output” refers to the name of the stacker in the default General layout.
7. Drag MessageLog from the Objects window to the Design window, dropping
it above the Object Information bar:
8. Right-click the new window's title bar, and select Convert to Tabs.
9. Drag-and-drop the BuildLog, VersionControlLog, and TargetLink objects into
position alongside the Message Log tab control to finish this stacker:
458
RenderWare Studio User Guide
11. Repeat the previous step for the AssetLister object, docking it just to the
right of GameDatabase. When it's in place, convert its contents to tabs, as
you did earlier.
12. Add the BehaviorLister, TemplateLister, and RWSEventList objects as tabs
alongside the Assets tab.
13. Drag the EntityAttributes object into the Design window to create a second
stacker element beneath Assets:
459
RenderWare Studio User Guide
14. Drag the new title bar so that the stackers are of roughly equal size, convert
the contents of the new one to tabs, and drag in the AttributeShareLister,
RF3AssetTemplateEditor, and RF3ProjectTemplateEditor objects to
complete it.
460
RenderWare Studio User Guide
461
RenderWare Studio User Guide
Who is it for?
This tutorial is aimed at designers who want to customize Workspace with new
menu bar and toolbar items that suit their way of working. It's also intended for
developers who want to create new menu bars and toolbars for their custom
ActiveX controls. It assumes familiarity with Workspace's user interface, and
some elementary VBScript knowledge.
Tutorial structure
The first three lessons in this tutorial explain how to create, customize, and then
install a menu bar in Workspace. The fourth lesson then repeats the procedure
with the changes necessary to create a toolbar, before the fifth describes how to
insert the items from one menu into another dynamically. More specifically, the
lessons proceed like this:
Creating a new menu bar object (p.463)
You use Enterprise Author to create a menu bar object in the
RenderWareStudio.ren file and provide sensible settings for some of its
most basic properties.
Adding items to a menu bar object (p.464)
You add menus and menu items to the menu bar you created in the
previous lesson, and set up the names of the events that will be fired when
users select menu items.
Installing a new menu bar in Workspace (p.467)
You install the new menu bar in Workspace's user interface, and write the
VBScript code that performs actions in response to menu items being
selected.
Complementing a menu bar with a toolbar (p.469)
You create, configure, and install a second menu bar object containing a
toolbar with buttons that perform the same actions as the menu items of the
previous lessons.
Merging menus at run time (p.472)
You take the items from your custom menu bar and merge them dynamically
into one of Workspace's standard menus at run time, without the need to
modify the default application source files.
462
RenderWare Studio User Guide
In this lesson
463
RenderWare Studio User Guide
In this lesson
You add menus and menu items to the menu bar you created in the previous
lesson, and set up the names of the events that will be fired when users select
menu items.
A menu bar can contain several menus, and each menu can contain several
items. In this dialog, all menus and items in the current menu bar are
displayed in tree format, beneath the <Menu> item that represents the menu
bar itself.
2. Click Add, and the dialog changes to the following:
464
RenderWare Studio User Guide
A new item has been created underneath <Menu>, and many of the other
controls on the dialog have been enabled.
3. Change the name of the new item to Logs, and then click Apply.
Child items of the top-level <Menu> item become menus in your menu bar,
and you'll see that Logs has appeared in Enterprise Author's representation
of LogMenu.
4. Select Logs in the tree view, and then click Add to add an item beneath the
Logs menu. Then repeat the process to give Logs a second item.
5. Rename the new items Clear Build Log and Clear Message Log, click
Apply again, and (temporarily) dismiss the dialog.
If you examine LogMenu in Design, you'll find that your menu now has two
items: Logs Clear Build Log and Logs Clear Message Log:
465
RenderWare Studio User Guide
combination.
• Provide names for the events that our menu items will fire when
selected.
6. In Enterprise Author, reopen the Menu/Toolbar Properties dialog for the
LogMenu menu bar, select Logs in the tree view, and then click Rename.
7. Insert an ampersand (&) between the “o” and the “g” of “Logs”, and click
Apply.
The visible effect of this change is that the name of the menu gains an
underline (Logs); the practical effect is that when the menu bar has been
installed in Workspace, Alt+G will open the Logs menu.
8. Select the Clear Build Log sub-item, and type OnClearBuildLog into the
Event box. This is the name of the event that will be fired when a user
selects this menu item.
9. Select Clear Message Log, and this time set the event name to
OnClearMessageLog. Click OK to dismiss the dialog, and save the project
at this stage.
466
RenderWare Studio User Guide
In this lesson
You install the new menu bar in Workspace's user interface, and write the
VBScript code that performs actions in response to menu items being selected.
3. Drag the LogMenu menu bar from the position it took up by default (probably
in a new line, by itself) to one next to the existing MainMenu menu bar:
Sub OnClearMessageLog()
467
RenderWare Studio User Guide
MessageLog.Clear
End Sub
468
RenderWare Studio User Guide
In this lesson
You create, configure, and install a second menu bar object containing a
toolbar with buttons that perform the same actions as the menu items of the
previous lessons.
Creating a toolbar
1. If it's open, close Workspace. Then, select Create Objects
Menu/Toolbar in Enterprise Author to create another menu bar object in the
RenderWareStudio.ren project.
2. Change the Name of the new object to LogToolbar.
3. In the Design window, reduce the width of the toolbar to its smallest setting,
and use the Property List window to change its Caption propertly to Log.
So far, this is no different from the creation of a menu bar, but now we need
to follow a different path. For a start, we need to tell Enterprise Author that
we're creating a toolbar rather than a menu bar.
469
RenderWare Studio User Guide
6. In the Property List window, highlight the Toolbar property, and click the ...
button that appears next to its current setting (“(None)”).
7. Browse to your custom.bmp file in the dialog that appears, select it, and
click Open to bring it into Enterprise Author.
8. Still in Property List, select (Layout), and then click the ... button that
appears opposite it to display the Menu/Toolbar Properties dialog for our
toolbar object.
Although the toolbar's user interface is graphical, the names you provide
here will appear in tooltips when the user hovers over the buttons, so it's
important to make them friendly.
Also, you need to specify names for the events that will be fired when the
buttons are clicked.
9. Add items named Clear Build Log and Clear Message Log directly
beneath <Menu> in the tree view:
470
RenderWare Studio User Guide
The images in the .bmp file are numbered from zero, so this associates the
“B” image with the “Build” button, and the “M” image with the “Message”
button.
With the toolbar in place, the last step is to write the VBScript code that
makes the buttons perform the same operations as the meu bar items they
represent. In a simple case like this, we could reproduce the calls to the
windows' Clear() methods, but in general it's more efficient to make the
button event handlers call the menu event handlers.
12. In the LogToolbar object's script module, add the following code:
Sub OnToolbarClearBuildLog()
LogMenu.OnClearBuildLog
End Sub
Sub OnToolbarClearMessageLog()
LogMenu.OnClearMessageLog
End Sub
471
RenderWare Studio User Guide
In this lesson
You take the items from your custom menu bar and merge them dynamically
into one of Workspace's standard menus at run time, without the need to modify
the default application source files.
472
RenderWare Studio User Guide
be different from those of the items already in the menu. To make this
example work, change the Index values of Clear Build Log and Clear
Message Log from 2 and 3 to (say) 102 and 103 respectively.
The items from the old Logs menu now appear in the View menu, as you
specified. Furthermore, the Clear Build Log and Clear Message Log items
still perform the tasks they performed when they occupied their own menu in
their own menu bar.
This is the end of the tutorial.
473
RenderWare Studio User Guide
RenderWare Studio ships with the C++ source code for Workspace's Preview
window (p.300), giving users the ability to change it to work with the custom asset
types they use. The project files that enable this facility are not installed by
default, but doing so is straightforward.
1. Select Start Programs RenderWare Studio Change or Remove
RenderWare Studio, and click Next > in the dialog that appears. (The
Modify option is selected by default.)
2. Select the Preview Control feature in the Extras section at the foot of the
list on the next page.
Completing the remaining steps of the setup tool as usual then installs the
source code files for the RWSPreview ActiveX control on your machine, in a
new directory called C:\RW\Studio\Components.
Before you can build the ActiveX control, you need to install Microsoft's
Windows Template Library (which the control uses) on your computer. You
also need to create an environment variable that points to the location of the
new installation.
3. Browse to Microsoft's download page (www.microsoft.com/downloads) and
search for “windows template library” by typing that phrase into the
Keywords box.
4. Select the link to download Windows Template Library (WTL) 7.0.
The Preview control was developed using this version of WTL, not the
newer 7.1 library.
5. Double-click WTL70.exe from its downloaded location, and extract its
474
RenderWare Studio User Guide
7. Create a new environment variable called RMDEVTOOLS, and set its value
to the path of your WTL installation's parent directory.
If you followed the advice above, this will be C:\devtools.
Now that WTL is installed correctly, you can load and build the Preview
control project in Visual Studio .NET 2003 and create RWSPreview.exe.
8. In Visual Studio .NET 2003, open the project file located at
C:\RW\Studio\Components\ActiveX
Controls\RWSPreview\RWSPreview.vcproj into an empty solution.
9. Build the solution by pressing F7. If all has gone well, Visual Studio will
place the intermediate files at ...\Components\ActiveX
Controls\RWSPreview\DebugU (or ReleaseU), and RWSPreview.exe
itself at ...\Components\debugu or ...\Components\releaseu
(depending on the active configuration).
Finally, you need to register this new version of the Preview control, so that
any changes you make to the control will be reflected in the Workspace user
interface.
10. Open a command prompt, browse to the directory containing
RWSPreview.exe, and execute the following command:
475
RenderWare Studio User Guide
476
RenderWare Studio User Guide
When you install RenderWare Studio, and provided that Microsoft Visual C++ 7.1
is already installed on the same machine, you're given the option to install the
Visual Studio .NET Application Wizards. Selecting this option adds two new
entries in the list of Visual C++ project types that can be created in Visual Studio
.NET 2003:
• RenderWare Studio ActiveX Control
• RenderWare Studio Attribute Editor Control
Creating controls based on the second of these project types is discussed in the
section on developing behaviors (p.382). In this section, we'll examine the
Renderware Studio ActiveX control wizard.
The text here explains what the wizard's about and what it will create, but the
only thing to do is click Page 2 and move to the next page:
477
RenderWare Studio User Guide
Like most wizards, this one allows you to change the default features of the
project. Page 2 gives you control over the COM aspects of your control. The one
you're most likely to want to alter is the Resource type drop-down, which
dictates the built-in functionality of the control you're creating. The settings are:
Dialog: A standard dialog control that can host ordinary Windows
controls—text boxes, list boxes, radio buttons, and so on
ActiveX Dialog: As above, but with the ability also to host ActiveX controls
Window: A control that's just a plain window, with no additional features
Page 3, on the other hand, lets you set the names of the .cpp, .h, and .rgs
files that will be created:
478
RenderWare Studio User Guide
Generated code
When you click Finish, the wizard goes away and generates the source code for
an “empty” RenderWare Studio-compatible ActiveX control. From the developer's
point of view, the two most important files are ProjectNameCtrl.h and
ProjectNameCtrl.cpp. They contain the definition and implementation of the
ActiveX control, and come complete with some built-in functionality.
In total, ProjectNameCtrl.cpp has implementations for ten methods.
Between them, these deal with three important RenderWare Studio mechanisms:
• Calling RWSInitialize() and RWSShutdown(), so that code elsewhere
in the control can use the features of the RenderWare Studio Manager API.
• Providing a means for script code to call RWSDatabaseAttach() and
RWSDatabaseDetach(). All controls must “attach” to the game database
before they can perform operations on it.
• Setting up the Selection object (p.447), so that the control can be
configured to receive events when game entities are selected in Workspace
windows.
In (roughly) the order in which they're called during the lifetime of a Workspace
object, the ten methods implemented by the RenderWare Studio ActiveX Control
wizard are:
Name Description
479
RenderWare Studio User Guide
480
RenderWare Studio User Guide
This tutorial uses Microsoft Visual C++ 7.1 and the RenderWare Studio ActiveX
Control Wizard to create a simple ActiveX control that can be embedded into
Workspace to customize its user interface.
Who is it for?
This tutorial is aimed at developers who seek to add custom functionality to
Workspace. It assumes that you are are familiar with using Microsoft Visual C++,
and it would help if you also have some experience of creating ActiveX controls.
Tutorial structure
For the purposes of this example, we're going to keep things simple. The control
will have a single button that, when clicked, will send messages for other controls
in Workspace to receive. In building the control, we'll look at the following topics:
Using the Wizard to create a custom ActiveX control project (p.482)
You step through the RenderWare Studio ActiveX control wizard and create
a skeleton project.
Building and debugging the custom ActiveX control (p.483)
You execute the custom ActiveX control in the Test Container, using
breakpoints to understand the actions that take place.
Adding a command button to the control (p.486)
You use Visual C++ to add a button to the control's user interface.
Handling the button click event within the control (p.488)
You write code that performs an action in response to the button being
clicked.
481
RenderWare Studio User Guide
In this lesson
You step through the RenderWare Studio ActiveX control wizard and create a
skeleton project.
1. Start up Visual Studio .NET 2003 and use File New Project to bring up
the New Project window. Since installing RenderWare Studio, you'll find that
some new project types have been added to the list. For our purposes, the
important one is RenderWare Studio ActiveX Control.
2. Select the wizard and provide a name (we've used myEvent here) and a
location for your project. When you click OK, the first page of a three-step
wizard appears.
Note: For more information about this wizard and the code it generates,
take a look at the topic on the RenderWare Studio ActiveX control wizard
(p.477).
3. On this occasion, leave the default settings alone and click Finish. Visual
Studio .NET 2003 will then create the project.
482
RenderWare Studio User Guide
In this lesson
You execute the custom ActiveX control in the Test Container, using
breakpoints to understand the actions that take place.
To confirm that our new project creates an ActiveX control, we can try hosting it
in the ActiveX Control Test Container.
1. Set the build configuration to Release:
• In the Standard toolbar, select Release from the Solution
Configurations drop-down.
Note: To use the Debug configuration:
a. Select the appropriate item in the Solution Configurations drop-down.
b. Select Project Properties...
c. In the dialog that appears, choose the Configuration Properties
Linker Input item.
d. In the Additional Dependencies box, change the file name from
RWSud.lib to RWSu.lib.
2. Press F7 to build the project and create the myEvent.dll file that contains
our skeleton ActiveX control. Visual Studio .NET 2003 also registers our
new ActiveX control at this stage. Now we can make sure that everything is
working correctly.
Note: If Visual Studio .NET reports that it is unable to register the control,
you need to do it by hand:
a. Browse to the DLL in Windows Explorer, right-click the file, and then
select Choose Program.
b. In the Open With dialog, click Other..., and then navigate to
C:\WINNT\system32\regsvr32.exe.
c. Double-click the executable, and then click OK in the Open With dialog.
3. Press F5 to start the debugging process, and agree to build any out-of-date
files if you're prompted. Because control projects need a host application to
run them, Visual Studio will now ask you to choose an appropriate
executable to perform this function. Later, this will be Workspace, but for
now you can choose the ActiveX Control Test Container:
483
RenderWare Studio User Guide
4. To add our control to the test container, go to Edit Insert New Control
and select myEventCtrl Class as the control to insert:
5. The grey rectangle of our control appears in the window. We've yet to add
any custom functionality, but we can at least confirm that it works as
expected:
484
RenderWare Studio User Guide
6. Click the icon (or press Shift+F5) to stop the debugging process (and
thereby close the test container). Our task now is to make the control do
something.
485
RenderWare Studio User Guide
In this lesson
You use Visual C++ to add a button to the control's user interface.
1. In Visual Studio, switch to Resource View and select the dialog called
IDD_DIALOG:
2. Choose Button from the Dialog Editor section of the Toolbox. Draw a button
on the dialog:
3. Right-click the button, choose Properties, and change the caption to Press
Me:
486
RenderWare Studio User Guide
4. Build the project again and debug it in the test container. This time, you
should see the button we've added to our control.
487
RenderWare Studio User Guide
In this lesson
You write code that performs an action in response to the button being clicked.
1. Lastly, we'll add some code that allows our new button to interact with its
surroundings. Right-click the button again, this time choosing Add Event
Handler....
2. In the resulting dialog, choose the BN_CLICKED message type and click
Add and Edit.
3. When you dismiss this dialog, Visual C++ will take you to the new code it
has generated in myEventCtrl.cpp. Our CmyEventCtrl class has
gained a method that will be called whenever the button is clicked.
488
RenderWare Studio User Guide
489
RenderWare Studio User Guide
In this tutorial, we'll take the simple ActiveX control that we developed in the last
section and add it to the Workspace user interface.
Who is it for?
This tutorial is aimed at developers seeking to understand how the Workspace
user interface works, and at designers wanting to see how to use Enterprise
Author to customize Workspace.
Tutorial structure
Like the last tutorial, this one has four sections. Together, they explore how
Workspace and Enterprise Author work, and then explain how to code the
interaction between your new control and the Workspace user interface.
Installing a control in the Workspace user interface (p.491)
You use Enterprise Author to add a custom ActiveX control to the
Workspace user interface.
Debugging custom controls using Workspace (p.493)
You set up Workspace as the application in which to debug your new
ActiveX control.
Firing events from an ActiveX control (p.494)
You create an a event that your control will fire, to be handled by
Workspace.
Handling ActiveX control events in Workspace (p.497)
You add script code to Workspace that handles the event you fired in the
previous lesson.
490
RenderWare Studio User Guide
In this lesson
You use Enterprise Author to add a custom ActiveX control to the Workspace
user interface.
491
RenderWare Studio User Guide
This action creates a project file that we can customize without the worry of
damaging the Workspace application. We'll start that process now by adding
our myEvent ActiveX control to the Objects window.
4. Select Create Control Window... to display the same dialog that we used
in the ActiveX Control Test Container (p.483), and again choose
myEventCtrl Class.
Our control appears at the bottom of the list in the Objects window. (In fact,
this window shows instances of controls, so the new addition is called
myEventCtrl1.)
5. Drag myEventCtrl1 from the Objects window to your choice of location in the
schematic layout of the Workspace window:
6. Save the project, and then run the application using Run Start.
Workspace will start up with the new control wherever you chose to place it.
Once you've confirmed that this is the case, we can proceed to the next
stage.
492
RenderWare Studio User Guide
In this lesson
You set up Workspace as the application in which to debug your new ActiveX
control.
When you were testing the RenderWare Studio ActiveX control wizard (p.483),
we said that it was possible to use Workspace as the host application for
debugging purposes. You're going to set that up now.
1. In Visual C++, and with your myEvent project open, select Project
myEvent Properties... and change the Debugging settings for the
Active(Debug) configuration:
493
RenderWare Studio User Guide
In this lesson
You create an a event that your control will fire, to be handled by Workspace.
This COM interface contains definitions of the events that your custom
ActiveX control will fire. You're going to create an event that's fired when
Press Me is clicked. The event will contain a string for any control that
handles your event to display.
494
RenderWare Studio User Guide
2. In the Add Method Wizard dialog, enter Clicked as the Method name,
BSTR as the Parameter type, and msg as the Parameter name.
Check the in box under Parameter attributes, then click Add, and then
Finish to have the new method's definition added to the .idl file for the
control.
495
RenderWare Studio User Guide
This causes the Clicked event to be fired when Press Me is clicked, which
is exactly what you want to happen.
9. Compile the project one last time, and close Visual C++.
496
RenderWare Studio User Guide
In this lesson
You add script code to Workspace that handles the event you fired in the
previous lesson.
The two drop-down lists at the top of the text area contain, respectively, the
objects and events that myEventCtrl1 exposes.
3. In the left-hand box, select myEventCtrl1. In the right-hand box, select
Clicked.
When you complete the second operation, Enterprise Author will generate a
subroutine to handle the Clicked event. Make it look like the following:
Sub myEventCtrl1_Clicked(msg)
MsgBox msg
End Sub
497
RenderWare Studio User Guide
4. Save and then run the project. This time, when you click the button, you
should see a message box appear. The text in this message box is the
string we wrote in Visual C++.
You've now seen how to get an ActiveX control to interact with Workspace.
The next step is to use VBScript to talk to other controls. In the next
example, we'll pass the string we receive from our control to Workspace's
Message Log window, which is implemented by the MessageLog object.
5. Select MessageLog in Enterprise Author's Objects window, and then look at
the Object Browser window.
You'll see a tree view with branches for the methods, properties, events, and
objects exposed by MessageLog.
6. Select Methods, and a list of all the methods that MessageLog exposes
appears in the right-hand pane. The first of these is AddMessage(), which
tells us that we can insert our own messages into the log.
This new line of VBScript code uses the AddMessage() method to append
a string to the Message Log window.
8. Run the application. When you click the button on your control, you should
find that after you close the message box that appears, the Message Log
window will report our message too.
498
RenderWare Studio User Guide
499
RenderWare Studio User Guide
This tutoral builds on the ones about creating custom ActiveX controls to work
with Workspace earlier in this section (p.481). In it, you improve the ActiveX
control produced earlier, enabling it to get data from and send data to
RenderWare Studio Workspace and the game database:
• The control will display the name of any entity selected in Workspace's
Design View window.
• The user will be able to select an entity in Design View by entering its name
into the control.
Who is it for?
This tutorial is aimed at developers who need to understand more about
RenderWare Studio's mechanisms for processing game data. It demonstrates
how to implement handlers for the events that Workspace fires to its hosted
windows.
Before reading this tutorial, you should have completed the two preceding
tutorials in this part of the documentation.
Tutorial structure
There are just two lessons in this tutorial. In the first, you add an edit control to
the custom ActiveX control that can display the name of the entity selected in
Workspace's Design View window. In the second, you hook up the edit control to
Workspace's user interface, and add some more code that makes the interaction
a two-way process.
Creating and coding the edit control (p.501)
You write code in an ActiveX control that Workspace calls as part of its
automatic processing, to be executed when entities are selected and
deselected.
Deeper integration with RenderWare Studio (p.504)
You attach VBScript code to an ActiveX control that hooks it up to
Workspace's messaging architecture, and then write additional C++ code
that interacts with RenderWare Studio's game database.
500
RenderWare Studio User Guide
In this lesson
You write code in an ActiveX control that Workspace calls as part of its
automatic processing, to be executed when entities are selected and
deselected.
3. Use the Properties window to change the ID of the new edit control from its
default value to IDC_ENTITY_EDIT.
You'll use this more memorable identifier to refer to the edit control in the
code you write to implement your ActiveX control.
If you test the control in Workspace, you'll see that it now contains the new
edit control, though it doesn't yet do anything of use.
501
RenderWare Studio User Guide
This code starts by checking that the control has been properly initialized
into Workspace, and that the entity ID passed as a parameter is non-zero.
Then, as the comments explain, it calls some RenderWare Studio library
functions to discover the name of the entity with the given ID, and then
displays it in the edit control.
5. Replace the implementation of the OnRemoveSelection() method with:
STDMETHODIMP CmyEventCtrl::OnRemoveSelection(long ID)
{
// Clear the contents of the edit window
CWindow EntityEdit(GetDlgItem(IDC_ENTITY_EDIT));
EntityEdit.SetWindowText(_T(""));
return S_OK;
}
This method is much simpler. It just responds to the entity being deselected
by clearing the edit control. We have the option of using the ID parameter to
do something more specific with the particular control being deselected, but
that's not our intention here.
6. Replace the implementation of the OnClearSelection() method with:
STDMETHODIMP CmyEventCtrl::OnClearSelection()
{
// Clear the contents of the edit window
CWindow EntityEdit(GetDlgItem(IDC_ENTITY_EDIT));
EntityEdit.SetWindowText(_T(""));
return S_OK;
}
502
RenderWare Studio User Guide
503
RenderWare Studio User Guide
In this lesson
Getting Workspace to recognize and communicate with your new ActiveX control
requires you to follow some standard procedures. You need to add code to the
control's script module that:
• Attaches the control to the game database.
• Allows the control to respond to entities being selected and deselected.
504
RenderWare Studio User Guide
505
RenderWare Studio User Guide
506
RenderWare Studio User Guide
if(m_DatabaseID)
{
// Structure to hold entity data
RWSEntity EntityData = {0};
while(EntityID)
{
// Get the RWSEntity structure of the selected entity
RWSEntityGet(EntityID, &EntityData);
return 0;
}
The comments explain the code in detail, but here's a simplified summary:
• Get the text from the edit control
• Loop through the entities in the game database, comparing their names
with the entered text
• If a match is found, select that entity in Workspace
8. Rebuild the control and start Workspace using the custom interface. Choose
the name of an entity in the Game Explorer window, and then type that
name into the edit control.
9. Click Press Me. Your chosen entity should now be selected.
This is the end of the tutorial.
507
RenderWare Studio User Guide
When you right-click an asset in Workspace's Assets window (p.264), the context
menu contains an Edit item that opens the asset for editing in a suitable
application. By default, Windows makes the decision about which application
should be used, but you can modify Workspace's source files with Enterprise
Author to change this behavior and specify the application of your choice.
Configuring ShellExecute
Windows associates file types (as indicated by their extensions) with the
application that should be used to deal with them. ShellExecute() takes
advantage of this association: when you call it, passing only the name of the file
you're interested in, that file opens in its associated application. Calling
“ShellExecute new_image.png”, for example, would open the file
new_image.png in the application configured for doing so—quite possibly,
Internet Explorer.
You can set up the associations between file types and applications through
Windows Explorer. Select Tools Folder Options File Types, and you'll see
this dialog:
508
RenderWare Studio User Guide
By default, files are associated with a single application, but you can specify that
different applications should be used in different circumstances. Click the
Advanced button above, and a smaller dialog is displayed:
509
RenderWare Studio User Guide
The Actions list names different operations that may be performed on files of a
particular type. For many files, only open is specified, but the call to
ShellExecute() from OnEditAsset() relies on the existence of another
operation, edit:
Shell.ShellExecute strFileName, , , "edit"
If the file type of the asset in question has an edit entry in its Actions list, the
application referenced by that entry is launched when you select the Edit menu
item. If there's no such entry, you'll see a dialog like this:
510
RenderWare Studio User Guide
The new ElseIf clause uses the Windows Script Host Shell object to launch
Microsoft Paint, passing the name of the selected file as an additional argument.
511
RenderWare Studio User Guide
The act of loading or saving data from or to the settings file involves reading or
writing data in XML elements within RwStudio.settings. The example below
demonstrates the kinds of operation that are generally involved.
Worked example
These sample implementations of
Broadcast_SaveApplicationSettings() and
Broadcast_LoadApplicationSettings() demonstrate how to record the
current date to the settings file, and how to retrieve it. (This information could
represent the date and time of the last build, for example.)
<OBJECT>
...
<RWSScriptedSettings>
...
<Custom>
<Test>
<Date>Date</Date>
</Test>
</Custom>
</RWSScriptedSettings>
</OBJECT>
Broadcast_SaveApplicationSettings()
Broadcast_SaveApplicationSettings() is passed an XML document
object representing the RwStudio.settings file, and an XML node object
representing the <RWSScriptedSettings> element. To insert <Custom> and
its children into the document, the method needs to do the following:
1. Check whether the <Custom> element exists; create and add it if it doesn't.
2. Check whether the <Test> element exists; create and add it if it doesn't.
3. Remove any child elements from the <Test> element.
4. Create and add the <Date> element and the data it contains as a child of
the <Test> element.
Sub Broadcast_SaveApplicationSettings(XMLDoc, XMLRootNode)
Dim CustomElement, TestElement, DateElement, ChildElement
512
RenderWare Studio User Guide
Broadcast_LoadApplicationSettings()
Broadcast_LoadApplicationSettings() is passed an object representing
the <RWSScriptedSettings> element. This implementation simply verifies
that the <Date> element exists, and then sends its contents to a message box.
' Handle broadcast message to load settings
Sub Broadcast_LoadApplicationSettings(XMLRootNode)
Dim DateElement, strSettingsFileDate
Set DateElement =
XMLRootNode.SelectSingleNode("./Custom/Test/Date")
If Not DateElement Is Nothing Then
strSettingsFileDate = DateElement.text
msgbox "The date in the settings file is: " &
strSettingsFileDate
End If
End Sub
513
RenderWare Studio User Guide
Examples
514
RenderWare Studio User Guide
Alpha sort
This example shows how FPSRender and CRpLevel have been extended to
support alpha sorting of atomics.
The example game contains three levels:
Alpha sort using a single world
Shows a single FPSRender rendering an RpWorld containing both opaque
entities and translucent entities. The FPSRender behavior has World
Render Back To Front and Depth Sorting of atomics enabled; this means
that the world sectors are rendered from furthest to nearest and that all of
the atomics attached to the world are depth-sorted.
Alpha sort using opaque and translucent worlds
Shows a scene consisting of two worlds. Due to the order of the objects and
worlds in the hierarchy view in the game database, some of the atomics are
added to the first world, and the rest are added to the second world.
When connecting to the target, the Opaque World is created first and sets
the Global Opaque World pointer. Then the objects in the Opaque entity
folder are created and added to the Global Opaque World. This first world is
drawn front to back with no depth sorting and contains the opaque objects.
Next, the Translucent (or Alpha) world is created which sets the Global
Translucent World pointer (this is now the active world). Any entities
following this are added to the translucent world; as in the first game level
folder, this world is depth-sorted.
Alpha sort using opaque and translucent worlds (atomics auto-select which
world, using CSetCRpLevelHint)
In this level, a behaviour is used to attach a hint to the assets (see the entity
folder Set CRpLevel Hints). Opaque assets have the hint set to
HINT_OPAQUE_WORLD; translucent assets have the hint set to
HINT_TRANSLUCENT_WORLD.
When connecting to the console, the hints are run first, then the two worlds
are created. Because the hints have been set, any behaviors using the
assets that have a hint set know which world to add the asset to, to render it
(that is, either the opaque world or the translucent world).
515
RenderWare Studio User Guide
Animation
516
RenderWare Studio User Guide
Area triggers
RenderWare Studio supplies three simple area trigger behaviors that send an
event when an entity enters the behavior area:
ATBox
Defines a box-shaped area.
ATCylinder
Defines a cylindrical area.
ATSphere
Defines a spherical area.
517
RenderWare Studio User Guide
518
RenderWare Studio User Guide
These two examples demonstrate the RenderWare Audio 2.0 integration with the
RenderWare Studio Game Framework.
To run the example:
1. Start RenderWare Studio and load the Examples Audio or Examples
Audio Group project.
2. Launch the Game Framework and connect to it.
3. When the Workspace has connected to the framework you should hear
some ambient droning sounds.
In the audio example, somewhere in the level there is a tiger sound, which
you should be able to find by just listening to the sound orientation on your
speakers or headphones.
In the audio group example, on the console screen you will see the channel
strip info for each sound playing in the level. Every few seconds a timer
event triggers the fading down of one of the sound groups. This is useful
because you can define different group within your game and fade between
them easily.
The audio behaviors used for these examples are:
AudioGlobalMixer
Controls the parameters for the output mixer, and controls the position of the
listener.
AudioSound3D
Responsible for assigning a sound to a virtual voice, and handling whether it
is playing or not.
AudioReverb
Controls the reverberation in a level. You can select from a list of prebuilt
reverb types or create you own. You can use this behavior to enable and
disable the reverbs, making it possible to have multiple reverbs available.
For example, if you are creating a driving game and want the car to go
through a tunnel, you can change the reverb accordingly.
AudioGroup (group example only)
Defines groups of sounds which can be enabled/disabled as well as faded.
To define a group, you attach the AudioGroup behavior to an object and
then add wave dictionaries as assets to the group. When your AudioGroup
entiy receives a fade message it will only fade the sounds in its group.
For an explanation of how the audio behaviors and toolkit works, see the Game
Framework Help.
519
RenderWare Studio User Guide
Camera look-at-point
This example contains one look-at-point camera, a directors camera, and a FPS
player. The purpose of this example is to show how to link a look-at-point camera
to another entity and make it follow that entity. It also demonstrates how to
connect up the camera system, so that both the directors camera and the look-at-
point camera can co-exist happily.
To see the example working, disable the directors camera.
520
RenderWare Studio User Guide
Workspace and not the one from the 3rd Person Camera CCameraLookAtPoint
entity.
What are the text, blue bubble and colored triangles for?
These are debug displays. The blue bubble shows the collision object used by
the object being followed. The triangles show the faces being collided with. Green
for floors and red for walls.
The text is showing messages (events) being sent by one object to another.
Dashed lines indicate system messages.
You can disable these by choosing the Environment debug entity in the game
database and changing its attributes. Un-checking Visualize Events and Visualize
Collisions will remove both debug displays.
521
RenderWare Studio User Guide
Dynamic light
This example demonstrates the use of the following light behaviors in the FX
module:
CFXColorLight
CFXLight_2Stage
CFXLight_Spline
CFXSpinLight
CFXWaveLight
522
RenderWare Studio User Guide
Environment map
523
RenderWare Studio User Guide
This example shows the operation of the FPS player and associated FPS
behaviors.
After connection to target, switch off the director's camera. You will not have
control of the player object in a first-person view. Movement is via the main and
secondary controls on the joy-pad or keyboard. It is possible to move forward,
back, turn, strafe and jump. (By default, the PC uses the cursor keys.)
The blobs on the ground represent teleporter behaviors. The yellow is the
teleporter itself (FPSTeleporter) and the green its target location
(FPSTeleportDestination). The bobbing heath pickups disappear when picked up
(this is achieved by them sending a message to the FPSPlayer object, which then
deletes them). These use the FPSSpinningPickup and FPSBouncyPickup
behaviors.
Behind the player's start location and next to a pillar are two further set-ups. The
pair of green boxes are used to display the auto-climb or stair climbing behavior
of FPSPlayer. The lift demonstrates the FPSPlatform behavior and will lift the
player when you travel onto it. This leads up to the FSPTrain example, which will
follow a path when the FPSPlayer behavior is moved (jumped) onto it. The
followed path is built up from FPSPathNode behaviors.
524
RenderWare Studio User Guide
CFXMotionBlur attributes
Start Render Event
The event used to trigger the motion blur blend.
Render Priority
The priority of the of render event. It is important that the motion blur is
performed last, however interesting effects can be achieved by performing
the blur mid render.
Offset X value
Amount to offset the blend poly in X.
Offset Y value
Amount to offset the blend poly in Y.
525
RenderWare Studio User Guide
Offset Z value
Amount to offset the blend poly in Z.
Scale X axis value
Amount to scale the blend poly in X.
Scale Y axis value
Amount to scale the blend poly in Y
Scale value
Overall scale value
Angle value
Angle of the blend polygon
526
RenderWare Studio User Guide
FX particle spray
This topic describes the particle behavior example project. This project is split
into game level folders to make the different examples easier to follow, and to
allow the Event Map to show a clearer, simpler view in each case.
Some examples use the CFXPartSpray behavior, others use the
CFXReplicatorGenerator behavior. The simpler behaviors have been made into
templates for easier placement within the world.
To see the example entities, you need to either:
• Turn the camera to the left.
or
• Switch off the director's camera. (This activates an FPSPlayer object which
can be guided around the levels. On the PC, use the arrow keys.)
The maximum number of particles can be changed on each emitter. This is the
size of the particle tank (that is, the maximum number of particles that can be
displayed in any one system). Editing this value can cause memory
fragmentation on the console and may ultimately result in the console running out
of memory. This will not affect the Workspace, though (and restarting the console
will solve the problem). Using “just enough” particle will help memory usage in the
final game.
Programmers should note that in a release (non-design) build, the CFXPartSpray
behavior allocates the particle tank once only, and that it will be set to the value
chosen by the editor of the behavior. This ensures that the memory usage is
controllable and does not cause fragmentation.
Artists/editors should not that odd color, size, etc. effects may occur during
changes. This is particularly true if lifetimes are extended. These effects are due
to the way in which the animation system works. The problems will disappear
after the newly emitted particles feed through the system. If the problem is minor,
then simply click the test fire button next to the Enable message (Message
section) twice. This disables the particle system and then re-enables it, restarting
all particles. If this fails, or the problem is more extreme (console slowdown), then
set the Max particles (Emitter section) value to zero and then return it to its
previous value. This forcibly kills all particles and causes a restart (causing
memory fragmentation in the design build).
Simple examples
These are available as templates for easier placement. They have been placed in
a child folder named “Simple Particles” in each game level folder.
Fountain (level 2)
Reproduces a fountain of water spurting out of the floor.
The emitter is angled by rotating the asset to give an angled spray effect. The
spread is changed to remove bands (y axis spread) and extend the area over
which the particles are emitted (x and z axis spreads) - ie not emitted from a
point. The emitter spreads are in local axis, so they are rotated with the asset.
527
RenderWare Studio User Guide
Angular spreads are adjusted to give a flat fan effect. Primary state velocity and
gravity adjusted to give water a curving spray.
Particle color and size is animated over three stages, but velocity and gravity stay
at the primary start values. This is achieved by selectively enabling the size and
color adjustments in the primary end and secondary end states.
The initial values must be set in the primary start state for velocity, color, size and
gravity. These will stay set throughout the lifetime of the particle unless they are
changed in any other state. The secondary states are ignored unless the
secondary state is enabled. Any changes between the primary start and end are
animated over the lifetime up to the secondary “lifetime change” or the end of the
lifetime, if the secondary stage is not enabled.
In this example, there are no changes in the secondary start state (these would
be snap changes) but the color and size are changed in the secondary end state.
Because there are no changes in the secondary start state, the values in the
primary end are carried over for used for the start of the animation that ends at
the secondary end state. This animation takes place over the period of time from
the secondary state lifetime changeover to the lifetime end (set in the emitter
section).
Note that the alpha value of the color is also reduced over the two animation
periods, becoming almost transparent by the secondary end state. Also, the color
in the primary end and secondary end states has been randomised in the green
and blue channels. Size has also been randomized in some states.
Fire (level 1)
Reproduces a patch of fire on the floor.
The emitter is extended in x and z to produce an area of fire. The angular spread
is set wide to make the fire expand as it rises. The system is in two parts; the first
simulates the flames and the second the smoke produced.
The primary start to end states is over a very short lifetime (the secondary state
change over is after only 0.2 seconds). The velocity is kept low so the fire only
rises a short distance. To stop the velocity being nullified, the drag is kept low
and the gravity is removed. The particle's size and color change over this primary
state, becoming darker and larger towards the end. There is a large amount of
randomness in the size at the end of this stage.
The secondary stage simulates the fire turning into smoke. When the secondary
state changeover occurs, the system emits extra particles and deflects the
particles direction of movement. For each particle coming into the secondary
stage, two extra ones are added. Each of these particles has its direction of
movement deflected by between 0 and roughly 60 degrees. This makes the
smoke appear to billow out from the end of the fire particle.
Additionally, these particles are given a one time only boost of velocity, have their
gravity, drag, color and size changed. These changes make the smoke appear
more full. Since these occur in the secondary start state, they are instant (ie not
animated) changes. The color is given a degree of randomness. The gravity is
adjusted to a negative value to make the smoke particles float upwards.
The color and size are animated over the secondary lifetime by turning these
attributes 'on' and adjusting the values in the secondary end state. The particles
fade due to the alpha value in the end color. The end size is also largely random.
The particles are also continuously accelerated on each frame between the
528
RenderWare Studio User Guide
secondary start and end state. This is set up in the secondary end state, under
'Accleration'. This is applied along the current movement vector of the particles.
This helps to keep the particles moving upwards at a realistic speed.
Fireworks (level 2)
Reproduces an exploding rocket firework.
Again, the particle system is in two parts. The first blasts the particles into the air,
the second makes them explode into a shower of colored sparks. The particles
are emitted in a random number per frame, sometimes none, sometimes 1 or
two.
The emitter is set to zero size in X, Y and Z. So the particles come from a single
point. The rate is set to zero, with a randomness of two. This causes the particles
to not be emitted on every frame. The angular spread is quite wide to allow the
rockets to fire off in a multitude of angles and the lifetime is quite short, but has a
degree of randomness. The second stage will always cut in at a set lifetime, but
the randomness of the lifetime is applied at the start of the particle (during
emission the age is not set to zero, but to a range between zero and the lifetime
randomness). Because of this the randomness effects when the particle enters
the second stage and so the particles explode at different heights, but still
complete their explosions.
In the primary stage start, the particles are given a reasonable velocity, but they
have zero drag and no gravity, so the particles continue upwards without being
slowed. The color is randomly adjusted from a light yellow and the size is kept
quite small. None of these values are adjusted in the primary end state, so they
are kept constant until the secondary stage is entered.
This occurs after approximately 1 second and when it does each 1 particle in
results in an extra 50 particles out (secondary change over -> secondary emitter
attribute). This forms the cloud of colored particles. These particles are deflected
into a sphere by virtue of the 0 degrees (min) to 180 degrees (max) deflection
angle.
As the particles enter the secondary start state, they are given a large velocity
boost. This give the effect of an explosion. Remember that the secondary start
state values are immediately applied; there is no animation from the primary end
state values. The high drag value causes the particles to slow quickly and the
gravity causes them to fall earthward. The red color is applied (with some
randomness) and the size is considerable increased (with a large degree of
randomness).
The secondary end state causes the particles to reduce in size over the
remaining lifetime. A small amount of continuous acceleration is applied to
counter act the long-term effects of the drag. If the acceleration weren't applied,
the particles would stop and not look quite so “explosion-like”. Try clicking the
Acceleration on check box on and off, to see the difference. You will need to
give the particle a short time to change over. The change of the check box is for
particles being emitted and these new particles need time to progress through the
system.
529
RenderWare Studio User Guide
However, the particles can be emitted from multiple locations per frame and be
tided to another behavior via the event system's messages. The following two
examples are used to demonstrate these features. However, this example does
not explain the use of the CFXReplicatorGenerator behavior. For information on
this see the Replicator FX example (p.539).
530
RenderWare Studio User Guide
spin the emitter around in a circle. A value of 45 or 135 degrees would spin in a
cone, etc.
Messages
The next problem is that of actual emitting particles. By default, the emit on
message is set to the iMsgRunningTick, which means that on each tick a burst of
particles will be emitted. But the replicator will send out several partlink messages
to each iMsgRunningTick message. If the emit on message is not changed, then
particle will only be emitted at the position received by the last partlink message
before the iMsgRunningTick message is received. That is, only one of the boxes
in the replicator would have a trail. To get each box to have a trail, the particles
need to be emitted when the partlink message is received to reposition the
emitter. The emit on message handler does not expect any data, so any
message link can be used. Therefore, the partlink message is also used here.
Note that the update on message is not changed. This is because we still want
the particles that have been emitted to update once a frame and not several
times a frame. If the message was changed to partlink, then the particle system
would run too fast and the speed would be the frame rate multiplied by the
number of replicator objects the particle system was attached to (that is, be
variable). This is far from ideal and not what the effect needs.
It is important to realize that the particle system is being used as a shared
resource here. That is to say, there are in effect several trails running, one per
replicator object, but only one particle system. This uses less memory than one
particle system per replicator object would. This would be especially true if the
attached object was coded so that it only emitted particles if it were visible. In this
way, several box fountains could be in the level (but only one particle system for
the trails). Only a sub-set would be visible and as such, fewer particles would be
needed in the one particle system that they all used. It would be necessary to
ensure the particle system had time to start up before it became visible again
though, otherwise a gap would be visible. This is the same effect as when the
example first starts or is reset.
The other parts of the particle system set up are straightforward. Only the primary
stage is used with color, gravity, drag and size being animated over it. The idea is
to simulate a gas stream coming from the boxes.
To do this, the particles start out with a very small velocity, quite high drag and a
small downward gravity, they are also very small (ie compressed droplets). In this
way the particles will slowly float downwards. By the end of the primary stage, the
size has been increased (randomly) and the color has changed (vaporised into a
gas). In addition the drag is total, ie the particles stop, except for the effect of
gravity, which is now negative and making the particles float upwards slightly.
531
RenderWare Studio User Guide
532
RenderWare Studio User Guide
533
RenderWare Studio User Guide
This example demonstrates the example flag vertex shader for the Xbox.
To run the example:
1. Open the Example FX XBox Vertex Shader project.
2. Launch and connect to an Xbox target.
534
RenderWare Studio User Guide
This example demonstrates the G3x material pipeline behaviors, which are
specific to the PlayStation 2. The G3x pipelines are rendering pipelines optimized
for various lighting conditions. In a nutshell, if the lighting model of the scene can
be considered static (for example one ambient and one directional light), then
these pipelines can significantly increase performance.
The example is split into 5 levels with each level rendering as much as possible
(given the example artwork) at 60 Hz.
Level 1: Using Default G3 Pipelines
Shows 5 warriors (a skinned character with 4 weights per vertex) being
rendered with the standard general purpose pipelines. The world contains 1
ambient and 1 directional light. Running this example on the PlayStation 2
with the metrics data enabled shows that we are reaching the limits of the
rendering performance.
Level 2: Using G3x_ADL (1 Ambient + 1 Directional)
Essentially this level is the same as level 1 except that we have applied
several G3x_ADL pipelines to the various geometries in the scene (the ADL
pipelines are optimized for 1 ambient and 1 directional light). We are now
able to render 10 warriors.
Level 3: Using G3x_APL (1 Ambient + 1 Point)
As in level 2 but using the APL pipelines.
Level 4: Using G3x_A4D (1 Ambient + 4 Directional)
As in level 2 but using the A4D pipelines.
Level 5: Using G3x_ADL (1 Ambient + 1 Point)
As in level 2 but this time the warrior has only 2 weights per vertex.
The material pipelines are attached using the following behaviors:
CG3x_APL_MatPipeID
CG3x_ADL_MatPipeID
CG3x_A4D_MatPipeID
CG3x_APLDup_MatPipeID
CG3x_ADLDup_MatPipeID
CG3x_A4DDup_MatPipeID
CG3x_APLGem_MatPipeID
CG3x_ADLGem_MatPipeID
CG3x_A4DGem_MatPipeID
CG3x_APLSkin_MatPipeID
CG3x_ADLSkin_MatPipeID
CG3x_A4DSkin_MatPipeID
CG3x_APLSkinDup_MatPipeID
CG3x_ADLSkinDup_MatPipeID
535
RenderWare Studio User Guide
CG3x_A4DSkinDup_MatPipeID
CG3x_APLSkinGem_MatPipeID
CG3x_ADLSkinGem_MatPipeID
CG3x_A4DSkinGem_MatPipeID
These behaviors work by attaching the relevant pipelines to the assets before
they are cloned for use by the normal behaviors such as CEntity and
CMultiAnimate.
536
RenderWare Studio User Guide
Maestro
This example demonstrates the use of the CMaestro behavior to allow some
control over a Maestro file (.anm) from within the RenderWare Studio Workspace.
To run the example:
1. Open the Example Maestro project.
2. Launch and connect to a RWS Console.
3. There should be two Maestro entities:
• A menu that can be navigated using up/down to highlight options and
Enter / Backspace (or the usual select / back keys on the consoles) to
select an option or go back a level.
• An animated square that swirls around.
4. The attributes of the Maestro entities allow for positioning within the game,
along with other options.
537
RenderWare Studio User Guide
Multiple levels
This example demonstrates the use of multiple folders in a game, where each of
the highest level folders corresponds to a level in the game.
In the Game Explorer window, one of the folders is highlighted in bold. This is the
active folder (p.166). When you connect to a target console, it is this folder's
contents that will get sent.
Each game also has a global folder (p.168), which is always sent to the target
console before the active folder.
You can also import folders (p.175) from another project.
538
RenderWare Studio User Guide
Replicator behavior
539
RenderWare Studio User Guide
Friction value are 1. This may seem odd, but in the replicator behavior, the value
of 1 means “no friction”. If you change the values to zero, the replicator objects
will not move off the floor. Set the Y axis value to 1.1 and they zoom off into the
air.
The Scale values are not used here, so you can ignore them. Also ignore the
Particle messages section for the moment; we will come back to this.
The color values allow you to change the objects color over its lifetime, time 0.0 is
the start of the lifetime, 0.25 is quarter the way through, 0.5 is halfway, 0.75 is
three quarters of the way through and 1.0 is at the end of the lifetime. These
colors are blended at intermediate time periods. So between the start and a
quarter the way through, the color starts as a dark blue and slowly changes to a
medium, slightly mauve blue.
The Render state flags allow you to change how the objects are drawn by the
graphics system. These can be ignored for the purposes of this example.
Inter-replicator messages
Returning to the Particle Messages section of the Rocket replicator behavior:
here there are two different messages being sent out from this behavior. The
Particle expire (Bang) message is sent when the particle dies (reaches the end of
its lifetime). The data for this is the last position the object reached, as an
RwFrame.
The second attribute, Particle active (Trail), is sent out on each tick, by each
active object in the replicator. The data attached is, once again, the current
position of the object, as an RwFrame.
Taking the Trail message first: looking in the Event Map shows that the
TrailEffect replicator receives this message. The Bang message, however, is
connected to three other behaviors.
Trail effects
The TrailEffect replicator is responsible for the rocket trails. This is set up in very
similar way to the Rocket replicator. However, it does not send out any
messages, has a much shorter lifetime and uses different colors. More
importantly, the Initial velocity velocity bias is negative, so the trails fall away
from the rocket and there is a per tick linear and angular acceleration/friction
applied. This just slows the particle over time, except in the negative y-axis and in
the y-axis rotation (due to accelerations counteracting the frictions). The scale
has been adjusted too, so the trails are smaller than the rocket (except in the
X-axis). This make the trails appear as bars and accentuates their rotation.
Explosions
The other message (Bang) sent from the Rockets replicator, on death, is received
by three separate behaviors. Together they provide the explosion effect. There
are two replicators, which are set up in basically the same way as the trail effect.
The only real differences being that they emit more particles (four or eight) than
the single one emitted by the trails. The colors and initial velocities are different
too. In the case of the velocities, all axes have the same values. This creates a
spherical explosion. One system (bang effect) has smaller value than the other
(bang effect B), and therefore has a smaller radius.
The other behavior receiving the bang message is the Flash Light Effect. This is
540
RenderWare Studio User Guide
Assets
Note that all the replicators are attached to instances of the same asset, a box.
However, the trails, rockets, and bang effects could have been attached to
different shaped assets. They would then have 'replicated' that asset for use in
the effect. The only restriction is that the asset must be a plain atomic.
541
RenderWare Studio User Guide
RF3 files
This example illustrates how artwork created in a package such as 3ds max can
be exported to .rf3 files, and then be converted to asset files to be viewed in
the Workspace using the project templates supplied.
Project Templates
The templates used for this example are stored in the “Export Templates”
child folder of the “Examples” folder. The project templates perform two
functions:
1. They automatically read and compile the source .rf3 files into asset
files when the example is opened, and
2. As they are reading and compiling the .rf3 files, they optimise the
output asset files for displaying on the appropriate target platform.
There are two places to set the project templates:
1. In the Game Properties dialog (p.98)
2. In the Targets properties dialog (p.199)
Assets
The root assets in this example show how an asset references .rf3 files.
The root assets - “military_lab”, “Guard”, and the four assets in the “Guard
Animation” asset folder - each reference a .rf3 file (stored in the “Models”
folder below the “Examples” folder). Below these root assets are the
generated assets described in the root asset's .rf3 file. These assets are
auto-generated from the root asset .rf3 files and reference files that will be
generated locally when the game is first loaded. These generated assets are
created in a folder referenced by the root asset's GUID in the folder structure
“Workspace Output\Asset\rf3s” beneath the game location.
The files created are:
1. A .xml file detailing each of the assets stored in the .rf3 file. Once
created, this enables the Workspace to find out which assets were in a
.rf3 file without re-parsing the file.
2. A single .rws file that has all assets from the .rf3 file in it.
3. A number of other .rws files, whose filename ends with the index of
the asset. This index is the ChunkIndex attribute of each asset in the
.xml file. Each of these .rws files is referenced by a child asset of the
root RF3 asset.
542
RenderWare Studio User Guide
Shared attributes
This example demonstrates the use of shared attributes (p.170) within the
Workspace. Each of the folders contains a class of object; these objects are
normal entities, except that their attributes are shared with others within the same
group. For example, the entity folder, Broken Lights, contains a number of
flickering fluorescent lights; if you select one of these broken lights and modify its
attributes, (try changing Style to normal) you can see that all of the entities that
share the attributes with the selected entity are also updated.
Shared attributes can also be used within templates. If you open the Templates
folder, you will see that there is a template setup for each class of object.
Selecting the template and modifying its attributes has the same effect as
selecting an instance of the template and changing its attributes.
543
RenderWare Studio User Guide
Sky dome
This example demonstrates the use of the sky dome and environment mapped
objects.
Load the example, connect and enable the director's camera ( ). If you use
the FPSPlayer's camera, you will not be able to see the sky dome because of the
room's walls. Choose the flight mode (paper plane button) and, using the right
mouse button, click and hold just above the box to move out of the top of the
room. Then turn 90 degrees to the left (left click and hold just to the left of the
box). This should bring a spinning torus into view.
The sky dome works by being rendered first (hence the higher message priority
than the FPSRender) and it is responsible for clearing both the color and z-
buffers. The FPSRender object attached to the room does not do this operation
as that would result in two clears per frame and give undesired side effects.
The texture matrix for the spinning torus is set up within the Setup Environment
Map. This uses a CFXEnvironmentMap behavior, allowing the positioning of the
environment map and its animation to be specified. It does NOT render the
object, it only sets up the mapping for the object it is attached to (alpha_torus).
The rendering of the torus is performed in the SkyDome Object as part of
SkyDone. This uses a standard FPSSpinningPickup behavior.
The thing to note is that the CFXEnvironmentMap sets up the mapping for all
instances of alpha_torus asset. Therefore they will all have the same mapping on
them. If you want a second torus with different mapping, they will have to use two
different assets.
The reason the torus is fixed in screen space is because it is rendered as part of
the sky dome, which is also fixed relative to the camera. This is achieved
because it occurs in the list of the game level folder after the sky dome and
before the room. If it was after the room, it would be rendered relative to it (that is,
move with the room).
544
RenderWare Studio User Guide
Spline camera
This example shows how to make a camera follow a curved path - defined by the
spline editor (p.34) - around the scene in the Workspace.
It also demonstrates how to connect up the camera system, so that both the
director's camera and the camera that is moving along the curve can co-exist.
Note: To see the effect of the camera moving along the curve on the target, you
need to ensure that you have turned off the Director's Camera.
545
RenderWare Studio User Guide
Split screen
546
RenderWare Studio User Guide
This example demonstrates how the split screen behavior and rendering behavior
can be used to easilly create a tool for viewing the visible sectors of a world with
PVS data, while still being able to view the scene as it would normally appear.
This is achieved by sending the camera first to two split screen behaviors
CSubRasterCamera, one for the left side of the screen and one for the right.
Each of these behaviors is then attached to one of two FPSRender behavior the
left side is rendered normally and the right side is rendered in a debug mode
showing the visible sectors.
547
RenderWare Studio User Guide
Glossary
A
asset
An object in the game database.
Identifies data that can be used by an entity. Among other properties, an
asset contains the relative paths of:
A primary asset file
Contains the “primary” data for an entity (for example, a .dff or .rf3
file, defining the geometry of an entity).
A dependencies folder
The folder containing data files required by the primary asset file (for
example, texture bitmaps).
Several entities can use the same asset. You can attach assets to an entity
either one by one, or you can group assets into asset folders, and then
attach a mix of individual assets and asset folders to an entity.
Note: In general usage, the term asset is sometimes used to refer to a
primary resource file. However, in RenderWare Studio, the term asset refers
to an object in the game database that points to a primary asset file, not to
the primary resource file itself. Like any other object in a game database, an
asset is stored in an XML file.
attribute
An object in the game database.
Stores the value of a parameter that controls the behavior of an entity. For
example, a vehicle entity might have an “exhaust color” attribute that
controls the color of the exhaust smoke that its behavior causes the entity to
emit. Each entity can either have its own individual attribute values, or use
attribute shares to share the same attribute values as other entities.
To change attribute values, use the Attributes window.
Behavior commands and entity attributes are closely related. Commands
define the attributes that an entity can have. Attributes store the values of
the command parameter values for an entity.
B
behavior
A C++ class that you can attach to an entity. The class defines:
• How and where an entity appears in the scene.
• The actions that an entity can perform.
• The events that an entity can cause.
• The events that an entity can respond to.
When you create an entity from an asset, the new entity is given the default
548
RenderWare Studio User Guide
behavior CEntity.
Behaviors are also represented as objects in the game database, but they
are not persisted in the game database XML files; entities refer to behaviors
by name.
box volume
Box volumes are simple cuboid entities that you can place into your game
without the need to import an asset. They can be used as placeholders for
entities that will be created in the future, or (more commonly) as the basis
for trigger volumes.
C
CEntity
The default behavior that RenderWare Studio attaches to new entities.
Defines simple rendering, physics, and collision-related actions.
D
delete
Erases an object from the game database, and all references to the object.
E
entity
An object in the game database.
Typically, each individual object in your game (such as human figures,
vehicles, tools, weapons, doors, buttons, levers) is represented by an entity
in the game database. An entity consists of:
• References to zero or more assets
• A reference to one (and only one) behavior
• Values for the attributes of the behavior
F
folder
A container for other objects in the game database. You can use folders to
organize a game database into a structured hierarchy. There are various
types of folder.
Only the following types of folder are significant in the game database
hierarchy:
Folder (without any additional qualifying term; if you like, a “normal” folder)
549
RenderWare Studio User Guide
G
game
The root object in the game database hierarchy. A game database can
contain only one game object. Currently, RenderWare Studio supports only
one game per project (.rwstudio file).
global folder
See folder.
game world
The 3D space in which entities are located in the game. This is the static
geometry that usually takes the form of a .bsp file.
R
remove
Erases a reference to an object in the game database (not the object itself).
Any other references to the object are not affected.
resource
The file that is referred to by an asset. This file contains data that can be
used by an entity: for example, geometry (typically stored in a .dff or .rf3
file).
To allow an entity to use a resource:
1. Create an asset that refers to the resource.
2. Add the asset to the entity.
(Also known as a resource file.)
resource root
The absolute path of the root folder where your asset data is stored.
550
RenderWare Studio User Guide
Each asset in the game database specifies the relative paths of:
• A primary asset file (such as a .dff or .rf3)
and, optionally,
• A dependencies folder (for example, where textures for the primary
asset file are stored)
The Workspace uses the resource root folder to resolve these relative paths
into absolute paths.
The resource root is a property of the game, and is stored in the project
.settings (p.76) file.
S
source root
The absolute path of the root folder where the Game Framework C++
source files are stored. The Workspace uses this path to locate the source
header files that define behaviors.
The Workspace parses the header files to determine:
• The list of behaviors that you can attach to entities.
• The attributes for each behavior, and the controls that the Attributes
window displays for setting these attributes.
The source root is a property of the game, and is stored in the project
.settings (p.76) file.
551
RenderWare Studio User Guide
Trademarks
552
RenderWare Studio User Guide
Contact us
General information
For general information about RenderWare Studio, email:
[email protected]
or visit the RenderWare website (www.renderware.com/).
Developer support
For support issues, please use our fully managed support services (FMSS)
website (support.renderware.com/).
To contact our Developer Relations team directly, email:
[email protected]
Sales
For sales information, email:
[email protected]
553