scene graph via ini

edited May 2013 in Help request
Any tips on organizing a scene graph via the ini file? I'd like to organize my scene like this:


Creating objects for different tiles/actors is straightforward. But the camera, I have questions about:

- How does one simultaneously connect the camera to both the viewport system and the object system? The coordinate for the camera should be set after tiles have been created, so as to center on them.


  • edited May 2013
    As you probably already know, the ChildList property will allow you to organize all of it beside the camera.

    You could almost do the camera part from config. The only missing part is being able to link the camera to a parenting object.
    If there were commands for the camera module, that'd have done the trick, but for now you'll need to write some code to set the camera's parent. Something like:

    In config:
    ChildList = Tiles # Actor1 # ... # CameraObject
    ; Declares and set local coords for Tiles, Actors and CameraObject
    Camera = Camera

    In code:
    // When receiving the orxOBJECT_EVENT_CREATE for CameraObject
    orxOBJECT *pstObject;
    orxCAMERA *pstCamera;
    pstObject = orxOBJECT(_pstEvent->hSender);
    pstCamera = orxCamera_Get("Camera"); 
    orxCamera_SetParent(pstCamera, pstObject);

    You can now handle the Camera via the CameraObject, including adding FXs (shakes, moves, scales(ie. 1/zoom), ...).
  • edited May 2013
    Just for the kicks, assuming we have the commands Camera.Get and Camera.SetParent (who knows, maybe soon! ;)), here's how we'd do it in config:
    TrackList = @CameraObjectTrack
    0 = > Camera.Get Camera # Camera.SetParent < ^
  • edited May 2013
    just applied the camera inheritance trick, worked like a charm, thanks! :)
  • edited May 2013
    Nice! :)

    Yesterday I added a bunch of Camera.* commands, so the all-ini solution should be working now. :)
  • edited May 2013
    ok, this really means that i have to study the latest track stuff :)
  • edited May 2013
    Timeline tracks can be very powerful, I handle all my UI needs, including tutorials, menu changes, sound/music/fullscreen toggle buttons, etc... with them.
    My UI code, on the C++ side, is only a generic 15 lines that track hower on/off, click/release status and simply add the matching tracks to the picked object if found in config.
    The whole UI logic being done in config in the tracks.
    That also allowed us to have the artist/designer do the whole UI/menus on their own without waiting for me to write any piece of dedicated code.
  • edited May 2013
    just tried setting the camera parent via ini, but no luck. I don't suppose there is a way to debug the timetracks, is there?
  • edited May 2013
    Not really, unforunately, however the commands themselves will often output error logs in debug which should help you find the cause of your problem.

    I just did a quick test locally and it worked for me. One thing to check: make sure your camera is created before the object that will be its parent, basically having the viewport created before the scene should do the trick.
Sign In or Register to comment.