Jump to content

Vulcan

Members
  • Posts

    92
  • Joined

  • Last visited

Posts posted by Vulcan

  1. After some debugging I found that changing from Sync(false) to Sync(true) then the problem goes away. But should I force users to use VSync? Or is there a better way for those who get higher 60 FPS ?

  2. Have anyone experienced that the player is vibrating after turning when using SetInput() ?

    How do I fix this issue?

     

    In App->Start():

    ...
    // Create the player
    entity = Pivot::Create();
    entity->SetPosition(Vec3(0.0f, 0.0f, 0.0f));
    entity->SetRotation(Vec3(0.0f, 0.0f, 0.0f));
    entity->SetMass(1.0f);
    entity->SetPhysicsMode(Entity::CharacterPhysics);
    // Load model
    model = Model::Load("Models/Characters/Barbarian/barbarian.mdl");
    model->SetParent(entity);
    ...
    

     

    App->Loop():

    ...
    // Calculate new angle
    float angle = 0.0f;
    float a = entity->GetRotation().y;
    float b = (window->KeyDown(Key::D2) - window->KeyDown(Key::D1)) * 10.0f; //turn speed
    angle = a + b;
    // Turn player but this causes vibration looking effect. Hmm??
    // Look at the edge of the sword after stopped turning.
    entity->SetInput(angle, 0.0f);
    ...
    

  3. I want to share with the community a video player that I have been tinkering with lately. Hopefully this will be useful for someone. I wish I could have got the audio streaming to work because the ogg-file has both video and audio data. But instead I made it load a wav-file.

     

    Issues I know about:

    • Memory leak (please help with this issue)
    • No sound streaming (must have separate wav-file)
    • Not yet tested if transparency works

    Note: Click on the upper-middle button to download zip-file.

    https://drive.google.com/file/d/0B1zs1aY8SN3nSm9ObjFaSmtCX28/edit?usp=sharing

     

    Does anyone know if this could use lua bindings to make it work with lua too?

    • Upvote 2
  4. I am looking for detailed information on Leadwerks::Sound. There are a couple of variables I am not sure about.

     

    float length;
    

    Is length in seconds (ie: 1.0f = 1 sec) or is it number of samples?

     

    Also I wonder about format.

    int format;
    

    Is one of those "static const int" below?

     

    Lastly I would like to know if I could/should use BankStream to update Bank* data if I get audio stream from a video decoder?

  5. I have been trying to learn about how TheoraPlay handles sound and found out the sound data is within struct packets called THEORAPLAY_AudioPacket. But so far I haven't figured out how to implement this with Leadwerks. I have looked at Leadwerks header files: Sound.h and Bank.h but seems like "Bank* data" is holding all sound data. My problem is I am not sure how to append more sound data as new sound packets are arriving from TheoraPlay.

     

    audio = THEORAPLAY_getAudio(decoder);
    if (audio)
    {
       printf("Got %d frames of audio (%u ms)!\n", audio->frames, audio->playms);
    
       // <------ How do I add sound data to Leadwerks::Sound ?
    
       THEORAPLAY_freeAudio(audio);
    } // if
    

  6. After reading Game Coding Complete v4 (GCC4), on page 100 the author describes what I find to be a good way to structure the game project. I wish Leadwerks could let me do this because right now I sorta got a ProjectRoot mixed with GameRoot and Assets. So it is not scalable if more people (5+) where to work on a game project.

     

    /ProjectRoot

    + /Assets <---------------------- Folder for raw arts and blender files etc.. (artists got their own version of Source folder)

    +++ /Art ...

    +++ /Models

    +++ /Sounds

    + /Docs <----------------------- Here goes any documentations and game design docs

    + /Game <---------------------- This would be the game-root directory (latest release)

    +++ /Data <----------------------- Main folder for (finalized) game assets

    +++ /Redist ...

    + /Lib <----------------------- 3th party libraries

    + /Source <---------------------- This is the root folder for cpp/h-files

    + /Temp <---------------------- When compiling the project, messy temp files and what not.

  7. I have tryied to get TheoraPlay to work with Leadwerks. I do get pixel data but when trying to assign that data to Leadwerks::Texture then I get a run-time error. How do I remedy this? Only thing I can think of now is to iterate through each pixels but that would probably be slow as turtle.

     

    void TestState::Enter()
    {
    //bunny.ogg: 720x400
    const char* filename = "bunny.ogg";
    int video_w = 720;
    int video_h = 400;
    texture = Texture::Create(nextPow2(video_w), nextPow2(video_h), Leadwerks::Texture::RGB);
    
    THEORAPLAY_VideoFormat vidfmt = THEORAPLAY_VIDFMT_YV12; // <----- Probably wrong format. VLC reports YUV
    THEORAPLAY_Decoder *decoder = NULL;
    const THEORAPLAY_VideoFrame *video = NULL;
    const THEORAPLAY_AudioPacket *audio = NULL;
    decoder = THEORAPLAY_startDecodeFile(filename, 20, vidfmt);
    while (THEORAPLAY_isDecoding(decoder))
    {
     video = THEORAPLAY_getVideo(decoder);
     if (video)
     {
      printf("Got video frame (%u ms)!\n", video->playms);
      texture->SetPixels((const char*)video->pixels); // <------- Runtime error: "Unhandled exception"
      THEORAPLAY_freeVideo(video);
     } // if
     audio = THEORAPLAY_getAudio(decoder);
     if (audio)
     {
      printf("Got %d frames of audio (%u ms)!\n", audio->frames, audio->playms);
      THEORAPLAY_freeAudio(audio);
     } // if
     if (!video && !audio)
      Sleep(10);
    } // while
    if (THEORAPLAY_decodingError(decoder))
     printf("There was an error decoding this file!\n");
    else
     printf("done with this file!\n");
    THEORAPLAY_stopDecode(decoder);
    }
    

    howtovideo.txt

  8. I think Leadwerks should have a video player for the purpose to show intro video and game scenes.

    Yesterday I did make short intro video (6 sec, compressed AVI, ~2 MB) in Blender that was good but did not have an easy way to play this intro when game start.

     

    I suggest having a Cinema class that play a video in window/fullscreen with Play/Stop.

    Cinema* intro = new Cinema("Video/intro.avi");
    if(intro->isLoaded())
    intro->Play();
    intro->Unload();
    delete intro;
    

     

     

    As a temporary solution I made a cinema class and all works pretty well, except for that it takes about ~500 MB. And it uses *.tex files as each frame (0001.tex -> 0099.tex in my case).

    Cinema.txt

  9. After peppering the code to figure what it does I realized that Game::Exit() never was called. I did fix that but now I got an error after using _world->Clear() and then crashes on next _camera statement (when starting the map second time).

     

    _camera->Move(strafe, 0, move);
    

     

    EDIT: How can I reset camera?

  10. I have a created a sample project to replicate the error at Map::Load(). I noticed that different map files gave different results so I decided to include two map files (one that works and one that don't). Also noted that the skybox wasn't showing on one of them.

     

    Look in Game.cpp at Game::Start() where Map::Load error occurs. If someone spots something bad/odd/weird code I would like to know so I could improve my code.

     

    I have uploaded it here (look at the top of page to get download link):

    http://speedy.sh/bCaPE/CrashMapLoad.zip

  11. I ran into a problem with loading map as I use a state machine to switch in and out between main menu and game level. First I didn't notice that the map wasn't unloaded as I thought it was unloaded when that state exited. But when I try to go back second time from menu it crashes and debugger points at Map::Load(..).

    But how do I unload the map (when unloading state) so it could load another map later?

     

    I have tryied with world->Clear() and world->Release() but without luck. How can I overcome this problem?

  12. Thanks, that's exactly what I was looking for!

     

    I've added a build target switch, so console window will only appear on debug build:

     

    #ifndef DEBUG
    #pragma comment(linker, "/SUBSYSTEM:windows /ENTRY:mainCRTStartup")
    #endif
    

    I've put that on top of main.cpp.

    Wow that was lean code. Thanks!
×
×
  • Create New...