Jump to content

Josh

Staff
  • Posts

    23,265
  • Joined

  • Last visited

Posts posted by Josh

  1. There is one thing that could possibly be a problem, but I'm not sure it's related.

     

    If I create a new project and then load the AI and Events map, I was getting a crash in the print hook. I figured out this was caused because the program just ran a long time without calling the garbage collector, and this map will print out a ton of error messages if you try to load it with all the media missing. So I just inserted a garbage collection call in the map load and save routines, for each object, and the problem went away.

     

    Not sure if that's related, but it could potentially cause seemingly random errors like we are seeing.

  2. It's just kind of a general rule. Never do anything in real-time that returns data from the GPU. Occlusion queries actually have a special command that lets you check if the test is finished yet, and you just keep checking each loop until it's safe to get the result.

     

    The reason for this is that the CPU -> GPU flow of data is one-way, out to the monitor. So the GPU is normally a bit behind what the CPU is doing.

    • Upvote 1
  3. Hello Rick,

     

    thanks for your reply (again smile.png). But wouldn't be it so that if i do add the seeding into App.lua that there's a quite high chance to get 2 "math.random(1, 100) in a row generating the same result, or am i wrong? For e.g. to randomize "Skillgains" i actually HAD to use two different seeds to prevent the "Skillains" happen at the same time with the same increasevalue.

    Random numbers can and will produce the same value twice in a row. The value of the last call has no bearing on the value of the next call...otherwise it wouldn't be random!
  4. If I create a terrain that matches the size of the heightmap, it works perfectly. The easy way to test is that the file size should be the terrain size squared times two.

     

    For a 1024x1024 terrain, the file size of an .r16 heightmap is 1024x1024*2 = 2097152 bytes.

     

    If the file size corresponds to an .r32, it is assumed the file is made of floating point values, which may or may not be what your program is exporting. Maybe it does unsigned integers? I never really encounter these files, so I don't know.

  5. One of the last things the editor does when saving files is it writes the position of various data chunks to the beginning of the file. If the editor crashed during saving, it makes perfect sense that those values would be zero.

     

    I am changing it so the editor will write to a temp file and then rename it when finished. This will prevent maps from getting corrupted in the event of a crash during saving...which ideally shouldn't happen, but until I have a reproducable error it's going to be very hard to track down. I suspect the editor is requesting some bit of info from the engine that is missing. It will be super easy to fix but first I need to produce it myself so I can run the debugger on it.

  6. I did some more poking around. The file is full of multiple wrong values...0 objects, nav data is wrong. It's almost as is it's full of random bytes.

     

    If you notice any pattern with this, or if anyone else experiences it, please post here. Not sure how I can continue investigating it at this point, since I have never experienced anything like this.

     

    Ah, I just realized the editor crashes during saving...of course the map will be totally borked at that point. There's two things we can do to deal with this. First, a backup of your map exists in "C:\Users\username\Documents\Leadwerks\Backup". By default, these are saved every five minutes. Second, I can do like many paint programs do and write the map to a temp file, then when it's done rename the file to the path it's supposed to be. This is done in Paint Shop Pro, etc. so that if the editor does crash for any reason during saving, the original file isn't messed up.

  7. Thank you.

     

    This is bad practice to let computer and work saved few hours , and redo a non necessary save (but indeed it should not pose problem.
    It is not possible to lose more than five minutes' work, maximum. The editor has an auto-backup feature that by default saves a copy every five minutes, in the location "C:\Users\username\Documents\Leadwerks\Backup". If the map loader isn't loading a file correctly, an external tool that does the same thing won't help. The proper thing to do is find and fix the problem, if one exists.

     

    Both the maps you provided have the internal string table position listed as '0' which is definitely wrong...

  8. It's working as intended. You might want to increase the lighting quality.

     

    With shadow mapping, a little extra padding has to be given to the depth test or you will get shadow acne, since the shadow map has a limited resolution and the luxels cover an area larger than one screen pixel.

  9. Well, let's see how this develops. If I see people making a lot of mistakes I will just have the engine choose. Really the only reason you would need manual control is if you have a very high-poly non-animated object, or a very expensive shader, for example tessellation.

  10. This was mentioned in the last Steam announcement, but it's worth pointing out again.

     

    Leadwerks has occlusion culling built in to the octree which hides and shows chunks of the scene, but individual objects can also have an occlusion test performed. This should not be used excessively because it requires a non-instanced render of the object's bounding box every few frames.

     

    I discovered that the editor was enabling occlusion culling on some models I did not want to have it. This was because some of the models had a vertex weighting information in the model, even though they did not use the animation shader. This was causing slow performance in the large room of the AI example map, in particular.

     

    I disabled occlusion on these prefabs and updated the beta branch with the fixed items. You may want to check in the appearance tab of your maps and make sure you don't have occlusion culling turned on for common objects. (Lights and animated models should have it enabled, as they are relatively expensive to render.)

     

    After making this change, my framerate in the AI example map jumped up into the hundreds. In the future, a "check for errors" dialog would be a good way to automatically detect wrong settings like this.

    • Upvote 2
×
×
  • Create New...