# TerranFury

Member

1285

142 Neutral

• Rank
Contributor
1. ## realtime fluid dynamics

There's another way to solve PDEs which I haven't tried myself but which sounds interesting. That is to represent your problem in the frequency domain and express differentiation simply as a multiplication. Then, your time derivatives are still finite-differences, but your spatial derivatives are more accurate. I've heard that techniques like this have just begun to find their way into solid mechanics as a more accurate alternative to finite-element models. Would it be useful to apply them to fluids?
2. ## [.net] Realistic sun in space

The corona can be very simple. Since the sun is spherical, you can get away with just creating a billboard centered on the sun. Draw an appropriate corona on a texture and then just render it to a quad, with additive blending. Another effect worth considering in addition to 'lens flare' is 'bloom.' That can be as simple as another billboard, but I've also seen some neat image-space tricks that cause the bloom to 'bleed' around objects. Presumably this is accomplished by doing something like this: Render the 'sky' in white to a texture with all the potential occluders to the light in black at very low resolution (so that, after bilinear interpolation, the texture will be blurry). Then blend a radial fade-out-to-black texture to this same texture; then additively-blend the resultant texture over the whole scene. Other posters may have implemented something like this themselves, and may have more advice.
3. ## Computing PI

Think about it for a bit. ;-) There are lots of good, established algorithms, but it might be fun to come up with your own. The obvious method to me back in the day was to find the area of a unit circle. This is an integral which can be approximated by a sum. In rectangular coordinates, each term of the sum involves a square root, which I solved using what I later found out was Newton's method. Pretty straightforward. The earliest methods of the Greeks, as far as I know, involved circumscribed n-gons. You could come up with a recursive formula for that which you could run to some depth of recursion. Go make something up!
4. ## Shadow Mapping question ...

Quote:Original post by Thr33d fyi quake2, if I'm correctly informed, would read off the lightmap of the polygon the character was standing on or over (and for lava/lights would do something different), anyway, would read the lightmap texel value (rgb) and apply an ambient term to the character, as well as apply dynamic lighting. I know Quake 3 did something similar; it defined a grid of ambient light values that filled all space; your character was lit by the near point(s) with vertex lighting.
5. ## Random number with given frequency of occurenc

Generate a random floating-point number between 0 and 1. You can do this by with (double)rand()/(double)RAND_MAX, in C/C++, or by using the appropriate libraries in whatever language you are using. Then... want a 50% chance of something happening? Do it if this number between 0 and 1 is less than .5. Want a 75%? Do it if the number is less than .75. etc.
6. ## Programming a Simple Auto-Tracking Missile

Once upon a time, I worked out the math behind leading a target. You can do it too. The basic problem: Given a stationary gun with known projectile velocity and a moving target with known position and velocity, what's the unit vector that the gun should fire along? It's a bunch of linear algebra, which you can work out to an explicit solution if you sit down at it with a pad of paper and a pencil. When you do work that out, just use that vector at each timestep to set your direction. Voila. Want acceleration of the target included in the calculation? That's more math, and involves finding roots of 4-th order polynomials. I never worked it out, and you're probably better off using numerical methods. There's an iterative technique out there also. Each timestep, you run a few little simulations: You try aiming straight at the plane, and see if you hit it. If you don't, see where the plane is when your missle hits where the plane would have been if it had stood still. Then use that position as the plane's position for the next iteration. Run that loop a dozen times and by the end you've got a decent approximation - or so I've been told.
7. ## tic-tac toe

Quote:Original post by WeirdoFu The funiest AI for tic-tac-toe I've seen was a defensive AI. There are specific heuristics that are triggered, like which moves would guarantee a loss, and when you have to block a player from winning. Apart from that, it just moved randomly. Tic-tac-toe is actually a small enough problem in modern computing sense to be solved with just pure brute force. That's how I did it the first time I made a tic-tac-toe game too! Well, plus obvious offense. It was something like: If a move that will make me win this turn exists Make that move. Else if there is a move that the player can make next turn to win Block that move. Else Move randomly. I never got around to writing a game tree search. I probably should...
8. ## Identifying enclosed regions

