4,631 reputation
11124
bio website vyznev.net
location Helsinki, Finland
age
visits member for 2 years, 8 months
seen 13 hours ago

I like programming in Perl and C. I know Java and PHP too (I'm a MediaWiki developer), but I can't really say I like them. I keep meaning to learn Python some day, but never seem to get around to it.

I'm working on a Ph.D. in biomathematics. I also like programming puzzles and cryptography.

Please consider any (original) code I post to Stack Overflow (and other Stack Exchange sites) to be released under CC-Zero unless stated otherwise. You may do whatever you want with it and don't have to credit me in any way, although of course that would be nice.


Nov
7
answered Multithreading 2D gravity calculations
Nov
7
comment Multithreading 2D gravity calculations
The nice thing about using quad/octrees for gravity simulation is that, instead of just ignoring distant particles, you can store the total mass and the center of mass of all particles in each branch of your tree and use this to calculate the average gravitational effect of all the particles in this branch on other, distant particles. This is known as the Barnes-Hut algorithm, and it's what the pros use.
Nov
1
comment Glitch-free cross-fades in HTML5
You really should do the interpolation using premultiplied RGBA values, otherwise funny things can happen if you interpolate between, say, an opaque pixel with hue A and a nearly-transparent pixel with a different hue B. getImageData() returns non-premultiplied RGBA values, so the back-and-forth conversion is yet another thing you'll need to include in your interpolation routine.
Oct
31
revised Help with timebased scoring algorithm
added 355 characters in body
Oct
31
answered Help with timebased scoring algorithm
Oct
26
awarded  Enlightened
Sep
21
comment What's the best way of translating a 2D vector into the closest 8-way compass direction?
@TheLima: octant = round(8 * angle / 360 + 8) % 8
Sep
5
comment What makes a path finding heuristic Monotonic vs. Non-monotonic?
...or better yet, here.
Sep
2
comment How should I provide a navigation system for a world with infinite space?
Just what kind of navigation system are you looking for, and what should it accomplish? Let the player know what's around them? Let the player get to some destination? Let the player know what route they've travelled? Let two players meet each other? Let players pass information about locations to each other? Something else?
Sep
2
answered How should I provide a navigation system for a world with infinite space?
Aug
30
comment How can I simulate a bad internet connection for testing purposes?
@Byte56: What these apps do is simulate a slow and/or unreliable network connection, just like the question asks for. I'm pretty sure how they do it is outside the scope of this site. I'd say this is a perfectly good answer to the question as asked; if there's a problem, it's in the question, not in the answers.
Aug
22
revised 24-Bit Colordepth not enough?
move images side by side, add attribution and license info; correct "256-bit" to "256-color"
Aug
20
comment 24-Bit Colordepth not enough?
+1 for mentioning dithering.
Aug
20
reviewed Approve suggested edit on 24-Bit Colordepth not enough?
Aug
15
comment Recreating this flat-shaded look
I don't think there's any actual global illumination going on. If there were, there ought to be some "anti-shadows" visible in places where an otherwise shadowed surface is adjacent to a directly illuminated one. There are a few places in the image where that should be visible, but I don't see any.
Aug
15
awarded  Yearling
Aug
14
answered Local shape color blending
Jul
24
comment How can I maintain a rectangular formation when units are added or removed?
@Tiby312: It shouldn't be that expensive: it's only a few bots and you only need to do it once when the gap forms. (Unless the chosen bot somehow gets killed before reaching the gap; then you obviously have to choose another one to take its place. One way to do that would be to mark it as already "belonging in" the position it's moving towards, so that getting it killed triggers the same gap-filling behavior whether or not it already reached its designated position.)
Jul
24
comment How can I maintain a rectangular formation when units are added or removed?
Presumably, the closest bot in the back rank (i.e. the one in column 3) should run to fill it. Or you could save a bit of time by having the bots in columns 3 and 4 of the second-to-last rank each step one column up, moving the gap to column 3, and then have the bot at column 3 step forward to fill it. (IMO, the most "natural" looking strategy would probably be some heuristic combination of the two, possibly with some randomness thrown in.)
Jun
29
comment how to calculate sky color hue in a specific way?
If you want a somewhat more realistic formula, see e.g. "A Practical Analytic Model for Daylight" by Preetham, Shirley & Smits.