Jump to content

elcoo

Members
  • Posts

    31
  • Joined

  • Last visited

Posts posted by elcoo

  1. Unfortunately it doesn't help too much. When developing a game that uses larger worlds (For example: a Flight simulator/Spacesim etc.) than usual indoor scenarios, you will have to see shadows from much farther away. Of course one could simply scale the world down by factor 0.1 or 0.01, but this will result in a loss of precision.

    So what we need is a option to scale the shadow casting distance. I know this will result in more blurry shadows, but that doesn't matter, as you wouldn't be as close to the shadows as in a FPS.

    • Upvote 1
  2. Yes, a soundmanager might be useful, and is used in many modern games to sort sounds by their importance to the player. Some call that HDR Audio.

     

    Still 16 channels seems to small for me. Games like Red Orchestra use up to 128 channels, Battlefield 4 uses 60.

  3. Hi,

    I recently discovered that I'm not able to play more than 16 sounds at once. Using

    SoundDriver::GetCurrent()->GetMaxChannels()
    

    Returns 16.

    I can't imagine that OpenAL or my soundcard (Asus Xonar DX) is limited to 16 channels.

     

    16 sounds at once is insufficient for any moderatly advanced game in my opinion. Every shooter that has a little bit of action going on is going to play far more than 16 sounds at once.

     

    Any tips what's wrong here? Is it a fault on my side, is it a bug?

    • Upvote 2
  4. Shadmar,

    thanks for your example! Unfortunately the problems I described still apply to it. As soon as you enable Multisampling, a visible edge appears arround the foreground objects. And the specular lighting changes with the camera rotation, which it obviously shouldn't do.

  5. I've gotten closer to a solution:

     

    //Header:
    #pragma once
    #include "Leadwerks.h"
    using namespace Leadwerks;
    class App
    {
    public:
    Leadwerks::Window* window;
    Context* context;
    World* world;
    Camera* camera;
    Camera* camera2;
    Buffer* mainbuffer;
    Buffer* foregroundbuffer1;
    World* world2;
    Texture* foregroundtexture1;
    App();
    virtual ~App();
    virtual bool Start();
    virtual bool Loop();
    };
    //CPP:
    #include "App.h"
    using namespace Leadwerks;
    App::App() : window(NULL), context(NULL), world(NULL), camera(NULL) {}
    App::~App() { delete world; delete window; }
    Vec3 camerarotation;
    #if defined (PLATFORM_WINDOWS) || defined (PLATFORM_MACOS)
    bool freelookmode=true;
    #else
    bool freelookmode=false;
    #endif
    bool App::Start()
    {
    //Initialize Steamworks (optional)
    /*if (!Steamworks::Initialize())
    {
    System::Print("Error: Failed to initialize Steam.");
    return false;
    }*/
    //Create a window
    window = Leadwerks::Window::Create("spectest");
    
    //Create a context
    context = Context::Create(window);
    
    //Create a world
    world = World::Create();
    //Create a camera
    camera = Camera::Create();
    camera->Move(0,2,-5);
    camera->SetMultisampleMode(4);
    
    //Hide the mouse cursor
    window->HideMouse();
    mainbuffer = Buffer::GetCurrent();
    foregroundbuffer1 = Buffer::Create(context->GetWidth(), context->GetHeight(), 2, 0);
    foregroundtexture1 = Texture::Create(context->GetWidth(), context->GetHeight(), Texture::RGBA, 0, 1, 0);
    foregroundtexture1->SetFilter(Texture::Smooth);
    foregroundbuffer1->SetColorTexture(foregroundtexture1);
    foregroundbuffer1->Disable();
    Model* b = Model::Box();
    b->SetColor(Vec4(0, 0, 1, 1));
    b->SetPosition(Vec3(2, 0, 2));
    Light* l = DirectionalLight::Create();
    l->SetRotation(Vec3(45, 45, 45));
    //Move the mouse to the center of the screen
    window->SetMousePosition(context->GetWidth()/2,context->GetHeight()/2);
    world2 = World::Create();
    World::SetCurrent(world2);
    Model::Box()->SetColor(Vec4(1,0,0,1));
    camera2 = Camera::Create();
    camera2->Move(0, 2, -5);
    camera2->SetClearColor(Vec4(0,1,0,0));
    camera2->SetMultisampleMode(4);
    l = DirectionalLight::Create();
    l->SetRotation(Vec3(45,45,45));
    return true;
    }
    bool App::Loop()
    {
    //Close the window to end the program
    if (window->Closed()) return false;
    
    //Press escape to end freelook mode
    if (window->KeyHit(Key::Escape))
    {
    if (!freelookmode) return false;
    freelookmode=false;
    window->ShowMouse();
    }
    
    if (freelookmode)
    {
    //Keyboard movement
    float strafe = (window->KeyDown(Key:) - window->KeyDown(Key::A))*Leadwerks::Time::GetSpeed() * 0.05;
    float move = (window->KeyDown(Key::W) - window->KeyDown(Key::S))*Leadwerks::Time::GetSpeed() * 0.05;
    camera->Move(strafe,0,move);
    //Get the mouse movement
    float sx = context->GetWidth()/2;
    float sy = context->GetHeight()/2;
    Vec3 mouseposition = window->GetMousePosition();
    float dx = mouseposition.x - sx;
    float dy = mouseposition.y - sy;
    //Adjust and set the camera rotation
    camerarotation.x += dy / 10.0;
    camerarotation.y += dx / 10.0;
    camera->SetRotation(camerarotation);
    //Move the mouse to the center of the screen
    window->SetMousePosition(sx,sy);
    }
    camera2->SetMatrix(camera->GetMatrix());
    Leadwerks::Time::Update();
    Buffer::SetCurrent(mainbuffer);
    world->Update();
    world->Render();
    foregroundbuffer1->Enable();
    Buffer::SetCurrent(foregroundbuffer1);
    world2->Update();
    world2->Render();
    foregroundbuffer1->Disable();
    Buffer::SetCurrent(mainbuffer);
    context->SetBlendMode(Blend::Alpha);
    context->DrawImage(foregroundtexture1, 0, 0);
    context->Sync(false);
    
    return true;
    }
    

     

    As you can see the red Box is always in the foreground now, as it's drawn after the blue box. However you'll notice the edge around the red box which appears when multisampling is enabled. I set the clear color to green so it's more visible.

     

    Also theres a problem with specular lighting. For the blue box, everything is ok, but if you take a closer look at the red box, you'll notice the specular light changing with the rotation of the camera.

     

    Any tips?

     

    Edit:

    In case it's unclear what I'm aiming for, this is exactly what I need:

     

    http://www.leadwerks.com/files/Tutorials/CPP/Rendering_Sky.pdf

     

    Unfortunately this Tutorial is LE2 only.

  6. Hi,

    I was trying to render a background like I was used to from LE 2.5.

    I basicly have 2 worlds: One main world and one background world. The Background would be rendered first, then the main world directly after it, like this:

     

    background_camera->SetRotation(camera->GetRotation(1), 1);

     

    background_world->Update();

    background_world->Render();

     

    world->Update();

    world->Render();

     

    context->Sync(false);

     

    I set the main camera clear color to transparent, like this:

     

     

    camera->SetClearColor(Vec4(0, 0, 0, 0));

     

     

    But the clear color doesn't seem to be transparent. The background isn't visible at any point, even if there is not a single object in the main world.

     

    What am I doing wrong?

  7. Hi,

    is it possible to create leadwerks roads from within the game code? I am able to load the road_node.gmf via LoadModel, but I fail to see how to connect those nodes so that they form a surface. Or is it only possible to do so in the sandbox?

    Thanks in advance!

  8. I got on experimenting with some other stuff in the meantime, but now I'm stuck again with the same problem. Can it really be that there is no way to get the true current position of a body? I worked with physics engines before and I see multiple scenarios were it would be essential to get the real position of a body and not a interpolated one. For example networking, limited movement etc.

  9. Doing some further enquiries I saw that it's possible to use the newton game dynamics commands directly. But how do you get the pointer to the newton objects? As far as I know attributes of the type TBody only are references to the Leadwerks entities. I'm using C++ btw.

  10. Found a dirty fix for the problem: The force was indeed applied at wrong positions as the physics interpolation wouldn't let me know where the body really is, it just showed me the visualized position. So a friend of mine told me to try and put this line:

    PositionEntity(p->hullBody,EntityPosition(p->hullBody,1),1);
    

    Between UpdateFramework() and RenderFramework(). Even though this call seems redundant and it's dirtier than Woodstock '94, it fixed the problem and my plane flies just like I wanted it too. Might post a vid of it soon.

    If you got any cleaner fix for this though, let me know smile.png

     

    EDIT: As I already suspected, this fix causes some other major problems, especially if the Framerate drops or rises. So what I need is a way to get the exact position of the body. Not the position of the mesh, nor the interpolated position of the physical body. I need to get the raw position of the body, the one that is shown to me in wireframe when I activate debugphysics. How can I get this?

  11. Hi Andy,

    I already am calculating the forces for each important point of the aircraft at the specific positions. This works good for the ruders, but not for the main wings, which have to deal with bigger forces. I think the reason could be, that the point I apply the force at might be somewhat behind the actual position of the body. I have to figure that out with callbacks I guess.

    Cool video you got there btw.. The flight dynamics look very believable! I'm gonna read through some of your posts, maybe I'll find some useful tips :D

  12. Hi there,

    am I right when I say the following two lines should do the same to the affected body? (Center of mass is at point zero)

     

     

    AddBodyForce(p.hullBody,Vec3(0,GetBodyVelocity(p.hullBody,0).Y,0)*-1000,0);
    
    AddBodyForceAtPoint(p.hullBody,TFormVector(Vec3(0,GetBodyVelocity(p.hullBody,0).Y,0)*-1000,p.hullBody,NULL),EntityPosition(p.hullBody));
    

     

    Because they seem to behave different. I'm trying to use AddBodyForceAtPoint as shown above in a plane simulation but as soon as I use it the plane doesn't seem to have as much lift as it had with AddBodyForce. If I just turn up the force It starts behaving jerky and jittery. Using AddBodyForce works just fine but I need to ajust the point where the force is added for a more precise simulation.

  13. Thanks, that helped at least for that problem. I ran right into the next one though I guess. I forgot to mention that I also need alphablending for vegetation. As far as I'm concerned you cannot apply scripts to vegetation, can you?

    Edit: Also: Can you set the world for a surface after it is created?

  14. Hi,

    I read the transparency and refraction tutorial and I understood that you have to render transparent materials after you rendered the lighted scene, so that you would see lighting effects through the transparent object. How do I achieve this in the sandbox? As far as I know the sandbox already has back and foreground worlds, is that right? Or how else do the atmosphere and particles work?

  15. I'm not sure if this is a bug or it's just me doing something wrong. In the sandbox, there are no Particle effects visible. That means the firepit just emits light but no particles and no haze effect. Also the smoke generated by bullets or the tires of the example gamescripts is not visible. This worked before I couldn't find the reason why it isn't anymore. Has anyone had that problem before?

  16. That was a fast answer, thank you!

    Regarding question No. 1:

    I understand your point! Although it's a bit unclear to me when exactly you consider something "modifiyng the application". Sticking with the car game example: If I enable users to do their own cars, with some 3D and texturing software etc, that would be against the EULA, right? What about an ingame car editor, like in Need For Speed for example, where you can change the engine, wheels, paint etc?

    Don't get me wrong, I'm not planning on doing some kind of game development kit, I just don't want to get in trouble with your EULA. I'd hate to be ready to release some game, just to find out I'm not allowed to because of some paragraph I understood wrong.

  17. Hi,

    I played around for only three days with the evaluation kit now, and I'm already pretty convinced I'm going to buy Leadwerks. Before I purchase I wanted to clear these 3 questions though:

     

    1. Let's say I'm about to do some car game. Do I understand correctly, that I'm not allowed to make it moddable, so that users could create their own cars, even though the mod mechanics are done by me?

    I'm reffering to this paragraph in the EULA:

    You may use the SOFTWARE PRODUCT to create computer game software and 3D modeling software for personal or commercial use. You may not create any programmable, scripted, or GUI-driven game engine or game creation system. You may not create a 3D game or other application that is modifiable by script, programming, GUI interface or other means, unless the system requires the end user to also own a valid license for the SOFTWARE PRODUCT.
    

     

    2. I read LE 3 will be done soon. If it is released, will there be an upgrade available, so I do not have to pay full price for it if I already own LE 2?

    3. When LE 3 is released, will I be able to port my work done in LE 2 easily, or will there be no backwards compability?

×
×
  • Create New...