Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 04 Jul 2003
Offline Last Active Yesterday, 06:36 PM

#5191603 Help, falling at the first hurdle as usual

Posted by JTippetts on 06 November 2014 - 06:26 PM

When the linker goes to link the glfw library, it will start looking in all of the paths that are visible to it, starting with the first one specified (usually PATH environment variable, I believe) and continuing on to any paths specified using -L, in the order that they are specified. (Some paths may be specified by CodeBlocks internally, they'll probably translate to -L options on the command line and will probably be specified before any that you specify). As soon as it finds the first file matching the name it is looking for (ie, libglfw.a for a static library) then it will try to link that library in.


If the library it finds first was built for 64-bit, and your current project is 32-bit, it won't work. If your project is 64-bit and the first library it finds is 32-bit, again it won't work. You need to ensure that if you have both 32 and 64 bit versions of the library installed, that only one version (the correct one) is visible.


Also, there is a bit of confusion as far as 32-bit and 64-bit configuration. Just because your toolchain executables are all named mingw32-something, doesn't mean the project is necessarily configured for 32-bit. Usually, 64-bit is specified on the command line by a command line switch (-m64 for gcc) rather than by using files explicitly named mingw64-something. In CodeBlocks, I believe you have to manually add -m64 to the compiler options to enable 64-bit (unless in recent versions they have included a check-box switch for it. Alternatively, you can add your own check-box switch for it by right clicking on the Build options->Compiler settings pane and inputting the relevant flag).


Finally, if you are using CodeBlocks then there is really no need to use CMake. CodeBlocks will handle the Makefile behind the scenes so that you don't need to. It is possible to specify that a project use an externally generated Makefile (such as built by CMake) but in my opinion it complicates things, and if you are creating your own new project then it is unnecessary.

#5190780 Help, falling at the first hurdle as usual

Posted by JTippetts on 02 November 2014 - 02:55 PM

Where is the file libglfw.a located? The option -lglfw on the linker command line is going to search the visible link directories for a static library called libglfw.a. If it is not located in any of the visible linker paths, then you need to specify the correct path using -L

#5188310 Techniques for creating underground caverns and tunnels

Posted by JTippetts on 21 October 2014 - 08:27 AM

I've gotten good results with using 2 layers of ridged Perlin noise:


I described the technique here and again, later, in Game Developer Magazine. The post is lengthy, scroll down to Caves and Tunnels. It regards Minecraft-style block worlds, but as dmatter indicated you can use the same exact technique with a different surface generator (marching cubes, marching tetrahedra, dual contouring, etc...) to get smooth rather than blocky areas.

Essentially, a single octave of ridged Perlin noise in 3 dimensions, scaled and clamped to output either 0 or 1, looks like this:


If you take two of them with different seeds and multiply them together, you get:


If you want them a little more rough-looking, apply some turbulence using additional Perlin noise layers to perturb the input XYZ coordinate:


Inverting the cave structure and integrating it with a volumetric terrain:


For other techniques, I dipped into my stuff all the way back to 2004 and found an old tutorial I once wrote for creating 2D cave systems by aggregating random circles together. (It's an old site I no longer maintain, filled with dead links and old info.) I began with a seed circle and iterated, generating additional circles and appending them onto the ever-growing structure at random locations.


This technique, combined again with isosurface generation, could be extended to 3D using spheres. For additional visual interest, I would probably apply some noise perturbation as before.

#5185833 Lua and Irrlicht compilation conflicts

Posted by JTippetts on 08 October 2014 - 02:17 PM

Been a lot of years since I used Irrlicht, but just offhand, you might want to be sure that if you are using a DirectX device that it is created using D3DCREATE_FPU_PRESERVE. D3ds default behavior is to switch to a lower precision fpu mode which messes up Lua, which still wants to use higher precision. I believe at some point Irrlicht introduced a device creation flag for this.

#5185139 n-dimensional noise generation

Posted by JTippetts on 05 October 2014 - 10:17 AM

The function Álvaro describes is a hash function. A hash function maps one input value (or set of values) to a value within a fixed range; ie, mapping a set of 2D, 3D or other coordinates to a single 8-bit, 16-bit, or 32-bit value.

Many hashing functions operate on the same principle as a Linear Congruential Generator (LCG) pseudo-random generator. In the past, many built-in random number generators for various systems have been implemented using an LCG. The idea of an LCG is to take some starting value (in fixed-state systems, the seed) and multiply it by some special number, then add another special number. If the numbers are chosen correctly, the output sequence appears to be random. When using an LCG to hash a value instead of store a seed as internal state somewhere, you pass the value into the function and use that value where the seed is normally used. The function then becomes a hash that maps this input state (seed) to a seemingly-random output value.

If the input is more complicated than a single value (such as a set of input coordinates) then the input values are commonly folded together into a single value, then that value is hashed to an output value.

Another commonly used tool when hashing integral values is the XOR operator. When you XOR two integral values, wherever the corresponding bits in the operands are different, a 1 bit is generated in the output value; otherwise a 0 bit is generated. By XOR-ing a value with some number, the effect is to sort of 'mix' the bits up in a predictable and deterministic fashion, with the output result having a seemingly-random appearance. This is the trick that Álvaro uses in places in his hash function.

The problem with XOR-ing alone, though, is that while at first glance the output might seem random-enough, there are in truth patterns generated in the output, and when doing Perlin noise you really want to avoid patterns. So the above hash function doesn't rely on a single XOR, but rather mixes XOR with LCG-like behavior (multiplying by specially chosen numbers) as well as some bit-shifting. The whole point of all of this is to get a really good mix or churn on the input bit pattern, and to hopefully remove any semblance of a visual pattern when the hash is used to generate noise.

If you study the reference implementation for Perlin noise, you can see a different form of hashing at work, one which uses a look-up table. Essentially you use the input value to look up a value in a table; the table is shuffled, adding an element of randomness to the look-up. Since look-up tables take up memory, the reference implementation folds the input coordinate state down so that it falls in the range [0,511] and the output hash is an 8-bit value in the range [0,255].

There is no one way to implement a hash. But a good way of understanding hashes is to study pseudo-random generator functions which use many of the same techniques that make for good hashes. (For example, see the list of generators created by George Marsaglia). Also do google searches for hash functions, which might turn up things like the FNV hash.

#5184990 n-dimensional noise generation

Posted by JTippetts on 04 October 2014 - 12:11 PM

Hi everyone!
I'm trying to make a Perlin noise program but I'm having a bit of trouble coming up with a good noise function.

So why don't you just use Perlin noise? (Reference implementation) What you are attempting to do isn't really Perlin noise, it's more like an explicit version of value noise.

#5182470 Free game engines for 3d games

Posted by JTippetts on 23 September 2014 - 01:38 PM

There is also Urho3D which is fully open source, supports Win32/Win64/Linux/Mac/iOS/Android/Raspberry Pi, can be scripted in either Angelscript or Lua, includes 3D and 2D functionality, supports physics (Bullet for 3D, Box2D for 2D), navigation (Recast/Detour), sound, input/output, XML, JSON, etc, etc, etc... It's coming along rather nicely, even since I started using it.

#5178971 simplex noise problem: boundary between simpleces not smooth

Posted by JTippetts on 08 September 2014 - 05:44 PM

Can you show a screen shot and some code? Without that we'd just be guessing.

#5175705 Looking for C++ engine for 2D isometric game

Posted by JTippetts on 23 August 2014 - 05:41 PM

You might give Urho3D a try. Grab the latest commits from the repo, rather than a release build, as there has been a lot of activity on the 2D side of things, including a tilemap structure with isometric capabilities. The chief drawback might be the documentation on the tilemap lacking a bit due to its newness, plus possible bugs.

#5172062 Trying to figure out the Accidental Noise Library

Posted by JTippetts on 07 August 2014 - 10:21 AM

I understand that it's a pretty complex process. I did download your newer source from google code and compiled it. I haven't played around with it yet. I am starting to finally shape terrain with a full length ground level with hills and mountains after playing with a few numbers, but still having problems with the cave systems, which render as a huge open area with a bunch of floating islands.

The Ridged Multifractal module is a hairy beast. There really isn't much in the way of internal 'taming' of it going on in the code, so the default output range can be weird. A quick analysis of an 8-octave Ridged using a Gradient noise basis and quintic interpolation shows that the values of the fractal are distributed like so:


The maximum value output by the fractal is 1.968995 in the test (corresponding to the right hand side of the image), and the minimum value output is 1.15179 (corresponding to the left hand side). The 'peak' in the diagram falls at approximately 1.70723, and roughly corresponds to the value that is most commonly output from the fractal. So if you use a ridged multifractal as a selection mask, as when doing caves, you need to ensure that your selection threshold lies at an appropriate location within that curve. Given that the distribution of that curve is so odd, you might need to experiment to find the sweet spot; and given that the curve can vary so rapidly especially on the higher end of the spectrum, small changes in the threshold value can result in large changes in the output mask.

#5171953 Trying to figure out the Accidental Noise Library

Posted by JTippetts on 06 August 2014 - 04:08 PM

I recommend that you start with the most basic functions (the gradient function forming the ground plane) and add complexity as you go. There are any number of ways such a complex tree can go wrong with but a single parameter change or error (and it can be quite difficult for someone, even myself, to browse through someone's function specification looking for such tiny errors),  so it would probably be best to work with simpler stuff until you have a good grasp on what's going on and build from there.
Additionally, I have not updated the Sourceforge repo of ANL in a long time. I changed to Google Code at one point, so the version [url=https://code.google.com/p/accidental-noise-library/]over there[url] is a LOT more recent. Specifically, the Builder code tree allows for far more concise function specifications in C++ than the repetitious pattern of (Create module) (Set parameters) (Set sources). There have also been a few bug fixes that made it into the Google Code library since I switched (although some other bugs yet remain that I haven't uploaded fixes for; I'm not much of a FOSS project maintainer, sadly).

#5152787 opengl question

Posted by JTippetts on 10 May 2014 - 07:57 PM

Nope, phil, unacceptable. You never even asked a question, you just posted a snippet of code that looks a whole lot like any number of other snippets of code you have posted in the past decade or so, demonstrating that you have not even attempted to follow the advice you have been given before. Do you have an actual question, and one that you have not asked before? Because this looks very, very much like just about every other post you have made since 2004. Do you honestly expect other people to waste their time trying to help you when you have not heeded advice and learned how to ask proper questions?
People have been very patient with you, phil. For a very long time. But you need to understand that you have to change your approach to all of this. It is just not acceptable for you to continue wasting the time of others. Before you come back to this thread, or any other new thread, I want you to re-read the advice given to you in past threads. I want you to really study it, because I promise you there are answers to your problems there. When you do come back, you really need to ask an actual question, and it better not be something vague like "how do I shoot bullets?"

I have been reluctant to employ actual moderation against you, but understand that my own patience (as well as the patience of others) is growing thin.

#5152773 opengl question

Posted by JTippetts on 10 May 2014 - 06:39 PM

Is it one you've already asked before? If so, the response is likely to be predictable. Are you prepared to take the advice of the responders, and make an honest effort to understand it and use it to solve your problem? If not, then again the response is likely to be unpleasant.


Unfortunately, you have made a name for yourself among many of the members of this community, and I believe it is going to take extraordinary effort on your part to overcome that. You are free to post, as none of your posts technically violate any hard rules, but just understand that if you expect anything good to come of it, you are going to have to work very hard.

#5152039 The acceptance of gold loot in RPGs

Posted by JTippetts on 07 May 2014 - 08:24 AM

I prefer gold drops. Hell, I even prefer that snake to have the chance at dropping a full set of platemail, 35 different potions and a massive claymore of impossible strength.

#5150942 UV Unwrapping: Ugh!

Posted by JTippetts on 02 May 2014 - 10:17 AM

UV unwrapping is, indeed, a tedious task. I don't really have anything to add to the discussion to make it easier, since I struggle with it myself even after all these years.
However, I would like to just throw a suggestion out there. How about eliminating UV unwrapping entirely? Depending on the style you are shooting for, it is entirely possible that you can make do with entirely procedural coloration/texturing, rather than texture mapping. Look at games like Cube World, which has minimal (if any) texturing, and relies almost entirely on coloration and AO to provide the rich visual appearance. On the other end of things, if you want more visual detail than simple vertex coloration, you can use techniques such as tri-planar texturing for terrain and landscape objects, and with some creativity, it can be used for all sorts of things.

Granted, doing procedural coloration and texturing moves work required from UV unwrapping over to additional shader creation, but for a programmer it can be a worthy trade.