ZorbaTHut
Reputation
9,710
Top tag
Next privilege 10,000 Rep.
Access moderator tools
Badges
27 43
Newest
Impact
~387k people reached

• 1 helpful flag
• 153 votes cast

278 Actions

 Dec 14 awarded Nice Answer Dec 12 awarded Guru Aug 19 comment Texture packing algorithm @dariooo, in theory, yes, but most of the items will be added much faster than that because a valid location will be found very quickly. My experience is that this is almost always fast enough. There are more advanced algorithms you can use if you really have a huge number of elements being added to a single atlas, but don't bother with these unless you need them, which you probably don't. And note that you can make this one or two orders of magnitude faster or two by encoding the next "free" pixel into the byte that says whether a pixel is used, thereby skipping dozens of pixels ahead. Aug 15 comment What is the fastest way to work out 2D bounding box intersection? You're missing that they have the origin at the center, not at the left edge. A box that runs from 0 to 10 will actually have "x = 5", while a box that runs from 8 to 12 will have "x = 10". You end up with `abs(5 - 10) * 2 < (10 + 4)` => `10 < 14`. You'll need to do some simple tweaking in order to make it work with topleft-corner-and-size. Aug 12 comment AABB of a sphere's screen space projection Link's dead :/ Don't suppose there's a copy elsewhere? Jul 16 awarded Yearling Jul 5 awarded Nice Answer Nov 17 awarded Good Answer Oct 3 awarded Nice Answer Jul 16 awarded Yearling Mar 28 comment Texture packing algorithm Oops, thanks for the update - I've been reorganizing that project pretty seriously. Modified the actual post :) Mar 28 revised Texture packing algorithm deleted 33 characters in body Jan 5 comment Implement an upper FPS limit in the gameloop Huh. Perhaps things have changed since the last time I tested. Well, that's why we test :D That said, if your'e not outputting the actual updates as well, you should do that - it may be that the sleeping-longer solution is getting less than the target framerate. Dec 31 comment Implement an upper FPS limit in the gameloop On Windows, at least, Sleep(0) means "give up whatever is left of my timeslice, but come back to me ASAP". There's no guarantee that the OS comes back instantly, and in my experience, it usually won't. The danger of giving a larger number is that the OS will not return until at least that much time has passed, and sometimes until significantly more than that much time has passed. In my empirical testing (years back), Sleep(0) provided almost the same CPU reduction that your suggestion did, with significantly better responsiveness. Of course YMMV :) Dec 31 answered Implement an upper FPS limit in the gameloop Jul 16 awarded Yearling Apr 16 awarded Guru Mar 13 awarded Guru Feb 23 awarded Nice Answer Dec 17 comment Optimal sprite size for rotations This isn't a helpful answer, but I read over the question, said "Oh, that's easy!", went to write an answer, frowned, read it again, and then thought about it really hard for a few minutes before concluding that it is not, in fact, easy. That said, my gut instinct is "twice the resolution on each axis is either perfect or definitely-good-enough", but I don't have any evidence for this. Finally, I suspect this depends dramatically on the downscaling kernel you're comparing against - a simple pixel-averaging kernel may be easy to analyze and replicate, but a Lanczos kernel may prove impossible.