Open-Source Graphics Development with the Delta3D Game Engine Chris Osborn Lead Software Engineer...
-
Upload
arthur-bryan -
Category
Documents
-
view
224 -
download
7
Transcript of Open-Source Graphics Development with the Delta3D Game Engine Chris Osborn Lead Software Engineer...
Open-Source Graphics Development with
the Delta3D Game EngineChris Osborn
Lead Software EngineerDelta3D, MOVES Institute
Agenda
• Why Use Open-Source Software?• Overview of the Delta3D Game Engine• Building a Delta3D Application• STAGE: the Simulation, Training, And Game
Editor• Building Actor Libraries for STAGE• Questions
Why Use Open-Source Software?
• Often cross-platform...• Windows, Linux, OSX, BSD, and more
• Always the lowest bid!• No vendor lock-in• Freedom to modify and enhance code• Often has commercial-friendly licensing
Licensing
• The Delta3D libraries are licensed under the LGPL.
• Lesser GNU Public License• http://www.gnu.org/copyleft/lesser.html• Applications may use a LGPL library and
retain a commercial license.• In contrast to the GPL, where programs that
use a GPL library automatically fall under the GPL themselves.
• The STAGE source code is licensed with the GPL.
What’s in Delta3D?Libraries
• dtUtil: General utilities• dtCore: Core engine• dtABC: Application Base
Classes• dtAudio: Audio• dtChar: Characters• dtGUI: CEGUI implementation• dtHLA: HLA/RTI networking• dtScript: Python scripts• dtTerrain: Terrain framework• dtDAL: Dynamic Actor Layer• dtGame: GameManager• dtActors: STAGE export of
dtCore• dtBSP: BSP Library• dtInspector: FLTK debugging
tool
Utilities• bspCompiler• STAGE• hlaStealthViewer• psEditor: Particle Systems• Viewer: Model Viewer
Architecture
Building a Delta3D Application
• Rapid, iterative development is good.• Delta3D provides base classes to facilitate
this style of development.• Derive from dtABC::Application to instantly
have a working program with a window, scene, mouse & keyboard callbacks, and an entry point into the frame loop.
dtABC::Application
• void Confg()• Setup your scene here
• void KeyPressed()• Keyboard callback
• void ButtonPressed()• Mouse callback
• void PreFrame()• Per-frame callback• It is safe to add and remove objects from the scene
here
Let’s take a look at a sample application.
STAGE
• The Simulation, Training, And Game Editor• Assemble 3D scenes by placing “actors” and
modifying their properties• Contains core library of actors supporting
almost all Delta3D classes• Extensible plug-in interface for your own
actors• Intuitive user-interface• Supports triggers and basic scripting
Let’s take a look at STAGE.
dtDAL & STAGE Architecture
Building an Actor Library
1. Create your Actor classes.2. Wrap the classes using ActorProxies.3. Export the ActorProxies in a shared library.4. Load the library via a GUI in STAGE.
Creating Actors
• Here, Actor refers to a custom Delta3D classes that you wish to use in STAGE.
• Actor classes must have a base class of dtCore::DeltaDrawable.
• An Actor Property is any member variable you wish to manipulate in STAGE. For example, a collision shape.
• You must define Gets & Sets for all of the Actor Properties.
Let’s take a look at a custom Actor: the TessellationActor.
It represents a flag-like object that can be assigned a texture.
Wrapping classes with ActorProxies
• An ActorProxy is a generic interface to Actor Properties. They allow STAGE to manipulate Actor without understanding the Actor type.
• Custom ActorProxies dervie from dtDAL::ActorProxy, dtDAL::TransformableActorProxy, etc.
• Often, you will need to wrap the Gets/Sets on the Actor itself to fit the interface required by STAGE.
• void BuildPropertyMap()• Associates Properties with Gets/Sets.
Let’s take a look at the ActorProxy for our TessellationActor.
Exporting ActorProxies to a Library
• Finally, we must export the ActorProxy into a shared library that STAGE can use.
• On Windows, this would be a .dll.• On Linux, the library is a .so.• ActorProxy Libraries derive from
dtDAL::ActorPluginRegistry.• void RegisterActorTypes()
• Defines which Actors are in this library.
Let’s take a look at the library containing our TessellationActorProxy.
Loading a ActorProxy Library in STAGE
• Edit -> Map Libraries... -> Import Library• Then you’ll be able to use your Actor in
STAGE!• Oh, and if you want to open your map at
another time, make sure you custom library is somewhere in your PATH (Windows) or LD_LIBRARY_PATH (Linux).
Let’s go check out our new Actors in STAGE.
Loading a Map from an Application
• dtDAL::Project::GetInstance().GetMap(“MyMap”)• This function returns a reference to the map with
the name “MyMap”.
• void LoadMap( dtDAL::Map& map )• You can then pass that reference into this function,
which loads the map into the default Scene in your application.
Let’s see how to load map with some good ol’ C++.
Finding Proxies in a Map
• dtDAL::Map::FindProxies(vector,name) • vector is of type std::vector<
osg::ref_ptr<ActorProxy> >• name is of type std::string (wildcards allowed, i.e.
*)• This function will fill the vector with proxies that
match the wildcard string name.
• Once you have the matching ActorProxies you can call ActorProxy::GetActor() to return the internal Actor.
• Then you should dynamic_cast the Actor to your Actor’s static type.
Let’s see how to find our TessellationActorProxy in a Map.
Thank you!
Questions?
Chris [email protected]
osb on the forums, come say hi!
http://www.delta3d.org/IISECTutorial.zip