Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 24 Mar 2001
Offline Last Active Today, 03:06 AM

Posts I've Made

In Topic: DLL-Based Plugins

16 October 2014 - 11:02 PM


There is no standardized C++ ABI.
Do they include their own version of the stdlib functions? Do they include the stdlib as a shared library themselves?
If they were created with a different compiler the class layout maybe be very different and so passing objects between your code and the DLL's code may result in crashes or other undefined behaviour.


Exactly, and to illuminate what this means in practice for Vincent, its that when your app is compiled with, say, Visual Studio 2013, update 2, bugfix 12, only DLLs compiled with the same exact version is guaranteed to work as expected (and still only if the compiler configs are identical and suitable for the purpose). It means that DLLs compiled with newer versions of compiler may not work, and more importantly that when the client is compiled with a newer version of the compiler, all the existing older DLLs are potentially broken. If you control all the code for the client and DLLs, you can at least provide DLLs that are in sync with your client, but still a user might copy an incompatible plugin DLL into your plugin directory and cause havoc; but where it gets much more difficult is when you have 3rd-party DLLs -- did you ever notice the boneyard of browser plugins that no longer work with the latest firefox.


In practice, of course, things are more stable than that, but the spectre of everything being broken by a minor-version increment of your compiler is a cause for concern.


This is why other ABIs do exist, such as COM.


Assuming you do decide to go the native DLL route, then I highly recommend you look long and hard at COM and how it behaves to get an idea of how to structure your code.

In Topic: Vectors, cosines, trig

16 October 2014 - 01:46 PM

First things first...

v is a vector and is most likely not a vector in R1, but probably in R3 (i.e. a 3-tuple), n is a normalized vector (i.e. unit length) in the same coordinate system, theta is the angle between v and n. Not arbitrary values you just plug in at random.


You're dealing with projecting one vector onto another, the picture is pretty straight forward, and you don't need to use trigonometric functions to perform this operation, as you can clearly see by the equation they derive in the end. If n is normalized then it is simply p = dot(v, n) * n which simply scales n by the distance v expresses its self onto the line represented by the vector n (i.e. the shadow of v on the line represented by n). Resulting in a vector pointing at a point p such that the angle between p and the vector from p to v is a right angle. (i.e. the vectors v, p, and p - v form a right triangle). If n is not unit length then you need to divide by the square of the magnitude of n, i.e. p = dot(v, n) / dot(n, n) * n, note that the dot product of a vector against its self is equivalent to the square of the magnitude of the vector.


In dealing with these equations on your calculator you need to construct the appropriate vectors, draw them on some graph paper, and things become much clearer. Then you can calculate things like the angles between your vectors and understanding projection.

In Topic: I'm getting back into game development...

15 October 2014 - 08:01 PM


In Topic: What Causes Port Mismatches ?

14 October 2014 - 08:36 PM

You don't need to recreate your ObjectOutputStream each time either. Just create it once, when you're connected.

In Topic: What Causes Port Mismatches ?

14 October 2014 - 07:09 PM

So, first things first...

Creating and destroying a socket every time you want to send a message is a horrible idea. It's slow, and messy.


Secondly, there's no "port mismatch" here, the server is listening for connections on port 9999. In TCP the listening port does not accept messages. Instead it negotiates a connection which is given another port number to not get mixed up with the listening port.1


This is not perfectly accurate but serves reasonably well as a basic explanation of what is going on. For more information I highly suggest you buy a decent book on TCP/IP and networking in general.