• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

176 Neutral

About SOS

  • Rank
  1. Whatthe... I don't get it. Two executables, huge codebase... WTF? This is C#! It's compiled to MSIL! All that's needed is a change to the runtime and every C# exe and dll ever compiled will be able to take advantage. I guess the reason it is under-utilized at the moment is that the MS compiler folks have had more important and beneficial optimizations to do (as was said: "SSE can be about two times faster but that's really a relatively small margin"). Not much one can do, though. Writing to MS helps, of course. They do actually want feedback. However, anything like using separate types like in the original poster's suggestion is not good. That does indeed cause all sorts of problems and compatibility issues. But the basic idea of this is perfectly doable in the runtime.
  2. Just hopping in to say I love the idea too :D
  3. Well, you can't. That's what shadowed variables are like. You always need to know the type where the actual shadowed variable is declared. They're two different variables. You can't change the type of a variable that you got from a parent class, you have to make a new variable. No way around that. Your best option is to just leave the base class variable abstract enough so that anything you might want to assign to it is accepted (you could just make it of type Object).
  4. Umm, ok... let's take the first code... Why are you using BeginSend/EndSend() at all? Lose them. They're only needed for sending in a separate thread, which is not what you would usually want to do with a small utility class like this. It is correct, however. Both your Send() and BeginSend()/EndSend() should work. But still, just do a single SocketHandle.Send(DataArray, 0, DataArray.Length); If that does not throw an exception, it works fine and the problem is with the receiving end. (Assuming the socket was set up properly, no firewall is screwing stuff up and the network is not hosed and Winsock has not turned into a potato) Also, more flaws: 1) Data.Length is not the length of the string in bytes, so why are you using it as a byte counter? Don't. 2) You don't need to initialize DataArray, GetBytes() returns a new one already. 3) ToCharArray() is unnecessary (and I wonder if it might be messing up the string conversion? Probably not, but maybe)
  5. I guess it does look a tiny bit like VB. Must have been the lack of indentation and capitalization that was throwing me off... Okey, I read your question 3 times and I don't understand what you're even saying. What is Nothing? What do you mean by the word "link"? That's not a programming term I've ever seen anyone use in this context. Please clarify the question. Are you saying that when you access bugs(0).parent.parent, it is Nothing? This could be because the "parent" member of inheritclass is not the same as the "parent" member of myclass. They're two different variables. To access the other one, cast bugs(0).parent to inheritclass first. After that, "parent" is the parent of inheritclass. If you're saying something else, please be more clear.
  6. Sorry, I can't help you, but I was wondering what language this is? (I don't really understand the question since this language is unknown to me - makes my eyes all fuzzy)
  7. It's the latter: the compiler does them. (Btw, it doesn't actually have to inline stuff, the inline keyword in C++ is just a suggestion for the compiler)
  8. I need help choosing an angle!

    Many thanks to all! Yeah, I hate angles too because of things like this. I just couldn't think of a vector approach. Woohoo, many thanks once more!
  9. Detecting Collisions?

    Yes, that is one very common way and it is the easiest one. If you have to simulate physics for a large amount of time (say 0.25 seconds) do it in smaller increments (say 0.05 seconds five times in a row). The other option for accurate detection is to create a "stretched object" along the whole path of movement, but that is way more complex. I haven't actually seen that method used, although it is mentioned here and there.
  10. So, basically what I'm doing is bouncing something off a wall. I treat the wall and the incoming vlocity as vectors to find the resulting velocity. Works well, except one little thing... I can either add the angle-between-wall-and-first-vector or I can subtract it. If the first vector is on "one side" of the wall, then one way works. If on the other side, the other sign works... (The direction of the wall vector in relation to the first vector? Something like that...) However, I found no clear piece of info that tells me which sign I should use for a given pair of vectors. Here is the code I use: Vector2 v = GetV(); // First vector (green on images). Vector2 Wall = GetWall(); // Wall as a vector. float cosa = Vector2.Dot(v, Wall) / v.Length() / Wall.Length(); float angle = (float)Math.Acos(cosa); Matrix mat = Matrix.RotationZ((float)Math.PI + 2 * angle); Vector w1 = Vector2.TransformCoordinate(v, mat); mat = Matrix.RotationZ((float)Math.PI - 2 * angle); Vector w2 = Vector2.TransformCoordinate(v, mat); So... when do I use w1 and when w2? Image 1 (blue aka w1 is correct here): Image 2 (red aka w2 is correct here):
  11. I'm trying to make my spaceship corner in a nice curve, but my math is a bit hazy in one area. The curve has two endpoints, I know the starting and ending angles for both and the coordinates for both. What equation should I use to find its length? I'm wondering as to how the "level of curvature" is handled. You can assume it's constant throughout the curve. Or am I going to need some more variables to define that as well? (I notice Photoshop has the normal pull-points for curve corners... that makes the issue harder, hmm?)
  12. Aha! Works great now, thanks for the tip! :)
  13. I'm implementing a quadtree for my physics engine. So far, it seems very simple and fun but there's one thing I can't quite grasp. When should I check whether an object has moved? And how? The only thing I can think of is to simply check where every object belongs before every single collision check, for every (moving) object. However, this seems... excessive. Is there some shortcut or speedup used here? Or am I way off the mark?
  14. Two ODE questions

    Alright, looks like I took care of the problem in question 1 by setting the plane2D's MaxXForce and MaxYForce to 0 (whatever they do, that seems to work). As for the bounciness, thanks. That helped me along. However, I set mu to 0 and bounce to 1 but it still slows down (although noticably less). What could be going on?
  15. Two ODE questions

    First, when I use the Plane2D joint to constrain an object's movement to 2D, the object seems to have some sort of friction applied to it - it slows down and stops pretty fast. How can I prevent this? And secondly, how do I control the "bouncyness" of collisions? Say I have a piece of static geometry and an object that hits it. How can I make it so that, for example, the object bounces off with 0.5x speed? I assume mass comes to play somehow... but how exactly?
  • Advertisement