Jump to content

darrenc182

Members
  • Posts

    55
  • Joined

  • Last visited

Posts posted by darrenc182

  1. What is the best way to create interior rooms for use in Leadwerks in order to have optimal frame rates and stability? The reason I ask is because I created an entire level as just one mesh and I am getting horrible frame rates (between 16 and 20 fps). When I just have a simple section, like a hallway or an office, the fps is fine (around 90). Is it a good idea just to break up an entire interior level into smaller sections or is there something else that can be done in order to get optimal frame rates?

  2. I am trying to render an outdoor scene with terrain, a skybox and my simple HUD. I can render the HUD in the transparency world with the Terrain, but I cannot render the skybox, terrain and HUD together. I can also render the skybox and terrain just fine by themselves also. I am putting my HUD in the transparency world like this:

     

    fw.GetTransparency().SetWorld();
    CreateAmmoHUD();
    CreateHealthHUD();
    fw.GetMain().SetWorld();
    

     

    I am rendering the skybox like this:

    fw.GetRenderer().SetSkybox(LoadMaterial("abstract::FullskiesBlueClear0016_2_L.mat"));
    

     

    When that is commented out terrain and HUD render fine. When it is uncommented then I get a black screen with the HUD display but no skybox and no terrain, however everything renders fine for the first frame and after that I get a black screen with the HUD only. Does anyone have an idea on how I can fix this, or is this potentially a bug? All help will be greatly appreciated.

  3. Reseting XForms should do the job before export. :lol:

     

    I reset the xform by going to the Utilities tab, selecting the Reset XForm button and resetting the selected object. It looks like the model is of the correct scale, but the object is has now been rotated 90 degrees on the x or z axis so that it is now parallel with the ground when I export it out of 3ds max and import it into the Leadwerks editor. In 3ds max, however, it has the correct orientation. Any ideas on how this could be happening and how I can correct it?

  4. When I try to scale my source vegetation models in 3ds max and then place then into a Leadwerks scene using the terrain vegetation placement tool the models remain the same size as they were before I changed there size. I am exporting the models out of 3ds max using the fbx format. The models are properly scaled when I just add them as models. Is this a problem other people have had? Any and all help will be greatly appreciated.

  5.  

    I finally got some time to work on this. I was able to get it to work using the references you gave VeTaL, thanks. I am getting this stupid unhandled exception when the render context is set to NULL before a call to wglMakeCurrent. I do not know why it happens because it will work without any problems sometimes. It only seems to crash after running another app that was using OpenGL before. I don't know why this is happening yet, but I think it's because the MFC app cannot acquire an available render context. That doesn't make much such because I check to see if the render context was created successfully. Anyway I will continue to try. Thanks for all the help and input.

  6. Alright I got it working. I had to rework my animation management code. The code below will animate a sequence (in this case a death animation sequence) and at the end of the animation it will stay on the last frame of the animation.

     

    next_frame = (AppTime() - animationStartTime) / 30.0f;
    next_frame = fmod(next_frame, 575-540) + 540;
    
    if(next_frame > fCurrentFrame)
    fCurrentFrame = next_frame;
    else {
    bNextSequence = true;
    next_frame = (AppTime() - animationStartTime) / 30.0f;
    next_frame = fmod(next_frame, 1) + 575;
    fCurrentFrame = next_frame;
    }
    
    Animate(swat_officer, fCurrentFrame, 1, 0, 1);
    

     

    Hopefully this helps anyone else that needs help with this.

  7. I cannot get the animation to play with no recursion. I'm thinking that there is something wrong with the Animate function.

     

    Update:

     

    I wrote a simple program to try and isolate the problem. I can get the animation to work when the recursion parameter is 1 but not when it is 0.

     

    Here is my code in its entirety:

     

    #include "engine.h"
    #include "Framewerk.h"
    
    leadwerks::Framewerk fw;
    TModel swat_officer;
    
    int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd )
    {
    flt next_frame, animationStartTime;
    
    if(!Initialize())
    	return 0;
    
    RegisterAbstractPath("I:\\Leadwerks\\LEAnimationTest\\LEAnimationTest\\Data");
    
    //Create a graphics context	
    Graphics(800, 600);
    
    if( !fw.Create() )
    {
    	MessageBoxA(0,"Failed to initialize engine.",NULL,0);
    	return 1;
    }
    
    fw.SetStats(0);
    
    fw.GetRenderer().SetSSAO( false );
    fw.GetRenderer().SetBloom( false );
    
    fw.GetRenderer().SetDistanceFog(false);
    fw.GetRenderer().SetGodRays(false);
    fw.GetRenderer().SetHDR(false);
    
    AmbientLight(Vec3(0.7f, 0.7f, 0.7f));
    
    PositionEntity(fw.GetMain().GetCamera(), Vec3(0.0f, 0.0f, -250.0f));
    swat_officer = LoadModel("abstract::swat_officer.gmf");
    PositionEntity(swat_officer, Vec3(0.0f, -75.0f, 10.0f));
    
    animationStartTime = AppTime();
    
    while(!KeyHit())
    {		
    	UpdateWorld(AppSpeed());
    
    	fw.Update();
    	fw.Render();
    
    	fw.GetMain().SetWorld();
    
    	next_frame = (AppTime() - animationStartTime) / 30.0f;
    	next_frame = fmod(next_frame, 1 - 200) + 1;
    
    	Animate(swat_officer, next_frame, 1, 0, 0);
    
    	Flip();
    }
    
    return 1;
    }
    

     

    I am using Leadwerks Engine 2.31.

  8. I am trying to animate a character after he dies using the last frame of a death sequence. I cannot get this to work at all. I have some simple code to do this but it looks like the character just sits there at the first frame of animation of the idle sequence.

     

    flt next_frame = 575.0f;
    
    next_frame = (AppTime() - animationStartTime) / frameSpeed;
    next_frame = fmod(next_frame, 575 - 578) + 575;
    
    Animate(m_Entity, next_frame, 1, 0, true);
    

     

    What happens with the code above is that the animation seems to flip from the last frame of the death sequence to the first frame of the idle sequence. Is there any way to feed the Animate function just one frame and have it position the character?

  9. Hey Rick. I don't know of anyone that enjoys using MFC, but I do know how to use it. I have used it a few times to write tools, which is what I want to do with this project. I know how to do it with OpenGL, but I want to write a ragdoll creator/editor for leadwerks. I think it would be better to use Leadwerks and MFC directly rather then using Leadwerks, OpenGL and MFC because the former sounds less bloated and more efficient. I haven't tried it yet with Leadwerks and MFC. I just wanted to see if anyone had any information or if it has been done before.

  10. How do you use the ControllerCrouched function? I know it is similar to the ControllerAirborne function, but with the ControllerAirborne you can apply a force to the controller to get the player to jump, but what do you have to do to the controller when the ControllerCrouched passes 0 back to the calling function?

  11. yes, i got it working ..

     

    this is my old demo: http://pavelrydl.cz/software/char_v12.rar

     

    in new version, there is a bug with velocity, so, it has strange behaviour, when you are falling and crouching, lol

     

    hey wh1sp3r, thanks for the demo. I did get my preliminary implementation done late last night. here are two sets of code, one for the initialization and one the function being called by the crouching event:

     

    
    bool dhPlayer::Init(TVec3 pos)
    {
    TMaterial alphatest_mat, ammo_sample_mat;
    std::vector<int> weapon_list;
    str str_alphatest;
    
    if(m_vStartPosition.X == 0.0 && m_vStartPosition.Y == 0.0 && m_vStartPosition.Z == 0.0)
    	m_vStartPosition = pos;
    
    //	Create(m_vStartPosition);
    PositionEntity(fw.GetMain().GetCamera(), m_vStartPosition);
    standing = CreateController(flt(PLAYER_STANDING_HEIGHT), 12.0f, 35.0f);
    crouching = CreateController(flt(PLAYER_CROUCHING_HEIGHT), 12.0f);
    EntityType(standing, 0);
    SetBodyMass(standing, 85);
    SetBodyGravityMode(standing, 1);
    SetBodyDamping(standing, 50.0f, 50.0f);
    SetBodyFriction(standing, 50.0f, 50.0f);
    
    EntityType(crouching, 0);
    SetBodyMass(crouching, 85);
    SetBodyGravityMode(crouching, 1);
    SetBodyDamping(crouching, 50.0f, 50.0f);
    SetBodyFriction(crouching, 50.0f, 50.0f);
    
    m_iPlayerStatus = PLAYER_STANDING;
    player = standing;
    PositionEntity(player, EntityPosition(fw.GetMain().GetCamera()));
    EntityType(player, COLLISION_PLAYER);
    SetEntityKey(player, "name", "player");
    
    luabind::module(myLuaState) [
       luabind::class_<dhLuaWeaponScript>("dhLuaWeaponScript")
      .def(luabind::constructor<>())
      .def("SetWeaponModel", &dhLuaWeaponScript::SetWeaponModel)
      .def("SetWeaponPosition", &dhLuaWeaponScript::SetWeaponPosition)
      .def("SetWeaponRotation", &dhLuaWeaponScript::SetWeaponRotation)
      .def("SetWeaponFireSpot", &dhLuaWeaponScript::SetWeaponFireSpot)
      .def("SetAttackSound", &dhLuaWeaponScript::SetAttackSound)
      .def("SetReloadSound", &dhLuaWeaponScript::SetReloadSound)
      .def("SetUseSound", &dhLuaWeaponScript::SetUseSound)
      .def("SetWeaponType", &dhLuaWeaponScript::SetWeaponType)
      .def("SetAttackAnimFunc", &dhLuaWeaponScript::SetAttackAnimFunc)
      .def("SetGeneralAnimFunc", &dhLuaWeaponScript::SetGeneralAnimFunc)
      .def("SetMaxClipSize", &dhLuaWeaponScript::SetMaxClipSize)
      .def("SetMaxAmmo", &dhLuaWeaponScript::SetMaxAmmo)
      .def("SetStartAmmoAmount", &dhLuaWeaponScript::SetStartAmmoAmount)
      .def("SetStartClipAmmoAmount", &dhLuaWeaponScript::SetStartClipAmmoAmount)
         .def("PrintWeaponMessage", &dhLuaWeaponScript::PrintWeaponMessage)
      .def("SetReloadDOF", &dhLuaWeaponScript::SetReloadDOF)
      .def("SetReloadDOFStrength", &dhLuaWeaponScript::SetReloadDOFStrength)
      .def("SetFireRate", &dhLuaWeaponScript::SetFireRate)
     ];
    
    luabind::module(myLuaState) [
       luabind::class_<dhLuaPlayerScript>("dhLuaPlayerScript")
      .def(luabind::constructor<>())
      .def("LoadWeapon", &dhLuaPlayerScript::LoadWeapon)
     ];
    
    LoadPlayerScript("abstract::player.lua");
    
    LoadPlayersWeapon(WEAPON_FISTS);
    
    weapon_list = PlayerScript.GetWeaponList();
    
    for(int i=0;i<weapon_list.size();i++)
    {
    	LoadPlayersWeapon(weapon_list[i]);
    }
    
    activation_timer.Initialize();
    activation_timer.AddItem(100);				// For turning flashlight on and off.
    activation_timer.AddItem(100);				// For switching light (in this case) on and off
    g_tCrossHair = LoadTexture("abstract::crosshairb.dds");
    
    //	new_gun.weapon_type = WEAPON_PISTOL;
    
    //	m_tGunList.push_back(new_gun);
    
    //	GUIHealthGroup = LoadTexture("abstract::health_group.dds");
    //	GUIHealthUnits[0] = LoadTexture("abstract::trans_test.dds");
    //	DrawImage(GUIHealthGroup, 400, 400, 156, 104);
    
    //--g_Renderer.SetCurWorld(WLD_FOREGROUND);	--//
    //	fgcam.Create(Vec3(0.0f, 0.0f, 0.0f));
    //	alphatest=CreatePlane();
    
    fw.GetTransparency().SetWorld();
    CreateAmmoHUD();
    CreateHealthHUD();
    fw.GetMain().SetWorld();
    
    //	RotateMesh(alphatest, Vec3(-90.0f, 0.0f, 0.0f));
    //	RotateMesh(alphatest, Vec3(0.0f, 0.0f, 90.0f));
    
    //	PositionEntity(alphatest,Vec3(1.5, -1.7, 2.5));
    //	ScaleEntity(alphatest,Vec3(0.5));
    //	alphatest_mat = LoadMaterial("abstract::alphatest.mat");
    //	PaintEntity(alphatest,alphatest_mat);
    //	HideEntity(alphatest);
    
    //--g_Renderer.SetCurWorld(WLD_MAIN);--//
    
    SetEntityCallback(player, (byte*)EntityCollisionCallback,ENTITYCALLBACK_COLLISION);
    SetEntityCallback(player, (byte*)MessageReceiveCallback, ENTITYCALLBACK_MESSAGERECEIVE);
    SetEntityCallback(player, (byte*)UpdateMatrixCallback,ENTITYCALLBACK_UPDATEMATRIX);
    
    m_sJump = LoadSound("abstract::jump1.wav");
    m_sGrenExplode = LoadSound("abstract::impexp_03.wav");
    
    campivot=CreatePivot();
    CreateFlashLight();
    
    PositionEntity(campivot, EntityPosition(fw.GetMain().GetCamera()));
    
    return true;
    }
    
    void dhPlayer::Crouch(void)
    {
    if(m_iPlayerStatus == PLAYER_STANDING)
    {
    	TVec3 pos = EntityPosition(player);
    	m_iPlayerStatus = PLAYER_CROUCHING;
    	player = crouching;
    	PositionEntity(player, pos);
    	EntityType(player, COLLISION_PLAYER);
    	EntityType(standing, 0);
    	SetBodyGravityMode(standing, 0);
    }
    else if(m_iPlayerStatus == PLAYER_CROUCHING)
    {
    	TVec3 pos = EntityPosition(player);
    	m_iPlayerStatus = PLAYER_STANDING;
    	player = standing;
    	PositionEntity(player, pos);
    	EntityType(player, COLLISION_PLAYER);
    	EntityType(crouching, 0);
    	SetBodyGravityMode(crouching, 0);
    }
    
    SetEntityKey(player, "name", "player");
    SetBodyGravityMode(player, 1);
    }
    

     

    The behaviour I am getting is not desirable. I can crouch the first time just fine but standing back up doesn't work very well. The camera slides back down to the crouching position sometimes. I was wondering if any one could suggest a better method or can see something in my code that would create a problem. Thanks in advance.

  12. There is no crouching state for the controller. You can't scale it on the fly and make it work currently. For now I would suggest storing 2 separate character controller at different heights. One for standing and one for crouching. Then swap them when you need them. I wouldn't create them on the fly either. Create them up front and swap them in when needed. It'll be faster and doesn't really use that much memory.

    That was suggested earlier, but was wondering if anyone had gotten it working or if there was a way of doing easily through the engine. I'm sure Josh said that he was going to look into this, but I guess he has chosen not to at this point. I did start with the implementation that you suggested above and I will revisit it very soon.

  13. I had something similar to this working in earlier version of LE, but now all I get is a black image.

     

    Here is some code:

     

    SaveBuffer(BackBuffer(),filename, 100);
    strcpy(g_strScreenshot, filename);
    g_bScreenshotMsg = true;
    sprintf(temp, "Saved screenshot as: %s", g_strScreenshot);
    AppLog(temp, 0);
    done=true;
    

     

    I am using Framewerk and LE 2.28, do I need to pass a buffer from Framewerk or is using BackBuffer still fine?

  14. Leadwerks 2.3 is the only sold version, therefore I can consider that economically, it isn't, and since development is a directly relational curve to profit, you can consider that LE2.28 is dead.

    I might be wrong, Josh will correct me if I am.

     

    Yeah that's what I thought when it was announced that 2.3 was going to cost money. Josh did say he was going to look into some of the issues people were complaining about and fix them for 2.28, but I guess that isn't going to happen.

×
×
  • Create New...