Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

450 Neutral

About Verg

  • Rank
    Advanced Member
  1. Well, of course it ended up being what I thought... something compiled with the wrong flag... but not any of my code. I was using a version of the Loki library that had one or two projects set to MDd (not MTd) for some reason... don't know why the project was like that. Anywho, changed the configurations of that project, rebuilt, and the program compiles and links.
  2. I have an old project I recently wanted to bring over to VS2008... haven't compiled it in about three years. It compiled fine on my old XP laptop; but I'm finding some weird behavior with the linker. Basically, I have specific .lib files in the "Ignore specific library" field of the project configuration (MSVCRTD.lib and msvcprtd.lib), and they're still getting linked against. The command line has /NODEFAULTLIB: "MSVCRTD.lib" /NODEFAULTLIB: "msvcprtd.lib" and so forth in it, and yet the linker errors are like: error LNK2005: "public: __thiscall std::_Lockit::~_Lockit(void)" (??1_Lockit@std@@QAE@XZ) already defined in libcpmtd.lib(xlock.obj) msvcprtd.lib These arise from the main executable being linked, not from libraries being linked. The project is set up as a MTd (multi-thread debug, non DLL) Seriously doubt it's a problem with VS2008... but maybe it is (?) Any light on the subject would help. Thanks. Chad
  3. OPTIMIZE TABLE does a defragment. Yeah, like I said... no access to the server so no way to restart MySQL. The owner is on the east coast, were he's probably in bed by now... or I'd give him a call. At any rate, he'll get my emails in the morning about how to reset things. The table itself has data that can be re-generated, so it's not a big loss if we have to DROP and CREATE it again. This had to do with the table not indexing any more... for some reason, the table stopped using its indexes... one of the things suggested "on the internet" was to ALTER TABLE <table> DISABLE KEYS, then re-index, then ALTER TABLE <table> ENABLE KEYS still in the re-index part; who knows how long it will take ultimately. In the meantime, about 2,000 people are without a web community.
  4. I made a boo-boo... maybe. On a vBulletin forum where I act as an admin (not an owner), I ran an OPTIMIZE TABLE command from the control panel. Over an hour later, I'm still waiting for the response. In the meantime, the server is not responding to new page requests... it's too busy to serve pages. The table in question was about 185,000 records at approximately 1K a pop for each record... possibly less. I think one of the fields is a varchar(500) which is why the size might be inflated. ... How long should this take, on an average webserver? I don't know the server; I don't have access to it to send MySQL a command to stop the OPTIMIZE TABLE thread... I just want to know how long I should continue to freak out :( Thanks Chad
  5. Quote:Original post by MJP Sure, you could do that with a RenderTarget2D. You basically just create it when you initialize your graphics stuff, set it as the current RenderTarget using GraphicsDevice.SetRenderTarget (use index 0), and then draw whatever you need drawn. When you're done, you call GetTexture to get a Texture2D that you can use normally. Probably the easiest way to start would be to just create a RenderTarget2D that's the same size as your backbuffer. Then you can render your lighting exactly like you're doing it now (except with BlendFunction.Max) to the RenderTarget, and afterwards just use SpriteBatch to draw it on top of everything else. Just be careful about the order in which you set your RenderTargets. If you target the 360 you'll want to do it in this order: -Render lightning to RT -Render everything else -Render lightning on top If you draw to the backbuffer, then to a RT, then back to the backbuffer, your backbuffer will be cleared when you switch to it the second time. If you want you can use RenderTargetUsage.PreserveContents in your PresentationParameters struct, and then the backbuffer won't be cleared. Just be aware that it's not too fast on the 360, so it's more desirable to use RenderTargetUsage.DiscardContents. Oh... thanks, MJP for the extra info. I actually did get this to work as expected (without looking here first :-)) but you've just confirmed that this was the way to go about it. I think in our game we: *render to a render target for the lightning bolt *switch to a new render target for this particular scene *render everything in the scene onto this render target, including the resulting Texture2D from the initial render target. Everything seems to work smoothly on a PC... we'll see how it goes on the 360. Thanks for the heads up Chad
  6. Hello, I've gone over Drilian's fantastic article on lightning, and am having a bit of trouble getting the same sort of effect in XNA. I've gotten this with anti-aliasing and alpha blended lightning segments: (everything looks even more obviously bad when I apply an additional glow texture to each segment) As you can see, the edges of the segments (when they overlap) are not blending as one might expect; they're doing additive blending instead of max blending. I'm just wondering if there's an easy way (using XNA) to perhaps render the lightning bolt offscreen using Blend.Max and then render that to the screen using Alpha. If so, might someone please suggest how? Could it be accomplished using a render target? Thanks and greetz Chad
  7. Verg

    Lightning Bolts

    Very nice job there. I'm in awe. Well... of course, it just so happens that our game is calling for lightning <parenthesis> wink </parenthesis> ... and I happened upon your nice article. I understood it well, and have been able to implement it about 90 percent satisfactorily (as much as possible in XNA). Unfortunately (yes) I'm running into a strange blending problem with XNA... even with alpha blending turned on (explicitly) RenderStates, yadda yadda... and this is how the lightning bolts are looking: Of course, I think you explained how to take care of this by moving vertex strips over the normals or something... and this is where I lost consciousness :D Or at least the eyes started to glaze over. If you have a moment, might you care to explain to someone with a pea brain how to do this? Thanks! Chad
  8. All right, I was able to get close to solving this using a RenderTarget. My only concern now is being able to get everything to render to a specific portion of the render target, so that I can spin the render target about an axis. I mean, I can flip the screen horizontally and vertically now... I would just like to be able to offset the rendertarget so all the rendering takes place in the center of it, or something. Thanks again, Chad
  9. I think the problem with the previous code is that it's taking the width and height (extents) of the sprite batch, and rotating around that (the Translation matrix is sent to SpriteBatch.Draw) I'm just trying to rotate the viewing rectangle, without messing with the sprite batch. Chad
  10. Okay, here's what I have for trying to get things at least rotated around the center of the screen. Problem is, it doesn't seem to be working. It seems to be trying to rotate around some outer point I can't find. Assume ZoomPercentage = 1.0f (zoom code works; rotate code doesn't seem to) int w = GameManager.Instance.GraphicsDevice.Viewport.Width; int h = GameManager.Instance.GraphicsDevice.Viewport.Height; float x = (float)(w / 2) - (((1f / ZoomPercentage) * (float)w) / 2.0f); float y = (float)(h / 2) - (((1f / ZoomPercentage) * (float)h) / 2.0f); Transform = Matrix.Identity * Matrix.CreateTranslation(0, 0, 0) * Matrix.CreateRotationZ(0) * Matrix.CreateTranslation(-x,-y,0) * Matrix.CreateScale(new Vector3(ZoomPercentage, ZoomPercentage, 0)) * Matrix.CreateRotationZ(MathHelper.ToRadians(45)); There's probably some trig in there, but I'm unsure where to apply it.
  11. Quote:Original post by Rewdew I can't even compute 1+1 right now, but wouldn't you just swap left and right for your projection matrix (assuming you use a perspective)? Also you could do all kind of nice effects by rendering to a texture first... And I suppose your HUD uses a separate projection. Hi Rewdew, It does seem like a pretty basic task, but I ask because I don't really have control of the HUD for the game. I think we're actually using the same projection matrix. This is a 2D game, though. I'm thinking Matrix.CreateOrthographic * some scaling matrix might do it, but I'm not sure. I think I could do something like multiply the projection matrix by whatever will flip/mirror it, and then switch it back before drawing the hud. I'm just not quite sure. Thanks Chad
  12. Hi Guys I've been looking into ways of flipping the screen or mirroring the screen during play (as an effect)... I'm not 100% sure how to do it, but it's probably something to do with the projection matrix. I don't want to flip the hud (if at all possible) but definitely want to flip the screen (the final boss in our game has the ability to flip/mirror the screen to confuse the player). I don't want to mess with doing this at the sprite batch level, if at all possible. I'd like to be able to render the render target and then do the mirroring/flipping (if possible). Please recommend (if possible) how I might do this. Thank you and greetings, Chad
  13. Hello, We're creating a 2D platformer w/parallax scrolling, and have run into performance issues for the XBOX 360/XNA. We've tried using Zones or Quadrants, which does improve performance (breaking a level up into pieces and doing the collision detections in those ranges, separately). However, we've found much better performance (actually acceptable performance) using a variation of Sweep and Prune. I'm not the one doing the physics code at the moment, but in fixing our basic directional collision code, I broke the sweep and prune code. If we run the basic collision loop without sweep and prune, everything works fine--except for performance. The collision checks are based on a time variable (the one passed in by XNA)--so that if something is colliding, it backs out of the collision based on certain fractions of that time step. The beauty is that that code works perfectly. If a collision occurs, we save the time step at which it occured (as a ref variable) and pass that time to the next collision test in the loop. The problem is... it fails with sweep and prune. I believe it is because once a sprite is updated (or backed out of a collision), during a single sweep, sometimes that "backout" causes a new collision that is not checked in that sweep--or it puts the sprite into a previously checked set of collisions (the sorted "sweep bucket") ------------------------------------ I guess my question is... should updating a sprite's position during a run of sweep and prune cause new, unchecked collisions? The way it works is that collisions that are left until the next Update() (or game loop) are assumed to be ignored collisions (i.e. once things are overlapping, if the collision hasn't been backed out, it's because they're supposed to overlap). If we don't do collisions this way, directional collision is impossible (i.e. making certain sides of a collision box non-collidable--like the underside of a platform). If we don't use directional collisions, gameplay is crude. Any insights into how we can fix Sweep and Prune to work with directional collisions? Thanks and Greetings, Chad
  14. Quote:Original post by Telastyn Quote:Original post by Mike.Popoloski You can constrain your generic types to specific interfaces, so you could define an interface for types that expose Value and then call it on that. Which sucks, because it requires explicit inheritance. Quote: C# 4.0 promises to introduce a dynamic type, which will support the concept of duck typing, allowing binding to be done at runtime. Which isn't really designed for this sort of thing (though will invariably be abused to this sort of thing, like some use var everywhere now...). Verg: C# is not C++. What you're trying to do is probably better done differently in the new language. What are you trying to do specifically? Just save some typing. The method I'm calling has the exact same signature and code inside of it, except that the T type passed in is different. I noticed (while creating both methods) that they simplified down and were exactly the same, except for the passed in parameter type. Again, it would be easy to extract a common base from that class... but it's not my code. Chad
  15. Hi Mike, Thanks for your reply. Currently I can't refactor the types to expose an interface, as the code was written by another person in the company and generally under their watch. I suppose I could write an adapter class that handled the types, but then that would completely alleviate the need for a template class at all... and it would mean that every new class coming along would have to be added to the adapter. I guess it's wait for 4.0 and hope the code doesn't get out of hand :-) Thanks, Chad
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!