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!


Khatharr

Member Since 24 Apr 2010
Offline Last Active Yesterday, 08:57 PM

Posts I've Made

In Topic: How to generate biomes?

30 March 2015 - 06:08 PM

I'm not really clear on what problem you're having here. You describe what you're doing, but then you just say that you can't use Perlin noise. Why not?

 

If it's just that you don't want to wait for long map generation times, then maybe you could do the top-level noise, and then do the progressively lower levels of noise only as needed? Do one Perlin iteration for the whole map, then break it into segments. Do a Perlin iteration for the segment the player is in, then break it into smaller segments, etc. down to the level of detail that you want. Keep the final results stored and mark unprocessed areas so that you don't have to repeat the work later. If you put a little thought into how you break up the segments then you should be able to amortize the work pretty effectively.


In Topic: How can I create a text based adventure game?

28 March 2015 - 06:21 PM

A thread for the ages...


In Topic: Collision detection with triangles as the basis of all computer graphics…?

27 March 2015 - 11:28 PM

I'm not sure what a "normal" is.

Is it possible to illustrate a very simple example of this concept?

 

A normal is a vector which is orthogonal (at a right angle) to another vector or plane. In a 2D space you can get a right-side normal as follows:

 

vector = {x, y}

normal = {-y, x}

 

Normals are used in a variety of calculations, especially collision and lighting. The reasons become clear when you study dot products and cross products, which can be found within the materials linked by jacmoe.


In Topic: VS2010: fatal error C1083: Cannot open source file

27 March 2015 - 11:20 PM

Did they un**** intellisense in 2015?


In Topic: Global Consts

27 March 2015 - 11:16 PM

Yeaaaaaaaaaaaah...

 

Anyway, if a constant relates to a specific class, make it a static const in the class. That's always handy because it's available directly within its own context and available publicly the same way it would be through a namespace:

class Foo {
public:
  static const int BAR = 42;
}

Foo::BAR; //is 42

Also, setting aside readability, avoiding magic numbers means that if you have to change the value at some point then you don't have to do the easter-egg hunt for all the relevant replacement positions. Even for trivial cases this can make sense:

const int ARY_SZ = 10;
int ary[ARY_SZ];
for(int i = 0; i < ARY_SZ; i++) {
  baz(ary[i]);
}

If you change the size of the array then you only have to change it in one place. In more complex code this can save a lot of heartache.


PARTNERS