• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

132 Neutral

About AnthonyS

  • Rank
  1. Source code for games?

    I would read this blog before getting interested in design patterns. I couldn't agree more with Mr. Ericson. http://realtimecollisiondetection.net/blog/?p=44
  2. Linux C++ IDE

    Quote:Original post by Simian Man I'd recommend using ddd over plain old gdb. It is ugly as sin, but is much easier to use. Thanks, I'll have to check this one out too. How well does ddd handle assembly level debugging?
  3. Linux C++ IDE

    Quote:Original post by daniel_i_l What C++ IDE would you reccommend for linux? Are there any that have debugging capabilities that come close to VC++? Thanks. Emacs + Konsole works for me. For debugging compile with the -g option and use gdb. Also get to know the make utility, it's very easy after you get used to it.
  4. collison algorthim

    Quote:Original post by jagguy2 I am using silverlight so i dont have a alpha value I believe. Correct me if i am wrong but it only uses jpg,png with transparent backgrounds I believe JPEG is a bad choice for images with an alpha channel, however most image editors export to RGBA format for both jpg and png. If you can't use an alpha channel just tag some color as your official transparency code, perhaps white (0x00) for most formats. If you're using a compressed (lossy) format you may need to compare the values within a certain range. if( max(value, transparency) - min(value, transparency) < someSmallValue )
  5. Here's a list of titles that I like. Real-Time Rendering, by Tomas Akenine-Möller and Eric Haines Assembly Language Step-by-Step by Jeff Duntemann. Lion's Commentary on UNIX 6th Edition by John Lions Real-Time Rendering, by Tomas Akenine-Möller and Eric Haines Concurrent Programming in Java by Doug Lea (a genius) Linear Algebra by Gilbert Strang Effective C++ by Scott Meyers Graphics Gems series GPU Gems series Game Programming Gems Series Real Time Collision detection by Christer Erichson 3D Math Primer for Graphics and Game Development by Fletcher Dunn Computation Geometry by Mark de Berg Calculus 8th edition by Ron Larson Elementary Differential Geometry by A.N Pressley
  6. collison algorthim

    Quote:Original post by jagguy2 My question is AFTER I have detected a collision with 2 rectangle images, how do I get a more accurate test. I have a spaceship on 1 image and it doesnt cover the whole rectangle it is placed in. I have a missile which also doesnt take up the whole rectangle it is placed in. I test to see if the rectangles overlap which I can do. I need a further test to see if actual pixels are touched within the image and this i want help with "per pixel collision detection. How do i do this? Say you have two overlapping rectangles. You'll need to create two bitmaps of the area that's Xed in where the x,y coordinates correspond, you don't actually have to create a new bitmap, just calculate the correct pixels. With most bitmaps you have an r,g,b,a value. The 'a' or alpha value should be 0 when an area is transparent. Simply iterate through that box and if the alpha values are both greater than 0 you know you have a collision. [Edited by - AnthonyS on June 29, 2008 9:36:43 PM]
  7. Quote:Original post by Spoonbender Quote:Original post by AnthonyS Remember, if you're developing for an out of order cpu, you'll have to consider memory fencing too. Luckily, on standard x86 this isn't a problem, yet... Are you saying x86 CPU's aren't out of order? O.o Internally they MAY perform out of order instructions, but specifications dictate that the user will never notice the implications. Itanium architecture, on the other hand, is a different story. There is one caveat, if you are using simd instructions in multi-threaded code you will certainly have to use the sfence/mfence instruction at the end of your functions.
  8. This is dependent on your architecture, and may require combing through the processors development manual. If you're programming for a standard x86 system, word sized writes occur atomically. This knowledge can lead to substantial performance boosts with some multi-threaded code. Actually, one of the easier ways to determine if you can get away with this is to search a linux code base for a file titled "atomic.h", then look for the functions named atomic_read and atomic_write(or something like that) and see how they implemented it. Remember, if you're developing for an out of order cpu, you'll have to consider memory fencing too. Luckily, on standard x86 this isn't a problem, yet... If you decide to go this route it may behoove you to write the code in assembler, and declare the variables as volatile to avoid complications that can arise due to a funky compiler.
  9. I'm not sure exactly what you are after, but maybe I can give you some ideas. Have you thought about rendering the scene on the gpu using orthographic projection from above your avatar? You could set the projection plane right above your head and clip at the height of your avatar. Every object could be assigned a unique hue which would make finding the object intersecting your path a matter of a hash table lookup. At the end you'll have a nice little bitmap to work on, which will be much easier computationally.
  10. Efficient matrix multiplication

    The best way to optimize matrix math is to do the code in SSE and assembly. The code below is COMPLETELY UNTESTED but it should give you an idea of what you need to be doing. An optimization could be to prefetch both matrices into the cache at the beginning of the function. Edit: you will probably need to add a memory fence to the end of this function. I've also noticed that you return the matrix by creating a copy, instead of by reference. This could be sped up by passing a reference to a destination matrix. Of course, with this strategy you won't be able to overload the multiply operator. The 2 most important machine instructions are mulps - multiply aligned packed singals. This instruction actually performs 4 32bit multiplies at once. addps - same as mulps except it performs addition instead. global mulmatbymat mulmatbymat: mov eax, [esp+4] ; dest matrix mov ecx, [esp+8] ; m1 matrix 1 mov edx, [esp+12] ; m2 matrix 2 ;; fill xmm0-xmm2 with matrix 1 movaps xmm0, [ecx] ; m11,m12,m13,m14 movaps xmm1, [ecx+16*1] ; m21,m22,m23,m24 movaps xmm2, [ecx+16*2] ; m31,m32,m33,m34 ;; copy m2[0]-m2[2] into xmm3-xmm5 movaps xmm3, [edx] ; m11,m12,m13,m14 movaps xmm4, xmm3 ; m11,m12,m13,m14 movhlps xmm5, xmm3 ; m13,m14 shufps xmm3, xmm3, 00h ; m11,m11,m11,m11 shufps xmm4, xmm4, 55h ; m12,m12,m12,m12 shufps xmm5, xmm5, 00h ; m13,m13,m13,m13 mulps xmm3, xmm0 ; m11*m11,m11*m12,m11*m13 mulps xmm4, xmm1 ; m12*m21,m12*m22,m12*m23 mulps xmm5, xmm2 ; m13*m31,m13*m32,m13*m33 addps xmm3,xmm4 addps xmm3,xmm5 movaps [eax], xmm3 ;; copy m2[4]-m2[6] movaps xmm3, [edx+16*1] ; m21,m22,m23,m24 movaps xmm4, xmm3 ; ^ ^ ^ ^ movhlps xmm5, xmm3 ; m23,m24 shufps xmm3, xmm3, 00h ; m21,m21,m21,m21 shufps xmm4, xmm4, 55h ; m22,m22,m22,m22 shufps xmm5, xmm5, 00h ; m23,m23,m23,m23 mulps xmm3,xmm0 ; m21*m11,m21*m12,m21*m13 mulps xmm4,xmm1 ; m22*m21,m22*m22,m22*m23 mulps xmm5,xmm2 ; m23*m31,m23*m32,m23*m33 addps xmm3,xmm4 addps xmm3,xmm5 movaps [eax+16*1], xmm3 ;; copy m2[8] - m2[10 movaps xmm3, [edx+16*2] ; m31,m32,m33,m34 movaps xmm4, xmm3 ; ^ movhlps xmm5, xmm3 ; m33,m34 shufps xmm3, xmm3, 00h ; m31,m31,m31,m31 shufps xmm4, xmm4, 55h ; m32,m32,m32,m32 shufps xmm5, xmm5, 00h ; m33,m33,m33,m33 mulps xmm3, xmm0 mulps xmm4, xmm1 mulps xmm5, xmm2 addps xmm3, xmm4 addps xmm3, xmm5 movaps [eax+16*2], xmm3 ;; copy m2[12] - m2[14] movaps xmm3, [edx+16*3] ; m41,m42,m43,m44 movaps xmm4, xmm3 ; ^ movhlps xmm5, xmm3 ; m43,m44 shufps xmm3, xmm3, 00h ; m41,m41,m41,m41 shufps xmm4, xmm4, 55h ; m42,m42,m42,m42 shufps xmm5, xmm5, 00h ; m43,m43,m43,m43 mulps xmm3, xmm0 mulps xmm4, xmm1 mulps xmm5, xmm2 addps xmm3, xmm4 addps xmm3, xmm5 movaps [eax+16*3], xmm3 ret [Edited by - AnthonyS on March 23, 2008 12:38:21 AM]
  11. Study of mathematics

    Greetings gd.net community, I have a few questions for the graphics experts out there. Having quit college early to pursue my programming and kung-fu, I was never able to finish my education in mathematics. To be honest, it was never a regret until I started getting into computer graphics a few years ago. Well, that was then, and this is now. I've read a book on 3D math for games(3D Math Primer for Graphics and Game Development) and quite a few siggraph papers, but my fundamental skills in math are still a weakness. It never really dug deep until I read this paper. http://graphics.cs.uiuc.edu/~garland/papers/quadrics.pdf So I bought a calculus book (Calculus with Analytical Geometry 8th edition) and proceeded to work through the book chapter by chapter, partially using MIT's Open Courseware to supplement the book. My intention is to eventually get a deeper understanding of linear algebra, differential geometry, and perhaps physics. Much to my chagrin, many of the calculus topics are very interesting, but not very useful for applied computer graphics. And working through the problem sets a section at a time will take at least 4-6 months - just so I can start practicing linear algebra and differential geometry. Which leads me to my questions, sorry for the long setup. Which subjects in calculus are a must for someone looking to do applied math in computer graphics for games, and which topics can be skipped. I really want to get into the meat of my interests sooner rather than later. Are there any other subjects I'm missing? Maybe Fourier transform? What should I most definitely study in order to better understand Michael Garlands paper. Is there a better pedagogy than the one presented in my textbook for taking math in the direction of computer graphics for games? Any advice would be greatly appreciated. Sincerely, Anthony
  • Advertisement