# Julian Spillane

Member

170

366 Neutral

• Rank
Member

## Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

1. ## Being it's almost 2009, c# or c++ for casual game?

Pick the language you're most comfortable with. It really doesn't matter at all. Programming languages are simply the tools with which you build your applications. Use whatever will make your development faster and easier.
2. ## 3d point-in-triangle algorithm

Google. http://www.google.ca/search?hl=en&q=3d+point+in+triangle+algorithm&btnG=Google+Search&meta= I don't know the context in which you're using this algorithm so I couldn't begin to give you hints on optimization. Give us some context and maybe you'll get more help. EDIT: CodeMunkie, you beat me to it. :P
3. ## Hex To RGB how to ?(C++)

There's a formalization for conversion from any base to decimal (and this is what you'll need to do for HEX to RGB conversion): So using HEX as an example, let's convert the number F47D8C to RGB. First let's convert R. (F4)s10 = 16^1 * F + 4 * 16^0 = 16 * 15 + 4 * 1 = 240 + 4 = 244 = R G: (7D)s10 = 16^1 * 7 + 16^0 * D = 16 * 7 + 1 * 13 = 112 + 13 = 125 = G B: (8C)s10 = 16^1 * 8 + 16^0 * C = 16 * 8 + 1 * 12 = 128 + 12 = 140 = B Therefore, #F47D8C = (255, 125, 140) in RGB. The rule is # base 10 = SUM(i=0, i < digit count, BASE^(i)*digit) Hope that helped!
4. ## World positioned lighting

What's wrong with doing 3D math? It seems that a lot of people are trying very hard to eke away from mathematics when it is at the -core- of game development. Hell, programming is a subset of formalized logic which is a subset of mathematics. But that's tangential. The point is that if you want your light to move with your camera, you are going to have to learn some matrix mathematics. Or use a library like the D3DX. It has matrix multiplication in it. Or you could always explicitly set your light's position variable to whatever it originally was + your camera's current position so as to move it with your view. But we really need more information. Based on your post, I'm assuming you're doing this using DirectX and the fixed function pipeline. First of all, I'd like to mention that the fixed-function pipeline has been declared deprecated and unless you need to take advantage of lesser hardware, I would recommend getting a solid understanding of how the pipeline works (transformation, clipping, rasterization, etc.) and move to a shader based engine. But that's just opinion. I guess I need more clarification. Why is it that you'd expect the light to rotate and move around the world with you? You're specifying explicit world coordinates and will have to transform it yourself.
5. ## simple rotation

I think the core of your problem is that you really don't understand the mathematics behind what you're doing. On a global level, I really would recommend reading up on formalized linear algebra to really get a solid understanding of what it is that you're doing and how it affects the world. This will make you a better graphics programmer and give you better insight into how to implement what you want to create. But here's a rundown: you have a transformation matrix that you're pushing down the pipeline as your World matrix. And you want it to rotate "around itself", which I'm assuming to be the center of the triangle. glVertex2f(-30.0+herox, 0+heroy); glVertex2f(30+herox, 0.0+heroy); glVertex2f(0+herox, 40+heroy); So that's your triangle building code. Assuming your extra position vars are 0, this will build a triangle that has coordinates at (-30, 0), (30, 0), and (0, 40). And you want to rotate along the z axis. Well, if you look at your numbers, of course rotating will cause you to rotate about the origin because that's what you're telling it to do. You either need to build the triangle centered around zero, or you need to translate it as such. So either you make your triangle: glVertex2f(-30.0, -20); glVertex2f(30, -20); glVertex2f(0, 20); Or you do this: glTranslate(0,-20,0) glRotatef(..., 0, 0, 1) glTranslate(0,20,0) This works because matrix multiplication is non-commutative. I.e., A * B != B * A (necessarily, anyways). So translating then rotating is a much different operation than rotating and translating. Anyways, let me know if this helped and if you need any more clarification.
6. ## Why Are Flash Games So Bad?

Flash games are about as inherently bad as games made using any other software development toolkit. The main level of difference is the level of accessibility that Flash has to people in general and its wide-ranging target demographic. I don't know if you remember or even know of the old "Klik"-style applications, but trust me: there were TONS of terrible games produced using those apps. Now that doesn't mean there weren't awesome ones as well, they were just well outnumbered. The problem is that anyone can pick up Flash and, with a quick bit of tutorial reading, make a game. Another issue is that for a lot of companies it's easy and cost-effective to produce a game using Flash, and, if quick revenue turnaround is required (especially for Advergames), the best thing to do is to make a game that's tried and true. Hence, clones upon clones. In a depressing way, it's kind of like spam. For them to have a reason to keep sending spam messages, there must be people buying products. Same with players and clone games. "Stick with what works." *shrug* But I've seen many an amazing Flash game. For example, anything by The Behemoth. That's just my 2 cents.
7. ## Counting days

