• Content count

  • Joined

  • Last visited

Community Reputation

122 Neutral

About titanandrews

  • Rank
  1. Using template class across libraries.

    Ah! You're right! Silly me. I'm not used to templates yet, but I'm learning. Thanks Guys!
  2. Using template class across libraries.

    So to be clear, these are linker errors not compiler errors. I have this header in project A that will create my lib. #ifndef FOO_H #define FOO_H #include "templatelib_global.h" template <typename T> class TEMPLATELIB_EXPORT Foo { public: void setValue(T value) { _value = value; } T getValue() const { return _value; } private: T _value; }; #endif // FOO_H I have this cpp file in project B that will create an exe. #include "foo.h" int main(int argc, char *argv[]) { Foo<int> f; f.setValue(1); int i = f.getValue(); } The linker errors are: error LNK2019: unresolved external symbol "__declspec(dllimport) public: int __thiscall Foo<int>::getValue(void)const " (__imp_?getValue@?$Foo@H@@QBEHXZ) referenced in function _main main.obj error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall Foo<int>::setValue(int)" (__imp_?setValue@?$Foo@H@@QAEXH@Z) referenced in function _main main.obj If I create a cpp file in project A. #include "foo.h"; void func() { Foo<int> f; f.setValue(1); f.getValue(); } the linker errors go away. thanks, B
  3. Hi All, I have a template class in a header file in lib A. Now I want to test it using CppUnit in exe B. Since the actual class of type T never gets created unless a client instantiates one, the code is never compiled in lib A. Since the symbols are never exported from lib A, I get linkage errors when exe B tries to link. I understand there are several ways to handle this. One way is to create a dummy class in lib A that instantiates classes of type T. ( however many T's you need ) The template classes would be created and symbols exported solving the linker problem. How do others handle this sort of thing? Is there some design pattern? many thanks, B
  4. MMO load testing

    Quote:We wrote LUA scripts to exercise different actions Were these actions that you could repeat over and over again in a loop or did the logic on the server prevent this? I would think to gather statistical data you would need to perform actions several times on each game instance. For actions that you can only do once during the game, I suppose you have to reset the state back to a point where you can repeat the test? How did you handle this? -B
  5. MMO load testing

    Thanks for the replies guys! So I guess what I was thinking was some sort of tool that could "simulate" game play for n number of virtual players. Basically you could describe the protocol to this tool as well as define certain other parameters and the tool could automagically run through all sorts of scenarios. Perhaps there would have to be some sort of AI involved in this. From what you guys are saying, such a tool does not exist and pretty much load testing is done with real users in beta testing scenario. Maybe a tool I am thinking of is just inconceivable? -B
  6. MMO load testing

    Hi, Does anyone know what tools are used in the industry to do load testing for MMO games? I googled "MMO load testing" and it didn't turn up anything useful. I'm sure companies must perform load testing on their servers so they can know how many users they can support. Does anyone have any insight into this side of the industry? many thanks, B
  7. Some help with collision detection

    Could this have something to do with how the perspective is set up and nothing at all to do with collision detection? I really am at a loss. Can anyone please help? thanks, B
  8. Some help with collision detection

    Hi All, I am having a lot of difficulty with collision detection. Actually, I'm not certain if it's a problem with collision detection specifically or something I just don't understand about OpenGL. :) I have adapted Oleg Dopertchouk's example from "Simple Bounding-Sphere Collision Detection" for a Java game using JOGL. ( Thanks to Oleg! ) Here is my method: boolean sphereTest(AbstractGameObject obj1, AbstractGameObject obj2) { // Relative velocity Vector3D dv = Vector3D.substract(obj2.getVelocity(),obj1.getVelocity()); // Relative position Vector3D dp = Vector3D.substract(obj2.getPosition(),obj1.getPosition()); //Minimal distance squared float r = (obj1.getWidth() / 2) + (obj2.getWidth() / 2); //dP^2-r^2 float pp = dp.x * dp.x + dp.y * dp.y + dp.z * dp.z - r*r; //(1)Check if the spheres are already intersecting if ( pp < 0 ) return true; //dP*dV float pv = dp.x * dv.x + dp.y * dv.y + dp.z * dv.z; //(2)Check if the spheres are moving away from each other if ( pv >= 0 ) return false; //dV^2 float vv = dv.x * dv.x + dv.y * dv.y + dv.z * dv.z; //(3)Check if the spheres can intersect within 1 frame if ( (pv + vv) <= 0 && (vv + 2 * pv + pp) >= 0 ) return false; //tmin = -dP*dV/dV*2 //the time when the distance between the spheres is minimal float tmin = -pv/vv; //Discriminant/(4*dV^2) = -(dp^2-r^2+dP*dV*tmin) return ( pp + pv * tmin > 0 ); } Now this works like a charm if obj2 is sitting at 0.0f,0.0f,0.0f, but the further down on the screen obj2 is ( for example -.5f on the y axis ) obj1 collides sooner. Way to soon. And the further down it is the sooner it collides. If obj2 is further up the screen from the center ( for example .5f on the y axis ) then the collision happens way too late. It's very odd to me. The output of my tracing is: Ball 0.0,-0.57959735,0.0 w=0.06 h=0.06 collided with TestBlocker 0.0,-0.5,0.0 w=0.1 h=0.05 Unless I am missing something, the above output looks correct, however the 2 objects are miles from each other. Can anyone give me hints as to what the problem might be? Many thanks! -B
  9. Free wavefront.obj files?

    Hi All, For someone like me who wants to experiment with 3D games but who is not an artist, are there any web sites where one could get free wavefront.obj files? I can draw things that are cube based like a table or chair, but for things like a human-like body or a tree, I have no idea. If I had a sample .obj human-like body that someone else has done, I could import it into something like wings3D, modify it, export it, and use it an OpenGL game. Is there any such free 3D artwork available? many thanks! B
  10. 3D modeling software, bitmaps and OpenGL

    That is quite impressive!
  11. 3D modeling software, bitmaps and OpenGL

    awesome! Thanks for the replies!
  12. Hi All, Since I have googled for a couple of hours on this and cannot find an answer, it is probably a stupid question that everyone knows. But here goes anyway. :) In Chapter 6 of Beginning OpenGL Game Programming, it talks about using bitmaps for 2D objects in a game. Well... if I want to use 3D modeling software like K3D or Wings3D to create a 3D game character, how do I go about using the character in the game. For example, in K3D you can export your 3D object as a tiff. But isn't that going to be a 2D image? If I load the image into an OpenGL program, will I be able to rotate the object around and see it's backside? I guess what I am asking here is this. I see how drawing objects with polygons in OpenGL works and how you can rotate them and such. But how does 3D modeling software fit into this picture? Obviously if someone wanted to create a game they would not try to do everything with OpenGL code or it would take forever. many many thanks for your help! -Barry
  13. Hi, Does anyone have SlickEdit v8 or higher for Linux that they don't use anymore and would be willing to sell to me? thanks, B
  14. OpenGL algorithm for creating a circle.

    Ah Ha!! I figured out my problem with the code you posted and a little trial and error. Thanks! I was making some calls like this, gluPerspective(52.0f,(GLfloat)width/(GLfloat)height,1.0f,1000.0f); and gluLookAt(0.0, 10.0, 0.1, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); These were left over from Chapter 3 examples in "Beginning OpenGL". It is unclear what these functions are actually doing. The book has not explained them yet, but just by commenting them, I can draw the circle. I did read the API docs for these functions, and I guess they will make more sense to me later. For now the light bulb is still off for me. thanks guys!
  15. OpenGL algorithm for creating a circle.

    Thanks for the replies! Yes, I assumed it was an int ( without thinking of course ). So I changed it to a float, but I still get the same problem, a straight line in the middle of the screen. I do a cout just to make sure there is no weird rounding problem going on. What else can I check? This really has me stumped. GLint circle_points = 100; glBegin(GL_LINE_LOOP); for (float i = 0; i < circle_points; i++) { float angle = TWO_PI*i/circle_points; char buffer[20]; sprintf(buffer,"%f",angle); cout << buffer << endl; glVertex2f(cos(angle), sin(angle)); } glEnd();