Jump to content
  • Advertisement

Jolle

Member
  • Content Count

    205
  • Joined

  • Last visited

Everything posted by Jolle

  1. Jolle

    Better card shuffling routine

    I think I've heard that "rand() * DeckCount / RAND_MAX" gives statistically better results than "rand() % DeckCount", and as above said, just srand once.
  2. Check http://www.wischik.com/scr/howtoscr.html, it has a part about the parsing (although it's ugly). Google is your friend.
  3. I've heard that the easiest way if you want mutlisampling, just draw to the main backbuffer and copy it.
  4. It may look like trivial recursion, but it seems it isn't. Anyway I didn't find the trivial stuff about it, but I manage to write some Haskell code that solves the problem. Maybe I missed some vital trick that makes it much easier, I dunno. f 0 = [[]] f n = concat [[x : z | z <- f (n - x), z == [] || head z <= x] | x <- [n, n - 1 .. 1]] stylish = putStr . unlines . map (init . tail . show) . f Main> stylish 5 5 4,1 3,2 3,1,1 2,2,1 2,1,1,1 1,1,1,1,1 (zeroes not included, it didn't make any sense)
  5. Jolle

    random number

    As said by many people already, you should only call srand once. The code you show above calls it for every random number you generate.
  6. Here's some code I used in an old app. It uses a lot of bad things, but the basic word wrap technique isn't very bad. (And yeah, you don't spell length that way) char** WrapLine(char* str, int w) { static char* lines[16]; int currentLine = 0; int place = 0; while (str[place] != 0) { int lenght = w / FONTW; if (strlen(&str[place]) < lenght) lenght = strlen(&str[place]); else { while (str[place + lenght] != ' ' && lenght != 0) lenght--; if (lenght == 0) lenght = w / FONTW; } lines[currentLine] = new char[lenght + 1]; memcpy(lines[currentLine], &str[place], lenght); lines[currentLine][lenght] = 0; place += lenght; if (str[place] == ' ') place++; currentLine++; } lines[currentLine] = NULL; return lines; }
  7. Jolle

    New to Opengl

    I've never really liked the nehe tutorials. I found them messy and unpedagogic. When I was new to OpenGL they didn't help much. But each to his own I guess.
  8. Jolle

    Problem with recv (Winsock)

    atoi wants a null terminating string, doesn't it? edit: also, always check n.
  9. Too bad they've completely destroyed the settlers concept.
  10. Jolle

    Condition testing

    It will skip "another == one_more", but will check something_else. If it was "if( something && veryLargeLongRunningFunction() )", the function would only be run if something was true.
  11. Unless you loop the code you show from World.cpp three times, m_Cycles will only have one vector. Edit: Otherwise I think it works as you want it to. Edit: Edit: When pushing m_Values into m_Cycles, what is added to m_Cycles is a copy of m_Values, so you won't need more m_Values vectors.
  12. Jolle

    Check out my Particle Engine

    http://members.gamedev.net/ryan_zec/OpenGL_Demos/SDLGameParticleEngine.zip clicky Looks nice.
  13. Jolle

    Socket Descriptor Range

    In other words, use a hash table.
  14. Jolle

    fps affected by mouse

    It would help if you posted your main loop.
  15. advantages: - you don't clutter the real filesystem with thousands of small files (which could be the case for ie scriptfiles for RPGs) - the average computer user won't be able to rip/change your files - you can bundle things, which may be very handy for patches/mods and addons. disadvantages: - you can't work directly with your files, but this is usually not really a problem: don't bundle the files up until release - depending on how things are done, you may not be able to use normal file operations that's what i could think up right now
  16. If you're running at 350 fps, you really should have better precision than timeGetTime(). Look up QueryPerformanceCounter.
  17. Jolle

    2D Soft Shadows

    You might want to check out bluescrn's latest LD48h entry. Full source code available. It's unfortunetly not soft shadowing, but nor is any of the other things posted here. Maybe it will help anyway.
  18. Anyone know if it's slower, or anything like that, to use non power of two textures?
  19. Jolle

    access to gamestate

    Maybe this can be of interest for you http://www.bookofhook.com/Article/GameDevelopment/TheQuake3NetworkingModel.html
  20. Jolle

    Current survey

    "What's your compiler's fontface?" For most compilers this doesn't make any sense. Maybe "What's the fontface of your IDE or text editor?" would be better.
  21. What's the difference between .innerText and .innerHTML, if any?
  22. Jolle

    to virtual or not to virtual

    Quote:Original post by Polymorphic OOP Quote:Original post by Jolle blablabla That's not a true at all. Once a function is declared virtual in the base A, it is ALWAYS virtual whether you explicitly write virtual in child classes or not. It's entirely up to you whether or not to write virtual in B or C. The outcome is exactly the same. Yeah, a quick check shows that you're correct... now I'll have to hunt down and burn whatever source that taught me that in the first place ;) Sorry for lying to you bobster :/
  23. Jolle

    to virtual or not to virtual

    B's destructor should be declared virtual if B have any other function declared virtual. B's functions should be declared virtual if you want other classes that inherit from B to be able to use them as virtual functions, just like with A->B edit: don't know if my wording was that good. but if a function is virtual in A, but not in B, then it's B's version is the "final" one. ie. you can't make a new one in class C and except that to be called like ((A*)c)->MyFunc()
  • 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!