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
Online Last Active Today, 10:11 PM

#5225727 What's next after knowing how to program?

Posted by Khatharr on 26 April 2015 - 05:49 PM

what are the C++ libraries that I would (eventually) need?

 
Start doing what you're going to do, and when you find a need for a library, ask about what options are available and how they compare. A lot of libs are in active development, and things can shift quickly if a new lib shows up and solves an old problem. If you sit around collecting everything then by the time you're ready to make use of it, you'll find that it's all become deprecated.




#5224119 Distance between OBB's

Posted by Khatharr on 17 April 2015 - 07:55 PM

I recently saw a video about optimal GJK. Let me see if I can dig it up for you, since you're looking at the algo...

 

Here we go. Mollyrocket in the house:

 

http://mollyrocket.com/849




#5224118 Why high level languages are slow

Posted by Khatharr on 17 April 2015 - 07:52 PM

Oh look, it's this thread again.




#5221763 Advanced unit steering (e.g minion movement in moba games)

Posted by Khatharr on 06 April 2015 - 09:03 PM

http://gamedevelopment.tutsplus.com/tutorials/understanding-steering-behaviors-collision-avoidance--gamedev-7777




#5221760 Two Questions - Willing to Trade experience on Tools and Business Side, for M...

Posted by Khatharr on 06 April 2015 - 08:56 PM

There's a series of getting-started tutorials on the official Android site.

 

https://developer.android.com/training/index.html

 

If you're using Eclipse then that's your starting point. If you want to use something like Unity I think you just build for Android from within a Unity project.




#5220844 c++ count lines in txt file and then read these lines without reopening a file

Posted by Khatharr on 01 April 2015 - 09:35 PM

std::vector<std::string> getLinesFromFile(const std::string& fname) {
  std::ifstream file(fname);
  if(!file) {throw std::runtime_error("getLinesFromFile() - Failed to open file.");}

  std::stringstream data;
  data << file.rdbuf();
  file.close();

  std::vector<std::string> lines;
  while(data) {
    lines.emplace_back();
    std::getline(data, lines.back());
  }
  lines.pop_back();

  return lines;
}



#5220809 c++ count lines in txt file and then read these lines without reopening a file

Posted by Khatharr on 01 April 2015 - 04:02 PM

std::ifstream is RAII.

 

But you should throw if the file has an error.

 

Anyway, wasn't this whole thing about performance? Why are you reading one line at a time from the disk?




#5220808 Anyone got any ideas where 4k a sec is coming from?

Posted by Khatharr on 01 April 2015 - 03:51 PM

If you're worried about leakage then download vld and test the program. Task manager is NOT an appropriate tool for measuring memory usage.




#5220340 How to generate biomes?

Posted by Khatharr on 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.




#5219893 How can I create a text based adventure game?

Posted by Khatharr on 28 March 2015 - 06:21 PM

A thread for the ages...




#5219777 Collision detection with triangles as the basis of all computer graphics…?

Posted by Khatharr on 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.




#5219776 VS2010: fatal error C1083: Cannot open source file

Posted by Khatharr on 27 March 2015 - 11:20 PM

Did they un**** intellisense in 2015?




#5219775 Global Consts

Posted by Khatharr on 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.




#5217998 C++ do while error

Posted by Khatharr on 20 March 2015 - 10:48 PM

It's not OOP's fault either, though. That's like picking up your car and carrying it to work and then complaining that cars are inefficient.

 

If someone tries to use OOP because of peer pressure rather than because it's the right tool for the job then the problem is with their peers and the response to those peers, not with OOP itself.




#5217216 How to Acess a singleton from everywhere?

Posted by Khatharr on 17 March 2015 - 06:01 PM

Ah, right. YOU SEE HOW THE POISON SPREADS?






PARTNERS