Jump to content

Josh

Staff
  • Posts

    23,313
  • Joined

  • Last visited

Posts posted by Josh

  1. 1. Replacing o's with e's is cute, but I don't think the engine API commands should be misspelled.

    2. You can use the existing leadwerks.framewerk module if you want. It's the same code.

    3. BlitzMax can't compile a module named "framework" so it isn't going to be distributed as a module. Complain to BRL if you don't like this.

     

    All in all, this really makes no difference to BMX users, so nothing was gained or lost.

  2. when I place it nothing seems to happen like it should

    What doesn't happen like it should? Your coffee maker starts squirting gravy? The purple cats outside your window fly upside-down? Be specific. :lol:

     

    If you mean that your script has no effect, Lua can't run a file from a .pak file, since that is our convention, and Lua doesn't know what it is. I think the best solution is probably to have the engine search for any script by the right name, if one is not found in the same folder as the model. There are reasons for doing the file directly instead of loading the string and passing that to Lua. Only the lua_dofile() command can run a compiled Lua script. It also make debugging easier, because Lua knows what file it is running, and can pass that information back in any error messages that occur.

  3. It actually doesn't matter where on the drawer the pivot is, as long as the tag you place in the desk mesh matches the position of the drawer pivot, so the drawer appears in the right place.

  4. Here, the program creates a skybox just by loading the environment_atmosphere model. Make sure you have the scripts folder copied to your project directory:

    //	====================================================================
    //	This file was generated by Leadwerks C++/LEO/BlitzMax Project Wizard
    //	Written by Rimfrost Software
    //	http://www.rimfrost.com 
    //	====================================================================
    
    #include "engine.h"
    
    int main( int argn, char* argv[] )
    {
    Initialize() ;
    RegisterAbstractPath("C:/Leadwerks Engine SDK");
    SetAppTitle( "luatest" ) ;
    Graphics( 800, 600 ) ;
    AFilter() ;
    TFilter() ;
    
    TWorld	world;
    TBuffer gbuffer;
    TCamera camera;
    TMesh	mesh;
    TLight	light;
    TMesh	ground;
    TMaterial material;
    
    world = CreateWorld() ;
    if (!world) {
    	MessageBoxA(0,"Error","Failed to create world.",0);
    	return Terminate();
    }
    
    TFramework framework=CreateFramework();
    TLayer layer = GetFrameworkLayer(0);
    camera=GetLayerCamera(layer);
    PositionEntity(camera,Vec3(0,0,-2));
    
    //Set Lua variable
    BP L=GetLuaState();
    lua_pushobject(L,framework);
    lua_setglobal(L,"fw");
    lua_pop(L,1);
    
    LoadModel("abstract::environment_atmosphere.gmf");
    
    material=LoadMaterial("abstract::cobblestones.mat");
    
    mesh=CreateCube();
    PaintEntity(mesh,material);
    
    ground=CreateCube();
    ScaleEntity(ground,Vec3(10,1,10));
    PositionEntity(ground,Vec3(0,-2,0));
    PaintEntity(ground,material);
    
    light=CreateDirectionalLight();
    RotateEntity(light,Vec3(45,45,45));
    
    
    
    
    // Game loop
    while( !KeyHit() && !AppTerminate() )
    {
    	if( !AppSuspended() ) // We are not in focus!
    	{
    		// Rotate cube
    		TurnEntity( mesh, Vec3( 0.5f*AppSpeed() ) ) ;
    
    		// Update timing and world
    		UpdateFramework();
    
    		// Render
    		RenderFramework();
    
    		// Send to screen
    		Flip(0) ;
    	}
    }
    
    // Done
    return Terminate() ;
    }

    • Upvote 1
  5. //	====================================================================
    //	This file was generated by Leadwerks C++/LEO/BlitzMax Project Wizard
    //	Written by Rimfrost Software
    //	http://www.rimfrost.com 
    //	====================================================================
    
    #include "engine.h"
    
    int main( int argn, char* argv[] )
    {
    Initialize() ;
    RegisterAbstractPath("C:/Leadwerks Engine SDK");
    SetAppTitle( "luatest" ) ;
    Graphics( 800, 600 ) ;
    AFilter() ;
    TFilter() ;
    
    TWorld	world;
    TBuffer gbuffer;
    TCamera camera;
    TMesh	mesh;
    TLight	light;
    TMesh	ground;
    TMaterial material;
    
    world = CreateWorld() ;
    if (!world) {
    	MessageBoxA(0,"Error","Failed to create world.",0);
    	return Terminate();
    }
    
    TFramework framework=CreateFramework();
    TLayer layer = GetFrameworkLayer(0);
    camera=GetLayerCamera(layer);
    
    PositionEntity(camera,Vec3(0,0,-2));
    
    material=LoadMaterial("abstract::cobblestones.mat");
    
    mesh=CreateCube();
    PaintEntity(mesh,material);
    
    ground=CreateCube();
    ScaleEntity(ground,Vec3(10,1,10));
    PositionEntity(ground,Vec3(0,-2,0));
    PaintEntity(ground,material);
    
    light=CreateDirectionalLight();
    RotateEntity(light,Vec3(45,45,45));
    
    
    
    // Game loop
    while( !KeyHit() && !AppTerminate() )
    {
    	if( !AppSuspended() ) // We are not in focus!
    	{
    		// Rotate cube
    		TurnEntity( mesh, Vec3( 0.5f*AppSpeed() ) ) ;
    
    		// Update timing and world
    		UpdateFramework();
    
    		// Render
    		RenderFramework();
    
    		// Send to screen
    		Flip(0) ;
    	}
    }
    
    // Done
    return Terminate() ;
    }

  6. It's just a limitation of the way the renderer works. 3D World Studio is designed to work on very old graphics hardware, and it doesn't have very good blending abilities. This won't affect how the terrain looks when you run it in DBPro or another program.

  7. The green one is correct. Just make sure the pivot you add for the drawer in the desk model is in the same place.

     

    The type of drawer should be a separate model, with a convex hull .phy file. If any drawers are the same, I can load another copy of the model.

     

    Here's what I am going to do in code:

    drawerpivot=object.model:FindChild("drawer")
    drawer=LoadModel("abstract::furniture_desk_drawer1.gmf")
    drawer:SetPosition(drawerpivot:GetPosition(1),1)
    drawerjoint=CreateJointSlider(object.model,drawer,Vec3(0,0,1)
    drawerjoint:SetLimits(0,0.6) --or whatever amount looks good

    The doors in the tunnels scene will open like Penumbra if you just fly up to them in the editor, hold the shift key, and click and drag them with the mouse.

     

    I would not worry about LOD at this point. Let's see if this even works first!

     

    Looks pretty nice so far.

  8. There's an update available now. This compiles the Framework commands into the main engine so that Lua can access the entire framework command set. C++ programs will now more closely resemble the results you see in the editor, because water, sky, and other settings can be controlled with Lua and any programming language.

    • Upvote 1
  9. This example shows how to use BlitzMax, Framework, and Lua together seamlessly! ;)

     

    Framework is a little different from the main engine. Although it is compiled into the DLL, it is not compiled into the engine module. This allows the programmer to make their own customizations to the code. However, it also means we have to generate a code file of glue functions for Lua to be able to access the Framework commands. The attached example shows how to do this. You can also use this method to expose your own BlitzMax types to Lua!

     

    Any time your command set changes, you need to regenerate the Lua glue code. This is done by commenting out the line that includes the glue code, and uncommenting the code that generates it:

    'Include "lua-gluefunctions.bmx"
    generateGlueCode("lua-gluefunctions.bmx")
    End

    Then switch the comments back to run the program:

    Include "lua-gluefunctions.bmx"
    'generateGlueCode("lua-gluefunctions.bmx")
    'End

    This allows your Lua scripts to access the entire framework command set, as well as your own types.

     

    You also need to set the value of the global Lua variable "fw". This is done with the included SetScriptObject() function, which just uses Lua commands to set a variable.

     

    The Framework code is distributed as code files instead of a module, mostly because BlitzMax does not allow compiling a module with the name "Framework".

    fwtest.zip

  10. Yeah, I think this is a good idea. Maybe an SBX can be saved as a model + automatically generated script. Until then, I recommend creating pivots in the mesh, and then using FindChild() to see where the lights should be positioned.

  11. Ha, that is brilliant! You could start with a photo and have a program that enters all the unique values into an image to make the palette. ;)

     

    Here's my attempt. I just resized the image (using pixel resize, so there is no blending of colors). I scaled it back up so it was easier to see.

     

    post-1-12621258520475_thumb.jpeg

  12. Solutions like that result in loss of resolution, which is why things start looking washed out instead of warm. We want consistency of similar hues, not a loss of resolution.

     

    Notice the colors are different, but look somehow consistent:

    transformers-the-game-screenshot-big.jpg

     

    Here's a good example of "random colors syndrome":

    2029.jpg

     

    Here is the same image multiplied by an orange tint. This looks like a lot of the screenshots I have seen. Even though the tint sort of forces it to look consistent, there is a loss of resolution and the odd colors still look odd:

     

    post-1-12621227445257_thumb.jpg

     

    Relying too much on colored lighting only washes out detail and makes everything look muddy.

×
×
  • Create New...