Open-Source Graphics Development with the Delta3D Game Engine Chris Osborn Lead Software Engineer...

26
Open-Source Graphics Development with the Delta3D Game Engine Chris Osborn Lead Software Engineer Delta3D, MOVES Institute [email protected]

Transcript of Open-Source Graphics Development with the Delta3D Game Engine Chris Osborn Lead Software Engineer...

Page 1: Open-Source Graphics Development with the Delta3D Game Engine Chris Osborn Lead Software Engineer Delta3D, MOVES Institute cwosborn@nps.edu.

Open-Source Graphics Development with

the Delta3D Game EngineChris Osborn

Lead Software EngineerDelta3D, MOVES Institute

[email protected]

Page 2: Open-Source Graphics Development with the Delta3D Game Engine Chris Osborn Lead Software Engineer Delta3D, MOVES Institute cwosborn@nps.edu.

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

Page 3: Open-Source Graphics Development with the Delta3D Game Engine Chris Osborn Lead Software Engineer Delta3D, MOVES Institute cwosborn@nps.edu.

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

Page 4: Open-Source Graphics Development with the Delta3D Game Engine Chris Osborn Lead Software Engineer Delta3D, MOVES Institute cwosborn@nps.edu.

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.

Page 5: Open-Source Graphics Development with the Delta3D Game Engine Chris Osborn Lead Software Engineer Delta3D, MOVES Institute cwosborn@nps.edu.

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

Page 6: Open-Source Graphics Development with the Delta3D Game Engine Chris Osborn Lead Software Engineer Delta3D, MOVES Institute cwosborn@nps.edu.

Architecture

Page 7: Open-Source Graphics Development with the Delta3D Game Engine Chris Osborn Lead Software Engineer Delta3D, MOVES Institute cwosborn@nps.edu.

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.

Page 8: Open-Source Graphics Development with the Delta3D Game Engine Chris Osborn Lead Software Engineer Delta3D, MOVES Institute cwosborn@nps.edu.

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

Page 9: Open-Source Graphics Development with the Delta3D Game Engine Chris Osborn Lead Software Engineer Delta3D, MOVES Institute cwosborn@nps.edu.

Let’s take a look at a sample application.

Page 10: Open-Source Graphics Development with the Delta3D Game Engine Chris Osborn Lead Software Engineer Delta3D, MOVES Institute cwosborn@nps.edu.

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

Page 11: Open-Source Graphics Development with the Delta3D Game Engine Chris Osborn Lead Software Engineer Delta3D, MOVES Institute cwosborn@nps.edu.

Let’s take a look at STAGE.

Page 12: Open-Source Graphics Development with the Delta3D Game Engine Chris Osborn Lead Software Engineer Delta3D, MOVES Institute cwosborn@nps.edu.

dtDAL & STAGE Architecture

Page 13: Open-Source Graphics Development with the Delta3D Game Engine Chris Osborn Lead Software Engineer Delta3D, MOVES Institute cwosborn@nps.edu.

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.

Page 14: Open-Source Graphics Development with the Delta3D Game Engine Chris Osborn Lead Software Engineer Delta3D, MOVES Institute cwosborn@nps.edu.

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.

Page 15: Open-Source Graphics Development with the Delta3D Game Engine Chris Osborn Lead Software Engineer Delta3D, MOVES Institute cwosborn@nps.edu.

Let’s take a look at a custom Actor: the TessellationActor.

It represents a flag-like object that can be assigned a texture.

Page 16: Open-Source Graphics Development with the Delta3D Game Engine Chris Osborn Lead Software Engineer Delta3D, MOVES Institute cwosborn@nps.edu.

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.

Page 17: Open-Source Graphics Development with the Delta3D Game Engine Chris Osborn Lead Software Engineer Delta3D, MOVES Institute cwosborn@nps.edu.

Let’s take a look at the ActorProxy for our TessellationActor.

Page 18: Open-Source Graphics Development with the Delta3D Game Engine Chris Osborn Lead Software Engineer Delta3D, MOVES Institute cwosborn@nps.edu.

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.

Page 19: Open-Source Graphics Development with the Delta3D Game Engine Chris Osborn Lead Software Engineer Delta3D, MOVES Institute cwosborn@nps.edu.

Let’s take a look at the library containing our TessellationActorProxy.

Page 20: Open-Source Graphics Development with the Delta3D Game Engine Chris Osborn Lead Software Engineer Delta3D, MOVES Institute cwosborn@nps.edu.

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).

Page 21: Open-Source Graphics Development with the Delta3D Game Engine Chris Osborn Lead Software Engineer Delta3D, MOVES Institute cwosborn@nps.edu.

Let’s go check out our new Actors in STAGE.

Page 22: Open-Source Graphics Development with the Delta3D Game Engine Chris Osborn Lead Software Engineer Delta3D, MOVES Institute cwosborn@nps.edu.

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.

Page 23: Open-Source Graphics Development with the Delta3D Game Engine Chris Osborn Lead Software Engineer Delta3D, MOVES Institute cwosborn@nps.edu.

Let’s see how to load map with some good ol’ C++.

Page 24: Open-Source Graphics Development with the Delta3D Game Engine Chris Osborn Lead Software Engineer Delta3D, MOVES Institute cwosborn@nps.edu.

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.

Page 25: Open-Source Graphics Development with the Delta3D Game Engine Chris Osborn Lead Software Engineer Delta3D, MOVES Institute cwosborn@nps.edu.

Let’s see how to find our TessellationActorProxy in a Map.

Page 26: Open-Source Graphics Development with the Delta3D Game Engine Chris Osborn Lead Software Engineer Delta3D, MOVES Institute cwosborn@nps.edu.

Thank you!

Questions?

Chris [email protected]

osb on the forums, come say hi!

http://www.delta3d.org/IISECTutorial.zip