Jump to content

ZioRed

Members
  • Posts

    1,133
  • Joined

  • Last visited

Posts posted by ZioRed

  1. I have tried to load a font with the following statement (I haven't understood what is and how to value the last parameter "charset", I tried with "0" and "1" and saw no difference):

     

    Font font = Font.Load("abstract::Arial12Shadow", 10, 0, 0);

     

    This line causes the following error:

     

    A call to PInvoke function 'Leadwerks!Leadwerks.Core::LoadFont' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.

     

    Now the problem seems to be in the source when calling Core.LoadFont(path, size, flags, charset)

     

    Anyone has the font loading working with the last wrapper headers?

     

    PS: with the C++ code it works:

    SetFont(LoadFont("abstract::Arial12Shadow"));

  2. As already suggested elsewhere, the C# wrapper could be stored in a SVN (closed to commit for whom you want) so that can be easily and deeply supported by the C# community (including me, I code with C# for every kind of work :)).

  3. Really I don't know and never tried that (cannot see how it may be useful since generally in a game you have GMF models for everything and so why just don't simply use the standard way?), but I think that loading a specific script for an entity other than the default way (file named same as GMF model) is not possible... But I am newbie (or less) in lua scripting, so I may be in fault.

     

    However I've found this example in which the author loads a lua script from C++

  4. That function already works with any file types, I tried to use "mytestfile.pdb" and it worked (that file was in a zip archive).

     

    EDIT: Oh, are you talking about working directly with the files contained in a zip archive? Well then I don't know how the engine load the files without extracting, but you can extract them or try to achieve the same result without extract.

  5. May be:

    string filePath = Leadwerks.FileSystem.GetAbsolutePath("abstract::yourmodel.gmf")

     

    It should be the absolute file path (I suspect it may run in trouble if you have more files named "youmodel.gmf" in the example, that is it may not return the path to what you expected), then you can open it with the System.IO functions.

  6. Is there any way to catch the Engine.Terminate()? Since I'm working to a client/server MMO with persistent world I'd need not to quit the game when engine terminates but only free its stuff and return back to login window (I use simple NET Window Form as login window because I don't know any C# GUI to use within the engine, if someone know any C# GUI that I can use please suggest).

  7. I think the lights in the editor (and probably every object you drag from the sidebar) are really models and their behaviour of "creating light" is due to the LUA scripts (see in example at /Models/Entities/Light/Directional/light_directional.lua in your SDK folder).

     

    If you load a scene in which you already have added some lights than I think you don't need to recreate the same lights in your C++ code but you have LUA enabled (see the Scene Loading Example thread):

     

    TFramework framework=CreateFramework();
    //Set Lua variable
    BP L=GetLuaState();
    lua_pushobject(L,framework);
    lua_setglobal(L,"fw");
    lua_pop(L,1);
    

     

    However I think this thread should be in C++ Programming section B)

  8. NET 4.0 rulez, it's a perfect enhancement to 3.5 where I really loved LINQ features for tens of code lines it saves to us (i.e. no more annoying foreach cycles to select items from collections). :)

  9. I can't keep my controller on the scene. Can you post your code?

    Something like:

    Collisions(1, 2);
    TEntity scene = LoadScene("abstract::yourscene.sbx");
    EntityType(scene, 2);
    TController player = CreateController();
    EntityType(player, 1);
    SetBodyMass(player, 1);
    

  10. You should not love C#, but C++.

    Well I may love C++ when I will be enough forward in my training with it, but atm after almost 10 years of NET programming there is no comparable language as easy but powerful as NET... C++ is really too complex for me now, I must admit that it is really more powerful in term of performance etc but I still know too few about it to appreciate more. :)

  11. Well, I'm testing the wrapper just now to use for my project (since I don't like C/C++ and love C#) with the 1.2 beta version downloadable from that thread and it doesn't occur any error. If you are on a x64 machine perhaps you should use x86 build configuration (building x64/AnyCPU configuration it raised some errors on my Windows 7 64-bit). I used the code from the "C# Getting started" page on wiki, only using 800x600 as resolution instead of 640x480 and creating a Windows Form Project instead of a Blank Solution (still you need to copy the DLLs, shaders.pak and Scripts from LE SDK folder to your build executable folder).

  12. The downloadable map RAR in the topic contains the .SBX, .DDS and .RAW, it should be all: download here.

     

    Thank you in advance and sorry, I'm trying to code my first game at all :)

     

    PS: I'm almost thinking to ask for hire (pay per hour) someone from the community to help in this first times until I good understand how to play with the engine by myself.

  13. Well I changed something as suggested and now the code is the following:

     

    TEntity light = CreateDirectionalLight();
    RotateEntity(light, Vec3(45, 35, 0), 0);
    LightRange(light, 500);
    SetShadowmapSize(light, 1024);
    SetShadowDistance(light, 6, 0);
    SetShadowDistance(light, 20, 1);
    SetShadowDistance(light, 100, 2);
    AmbientLight(Vec3(0.6));
    

     

    But the result is the following:

    immagine2p.th.png

     

    As you can see it is still darker as regards to the editor:

    editor.th.jpg

     

    Particularly regarding the "white" light on the mountains. What am I still doing wrong? :mellow:

  14. I have tried to to use Gamelib but with no success to achieve the editor graphic quality:

     

    game.scene.LoadMap("abstract::mappaprova2.sbx");
    AmbientLight(Vec3(1));
    EntityShadowMode(game.scene.terrain,1);
    

     

    Can someone try to achieve it and post me the code please (using the map linked in the topic and possibly using standard LEO) so I can learn what I'm doing wrong? ;)

  15. You need to enable terrain shadows.

    The terrain is a child of the scene entity.

    I suppose you're talking about calling SetShadowMode(1) to the terrain entity (or not? I already tried calling that method on the character which is of Mesh type but it don't appear with shadow on the body as it seems in the editor using the crawler sample GMF), so I tried to reproduce the GetFirstEntityByKey function of Gamelib into LEO (that I like more than procedural calls) but I fall into access violation errors.

     

    The following are how I wrote them:

    struct TKeyData
    {
    str key;
    str value;
    Entity result;
    };
    
    int _stdcall GetOneEntity(Entity e, TKeyData *data)
    {
    int i = 0;
    if(NULL==data->result)
    {	
    	std::string s;
    	s = e.GetKey(data->key, "nothing");
    	if(s==data->value)
    	{
    		data->result=e;
    		return 0;
    	} else return 1;
    } else return 0;
    }
    
    Entity GetFirstEntityByKey(Entity e, str key, str value)
    {
    TKeyData data;
    data.key=key;
    data.value=value;
    data.result=NULL;
    e.ForEachDo((BP)GetOneEntity, (BP)(TKeyData*)&data,ENTITY_MODEL);
    return data.result;
    }
    

     

    then I tried to call:

    Terrain terrain = (Terrain)GetFirstEntityByKey(scene, "class", "Terrain");

     

    but the client stops giving the access violation on the last line of GetFirstEntityByKey ("return data.result")... I'm doing errors somewhere?

  16. When I load a SBX scene in the code, I don't succeed to achieve the same quality as the same scene is rendered in the editor expecially for the shadows.

     

    This is a portion of the scene rendered in the editor:

    editor.th.jpg

     

    This is almost the same portion rendered in the client code:

    clientn.th.jpg

     

    The code I used to load the scene is the following:

     

    TBuffer gbuffer = CreateBuffer(AODO_GAME_DEF_WIDTH, AODO_GAME_DEF_HEIGHT, BUFFER_COLOR | BUFFER_DEPTH | BUFFER_NORMAL);
    TBuffer lightbuffer = CreateBuffer(AODO_GAME_DEF_WIDTH, AODO_GAME_DEF_HEIGHT,BUFFER_COLOR | BUFFER_DEPTH);
    
    // Set graphic quality
    SetTextureQuality(1);
    TFilter(1);
    AFilter(4);
    fw.renderer.SetBloom(true);
    fw.renderer.SetHDR(1);
    
    DirectionalLight light;
    light.Create();
    light.SetPosition(Vec3(0, 1, 0), GLOBAL);
    light.SetRotation(Vec3(44.9999924,34.9999924,2.14186755), GLOBAL);
    
    Scene scene;
    scene.Load("abstract::mappaprova2.sbx");
    scene.SetType(2);
    
    fw.main.GetWorld().SetAmbientLight(Vec3(1));
    light.SetColor(Vec4(0.15));
    

     

    EDIT: the SBX scene contains the environment Ambient entity, you can download the scene here.

  17. The new homepage content is really nice, perhaps you could/should move the Flash media content just after the "Latest news" box to solve the "hidden hover menu" (unfortunately it's impossibile in the browser rendering to write any HTML/CSS/Javascript content over a flash content, as you can see trying to move your mouse over the menu in the home), or even trying to replace the flash with some jquery implementation (there are some examples of similar boxes on the net).

  18. About Dexsoft packs, I have recently purchased the fantasy House and Blacksmith packs, but when I tried to insert the houses in the Leadwerks Editor I didn't succeeded to activate a correct physic for collision (even if I set collision to "Scene" in their properties and tried to re-create the .phy file with the LE phy-tool) and the character pass through the house walls. I'd like to know if any other purchased the medieval houses from them and succeeded to have collisions work (and how).

  19. I generally just use LoadMesh() instead of LoadModel() since the character controller is acting as your physics body.

    I'm following this way, but now I'm trying to figure out how to rotate the controller when the body mesh is turned in a direction.

     

    This is my scenario: when I hold down the right mouse button my body mesh turn into the inverted camera direction but of course the controller will not. This is the code (before framework update method call):

    if (Mouse::IsDown(RIGHT))
    {
    body.SetRotation(camrotation);
    body.Turn(Vec3(0, 180, 0));
    }
    

    I have tried to call the following line both just inside that "if" and after the framwork Update method but without luck:

    player.SetRotation(body.GetRotation());

    What happens is the mesh flickering or turning from left to right position. Any thoughts or suggestion?

×
×
  • Create New...