Nercury

Members
  • Content count

    112
  • Joined

  • Last visited

Community Reputation

812 Good

About Nercury

  • Rank
    Crossbones+
  1. What Color is the darn dress?!

    Forget about perception. Everything is fine with perception :) How does brain decide how the object is lit? Well, it depends on the SHAPE of that object. Those who imagine it being worn by a person (convex) see it as dark blue/black. Those who imagine it as a piece of cloth (concave) see it as bright blue/gold. It comes down as object being imagined being convex/concave: http://brisray.com/optill/vision2.htm Interesting how a photo could accidentally have this property.   Geez. This took some time. Now I can go to sleep. But I can no longer "flip" it back to "convex" in my mind :(
  2. Thoughts on Rust?

    My background: for the little I delved in game programming with C++, I was absolutely scared of the language. Previously, I was programming in C#/Java, and C++ with its manual memory management was so scary I switched completely to "modern" C++11 and used shared_ptr absolutely everywhere. Then my enthusiasm got drowned by "serious" work in PHP "language". And Javascript. I am a huge fan of finding problems on developer machine, and not runtime. And scripting languages are in absolutely the farthest distance from that ideal.   Year and a half later, I found Rust. It is like a breath of fresh air. It has the right idea. It is not that it is "killer" of some particular language. It simply stands out because it leaves less problems for runtime than any language I used before.   I am not saying that "Rust" is special. No, the idea of "ownership" and "borrowing" is special. Even if by some unfortunate event Rust dies, other languages are going to pick up this idea.   How else to explain it? Well, you know, how we find elements in map quickly? We keep it sorted. How do we quickly calculate statistics for the large amount of data? Well, we aggregate it as the data comes in. How do we avoid collecting garbage in language to ensure memory safety? Well, we define strict rules so we can know when all data is deleted at compile time. duh.   Yeah, I know, it sounds like Rust turned me into a fan
  3. The Programming Primer

    As a beginner, I feel I would loose it at the example of adding numbers.   It just does too much demonstration instead of actually doing something. Imagine a beginner who will finally figure out that the best way to write that piece of code in practice would be:   int myNumber = 8;   5 + 3 is 8, duh! :)   I would mark this as peer reviewed, because honestly this article does what it claims to do: confuse the hell out of beginners :). It basically throws to the face all these concepts and says "Get your brain familiar with these words!". It is not for everyone.
  4. Where to go to start to learn Python?

      Don't rely on single source :) Also when you understand basic language constructs, you can delve into something bigger. For example, I learned python while writing Civ4 script.
  5. Unity 3D vs UDK

    Unreal engine is made for First Person Shooter, meaning that it works best for what you would usually see in other Unreal games: a map, weapons, shooting, jumping, multiplayer, bots.   These are Pros if you need that for your game.
  6.   When I mentioned null pointers I was thinking about those corner tiles which have 7 neighbors instead of 8.
  7. It looks like you will have to store your shortest path node list in memory somehow.   Also it seems that you need a bit more than brute force nearest nodes, you may need to exclude mountains and lakes, or assign appropriate values for hard-to-pass terrain.   So you may need to take that data you use for the terrain (i will call it "6 sphere face"), and use it to compute "shortest path node" only once (or only when it changes). This can be done and tested separately, until you get it right (even with smaller cube density if needed for testing purposes). In case of the corners, just allow null references for your nodes (if you need diagonal path too). Every "shortest path node" may have a reference back to original "6 sphere face" node, so you get the real thing if needed.   This way your lookup algorithm remains simple and fast yet you do not loose any information about your world.   EDIT: As for adjacency of the faces, the most basic approach is naming things right. For example, of two futhermost corners of the box have respectively values of (-1, -1, -1) and (1, 1, 1), this information can be retained in cube face array. For example, cube face array may contain faces from (-1, -1, -1) to (-1, -1, 1) for U and from (-1, -1, -1) to (1, -1, -1) for V. A bit more math, but solving it would help to avoid a lot of repetition. 
  8. I have been fired :(

    From your post, looks like your colleague did not like you :/
  9. My article may help to get started with vectors.
  10. It depends on what is meant by the "best" code. If a company is evaluating a candidate for a team, then the "best" code in this case can do next to nothing and still be the best: clarity, readability, structure, consistency would be the main evaluation points. Another case of the "best" code would be something that has the best value. However if a company is looking for this particular type of code, then they are not actually interested in the code, they are interested if you are awesome.   Thing is, my best code which does something productive looks the same as my code which does something boring. I would send the code for the boring case and a executable binary of the productive case. With a note: this is how my code looks like, and this is what I can do.   THEY ARE NOT GOING TO COMPILE IT ANYWAYS.
  11. You can copy the initial permutation idea from the Perlin noise: basically, you have a permanent 256-sized array which points to a numbers from 0 to 255, call it "permutations". Then your "random" hash number at a specific integer point would be:   int X = (int)Math.floor(x) & 255; int Y = (int)Math.floor(y) & 255; int Z = (int)Math.floor(z) & 255; int hash = permutations[X]; hash = permutations[hash + Y]; hash = permutations[hash + Z];     Also the trick is to expand the 256-sized array and clone the copy of the same numbers to the second half, so you don't need to check for array overflow when adding the coordinates.   You get more variations by interpolating between these values and blending more noises at different scales.   Perlin noise is here: http://mrl.nyu.edu/~perlin/noise/. 3D Perlin noise additionally interpolates between 12 points, plus 4 point simplex shape. Although you would want to use improved Perlin noise, which uses 4 point simplex for 3D and 3 point triangle for 2D, which is aptly called Simplex Noise.
  12. Writing Game Music

    A very nicely presented article.   But it is my opinion that music theory would gain from sorting out the way it names things. Also syntactic sugar, just too much of syntactic sugar!
  13. c++ delegates, evil method?

    If you have VS2012 and can install latest CTP, it adds support to variadic templates (from C++11). You can then do stuff like this:   #include <functional> #include <iostream> #include <list> template<typename ... Args> struct event { std::list<std::function<void (Args...)>> handlers; void listenIn(const std::function<void (Args...)> & handler) { handlers.push_back(handler); } void call(const Args ... args) { for (auto handler : handlers) { handler(args ...); } } }; class other { public: void handler1(const std::string & name) { std::cout << "Hello " << name.c_str() << "!" << std::endl; } }; int main(int argc, char* argv[]) { auto a = new other(); // this event will work with handlers having one string parameter event<std::string> e; // listen in any compatible class method e.listenIn(std::bind( &other::handler1, // class member a, std::placeholders::_1 // bind first param to object pointer, leave others for the event )); e.call("World"); delete a; return 0; }   Basically you get type safety with no downsides, if you can ignore crap in the bind method. You can also add a lambda function as a listener:   // listen in inline lambda function e.listenIn([] (std::string & name) { std::cout << name.c_str() << " is mine." << std::endl; });     Several parameters example:   class other { public: void handler1(const std::string & name) { std::cout << "Hello " << name.c_str() << "!" << std::endl; } void handler2(int number, int basket) { std::cout << "There are " << number << " apples in the basket " << basket << std::endl; } }; int main(int argc, char* argv[]) { auto a = new other(); // this event will work with int, int event<int, int> e2; e2.listenIn(std::bind( &other::handler2, // class a, std::placeholders::_1, std::placeholders::_2 // bind first param to object pointer, leave others for the event )); e2.call(8, 2); delete a; return 0; }   Note that adding listener in lambda function is actually safer and easier, because all the hell will break loose if the event is called after the "a" is deleted (on access to any class member).