Results 1 to 9 of 9

Thread: Loading scenes in runtime?

  1. #1

    Loading scenes in runtime?

    How to do this correctly? I tried the example at caperaven.co.za but it didn't work at all.
    Now could someone explain how to do this. For example if my base scene has a cube and a camera and I want to load my level1.gls witch has the cube and the camera and some other objects. Now if I call [pascal]glscene1.loadfromfile('level1.gls'); [/pascal]
    It gives me an error "invalid enumerant". What's going wrong?
    6872498642289459849826 flies can't be wrong... shit tastes good.
    <br />www.bylkkisoft.vze.com

  2. #2

    You can TRY

    Hi Bylkki ..


    i don't know exactly whay your code doesn't work . ?
    but i think maybe there are a small mistake .

    You can TRY :

    1- Add "ExtractFilePath(ParamStr(0))" to your Path , to be shore that you are working in the curint path ..
    Like this :
    GLScene1.LoadFromFile(ExtractFilePath(ParamStr(0)+ '\Levels\Level1.Gls');

    2- you must reDefine some Parameters after calling ..:. (( GLNavigators for example)) :
    Like This :
    GLNavigator1.MovingObject:=actor;

    my be there are some other things ......
    but at any rate this is a code i wrote .. and it is working correctly :


    if IsKeyDown('s') then begin
    GLScene1.LoadFromFile(ExtractFilePath(ParamStr(0)) +'\Levels\Level1.Gls');
    GLNavigator1.MovingObject:=actor;
    GLNavigator2.MovingObject:=Actorvert;
    end;



    God Luck.


    .
    Ask them just what they think Delphi can't do, and show them they're wrong! Abo Delphi .

  3. #3

    Loading scenes in runtime?

    A bit of an improvement. Just downloaded the newest CVS-version of glscene and now it loads my scene well without errors but...
    The problem now is that glscene doesn't referr to my newly loaded objects. It loads the scene but all the positions I have set in code wont work. For example I have a hudtext and in code i set its position to
    [pascal]hudtext.position.y := 5;[/pascal]
    Now when i load the scene it doesn't set the position. :cry:
    I tried to do like in the demo at caperaven.co.za
    [pascal]hudtext := glscene1.findsceneobject('hudtext');[/pascal]
    If i do that the code wont compile and it says: " incompatible types: TGLHUDText and TGLBaseSceneObject "
    How can they be incompatible? :x

    Could someone help me?

    Thanks in advance.
    6872498642289459849826 flies can't be wrong... shit tastes good.
    <br />www.bylkkisoft.vze.com

  4. #4

    where you put the position code

    where you put the position code ... ?

    if the code is in (Form create) ,
    simply separate the position code Lines on a new procedure .
    and recall the procedure after loading the new scene .
    i think that will be usefull .
    Ask them just what they think Delphi can't do, and show them they're wrong! Abo Delphi .

  5. #5

    Loading scenes in runtime?

    recall the procedure after loading the new scene .
    No luck. I tried that too but it just wont work.

    The actors wont load even if I load them after the scene loading.
    6872498642289459849826 flies can't be wrong... shit tastes good.
    <br />www.bylkkisoft.vze.com

  6. #6

    this must work

    hi
    this code from my game and it work so good
    try some think like it >> it must work ?

    [pascal]
    // we also call this procedure on form create
    ////////////////////////
    procedure Tform1.loadsceneactors;
    begin
    Actor1.LoadFromFile(exepath+'\actor\gun.md2');
    Actor1.Material.Texture.Image.LoadFromFile(exepath +'\Actor\gun.jpg');
    Actor1.Scale.SetVector(0.01, 0.02, 0.02, 0);


    Actor2.LoadFromFile(exepath+'\actor\other\Misdun.M D2');
    Actor2.Material.Texture.Image.LoadFromFile(exepath +'\Actor\other\Misdun.jpg');
    Actor2.Scale.SetVector(0.06, 0.06, 0.06, 0);

    Actor3.LoadFromFile(exepath+'\actor\other\Mrbat.MD 2');
    Actor3.Material.Texture.Image.LoadFromFile(exepath +'\Actor\other\Mrbat.jpg');
    Actor3.Scale.SetVector(0.06, 0.06, 0.06, 0);

    Actor4.LoadFromFile(exepath+'\actor\other\sold.MD2 ');
    Actor4.Material.Texture.Image.LoadFromFile(exepath +'\Actor\other\sold.jpg');
    Actor4.Scale.SetVector(0.06, 0.06, 0.06, 0);

    Actor5.LoadFromFile(exepath+'\actor\other\sold.md2 ');
    Actor5.Material.Texture.Image.LoadFromFile(exepath +'\Actor\other\sold.jpg');
    Actor5.Scale.SetVector(0.06, 0.06, 0.06, 0);

    end;
    // ////////////////////////////////////////
    ///////////////////////////////////////////
    //////////////////////////////////////////
    // the load scene procedure

    if IsKeyDown(VK_F5) then begin
    GLScene1.LoadFromFile(exepath+'\levels\level1.gls' );
    GLNavigator1.MovingObject:=actorcube;
    GLNavigator2.MovingObject:=vertactorcube;
    playsound('back.wav',actor,2);
    GLSMBASS.Listener:=GLCamera1;
    loadsceneactors;
    end;


    [/pascal]
    Ask them just what they think Delphi can't do, and show them they're wrong! Abo Delphi .

  7. #7

    Got it to work

    Yeah! got it working . Thanks orwa. I tried again to load and set everything again and it worked. I wonder why it didn't work before :?

    BTW: If you want to check what the game looks like then heres a couple of pictures.
    ingame:
    http://www.bylkkisoft.vze.com/images/game/leizoor.jpg
    Gui:
    http://www.bylkkisoft.vze.com/images/game/ingamegui.jpg
    config window:
    http://www.bylkkisoft.vze.com/images...leizconfig.jpg
    6872498642289459849826 flies can't be wrong... shit tastes good.
    <br />www.bylkkisoft.vze.com

  8. #8

    Loading scenes in runtime?

    Great work ...[/img]
    Ask them just what they think Delphi can't do, and show them they're wrong! Abo Delphi .

  9. #9

    Loading scenes in runtime?

    Having minor problems, again. Now the scene loads but the Gui isn't working correctly. You can drag the gui around but the buttons dont react. What i mean that the buttons dont have their events anymore. How can I assign them again?
    6872498642289459849826 flies can't be wrong... shit tastes good.
    <br />www.bylkkisoft.vze.com

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •