Jump to content
  • Advertisement

rozz666

Member
  • Content count

    387
  • Joined

  • Last visited

Community Reputation

896 Good

About rozz666

  • Rank
    Member
  1. rozz666

    Casting Problem

      If you need to cast, then you should review your design. The point of an abstraction not to depend on concrete types. E.g. your GraphicsFactory::init accepts and interface, but inside you assume it's a specific class. What if I derive another class from IInitiationSettings? init will probably crash, even though init declaration told me I can pass anything that's an IInitiationSettings.   Of course, IInitiationSettings should be a data object, but this has already been address in other posts.
  2.   While this is true for operator<, std::less for pointer guarantees correct ordering (source: http://en.cppreference.com/w/cpp/utility/functional/less).
  3. rozz666

    Using old array or stl

    Yes, I agree with fastcall22.
  4.   Python reference are C++ pointers (they are also garbage collected, of course).
  5. Have a look at Boost.MPL: http://www.boost.org/doc/libs/1_55_0/libs/mpl/doc/refmanual.html It provides among other things containers and algorithms for types.
  6. rozz666

    Documentation Driven Development

    Are you proposing to write the comments for Fibonacci and A* instead of unit test? If yes, then there is a high risk they will quickly get out-of-date. If no, then what value do they add? For fibonacci I would make 3 UTs, e.g. in RSpec: describe :fibonacci do it "should return 0 for 0" do expect(fibonacci(0)).to eq(0) end it "should return 1 for 1" do expect(fibonacci(1)).to eq(1) end it "should return fibonacci(n-1) + fibonacci(n-2) for positive n" do expect(fibonacci(2)).to eq(fibonacci(1) + fibonacci(0)) expect(fibonacci(8)).to eq(fibonacci(7) + fibonacci(6)) end end  For A*: describe :AStarPathFinder do # setup it "should return nil if a path cannon be found" do expect(@finder.findPathBetween(STARTING_POINT, UNREACHABLE_POINT)).to be_nil end it "should return points traced along the path" do expect(@finder.findPathBetween(STARTING_POINT, FINAL_POINT).to eq(PATH_POINTS) end end
  7. rozz666

    Always running into a circular dependency

    Why does an Entity has to know about the Scene?
  8. rozz666

    Unit Testing ftw?

    In my experience when I started using Unit TDD and Accepance TDD, I've never had to step through every line. That's what my tests are doing.   I'm also surprised that no one mentioned that writing unit tests improves the design of the application. It enforces separation of concerns, single responsibility principle, dependency inversion, etc., because it becomes difficult to unit test classes if they violate these principles. This, in turn, improves maintainability.
  9. Very good article. Good emphasis on the importance of naming things correctly instead of commenting them.
  10. If I understood correctly, you have a shadow function that depends on time (let's call it s(t)) and you want to describe this function. For this, you want to make is a smooth step function (_/---) so you just need to store the coefficients. Keep in mind though, that you need more than 2 values. s(t) looks more like this (sunrise ___/--day--\___ sunset), so you need at least 4 values. Still, it should be pretty easy to implement. This, of course, assumes fixed relation between the ground and the sun.
  11. I would split the algorithm into the smallest pieces that are reasonable and unit test every possible scenario. Then the only bugs that could occur would be integration errors, which I would cover with module tests.
  12. rozz666

    The Lua Tutorial

    I disagree. This is a tutorial meant for beginners and suggesting bad coding practices in the examples can be harmful.
  13. rozz666

    The Lua Tutorial

    Please, drop the Hungarian notation.
  14. rozz666

    How to handle endianness?

    Using the union solution also causes undefined behaviour. You are only allowed to read the last assigned member (with few exceptions, not applicable here).
  15.   Then it should be mentioned in the article that the code is not C++ compliant and will only work with given compilers that support such extensions.
  • 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!