Developing 3D Games with Macromedia Director - PowerPoint PPT Presentation

About This Presentation
Title:

Developing 3D Games with Macromedia Director

Description:

Lets the artist become a level designer ... Clothes. Weapons. etc. on updatePosition me --Get the transform of our parent bone ... – PowerPoint PPT presentation

Number of Views:73
Avg rating:3.0/5.0
Slides: 25
Provided by: dub9
Category:

less

Transcript and Presenter's Notes

Title: Developing 3D Games with Macromedia Director


1
Developing 3D Games with Macromedia Director
  • Brian Robbins
  • Director, Online Gaming
  • Fuel Industries, Inc.
  • www.fuelindustries.com

2
My Background
  • Director developer since 1999
  • Worked on over 70 games
  • Developing 3D games since 8.5 Beta
  • Previous Projects
  • Lots of games for CleverMedia
  • The Lord of the Rings Online Trading Card Game

3
Recent Projects
  • Coors Golf
  • My first use of shadows and other enhanced visual
    effects
  • Cowboys Engines
  • Multi-user Junkyard
  • Wakeboarding
  • Crazy wakeboarding game

4
Todays Topics
  • Graphics
  • Production workflow
  • Using user-data
  • Power to the artists
  • Shadows
  • Overlays
  • Skyboxes

5
Todays Topics
  • Programming
  • Time-based
  • Character Add Ons
  • Collisions with MUR
  • Billboard sprites

6
Graphics
  • ltltbig cool screenshot goes heregtgt

7
Project Workflow
  • Model the world in 3D Application
  • Maya, MAX, etc
  • Export to .w3d
  • Public exporters or your own custom exporter
  • Import into Director
  • Put it on stage

8
The joys of .userData
  • Lets the artist become a level designer
  • The best way to add information in modeling for
    run-time
  • repeat with ig3d.model.count down to 1
  • mdl g3d.modeli
  • usrData mdl.userData
  • tmp usrDatatextureTransparent
  • if not voidp(tmp) then
  • --Set the texture's renderformat to rgba8888
  • mdl.shader.texture.renderFormat rgba8888
  • end if
  • end repeat

9
Let artists worry about the visuals
  • We should be providing tools to the artists
  • They are the visual people, let them do the
    visuals
  • Make an engine, and let them use it
  • NEVER underestimate an artist

10
Shadow Maps
  • What is a shadow map?
  • But .w3d doesnt support multiple texture layers!
  • Example
  • generateLightMap(member("Source Scene"),
    member("lightmap scene"))
  • getLightmap(member("source scene"))

11
Other Shadows
  • Simple circle
  • Can be effective
  • Barry Swans shadow controller
  • Lots of overhead, but looks the best right now
  • inludo.com/rd/d85/tuts/shadows01.htm
  • gCharShadow script("P Shadows").new(g3d,
    g3d.model("character"), lightVector, floorPos,
    shadowColor, true)
  • Noisecrimes real-time shadows
  • noisecrime.com/develop/techdemo/dmx/shadowmapping1
    1.htm

12
Better Overlays
  • Built-in overlays suck
  • We use multiple cameras
  • Gives us much more control
  • Now we have an overlay controller

13
Create Overlay Camera
  • --Make it an ortho camera
  • pCam.projection orthographic
  • --Set the cam not to clearAtRender
  • pCam.colorBuffer.clearAtRender false
  • --Set the cam's rootNode to itself
  • pCam.rootNode pCam
  • --Remove the cam from the world
  • pCam.removeFromWorld()
  • --Set the hither and yon
  • pCam.hither 1
  • pCam.yon 10000
  • --Add the camera to the sprite
  • p3dSprite.addCamera(pCam, pCamIndex)
  • --Set the orthoHeight to the sprite height
  • pCam.orthoHeight height
  • --Update cam rect too
  • pCam.rect rect(0,0, width, height)

14
Creating Skyboxes that work
  • This is the same theory as the overlays
  • Instead the camera goes first
  • Now we can have fog and a backdrop!
  • baseCam pSprite.camera(1)
  • pTargetCam baseCam
  • pMyCam baseCam.clone("SkyboxCam)
  • --Turn off the base clearAtRender
  • baseCam.colorBuffer.clearAtRender false
  • --Add our camera to the sprite
  • pSprite.addCamera(pMyCam, 1)

15
Programming
  • ltltbig cool screenshot goes heregtgt

16
Time-based is the Key
  • Absolutely critical for 3D games
  • When planned from the start its easy
  • Once you go timed, youll never go back
  • on newFrame me
  • currTime the Milliseconds
  • timeElapsed currTime - pLastTime
  • pLastTime currTime
  • if timeElapsed gt 100 then
  • timeElapsed 100
  • end if
  • return timeElapsed
  • end

17
Character Add Ons
  • How to attach objects to a skeleton?
  • Useful in all sorts of character games
  • Clothes
  • Weapons
  • etc
  • on updatePosition me
  • --Get the transform of our parent bone
  • if pBoneID gt 0 then
  • trans pParentModel.bonesPlayer.bonepBoneID
    .worldTransform
  • pMyGroup.transform trans
  • end if

18
Collision Detection
  • This makes (or breaks) your world
  • ModelsUnderRay works well
  • Collision resolution can be tricky

19
Collision Resolution
  • --Slide the char along the object
  • --First get the normal Angle
  • normalAngle pCollisionInfo.isectNormal
  • --Next get the vector that's parallel to the
    normal
  • parallelVec normalAngle.cross(vector(0,0,1))
  • --Now get the amount we need to move (this takes
    into account whether to slide left or right)
  • dotProd pDirectionRay.dot(parallelVec)
  • --Get the moveVector to be the appropriate length
  • moveVec parallelVecdotProd
  • --Now 0 out the moveVec's zAxis (so we don't go
    up or down)
  • moveVec.z 0
  • --Check to see if we can actually move to that
    point
  • if me.checkMove(moveVec, true) then
  • --Actually move the character this way
  • pMyParent.translate(moveVec, world)
  • else
  • --There's another object preventing us from
    sliding there so just stop
  • end if

20
Billboard Sprites
  • They always face the camera
  • Character names
  • Signs
  • Trees
  • Etc
  • Easy to do!
  • --Get the cam rotation
  • camRot pSprite.camera.getWorldTransform().rotati
    on
  • -- Update the model position (optional)
  • pMyModel.transform.position pModelParent.transfo
    rm.position pOffset
  • --Update the model rotation
  • pMyModel.transform.rotation.z camRot.z

21
Conclusion
  • Graphics
  • Workflow
  • .userData
  • Artists are visual
  • Shadows
  • Overlays
  • Skyboxes

22
Conclusion
  • Programming
  • Time-based
  • Character Add Ons
  • MUR and Collisions
  • Billboard Sprites

23
Links / Resources
  • dubane.com/cons
  • noisecrime.com/develop
  • inludo.com/rd/d85/
  • director-online.com
  • blog.fuelindustries.com

24
Q A
Write a Comment
User Comments (0)
About PowerShow.com