BlueHabu

Members
  • Content count

    65
  • Joined

  • Last visited

Community Reputation

106 Neutral

About BlueHabu

  • Rank
    Member
  1. While others have answered the TCP portion very well I will note that the websocket layer may add some delay/buffer depending on implementation.      http://tools.ietf.org/html/rfc6455  -- search for the word "delay"   I think some implementations disable nagle (TCP_NODELAY) by default.
  2. Qt Image won't load?

    I believe the jpeg implementation is in a dll.  I compile Qt myself and I have to be careful to update the image plugins when I do so or images wont load.
  3. UDP packets: can they be splited?

    MTU sizes can dip in the 500 byte range for dial up and are determined by link layer protocols. AFAIK there is no minimum MTU you can set the will ensure absolutely no fragmentation unless you know what link layer protocols will be used. However, you could find a good enough number. I use what ever the dial up MTU which is I think something around 536 when using TCP. That said some routers will fragment purely based on congestion. Blackhole routers as swift mentioned are a problem but most behave correctly and send an ICMP destination not reachable if do not fragment is set in IPv4. As always, the smaller the packet the better if overhead is reasonable.
  4. I have been using this lighting model for years to run a small program that run a visual simulation for a network project I am working on. I took it almost verbatim out of the my book by Frank Luna on using D3D 9.0. I understand it is copyrighted but I am only using the code for academic uses. I have not rebuilt the program in over a year but I tried this week with the latest march 09 SDK and for the life of me I can get this fx file to load. The error is "Lighting.fx(87,8): error x4579: NaN and infinity literals not allowed by shader model ID3DXEffectCompiler: Compilation Failed" I am no graphics guru but I just cannot see the error. As a "quick fix" i have float t = 0.0. thanks for taken a look and any sugesstions //============================================================================= // PhongDirLtTex.fx by Frank Luna (C) 2004 All Rights Reserved. // // Phong directional light & texture. //============================================================================= struct Material { float4 ambient; float4 diffuse; float4 spec; float specPower; }; struct DirLight { float4 ambient; float4 diffuse; float4 spec; float3 DirW; }; uniform extern float4x4 gWorld; uniform extern float4x4 gWorldInvTrans; uniform extern float4x4 gWVP; uniform extern Material gMaterial; uniform extern DirLight gLight; uniform extern float3 gEyePosW; uniform extern texture gTexture; sampler TexS = sampler_state { Texture = <gTexture>; MinFilter = Anisotropic; MagFilter = LINEAR; MipFilter = LINEAR; MaxAnisotropy = 4; AddressU = WRAP; AddressV = WRAP; }; struct OutputVS { float4 posH : POSITION0; float3 normalW : TEXCOORD0; float3 toEyeW : TEXCOORD1; float2 tex0 : TEXCOORD2; }; OutputVS PhongLightingVS(float3 posL : POSITION0, float3 normalL : NORMAL0, float2 tex0: TEXCOORD0) { // Zero out our output. OutputVS outVS = (OutputVS)0; // Transform normal to world space. outVS.normalW = mul(float4(normalL, 0.0f), gWorldInvTrans).xyz; // Transform vertex position to world space. float3 posW = mul(float4(posL, 1.0f), gWorld).xyz; // Compute the unit vector from the vertex to the eye. outVS.toEyeW = gEyePosW - posW; // Transform to homogeneous clip space. outVS.posH = mul(float4(posL, 1.0f), gWVP); // Pass on texture coordinates to be interpolated in rasterization. outVS.tex0 = tex0; // Done--return the output. return outVS; } float4 PhongLightingPS(float3 normalW : TEXCOORD0, float3 toEyeW : TEXCOORD1, float2 tex0 : TEXCOORD2) : COLOR { // Interpolated normals can become unnormal--so normalize. normalW = normalize(normalW); toEyeW = normalize(toEyeW); // Light vector is opposite the direction of the light. float3 lightVecW = -gLight.DirW; // Compute the reflection vector. float3 r = reflect(-lightVecW, normalW); // Determine how much (if any) specular light makes it into the eye. float t = pow(max(dot(r, toEyeW), 0.0f), gMaterial.specPower); // Determine the diffuse light intensity that strikes the vertex. float s = max(dot(lightVecW, normalW), 0.0f); // Compute the ambient, diffuse and specular terms separatly. float3 spec = t*(gMaterial.spec*gLight.spec).rgb; float3 diffuse = s*(gMaterial.diffuse*gLight.diffuse).rgb; float3 ambient = gMaterial.ambient*gLight.ambient; // Get the texture color. float4 texColor = tex2D(TexS, tex0); // Combine the color from lighting with the texture color. float3 color = (ambient + diffuse)*texColor.rgb + spec; // Sum all the terms together and copy over the diffuse alpha. return float4(color, gMaterial.diffuse.a*texColor.a); } technique LightingTech { pass P0 { // Specify the vertex and pixel shader associated with this pass. vertexShader = compile vs_2_0 PhongLightingVS(); pixelShader = compile ps_2_0 PhongLightingPS(); } }
  5. How do TCP Packets get merged?

    http://en.wikipedia.org/wiki/Nagle's_algorithm
  6. checksums won't match!

    A quick guess and something that may be easy to disable is checksum offloading.
  7. Using IRC to make a game lobby?

    1) IRC is blocked by some hosting providers. 2) Some ISPs block it. 3) A chat lobby is very simple to implement. Ours is less than 2000 lines easy. 4) Add custom stuff for your product. 5) No off the shelf bots putting in ads for all that other crap. IRC was in our product in 2004-2005. It was replaced with a custom system with the first patch.
  8. Any CEs that study DSP do quite a bit of math. Not to many CS I know can bust out a laplace/fourier transform.
  9. You've heard it all before...

    Call a company that has already done a paintball game and license their tech. Quickest and easiest
  10. ios::in is not needed for ifstreams
  11. Anti-Aliasing

    Quote:Original post by VanillaSnake21 My card is Mobility Radeon 9000 IGP DX 8.1 and will do supersample AA. I have one in a older Dell 600m
  12. Quote:Original post by Shaitan00 1- Foreach Client the main form launches (create and start) a thread per client (so many threads), each thread performs the tcpclient connection, sends the data, and then close. 2- Main thread launches a single thread (create and start) which will loop through the list of clients (tcpclient connection, send data, close) and send the data Not sure what you are trying to do exactly but you should keep the connection open as long you are communicating with a certain client. Closing the connection after each send then reopening it is very wasteful. (three way hand shake and all)
  13. Getting local IP (internet sockets)

    markr is correct. Here is code sample from my network library that I am currently developing. // TODO check error number after calling getsockname() int iSize = sizeof(Socket::mLocalSocketAddress); getsockname(this->mulSocket, (sockaddr*)&this->mLocalSocketAddress, &iSize); mulLocalIP = ntohl(this->mLocalSocketAddress.sin_addr.s_addr); musLocalPort = ntohs(this->mLocalSocketAddress.sin_port);
  14. C++ or C#?

    Quote:Original post by Promit Quote:Original post by BlueHabu "C# is faster than C++". That seem pretty bold to me It's also a claim that doesn't appear anywhere in this thread. You are right you said Quote:Original post by Promit Performance would probably be (significantly?) better in C#. Since this is "C++ or C#?" thread what are you comparing if not C++ performance to C#? Quote:Original post by PromitI can't speak for others, but I feel no obligation to prove myself to others. I've put a lot of time into researching performance. If others aren't willing to spend even a little effort on the matter, that's their problem. I just don't want their ignorance polluting these discussions. Well that’s too bad but that’s what computer SCIENTISTS do. We research ideas and topics and post our results. You would think if you had all this research it would be simple for you to post it and if it was proved correct you would receive many accolades for resolving this very volatile and heated issue. If you are so concerned about the "their ignorance polluting these discussions" then PROVE them wrong. You say you have all this research share it. Let other look at and learn form it. Let others make it better. On a side note: Does anyone not want to see Promit prove C# is faster than C++? If you look at the latest issue of Communications of the ACM you will see a nice paper called "What makes a good programmer" The one trait the article said was important yet I thought most programmers lacked was objectiveness. IMO, this lacking trait is polluting these forums more than anything else. To whoever: Feel free to knock me down some more in ratings. I really dont put much stock in it
  15. C++ or C#?

    "C# is faster than C++". That seem pretty bold to me It would seem with all the "expert engineers/programmers" someone would confirm that C# is faster than C++ by publicly posting their testing environments for scrutiny. When the hypothesis that C# is faster than C++ is proven, it would no longer be considered irresponsible to make such a claim. It seems like there are plenty "C# is God's native tongue" people with an agenda so I don't see any lack of motivation to prove their point. However, I have seen no effort to do so.