Jump to content
  • Advertisement


GDNet Emeritus
  • Content Count

  • Joined

  • Last visited

Community Reputation

1658 Excellent

About Fruny

  • Rank

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hey Fruny! I know you'll come back and check this eventually. :D
  2. list.begin() should be myList.begin(). Same for list.end(). Also note that, in standard C++, there is no such thing as a _tmain() function.
  3. I've been curious about how you went about doing that, but never to the point of actually looking it up. Thanks for the link.
  4. Fruny

    Best language for game development?

    Quote:Original post by poker158149 But is there any language that can be substituted for C++ in making the actual game or does it have to be C++? Pascal, Fortran, Ada, LISP, Haskell, Eiffel ... There are plenty of languages out there that you can use. The whole point is that you are most likely going to use third-party libraries to make that game, if only to handle the graphics (if any). In which case you need to pay attention to the languages it is designed to be used with or, conversely, find libraries that work with the language you are going to be using. You can make games in other languages than C++: look at all the flash games on the net. You can't deny their "actual game" status. Eve Online is reportedly written in Python. Systems have also been created for facilitating the creation of specific kinds of games. So no, it does not have to be C++.
  5. Fruny

    Implementing [][] operator

    As it's been said before in the thread, yes, that's the way to do it. Watch out for object scopes when using references.
  6. Fruny

    [C++] Question about memset

    Quote:Original post by jonathanc Thanks! You have indeed helped a lot. Will go look more into standard vectors. Just keep in mind that there are other containers, with different trade-offs than vector. Using the right data structure and the right algorithms is key to having good performance (along with not doing unnecessary work ;))
  7. Fruny

    [C++] Question about memset

    Quote:Original post by jonathanc Yes , m_height's type is std::vector <float>. So you say its ok just to do m_heights.resize(m_size * m_size); without the need to copy it into memory? (I am also working in OpenGL here hence the slight confusion) Yes. std::vector::resize() does change the number of elements in the vector. When you increase that number, the new elements will be initialized to the default value for that type. For float, as well as other basic types, that is the value 0. Container elements are always initialized. They are not like data in C arrays. Quote:I am still new to C++ (from C) so I guess some concepts still new to me. I strongly suggest you start by spending a bit of time studying the functionality exposed by std::vector's member functions (there are other containers, but vector is the easiest to deal with). Then have a quick look over what's available in the <algorithm> header (it helps to have some Computer Science grounding). If you want to exchange the contents of two vectors, note the presence of the std::vector::swap() member functions which obviates the need to use a temporary variable. That can be important for performance.
  8. Fruny

    [C++] Question about memset

    Quote:Original post by jonathanc m_heights.resize(m_size * m_size); ... memset(&m_heights[0], 0, m_heights.size()); The elements in a vector (I assume it is a vector) are default-initialized. They will already be zero, no need for a memset. Furthermore, the problem with memset is that it does treat memory as byte data. std::fill and std::fill_n treat memory as whatever data type your pointer points to. Quote:m_heights will then be filled in another function If you're going to do a fill anyway, why bother with the first one? Quote:Isn't using memset the only way in this application? It never is the only way.
  9. Fruny

    Best language for game development?

    Quote:Original post by poker158149 Which engine would be good for me to use as a beginner learning Python? Until you know what kind of game you want to create, that question is meaningless. Quote:I have Pygame along with Python installed on my computer, but I don't know how to use it :/ You will have to learn. No way around it. Quote:Any help? Depends on what help you need. None of us really has time to teach you. There is material on the PyGame website that can help you get started. Beyond that, it is up to you. Quote:C++ is for programs, but more time consuming C# is faster, but its easier to make mistakes with it Java is more for design, right? VB is for small things. Do I have my information remotely right? No. Usually the discussions of what is easy/hard is somewhat lower-level than that, at the language, tool or library feature-level. And as Oluseyi pointed out, it very much depends on what you know how to do in a given language.
  10. How about Diplomacy?
  11. Fruny

    [C++] Question about memset

    If you're using C++ rather than C, do not use memset or memcpy. Use std::fill, std::fill_n or std::copy instead, they do the Right Thing. #include <algorithm> std::fill(m_heights.begin(), m_heights.end(), 0); Quote:Now, let's say I need to make a copy of this value(s) and also create another set of values in memory after copying, how should I implement it? m_heightsCopy = m_heights; m_heights2 = m_heightsCopy; Quote:Also, is it necessary to destroy values created on program exit? Only if you used new somewhere.
  12. Fruny

    I think I broke my toe

    My sister broke her toes 7 times, IIRC. 3 on one side, 4 on the other. The doctor's advice was: "wear slippers".
  13. Fruny

    The lowest factor of any number is prime

    If the smallest factor is not prime, then you can further decompose it into prime factors, which will be: - smaller - factors of the initial number. And depending on who you ask, 1 is prime.
  14. Fruny

    check extensions

    For your game, today, it most likely does not matter. But if, say, Blizzard's Battlenet servers shut down every time someone with an out-of-date (or pirated) copy of Starcraft attempts to connect using an invalid protocol, or has a slight network glitch (for which networking protocols like TCP already compensate much) there would much howling on the Internet.
  15. Fruny

    binary I/O

    Quote:Original post by icecubeflower I never use it. I usually use it, unless I have reasons not to. Quote:I think I don't need it because I said: using namespace std; Correct. Although one important rule is that you should never* do that in a header file - use fully qualified names instead. If you add a using directive in a header, anyone who use it sees his global namespace polluted by everything you imported there, instead of leaving the decision with them. Quote:Is it better to do it one way or the other or does it matter? It does matter, though you probably need not worry about it yet. By the way, the C++ FAQ Lite is a very good read. * for some values of "never". There may be situations where it makes sense, but in those cases it is deliberate and not just convenience.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!