It's easy IF you can access the verteces in a consistant order: say, clockwise, or counterclockwise. Just add up the signed areas under each segment. More detail: For now let's say that order is clockwise. Imagine an axis below the lowest vertex. Then, measure the area undereath the first segment. To help visualize, imagine that that segment is at the top of the figure, going from left to right. Now add the area under the next one, and so on. Now here's the catch that makes it work: curves that go from right to left have NEGATIVE areas. You can switch everything and use a counterclowise order too, of course. I think this works in all cases, but I'd need to think about it for a while to make sure. If it does indeed work, there's probably a formal proof out there somewhere.
9. ## Are there any free c++ IDEs that have a GUI editor? eg like mfc,cbuilder6

Honestly, I don't know what's so awful about VB. Sure, it doesn't have the prestige, but it's meant for fast GUI development. If you've got bits of code that need to be really fast, you can always use C++ to make DLLs. VB got a bad name because it makes it easy to write bad code. But you can write perfectly clean, good code in VB too. I'm not telling you not to try C#. I haven't tried it, so I simply don't know. I'm just saying that using VB is a perfectly legitimate approach. You could also try Java; I hear there are RAD GUI designers that work well with Java too, though, like C#, I've never used it.
10. ## Difference between intelligence, consciousness, and sapience?

Humans are sentient, I think you would agree. What about my dog? Of course she is sentient. But then what about smaller mammals, like mice? They're sentient too, right? They're not as intelligent, but they are sentient, no? Or non-mammals: A shark is sentient, right? How about a goldfish? Or insects: Does a fly have consciousness? Does an earthworm? I'd say they do. Those are all multicellular. What about an aomeba, or a paramecium? Or going smaller - is a bacterium conscious? Is anything that's "alive" by definition sentient? Now, what if we keep going smaller - small enough that now it becomes arguable whether things are "alive." Are viruses living things? I'd argue that they are (The "They need a host to reproduce so they're not really alive" argument is bogus. So do plenty of other parasites that we acknowledge are alive.) If they are alive, are they sentient? If a virus is, what about a prion? Prions reproduce and spread. Are they alive? Are they concious? If they are, then we're granting that a single molecule can have consciousness, because prions are in fact just a class of proteins. Why shouldn't we? A DNA molecule reproduces. It evolves, changes. It even learns. In fact, it learns where it needs to evolve. There was an article in New Scientist recently; apparently there are multiple encodings for any given amino acid in a DNA molecule, and some are more likely to cause mutations than others. So DNA evolves not just sequences of amino acids to produce proteins, but also a map of what needs the most work. This strikes me as fairly intelligent behavior. So if prions and DNA can be intelligent, is there a bottom limit? Are all things sentient, but merely posessing differing degrees of intelligence? Is consciousness universal? Is a lepton self-aware? (No way to know unless you're a lepton.) Is being self-aware even a criterion for sentience? For life? I asked before if all life is sentient. If all things are sentient, then perhaps all things are alive?
11. ## Robotics, Stereo Vision, billiards

I think what everyone's saying is that MONOCULAR vision will probably give you all the data you need. Just measuring the size of things in your 2d view will tell you how far they are. Now, for a random comment: I've always thought that an interesting way to do depth perception would be to change the focus of the camera and see where which objects are sharpest. But I digress...
12. ## Why not stop at C#? What's wrong with it?

In the grand, scheme of things, C#, C++, and Java are the next closest thing to clones. If you know one, chances are you can jump into either of the other two pretty darn quickly. So, since the differences aren't that huge, let's look at WHY you want to pick one of these languages: To learn to program better! So since you're new to programming and want to find resources and tutorials, you probably want to start with C++: It's older and more popular, so you'll get more help. But once you get familiar with one, learn the others too; they're so close that it's really not too difficult. They say that a programming language is a tool. Well, after learning those three, you'll have a nice set of Object-oriented procedural languages -- for the metaphor, let's call them wrenches. Then you should also try to swing a hammer or to turn a screwdriver: Try Lisp, for example. In the end, Computer Science isn't about languages. It's about knowing how to think. Try wrapping your head in all of the completely different paradigms that are out there, and the exercise should help you to do that. Just remember that you're trying to learn, not to make a bundle of money off an indie game. If you want to make the next Quake, chances are you will be hugely disappointed. But if you approach this as a learning experience, as a way to develop a broad skill-set -- well, then maybe you will some day be in a position to give the John Carmacks of the world a run for their money.