• Advertisement


  • Content count

  • Joined

  • Last visited

Everything posted by Erzengeldeslichtes

  1. D3DX link error on libcp.lib?

    I'm confused, I've never had this libcp.lib compile error. I used preprocessor directives to narrow down what code wants libcp.lib, and I've found D3DXLoadMeshFromX, D3DXComputeBoundingSphere, and D3DXComputeBoundingBox are causing it. I have a few other places where I use D3DX (ID3DXMesh, D3DXMATRIX, D3DXCreateTextureFromFileEx, etc), and they're all enabled and compile correctly. I've even successfully compiled with those currently causing difficulties, just not in the current incarnation. I kind of need these functions (well, I suppose I could do the bounding stuff on my own, but I'd rather not do the LoadMeshFromX), so anyone have any ideas why this is occuring? Of course, telling it to ignore the library makes it compile, but it seems stupid to have to do that.
  2. I'm making a game in PHP, javascript (ECMA script), and MySql. It's an idle game, where you do some actions and it takes real time for the actions to complete. There are two things I wanted to do with this: On completion, e-mail the user if they have their options set up for this, and have random events that might speed up or slow down the actions. These things must be able to be done even if no one is actively online. I have access on the shared host (which is a temporary home for the game while it's in the pre-alpha phase) to PERL, Ruby, and PHP as server scripting languages. I can set up CRON jobs manually. My current thinking is to just have a CRON job every hour that will process any unprocessed game data (users playing the game will process nearby data) and send out e-mails. (I'm avoiding have a CRON job every minute to keep my host happy) However, what I would like is something like a dynamically added single run task. That is, if the user starts something that will take 1 hour 30 minutes, have a task set to trigger in 1 hour 30 minutes (or randomly decide that in 35 minutes a random event will occur, so the trigger will be set for 35 minutes) that will execute a script to process that game data. Is it possible to do this with just the tools given?
  3. The Game I'm working on is supposed to let you walk around and fly around on a planet. In order to do this, every object on a planet, flying around above the planet, or in orbit of the planet defines its position with a special OrbitPosition, which has a Quaternion and a Distance. In order to move a certain distance, it divides the velocity by Distance and pitches the Quaternion by that amount (Roll is used to change direction). It works fantastically. However, I wanted to give players a real sense of the scale involved in planets. So I defined 1 unit is 1 meter, increased the planet size to that of Earth, gave it the correct rotation rate, put in the moon, properly sized, distanced, and the correct speed. I included a proxy sun that was much closer and smaller than the real one, just to give me something to call "stationary". I had to use 3 projection matrices to render them all without z-fighting. I also included a properly sized car, airplane, and Mt. Everest proxy (it's just a cylinder with the proper height). The problem, though, is that when working at these extreme values, floating-point precision becomes an issue. This was most obvious with the car and airplane, the vertices moved around to become almost voxel-like. I fixed that by transforming objects into Camera space before rendering (basically, the View matrix assumes it's a 0,0,0 and all world matrices are transformed by negative the camera's position). However, while the car now looks like a car instead of a car viewed through a pixelation censor filter, its position shutters horribly. The calculations for its position based on where it is on the rotating planet suffers from the inaccuracy. If I were using simple Cartesian coordinates (XYZ), I would break up space into a grid of cubes so that each object is accurately positioned within its parent cell. I'm not using Cartesian coordinates, I'm using Quaternion and Distance (is there a name for that?). I honestly have no idea how I could segment out this coordinate system to provide something more accurate. Does anyone have any suggestions? I'm using XNA and C# for my rendering and basic framework. As such, the Matrix, Vector3, etc, are all single floats and changing them to double floats would require significant reimplementation.
  4. Cutting up extremely large numbers when working with rotational positioning

    Hmm. I don't really understand; that appears to be Cartesian coordinates using the planet's center point as a frame of reference. How would that help me when I need to tell an object to move 10 units and have it actually move 10 units across the surface of the sphere? If I were to to temporarily do what I'm currently doing, convert its position to a quaternion, pitch the quaternion by the distance divided by the planet's radius, then convert it back, I would still have the precision issues, right?
  5. OpenGL C# graphics.

    If you just want to do this for your class, you'll definitely want to double buffer, as the Mighty Pigeon said. It should be less work to implement that into your existing code than rewriting using [url=http://csgl.sourceforge.net/]OpenGL for C#[/url] or XNA. Just keep in mind that what you're doing is rather slow compared to OpenGL and DirectX. It shouldn't be material for a simple Pac man game, but when you go beyond you should definitely go for XNA as Mike suggested.
  6. Mirroring a view matrix?

    I'm trying to make a mirror using the stencil buffer. I don't have the camera's position or orientation, I only have the view matrix. The reason for this is that the view matrix goes through several transformations including transforming around parents and transforming between scenes due to portals. I've tried using Matrix.CreateReflection and applying that to the view matrix (both Reflection * View and View * Reflection), but that failed. I also tried rotating the view 180 degrees (which rendered fine, but wasn't a reflection). I even tried scaling one axis by -1 (because that mirrors things in 3D Studio Max), but that did not render correctly either. I'd rather not modify the world matrix as I'm unsure how this will affect portals and mirrors in the mirror, or the mirror through portals and mirrors, but I did modify my render queue to apply the reflection matrix to all world matrices in the reflected scene. I tried in the form of Reflection * Bone * World, Bone * Reflection * World, and Bone * World * Reflection, and none of them worked. I admit that I have no clue how the reflection matrix is supposed to work, and tutorials are proving to be quite... dark, shall we say. They don't provide enough information, even in the form of using it for a world matrix. Can anyone help? Does anyone know of a way to flip a view matrix across a plane? It's driving me mad trying to figure it out.
  7. Mirroring a view matrix?

    Epilogue: Figured out where the problem lay. I was beginning to suspect that it was the frustum code culling the wrong objects, so I took a closer look at how the frustum code acts when the camera is behind the "portal plane". It didn't match, so I rotated the frustum's "portal plane" 180 degrees (sure, rendering from 180 degrees doesn't work right, but the frustum is exactly the same) and it worked. Now I just use View = Reflection * View, and removed the "apply to all world" code, and everything works out swimingly, even the other portals and multiple mirrors.
  8. Mirroring a view matrix?

    Okay, I tried Invert(View) * Reflection * View, View * Reflection * Invert(View), Invert(Invert(View) * Reflection) and Invert(Reflection * Invert(View)), but all failed to function correctly. I also used Reflection as Matrix.CreateReflection and the matrix you gave (upgraded to a 4x4 matrix), and every negative/positive variation thereof. I figured out the problem with the reflection in the world matrix, however. I was doing: void DrawPart(Part ToDraw, Matrix World) { Matrix MyWorld = ToDraw.Bone * World * Reflection; Draw(ToDraw.Mesh, MyWorld); foreach(Part p in ToDraw.Children) { DrawPart(p, MyWorld);//<-Problem is here } } As you can see, I was using the reflected world in the children, which then sort of reflected back. Since all the models I could see were children of a root node, they didn't work right. With the correction (Separating the "parent space" matrix from the "draw" matrix), the reflection works correctly from the world matrix side. But it makes me wonder. In the end, the graphics card basically is doing World * View * Projection, which substituting for World is Bone * ParentSpace * Reflection * View * Projection, right? So why doesn't it work to put Reflection * View in the view matrix instead of in the world matrix? Am I misunderstanding something? That said, even though the reflection works, portals inside of a reflection do not. That is what I was concerned about when I tried using the world matrix. So I still think it would be best if it was possible to simply reflect the view matrix rather than use my "apply this matrix to all meshes in this render queue" method that I'm using right now. Thanks for any help.
  9. I'm using the Stencil Buffer to create portals so that I can see through into another scene through some portal object. It's all working great, except when there's an object in the other scene that's relatively between the camera and the portal. The object appears in the portal, even though only objects past the portal should appear in it. It looks very odd. I know why it's happening: I only have one depth buffer to work with, and I need to reset that to 1.0 so that objects on the other side will be clipped properly. I'm having trouble thinking of solutions to this problem. The projection matrix's near plane is always flat along the view, and there's no built in way to have two depth buffers to scissor between. Would using a pixel shader with a second depth buffer work? Or is there some way to mess around with clipping planes? Any help would be appreciated.
  10. Wrong objects visible through portal...

    Quote:Original post by Krypt0n if the object is really between camera and portal (and not touchting the portal), you could also use the portal plane to cull it. you should anyway use the portal in the other room to generate a culling frustum with the portal as 'near plane'. While I have a frustum clipping out objects that shouldn't be visible, it works on a Model level, and the static geometry is all one model. Granted I should probably use an octree or something, but at the moment it's a proof of concept. Quote:Original post by bzroom You can set clipping planes. If you're using shaders there may be a few extra tricks to get them to work. I feel like an idiot for not finding clipping planes before. It took me a while to figure out how to take a the plane I have and transform it to clip space (the standard Transform(plane, Transpose(Transform(View * Proj))) wasn't working with the Plane object, it apparently needs to be a Vector4), but now it seems to work great.
  11. I'm looking for the functionality of std::string::find_first_not_of, but System.String does not appear to have anything akin to this. Short of writing a full blown Regex (which is very overkill) or manually iterating, how could I find the indices of the chars that do not match a set of characters? Why is there a System.String.IndexOf but no System.String.IndexNotOf? It seems like they should be logically paired...
  12. [.net] System.String.IndexNotOf?

    Those are both good, I like them. I might use a modified version of one. But the only way to do this with core .net, without writing my own worker functions, is with regex? Thank you for those ideas.
  13. [.net] System.String.IndexNotOf?

    Not quite, it would be: std::string("ABC1234ANYTHINGELSE").find_first_not_of("ABCDEF") yields an index 3, the character '1'. The only way I can figure to do it is with the sledghammer of regex, "[^ABCDEF]".
  14. Look up threads and multi-threading. I'm reasonably sure that's what you want.
  15. C++ properties

    EasilyConfused: I've used compiler specific properties in a few places, usually for callback or verification that the set is within range. It's just nicer to use, ex, "MyList.CurPos = 5" than "MyList.JumpToPos(5)" or "MyContainer.Weight += this.Weight" than "MyContainer.UpdateAndNotifyOfWeightChange(this.m_weight + this.ChildrenWeights())". After a little more thought, I don't particularly like the OP's implementation. It has 2 to 3 pointers per property, per object instance. This is going to get expensive fast. Zahlman: Your #3 classes are not properties. They're read/write variables. Those variables can only be read by their parent class and written to by anyone or vice versa. The OP's code calls either a get or a set FUNCTION, like C# properties do. This allows the user to do whatever they please--make verifications, call callbacks, notify the server or clients, whatever--so long as in the get function they return a variable. The C# tendancy to use properties instead of public variables is because using a property calls a function, while using a variable changes it directly. C# crosses DLLs frequently, and so the DLL can be changed without having to change the EXE. But wait, if we switch that name from a variable to a property (because we decided to broadcast the change to the server), the MSIL for the EXE is still trying to modify the variable directly and will probably throw an exception. Oops. Even get/set functions that do nothing but publicize a variable has its advantages.
  16. C++ properties

    Quote:Original post by JasonBlochowiak Yuck. All that work, when all you're really doing is making a variable public. jpetrie is right about if you have so many get/set functions that it's bogging you down, something is seriously wrong with your class design. How so? All that work wraps a pair of functions, where using = calls one and using it as a variable calls the other. How is this, in itself, making a variable public? It can be used to make a variable public, sure, but it can also be used for so much more.
  17. C++ properties

    To the OP: If you don't mind being non-portable, you can use MSVC's "__declspec(property(get=GetVarFunction, put=SetVarFunction)) Var_t TheVar", which will let you use "TheVar" as a "Var_t", but will actually call the get/put functions behind the scenes. This has the benifit of not being actual code, with no instance pointer or function pointer being stored per property per class instance. But your code looks fine, though I personally would have used multiple inheritance with Property derived from ReadOnlyProperty and WriteOnlyProperty... For those of you who bemoan properties: They are useful. Sure, if it just gets/sets a variable you have to ask "why", but that's no reason to be rid of properties entirely! What's wrong with a setter function validating that the recieved integer is between 0 and 12? What's wrong with a setter function calling a callback to update caches? What's wrong with a getter function generating the answer rather than storing a cached value? The code that the OP posted allows this. So why are you ripping on h(im|er)? Because of the "example code"? Realize: Example code is heavily simplified so as to demonstrate what's going on. It is not intended to show academically 'proper' code. It's like attacking a tutorial maker when his code doesn't check error codes.
  18. VC7 compiler in VC8?

    I'm working on a DLL that has to be compiled using VC 2003 (otherwise it won't work in the EXE which is closed source), but I've become spoiled on Visual Studio 2005. Is it possible to use Visual Studio 8 as the IDE for editing a solution, but when you hit F5 or Build or whatnot, have it compile using VC7's compiler and linker? Simply redirecting the binary path to VC7's binaries results in the compiler returning an error code.
  19. VC7 compiler in VC8?

    The error is: Quote:From Compiler Output error PRJ0002 : Error result -1073741515 returned from 'C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin\cl.exe'. (Just FYI, that's 0xC0000136) MSDN says "To resolve this error, be more informative on error conditions." I think they meant that toward cl.exe... Google remains unhelpful in this area. I've searched quite a bit to see if this is possible but I'm not pulling up any information on the possibility of using a different compiler. I've checked the command line: it won't let me use the single threaded runtime library switch that I need, but all the switches I see are valid commandline switches for the 2k3 compiler. I should mention that it returns the error before it even attempts to build anything. [Edited by - Erzengeldeslichtes on September 22, 2006 2:54:57 AM]
  20. Using Managed C++, I want to be able to typedef a class to a type, for example "typedef System::UInt32 CommandIndex;". This works fine within the assembly. But the class which uses this typedef is actually exported as part of a library, and the other assemblies are entirely unable to see "CommandIndex" as a type, they simply see it as an "unsigned int". The thing is, I'm not sure if I want a UInt16, UInt32, or UInt64, or if I even want it to be a UInt* or a regular Int*. Is there any way to make a "type" aliased to another that is visible to other assemblies for use?
  21. [.net] VC++ Function called from C#

    Firstly, in Managed C++ all ref classes must be GC Handles, ie, System::Array^ DataSrc. The second portion wants the predeclaration to match the definition. So you have to check to make sure the class Memory has a function declared which takes the System::Array^ and whatever else you chose. As for the third portion, the GCHandle is expecting just that: A handle to a garbage collected object. You seem to be using System::Array and System::Object directly rather than through the requisite handles (System::Array^ and System::Object^). The compiler should be complaining loudly about this.
  22. [.net] VC++ Function called from C#

    You really should just start a new thread. But when you referance a DLL all public types are immediately available to all cs files in the assembly. Within an assembly each cs file has complete access to the types in every other cs file.
  23. [.net] VC++ Function called from C#

    Probably because it's not a class in the C# and .net sense. The C# class is called a "ref class" or "ref struct" in managed C++. Since both C# structs and C++ unmanaged classes can live on either the heap or stack, I guess it's seen as a struct that's marked as "unmanaged". After all, in C++, there's no significant differance between a struct and class while in C# and .Net there's a very massive difference.
  24. Specifics: I'm using Visual Studio 2005 Professional Edition, using C++ with /doc and /clr. Problem: I'm trying to document my code with the XML documentation that VS can use. However, the CREFs are driving me completely insane with the "ambiguous" errors. For example: ref class AppTest { public: void MsgBox(System::String^ str) { System::Windows::Forms::MessageBox::Show(str, "Test Msg"); } void MsgBox() { MsgBox("<Blank>"); } void MsgBox(int i) { if(i == 1) MsgBox("Test One"); else MsgBox("Test Other"); } void Test() { } }; ///<summary cref="AppTest::MsgBox"></summary> int MyAmbiguousMsg;//^--C4641, ambiguous. ///<summary cref="AppTest::MsgBox(System::String^)"></summary> int MyUnambiguous_NonworkingMsg;//^--C4638, doesn't exist. ///<summary cref="AppTest.MsgBox(System.String)"></summary> int MyUnambiguous_Nonworking_Csharp_Msg;//^--C4638, doesn't exist. ///<summary cref="M:System.Void AppTest.MsgBox(System.String)"></summary> int MyUnambiguous_Nonworking_AsInXML_Msg;//^--C4638, doesn't exist. ///<summary cref="AppTest::Test"></summary> int MyWorkingTest;//^--no warning, "works". ///<summary cref="AppTest::MsgBox(int)"></summary> int MyWorkingMsg;//^--no warning, "works". ///<summary cref="AppTest::MsgBox(System.String)"></summary> int MyUnambiguous_Crashing_MixedCppCs_Msg; //^--*boom*, crashes the compiler. I've tried every variation I can think of, but it refuses to produce the documentation XML for the referancing documentation. It works fine with POD, like shown in the help file for this error, but even built in types like System::String makes it unhappy. The only variation that did anything different was "AppTest::MessageBox(System.String)", which either says "fatal error C1004: unexpected end of file" or crashes the compiler with an internal error. Even the help file for <summary>, which has this example: public ref class MyClass { public: /// <summary>MyMethod is a method in the MyClass class. /// <para>Here's how you could make a second paragraph in a description. /// <see cref="System::Console::WriteLine"/> for information about output /// statements.</para> /// <seealso cref="MyClass::MyMethod2"/> /// </summary> void MyMethod(int Int1) {} /// text void MyMethod2() {} }; /*Edited to fit on the forum*/ produces C4641. Does anyone know how to get the crefs in the xml comment documentation to actually work unambiguously in C++? [Edit: I broke up a long statement that was making the message wider than my screen]
  25. [.net] Comment documentation, ambiguous referance?

    Does doxygen hook up with intellisense to provide in-IDE documentation? [Edited by - Erzengeldeslichtes on August 8, 2006 10:53:57 PM]
  • Advertisement