Jump to content
  • Advertisement

Kaptein

Member
  • Content count

    504
  • Joined

  • Last visited

Community Reputation

2224 Excellent

1 Follower

About Kaptein

  • Rank
    Advanced Member

Personal Information

  • Role
    Programmer
  • Interests
    Programming

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Kaptein

    AVX2 support in Visual Studio

    You can detect support from CPUID and implement the AVX2 variant by detection if you really want to. If your compiler has multi-versioning support this is really easy (gcc, clang), otherwise I'm sure there are workarounds.
  2. Kaptein

    High Lua engine call rate

    For posterity: I ended up implementing a call that can clone an object N times. So for say 600 trees: Create one tree in Lua, ask engine to clone it 600 times and return a list of 600 ids. Then iterate in lua over IDs and move the new objects into place. It cut really deep into the loading time which is now at 11-13ms.
  3. Hello all. I'm currently mid developing a game with my engine. There is currently a stage during loading that takes 21ms, where the script is creating lots of objects by calling into the engine. I noticed that each extra call needed to fully define an object cost me around 3ms overall. I was prototyping using a lua table to model the whole object to reduce the number of calls, but its a slight pain to implement. Right now 21ms is not very noticeable. However as development progresses I will eventually reach that 3-digit millisecond number where its noticeable during loading. *** Entering 'treskott_village' (in maps/overworld) on start [18:36:48] INFO: Loaded map 64x64 (F= 2 L=6, 24576 tiles) -> Loading tiles took 1.77 milliseconds -> Adding MOD scripts took 1.13 milliseconds -> Adding MAP scripts took 0.09 milliseconds >> Player life delta=64 Tile scan callback took 0.031000.2 milliseconds Tile scan callback took 0.412000.2 milliseconds Tile scan callback took 0.102000.2 milliseconds Tile scan callback took 0.138000.2 milliseconds Tile scan callback took 15.023000.2 milliseconds Tile scan callback took 0.229000.2 milliseconds *** Tile scan objects created: 618 >> Map season is [18:36:48] WARNING: Image already loaded: bitmaps/npcs.png -> Calling entry functions took 18.14 milliseconds Loading map took 21.44 milliseconds How do you go about making it take less time? EDIT: I thought about some instancing-like behavior, but it still requires some calls to the engine to at least move the object. I guess that will greatly reduce the time compared to what is going on now. Does anyone have a ballpark number for when players really notice the loading time?
  4. Kaptein

    Object placement in O(1)

    This is for try-placing objects, so no searching is necessary. For each position (x, z) in the world, read a seamless pre-computed array of radius-values and compare lequal against radius of object you're trying to place. This was 5 years ago, but I don't remember the details unfortunately. I ended up finishing the poison-disc generator and now my objects are try-placed properly in O(1), and seamlessly wraps around on the arrays. One (singular) array can't be used with many objects of many sizes, though, but I'll live. The bottom line here is that I can't use my poisson-disc array to place both big and small objects interchangeably. Instead I would have to create two arrays to support two object sizes, or one array where the one object affects placements of other objects, which is also unwanted. The primary reason for having something like this is just being able to use the same array to place any kind of size object from a single array shared across all threads.
  5. Kaptein

    Object placement in O(1)

    Today I started implementing Poisson Disc generator, however halfway through the implementation I realized this was not what I was using 5 years ago. First off, while I can implement this with a min and max radius, it doesn't help me fill in the void (so to speak) if I should generate a wrappable array from this data. So, this is what I need to know the name of: 1. The algorithm probaby uses poisson-disc to start with 2. It then creates a power-of-2 sized array 3. It fills the array with radius-values, distanced so that if you access the array at any position modulo the array size, you can use lequal to know if you can place your object. An example row: [1, 2, 3, 2, 1, 2, 6, 2, 1, 2, ...] <-- if i remembered the specifics I wouldnt be asking 4. This is O(1) because an object can be try_placed with `array(wrap(x), wrap(y)) < radius` Anyone know the name of this procedure? Any help would be appreciated.
  6. I am currently implementing UBOs and Buffer Textures in an effort to go from using glUniforms which are quite decent performance to something more per-frame and per-world-transition. I have a few thousands of mesh chunks that are generated for coordinate (0, 0) so that I can translate them wherever I need. I'm now doing the translation with a glUniform call each time I make a draw call. I would like to transition away from this by using UBOs (once per frame to setup all per-frame stuff) and then using texture buffers to translate and get better control over chunks. 1. Is this new method much faster than before? If the answer is no, it might not be worth it for me 2. How do I make sure that a given mesh that knows nothing about itself can sample from the right index in the texture buffer? There might be a ray of hope here if each draw call could be numbered from 0 .... N-1. EDIT: I baked in a mesh ID in all meshes and used a vec3 buffer texture as translation to avoid setting any kind of uniform data at all. I didn't notice any performance improvements.
  7. Kaptein

    Noise derivatives

    Can anyone explain to me how to use analytical derivatives in noises for use in 3D terrain? I have made a very capable game engine but I'm unable to make any cool terrains due to not being good at math. I have looked around on the net but it seems terrain generation is just a creative art no one teaches. For starters, how about how to perturb the top portion of a density bubble so that we can increase the chance of unbroken terrain with overhangs, as opposed to disconnected terrain due to too much perturbation? http://www.iquilezles.org/www/articles/morenoise/morenoise.htm gives an introduction on the topic and shows that it can be useful (which I wasnt sure of beforehand)
  8. Hey all, this is mostly a thinking problem. I have terrains, all of which are placed on an N-dimensional graph/system which determines their wetness, temperature etc. The conversion from a biome coordinate/point to a terrain is done by simply finding the closest terrain point/coordinate in the system. Think voronoi diagram. Given that there are very few terrains (lets say 20), shouldn't I just be iterating over each point and determine which is closest? What would you prefer? I have implemented uniform voronoi cells myself for creating simple zones, but I feel like using a Voronoi diagram just for this is overcomplicating it.
  9. There should be a stack for each execution environment, so threads, fibers and interrupt handlers get their own. There is also separate stacks when switching to kernel simply for security reasons. Otherwise, I would only switch stack if I needed a really big one for something, and that hasn't happened yet. We just make regular function calls into DLLs, so it's all executing inside the same execution environment. I would assume DLLs also used the standard libraries for memory management, if the code in those DLLs make calls to new/delete or malloc/free then that's what's going to happen.
  10. Kaptein

    CMake is insane on Windows

    Yea the build folders are cleaned out each time, so unless there are some hidden files it should be empty
  11. Kaptein

    CMake is insane on Windows

    Unfortunately, it's the same output as before: it detects CLang 4.0.1 and then proceeds to MSVC EDIT: I tried cmake with MSYS, and I also get the same output: cmake -G "MSYS Makefiles" -DCMAKE_CXX_COMPILER=/c/LLVM/bin/clang++.exe -DCMAKE_MAKE_PROGRAM=mingw32-make .. ... /C/LLVM/bin/clang++.exe /nologo /DWIN32 /D_WINDOWS /W3 /GR /EHsc /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1 Even if I should find some hack to make this work, it shouldn't be behaving like this.
  12. I am trying to build with Clang on Windows for the first time. I usually use G++ but it creates large static files which irritate me. I also want to try CLang on windows, since I use CLang exclusively on Linux. There is nothing that seems to work to make it stop sending "MSVC-like" parameters to the compiler. How can I disable MSVC-detection? It clearly says: C:\Projects\dm2\clang>cmake .. -G "MinGW Makefiles" -DCMAKE_CXX_COMPILER="c:\\LLVM\\bin\\clang++.exe" -- The CXX compiler identification is Clang 4.0.1 -- Check for working CXX compiler: c:\LLVM\bin\clang++.exe -- Check for working CXX compiler: c:\LLVM\bin\clang++.exe -- broken ... c:\LLVM\bin\clang++.exe /nologo /DWIN32 /D_WINDOWS /W3 /GR /EHsc /D_DEBUG ... predictable output ... what's going on here? EDIT: I'm using newest CMake, newest LLVM for win64, newest MSYS and MinGW64. I am successfully building statically with G++ as of writing this.
  13. Kaptein

    Profiling

    Yeah. live stack sampling is more of a "we don't have any other choice, because its hardware". It does have some positive traits though, eg. if the sampling source is bias-free then so are the samples. I'll defer to your experiences with full frame analysis. I always thought I would want to see data on a specific point and then "do things" in the game to figure out how that area changes in time-cost. Your answer on the cells seem right to me. Sounds like uniform voronoi grid thing I did ages ago. Thanks.
  14. Kaptein

    Profiling

    Hey all, As the code slows to a crawl we have to instrument our binaries, but its been a while since I did programming on a platform that had options. I'm used to live stack sampling inside small kernels, and because of this I don't want to go back to the stone-age of fully instrumented executables. I had a look at CxxProf: https://github.com/monsdar/CxxProf/wiki/What-is-CxxProf%3F and it looks nice. Especially the part where you can pick and choose where it does the work. But, before I go ahead and do all this integration, what profilers do you use? Not to mention, CxxProf hasn't been updated in 3 years, although hopefully it still works well. Actually, I have to sneak in a second question. I'm dividing my levels into a grid of X*X cells so that I only have to iterate over the cells (X-1 to X+1, Y-1 to Y+1) to find nearby objects. Using a "hash" of the cell position to assign objects to cells, where each cell has a set of objects. Does this sound like a plan?
  15. I need some advice. After I changed my scripting language from in-memory C to Lua I've had numerous problems I've never encountered in other languages. Prototypes? Type signatures? Calling functions with any number of parameters? How do you deal with all the random bugs you can get that you have really no way of determining the cause of? If I call a function with one less parameter than it should have, I might just get a Lua error somewhere else in the script. At a later time. What do you do to make your code (which isn't bottlenecked at all, so there is tons of room to add checks and balances) more correct and more sane? If I scripted sanely in C I would rarely have these issues. For example any pointers passed between the engine and the script goes through a sanitizing stage where it actually checks if the pointer points to an actual valid existing entity. If it sounds like I am regretting the change, I don't know how to answer that. Lua can construct tables and pass them around, which is very nice, unlike C where I would have to malloc (and that is just not going to happen).
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!