Erzengeldeslichtes

Members
  • Content count

    677
  • Joined

  • Last visited

Community Reputation

336 Neutral

About Erzengeldeslichtes

  • Rank
    Advanced Member
  1. 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?
  2. 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?
  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. 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.
  5. 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.
  6. 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.
  7. 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.
  8. 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.
  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. [.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.
  11. [.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]".
  12. 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...
  13. Look up threads and multi-threading. I'm reasonably sure that's what you want.
  14. 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.
  15. 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.