# Ezbez

Member

3113

1164 Excellent

• Rank
Contributor
1. ## What is the reason for making the leading entries all ones in a echelon form?

Wikipedia tells me that this requirement to have the leading non-zero term be a 1 is not universal. I suspect that it's just done in order to make the echelon form unique. If you don't specify that, then depending on how exactly you carry out the reduction, you could get different results from someone else also reducing that same matrix.   (I'm not 100% sure that it does in fact make the echelon form unique, but it feels like it would to me.)

sqrt(x)^2 = x is true in general, even in the case of negative or imaginary numbers. What is the difference between squaring the "side" sqrt(x) and squaring the "term" sqrt(x)?   I'm a graduate student in math and this thread has been more convoluted than most of my textbooks - why is everyone making such a simple thing so difficult? Alvaro has the right of it.
3. ## Dividing by zero, on purpose

The very first game I wrote I didn't know how to handle events well enough to get it to quit in a natural way. So I had the escape key just divide by zero so that it would exit.   My proudest moment.
4. ## New Kickstarter Game from the creators of Myst

This is the first Kickstarter I've backed, despite being quite enthusiastic about a lot of them. I did this because if any genre needs a second chance, it's the Myst-likes. That, and massive nostalgia. But the point of Myst was never the particular characters, it was the exploration. They didn't show much in the Kickstarter, but they've made it pretty clear that we'll be given weird and wonderful worlds to traverse. That's all I want, and is half the reason I loved Fez which despite being a platformer has as much in common with Myst as with Mario.   For those who are saying that Myst is a niche game, reconsider your thoughts. It was, until 2002 when The Sims over took it, the best selling PC game of all time. It spawned 4 direct sequels and the URU-spinoffs. Myst was a massive force in the gaming world at the time and there were countless knockoffs of it made afterwards. I've played a lot of those knockoffs but most were varying degrees of bad. And oh god they were so inconsistently compatible with PCs back then: every one required the installation of bizarre software to play animations that had generally a 50/50 shot of working.
5. ## How do I create the equation for a curve?

We are trying to solve for the constants a,b,c so that the polynomial a+bx+cx^2 gives the appropriate points. Suppose those points are (x1,y1), (x2, y2), (x3,y3).   The typical way to solve this is by using some linear algebra (I know! linear algebra lets you solve quadratics? It's somewhat surprising but we actually know x here and so we don't need to worry about any quadratic behavior. The things were solving for are a, b, and c which are only used linearly in this equation.). If you aren't familiar with this then you'll have to solve it out entirely (and may want to either way if you're not already using a linear algebra library). What this means is that we can plug each point (x,y) into the polynomial and this gives us a constraint on the possible values of a,b,c. So we get:   a + b*x1 + c*x1^2 = y1 a + b*x2 + c*x2^2 = y2 a + b*x3 + c*x3^2 = y3   These are three equations and we have three unknowns a,b,c so it should be solvable, at least so long as the three points permit a unique solution (almost all such points do). You can now solve these three equations for a,b,c.   If you know linear algebra, then this is just solving the matrix-vector equation:   The matrix M =  | 1 x1 x1^2 | | 2 x2 x2^2 | | 3 x3 x3^2 | The vector Y = {y1, y2, y3} (a column vector) The vector X = {a,b,c} (also a column vector). Solve M * X = Y, or X = M \ Y if you're in a language or package that support matrix math directly. Most such languages will also have built-in functions to do this sort of thing. Look for polynomial fitting or least squares (though least squares would technically be overkill).   Or, like I said, you can solve this any other way that you want, such as substitution that most people learn by highschool algebra.   Edit: Actually, I feel like doing that substitution out right now. Starting with the last equation: a + b x3 + c x3^2 = y3, so a = y3 - bx3 - cx3^2 Substitute into the second equation for a: (y3 - bx3 - cx3^2) + bx2 + cx2^2 = y2 Solve for b: b = [ y2 - y3+ c (x3^2 - x2^2) ] / (x2 - x3) Substitute into the first equation for b and a: (y3 - [y2 - y3 + c ( x3^2 - x2^2) ] / (x2 - x2) - cx3^2) - [y2 - y3 + c (x3^2 - x2^2)] / (x2 - x3) x1 - cx1^2 = y1 Solve for c: c = oh gosh I don't really feel like doing the rest of this I guess, but you get the idea. It's pretty long! So I decided to cheat and use Wolfram|Alpha to solve it for me.   This gives us some beautiful solutions: Let C = 1/ [ (x1-x2) * (x2 - x3) * (x1 - x3) ]. a = C * [ x1*x2 * (x2-x3) * y1 - x1*x3 * (x1-x3) * y2 + x1*x2 * (x1-x2) * y3] b = C * [-(x2 + x3) * (x2-x3) * y1 + (x1 + x3)* (x1-x3) * y2 + (x1 + x2) * (x1 - x2) * y3] c = C * [ (x2 - x3) * y1 - (x1 - x3) * y2 + (x1 - x2) * y3 ] Gives us the coefficients!
6. ## Custom 2D geometry from a list of points.

One algorithm that should work in this situation to break the shape into convex hulls that can be drawn more easily:   1. Pick a point, add it a list A which shall be our first convex sape 2. Cycle through points going clockwise 3. Check each such point to make sure that it is further clockwise than the previously checked one 4. If it's not clockwise not, then ignore add it to a list of points left over 5. If it is clockwise, add it to the convex hull 5a. If it is clockwise and the previous one was not, run this algorithm recursively, making a new convex shape by iterating over the list of left-over points (clear left-over point list when done) 6. Continue until all points have been checked   I hope that's clear. Basically, anything that isn't still going clockwise is a new convex (recusively, since this might also need to be broken up), but anything that is, is. This isn't guaranteed to have the best possible break-up of convex shapes and I'm sure you could come up with weird shapes that it would break up inefficiently. But I suspect it will work for the vast majority of things. It is guaranteed that for any non-self-intersecting shape it will fill exactly its interior and none of its exterior. Don't expect it to work sanely with self-intersections. Also, your choice of initial point will affect how it makes the convex shapes.   Note that a convex shape can be drawn by picking any point and drawing a 'triangle fan' out from that point, like the (out-dated?) OpenGL function for that.
7. ## How many try blocks

I'm not sure how much this data means. Everything depends upon language and programming style. In Python, for example, use of try blocks is encouraged where as in C++ it must be done with much more caution. The project I am working on probably uses about 5 try blocks per thousand lines of Python code. I can't think of any uses in our C++ code, but there might be some and some of our code is written more in the style of C than C++ (I am less familiar with that part of our project).
8. ## Intel CPU speed

New processors from Intel are the Sandy Bridges architecture, which tends to perform something like 10-30% faster than previous architectures at the same clock speed. Look for example at this: http://www.tomshardware.com/reviews/processor-architecture-benchmark,2974.html and see other benchmarks on that site that are less artificial. Sandy Bridges has a smaller pipeline and other changes which are hard to notice in 'just the numbers' that can make a big difference. My bet is that you would see a big difference, depending on what you are doing with the computer.
9. ## Asteroids clone.. asteroids won't shatter

Why do you only draw the small rocks if they have exploded == true? Here's some general tips for debugging this: You want to confirm with the debugger that several things are happening. First, that four small rocks are being made. Second, that those rocks are being added to the list. Third, that when you go to the game's draw loop, you are infact looping over those boxes. And lastly, you want to confirm that the drawing code is correct (eg: by starting with some small rocks already initialized and seeing if they draw).
10. ## Ready to start SDL?

If you have a good grasp of pointers and are comfortable designing a small project from scratch, then you'll be fine. Also consider learning SFML instead. It's written in a C++ style and is quite nice. SFML is GPU accelerated since it's based on OpenGL.
11. ## A random number generator class?

Can you give some details about this? I find this highly unusual, since if there are two RNGs the output of either one is still just random so you might as well just use a single RNG. Do you need to reproduce the output of each branch independent of those of the others? As for your actual class, is it a good idea to default the seed to 0 if there's none specified? Shouldn't time() or something similar be used, like normal?
12. ## Marxist RTS

I like the idea of having a fixed population that is a resource for the players to exploit. I have wanted to see a game like that for a long time, and this seems like the only reasonable suggestion I've heard to implement it. However, I think you are over-complicating the idea. Keep it simple - even the most basic of these ideas makes it economically much more complicated than Starcraft (and look at the amount of research that has gone on online into optimal Starcraft economies). You have a good basis - workers choose the jobs they will work based off the ones that pay the most for their time. That's all you need and anything more will probably get in its way! Don't have a half dozen resources, don't try to accurately simulate any form of economics, and don't make the player break out their economy text books. That's my suggestion.
13. ## [Theory] Unraveling the Unlimited Detail plausibility

It’s a very pretty and very impressive piece of technology, but they’re carefully avoiding to mention any of the drawbacks, and they’re pretending like what they’re doing is something new and impressive. In reality, it’s been done several times before.[/quote]-Notch The point made was that their exact technique hasn't been used yet.[/quote] That's now what he was using Notch's quote for. He kept paraphrasing it as "what UD is doing is unimpressive" and the Carmack quote as being "this is impossible". Clearly that's not what Notch was saying. Tesselation often uses a displacement map input. It takes a patch and generates more triangles as the camera gets closer. His explanation was right of the current usage. (Unigine uses tesselation in this way). [/quote] Fair point, and you probably know more about this than me, but I did feel like his description missed the point of tesselation and if you didn't know what it was already you wouldn't know what to think. He shows one static picture of a mesh which slight bumps and implies that that's all tessellation can do. 20 polygons per meter? That's a pretty close estimation. Turn on wireframe on a game and you'll notice how triangulate things really are. Characters are usually the exception to this.[/quote] Sure that's accurate if you don't look at much of the grass, but the denser grass areas directly above where he was looking look to me like they'd be several times that and 20 certainly isn't "throwing them a bone". But when I made that comment I was thinking of some other number he threw out some other time, but I can't remember what it was or when now. You need POM or QDM would really be needed to get the grooves right including self-shadowing. It's not as cheap as it sounds. I agree it would be nice to see the comparison between the two techniques when it's done.[/quote] Fair point, but he really just dismisses this as impossible. The really impressive thing with their technology is that it doesn't matter how many of these elephants they put on the screen - that's what he should be emphasizing, not making it sound as if current games couldn't possibly show such a detailed model. No, it's that they choose to use those polygons for the parts of the game we play closest attention to - usually humans. I've realized what has been *really* bugging me about his talk now though: He refuses to show us so much because he thinks we'll react badly to it. But this only makes sense to do if we'd react even worse to seeing it than to not seeing it. Our negative reaction to not seeing animation isn't strong enough - he's not showing us the animation because we're currently underestimating how bad it is. Showing us 7 year old animation with a "don't worry it's gotten better" gives a better reaction than showing us the current animation. Ouch. Or maybe he's irrational or doesn't care what reaction he gets.