Jump to content

gamecreator

Members
  • Posts

    4,937
  • Joined

  • Last visited

Posts posted by gamecreator

  1. Yes but with caveats. Last I asked about this (last year) it was possible one of two ways:

     

    1. You control your character, positioning it yourself and doing physics yourself.

    2. You use Leadwerk's physics but put an invisible wall behind and in front of the character so it doesn't go toward or away from the screen (so it's locked into 2D).

     

    This is because last I checked, the physics engine Leadwerks uses doesn't allow you to lock physics to 2D.

     

    This all assumes that you want to use 3D characters/models in your 2D game, like Trine. If you want to use 2D animated graphics/sprites, I'm not sure how good Leadwerks is for that.

  2. Thank you very much for sharing this klepto. I got it to work on the first try (and that's a feat for a beginner like me)!

     

    The only thing I noticed was that the snow texture remained bright white even when the sun was fully gone but I'm guessing that may not have been addressed yet. I also didn't play with any other settings beyond turning up the rate of the sun movement.

     

    Finally, how can this be used in C++ code? Is it possible yet?

     

    Thank you again!!

  3. Pong is the easiest. Then breakout. Then tetris, as Rick mentioned. This article has a few other suggestions.

     

    That said, how are you doing on your RPG? If you've stuck with it for 2 years (which is pretty impressive!) then you seem to be in a good place, having likely overcome quite a few setbacks. You are probably better off sticking with it than abandoning it.

  4. Thank you very much macklebee!! Here's how the one-time switch looks in C.

     

    TMaterial ballmaterial = GetSurfaceMaterial(GetSurface(GetChild(ball,1),1));
    TTexture boxtexture = LoadTexture("data/box1.dds");
    SetMaterialTexture(ballmaterial,boxtexture,0);

    or combined into a single line:

     

    SetMaterialTexture(GetSurfaceMaterial(GetSurface(GetChild(ball,1),1)),LoadTexture("data/box1.dds"),0);

    And thanks again ZioRed as well.

     

    Bonus points to anyone who gets GetEntityMaterial working with this. :) I couldn't get it to do anything but return 0 or crash.

  5. Attached.

    It does have a material file originally and the texture loads properly. With ZioRed's help the material was even switched. Now I'd like to figure out how to switch the ball.dds texture to the box1.dds texture and that's what I'm having trouble with.

     

    Thanks!

    data.zip

  6. The line that causes the crash is this:

     

    SetMaterialTexture(GetEntityMaterial(ball),LoadTexture("data/box1.dds"),0);

     

    Based on what you told me, I suspected that I need to get the material not from ball but from ball's child. So I changed it to this:

     

    SetMaterialTexture(GetEntityMaterial(GetChild(ball,1)),LoadTexture("data/box1.dds"),0);

     

    This doesn't crash immediately and generates a complete log (which doesn't show anything irregular) but the program does still crash when it gets to that line. Here's the complete code:

     

    //    ====================================================================
    #include "engine.h"
    
    #if defined( _WINDOWS )
       void ErrOut( const char* pstrMessage ) { MessageBoxA(0, pstrMessage, "Error", 0 ); }
       int WINAPI WinMain( HINSTANCE hInstance,
                           HINSTANCE hPrevInstance,
                           LPSTR lpCmdLine,
                           int nShowCmd ) 
    #else
       #include <string>
       void ErrOut( const std::string& message ) { puts( message.c_str()); }
       int main( int argn, char* argv[] )
    #endif
    {
       if(!Initialize()) return 1;
    
       RegisterAbstractPath("D:/Programming/Leadwerks Engine SDK");
    
       Graphics(1024,768);
       TFramework fw = CreateFramework();
       if(fw==NULL)
       {
           MessageBoxA(0,"Failed to initialize engine.","Error",0);
           return 1;
       }
       SetGlobalObject("fw",fw);
    
       // Set Lua framework variable
       BP lua=GetLuaState();
       lua_pushobject(lua,fw);
       lua_setglobal(lua,"fw");
       lua_pop(lua,1);
    
       // Get framework main camera
       TCamera camera = GetLayerCamera(GetFrameworkLayer(0));
       PositionEntity(camera,Vec3(2,6,-5));
       RotateEntity(camera,Vec3(45,0,0));
    
       TModel scene=LoadScene("data/scene.sbx");
       TModel ball=LoadModel("data/ball.gmf");
       PositionEntity(ball,Vec3(0.0,2.0,0.0));
    
       PositionEntity(camera,Vec3(0.0,8.0,-5.0));
    
    //    SetMaterialTexture(GetEntityMaterial(ball),LoadTexture("data/box1.dds"),0);
       SetMaterialTexture(GetEntityMaterial(GetChild(ball,1)),LoadTexture("data/box1.dds"),0);
    
       while(!KeyHit(KEY_ESCAPE))
       {
           UpdateFramework();
           RenderFramework();
    
           DrawText(0,100,"children = %d",CountChildren(ball));
    
           Flip(0);
       }
    }

  7. I'm sure I'm doing something incredibly stupid and this should be simple but...

    I load a model like so:

     

    TModel ball=LoadModel("data/ball.gmf");

     

    I then try to put a new material on it:

     

    PaintEntity(ball,LoadMaterial("data/ball2.mat"));

     

    Engine.log shows that the material and the new texture (box1.dds) are both successfully loaded but the ball doesn't change. Any idea why?

     

    I also tried swapping just the texture with this:

     

    SetMaterialTexture(GetEntityMaterial(ball),LoadTexture("data/box1.dds"),0);

     

    But that crashed at the very start of the run (Engine.log was empty).

     

    Anyone know what I'm doing wrong?

  8. In a future version (hopefully with Leadwerks 3 or sooner), could you please include partial settings for Effects Commands? I love the ease with which Bloom, HDR and GodRays can be turned on and off but sometimes it's a bit much and I would like to use a little less than what turning it on provides.

     

    I'm not an advanced user so I don't know how to code shaders. Frankly, despite reading some of the documentation and looking at .vert files and whatnot, I couldn't get a handle on it at first try. So I would love to be able to do something like:

     

    SetBloom(0); (turns Bloom off, like it does now)

    SetBloom(0.5); (turns Bloom on at half strength)

    SetBloom(1.0); (turns Bloom on at full strength)

    SetBloom(2.0); (turns Bloom on at double strength)

     

    Similar for HDR and GodRays. This way the effects can even be modified during runtime depending on where a character is in the game world.

     

    Thanks!

    • Upvote 1
  9. Rest assured that RakNet is a close second on my list. If I crash and burn with Netwerks, it is where I'll turn. I've looked at enet as well (what I understand Netwerks to be built on top of) and though I like its documentation the most of the three, it doesn't seem to have a visible community behind it (does it even have a forum?).

  10. Have you seen the tutorials? They're hardly brief, easy-to-understand-at-first-glance snippets. Even though they're broken up into what should be small segments, like "Creating Packets," each page is stuffed with rules of things you must and can't do to make sure your program works. Hardly an indication of a friendly engine.

×
×
  • Create New...