And just a little hint so you don't get frustrated by it: a leap year occurs in all years evenly divisible by 4 that aren't centennial (years ending in 00). Centennial years can only be leap if they are divisible by 400. Cheers.
8. ## Help

If you want to become a good programmer (note not necessarily games because there IS a world outside of games if you decide that it's not your thing), I would suggest enrolling in a computer science or software engineering program. Since you're relatively local, my reccommendation would be the Software Engineering program at the University of Waterloo. That or its CS program. Waterloo has placed 1st, 2nd, and third and is currently ranked in the top 10 of the international ACM programming contest, and it's only an hour away from where you are. I'm a student of the software engineering program and I find that I've been exposed to a lot of fundamentals that help build logical thought and problem solving skills that are required for this industry. A lot of the 'programming' you need you might have to discover on your own (since that isn't what university really is about), but you'll learn tons about algorithms, data structures, logic, mathematical thinking, and problem solving. There's also a bit of hardware design and interaction in there as well to help broaden your horizons. http://softeng.uwaterloo.ca Other than Waterloo I could reccommend any CS or SE program in Ontario, really. McMaster and Carlton both have good SE programs, and Western, Brock, and U of T have good CS programs. Anyways, just my 2 cents.
9. ## is there a way to get rid of clas::getSingleton().functionCall

See, I personally believe that Singletons are an evil creation by the Gang of Four designed to increase the size of our source files and decrease the readability of our code. :p Seriously though, guys: design patterns are not the be all and end all. Sure some of them may be useful in some situations, but that book really isn't programming dogma. Just make your best judgment on what you need in your current situation. If a global variables works fine for you and it's well documented that it's a global variable that does XYZ, then you should be okay. Now if you have 100 people on this project and you require some heavily object-oriented abstraction then singletons or another solution might be a better idea. Just use what's appropriate for the situation and think for yourself. Never let an advocate of one thing convince you of it without putting any thought into it first.
10. ## Math riddle

Well what you wrote was hardly a formal inductive proof. It was merely writing in gcd relational equations what I expressed (well, I know it's obvious and I'm not saying you rewrote what I expressed, merely that they're equivalent statements). I mean, you could formalize it, but in that form it's not. And yeah, I was wrong about the "min" statement...I had misread the problem. I thought it said n-1 and k-1, not n-k and k-n.
11. ## Math riddle

Alright, I was going to use Hoare logic as a program verification proof on the function using the assumptions that I made that to state that if k' = n', then k' is the gcd(k, n)... but I can't for the life of me figure out the loop invariant. :(
12. ## Math riddle

Alright, yes, it is the GCD. Now...to prove it... Let d = gcd(n,k) In the case that n = k, we know that the gcd(k, k) = k by the properties of divisibility, so we're done. In the case that n > k, we know that n does not divide k. There could, however, be the chance that k divides n, so we recursively subtract k from n in hopes that it is a multiple and that eventually we will reach equivalence. If we overshoot, we fall back to the case that k > n. In the case that k > n, we know that k does not divide n. It could be that n divides k, and so we reduce it by k until we reach equivalence. When the algorithm eventually reaches the point where n' | k' and k' | n', we know that we've found the gcd(n,k). This is true because d would be the largest number that divides both n and k. Well, that wasn't a rigorous proof at all, but it's too early in the morning to do a formalization of that. Give me about an hour or so to wake my brain up. :p
13. ## Math riddle

Whooops. My bad. I misread it. I thought it read return func(k, n-1) and return func(k-1, n)
14. ## Math riddle

The answer, old boy, is func(int k, int n) = min(int k, int n) How do we know this? Welllll..... In the equality case, the function merely returns the value of k, since either one of the values is considered the 'minimum'. In the case that n is larger than k, we recursively call func, decreasing n until it is equal to k, in which case we return k. In the case that k is larger than n, we recursively call func, decreasing k until it is equal to n, in which case we return k (which n is now equal to). Since we are recursively decreasing our parameters until we reach the smallest one and then returning, it is obvious to see that we are returning the minimum value of the pair.
15. ## [CgFX] Problem Updating Parameters...

Hmm...I still haven't been able to solve it. I've posted on the NVidia forums as well but have received no response. Does anyone have any suggestions on how I can circumvent this if there is no way to prevent this behaviour in CgFX?