Jump to content

helmers

Members
  • Posts

    11
  • Joined

  • Last visited

Posts posted by helmers

  1. Hi,

     

    after spending some time searching for the reason for the crash (the program crashes during UpdateFramework(), a while after the callbacks have been called!), I found the following:

     

     

    Naivly I called during the collision callback method the GetEntityKey() method to get the name of the collided objects (for test purposes). This seems to be the reason that the program crashes some time later in the UpdateFramework() method. Without any call to the engine from within the callback the program runs fine. Tried also other engine methods with the same effect.

    Seems that reentrency is not an option.

     

    The WIKI and also the tutorials say nothing that engine calls are forbidden! But I noticed that the tutorial example also avoids calling any engine methods. Coincidence?

     

    So if this is the official rule I would like to now whether this is true for all callbacks. I would then like to make some additions to the WIKI. Otherwise I would raise a bug report.

     

    It also seems that the callback is called for all collisions not only for the entity it is registered on! Also a bug or a feature? Description at least is different from reality.

     

    by the way I am talking about 2.31

  2. Hi,

     

    sorry to revive the thread, but it seems I do have the same/simmilar issue in C# right now.

    I try to implement the particle example with the framework and only get a zero message bow during RenderFramework.

    The other examples worked good so far.

     

    I am working still on 2.31 by the way. An I also tried the trick with the transparency world.

     

    So is this bug still open?

  3. Hi,

     

    I bought LW some days before and am now in the process of writing my own C# layer on top of Leadwerks.

     

    As a good street to walk I use the tutorials in the wiki to build it up, up step by step.

     

    Now I want to 'convert' the particle tutorial to my wrapper, but I can not get access to the provided files!

    When I want to download the zip (and this is also true for some other tutotial asset files) I get a dialog that wants me to login. I tried my forum login and my wiki login. Neither worked!

     

    Could someone please tell me how to proceed?

    Do I have to contact Josh personally to provide a login?

  4. mmh.. perhaps I remember wrong, but I thought that, when passing structs to a method, a copy of the struct is passed to the function, while passing a class a reference is passed. If it is so (as it seems from here), then I see no performance improvement changing "class" to "struct".

     

    Am I wrong?

     

    You are on the right track!

     

    With the 'ref' keyword you force the .NET runtime to put the "pointer" of the struct on the stack and not a copy of the contents. So you can enforce the same speed as when you use a class instead of a struct. Of couse this is not very 'nice' code because it has the side effect that you can chenge the callers value in the called method (thats what calling by reference is originally for). But when doing loops I think that performance is worth the less readable code.

    Even Microsoft itself uses this trick in their XNA library, where for nearly all mathematical method (involving Vector or Matrix) exists a "normal" method but also a "by ref" method.

     

    The trick with the "sequential" attribute simply defines that the fields for x,y and z are in this order, so that we can directly map the Vector3 struct to a pointer in the stdcall method. So we do not need any longer the Vector3.ToFloatArray() method.

  5. I have made my first steps with using the header today. :)

    I work with my own header that is based on the 1.3b header.

    Took me some days to add all the XML help tokens to all methods (>1300!!) but now I have the intellisense support for the methods and its parameters.

    I have made up to now only minor changes to the classes/methods so the following results should also apply to the current/official header.

     

    I started with the Control example and crashed after the first few calls to the collision callback.

     

    I found two problems.

     

    1. The collision callback header has the wrong parameters.

    In my version (2.31) of the C headers the force parameter is a vector and no float.

    And there is an additional parameter: float speed.

     

    This still did not resolve the crash.

     

    2. The mapping between the Vector3 and the byte* is not correct.

    Here I would suggest the following improvement:

     

    The Vector3 (and also the other Vector/Matrix classes) should be declared like this

     

    [structLayout(LayoutKind.Sequential)]

    public struct Vector3

    {

    private float m_X;

    private float m_Y;

    private float m_Z;

     

    Then one could declare the passing of vectors in the callback as

     

    public delegate void EntityCollisionCallback([MarshalAs(UnmanagedType.SysInt)] IntPtr entity1,

    [MarshalAs(UnmanagedType.SysInt)] IntPtr entity2,

    ref Vector3 position,

    ref Vector3 normal,

    ref Vector3 force,

    float speed);

     

    This did the job for me and there is no longer any memory corruption during the callback.

    The same should also work for the normal methods (not only callbacks).

    This should also improve performance as no copying of the float array is needed.

     

     

    There has been suggested to start a project for the wrapper on sourceforge, codeplex, ...

    This should really happen as I have the feeling that the header needs the joined effort to improve it.

    One problem with this is that there are two equally valid ways to go:

     

    I think the way klepto2 is going is to keep the classes as close to the C/C++ original as possible.

    That makes the use of samples from other languages easier and helps to maintain the code when new versions of LE become available.

     

    My personal way I plan to go is to make the wrapper more object oriented. Even if that means to rearrange the methods.

    May be I feel that way because I come from the XNA world.

     

    I hope klepto2 can have a look at my suggestions and can perhaps update the wrapper.

  6. I think it should be possible to attach not one model to a vegatation layer but a whole list. When you draw or populate the layer then it randomly places the models. This is a little bit simmilar to the eco system in Vue but of course not as elaborated. I asume that it should be faily simple to implement.

    Then one could define a forrest layer that has a bunch of variants of the tree (what else are Pure3D's tree sets for!), some bushes and also some floor covering flowers/herbs.

     

    A luxury version of that whould be if you could assign 'wights' to the models to influence the random selection of the model (have three times more bushes than trees, ...).

     

    If you really want to go for it you can later enhace it with a lot of additional rules (or have a scripting acces) simmilar to Vue.

     

    That would look much better with less work and also helps to get around the limit of 16 vegetation layers. Because now you have 16 different eco systems at hand!

     

     

     

    Ceterum censeo terranum esse dividam est! (I want to enter a value below 1m as a value for terrain)

  7. At first thanks for the first bunch of answers.

     

    @Marleys Ghost:

    1. Is there a plan to add support more layers in the future. I think that is something to put in the Feature Request Forum (if not already requested)

    2. OK, then only one terrain. I think I then have to live with the rather course ground and can not get around the other problems by simpling dividing up the terrain.

    3. Thanks a lot for the manual. I have not known that there exists any! Perhaps the link in the Sandbox editor should post to this page! That answers my problem how to get my own textures into the terrain texturing system!

    4. OK another restriction then. I will have to make my terrain with 1024 and 1m resolution. That will probably be as close to my requirements as possible. Definitly another point for the Feature Requests section :D

    5. OK, some task for the future.

    6. Yes I have read those already (Ok not the Pivot one as there is none.), but so both can structure entities in hierarchies and move those together but only Groups are evaluated for visibility down the hierarchy?

     

    @Lumooja:

    Hmmm, cover everything with vegetation. One layer is equal to one model (with his LODs). I can not provide a mixture of models for each layer (e.g. 10 different tree models of the sam species with some bushes and some ground cover), can I? If I have to use up one layer per model then I am running out of vegetation layers even before the texture layers!! Oh Oh.

     

    @wh1sp3:

    Ahhh, Ok that might be a creative solution. That might be possible at one place or the other.

     

     

    Again thanks for the help. I feel a little bit better now. Sadly easter is over and so I have to file my feature requests as a wishlist for christmas :)

  8. Hi,

     

    first I want to provide you with a little bit background of me, so you can perhaps understand my problems better.

     

    I found the LW engine last week during my easter holidays. Sadly the evaluation framework told me nothing about the programming side so I bought it right away. I have my own game engine done in XNA (using Sunburn for the graphics part) and now want to switch to LW because it seems to offer a more complete and easy to use system and the demo pictures are simply superb! But of couse I want to stick with using C#.

     

    I started the last three days to extend the C# wrapper from UBU, mainly with providing all the classes and methods with XML help from the LW WIKI. Its painfull an boring work but I thought that this would be a good way to get a deep overview about the API.

    During that I stumbled about some things that now bother me:

     

     

    1. Is it really true, that you can use only 5 texture layers on terrains!!!!

    This is major topic for me! In the game I want to make (a medieval/fantasy third person RPG) I definitly need more that five ground textures. Forest floor, grass, rocks, field and river/lake floor, then I run out of options. I may be able to use roads for the paths, but this would make irregular places impossible. Anything more seems not to be possible.

    Please tell me that I have understood this wrong. That I can either use more layers or can devide up my world in several tiles with their own layers each. I think in the demo pictures on the web site there are more then 5 layers used or are those enhanced by meshes?

     

    2. Only one terrain at the same time?

    If you can display and use only one terrain at the same time then building a continous world which loads the next 'tile' in the background seems impossible. Have I read this correctly or am I wrong (hopefully)?

     

    3. Currently there is no description for the editor (all links lead to a non existing document).

    Could someone please tell me how to use my own textures for terrain layers? Currently the box only offers me the preinstalled ones.

    Also a description of the editor would be nice. I do like to read the manual before using complicated things (Ok, well, maybe not always!).

     

    4. Scaling problem.

    My 'world' is about 800m by 800m. The terrain does not need to be bigger. But I would like to use the higher resolution (up to 4096) to make it more detailed. Currently the editor does not allow values below 1(m) per pixel/vertex! Is it possible to scale the terrain? I need to use the resolution for finer details than 1m. of couse I can pretend that 1 unit is 20cm but then I have to make my characters 9.0 units big and it is simply difficult to always have that factor in mind when doing asset modelling and level assembling. I have also heard rumors that some physics system have difficulties when not used within certain scales.

     

    5. Direction of waves.

    Is there a way to control the direction of water waves?

     

    6. What is the difference between Pivot and Group?

     

    The first four points are the source of my current worries because it seems that I can forget to use LW engine for my project.

     

    I hope someone can help me with my problems.

    Thanks in advance!

×
×
  • Create New...