Jump to content
  • Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

100 Neutral

About brwarner

  • Rank
  1. brwarner

    Multiplayer ENET Runs Extremely Slow

    Wait nevermind, I'm an idiot.... I wrote microseconds instead of milliseconds so it was actually running at 30 000 frames per second. Fixed and now it runs fine (still needs tuning though). Thanks anyway [Edited by - brwarner on July 4, 2010 10:36:57 AM]
  2. brwarner

    Multiplayer ENET Runs Extremely Slow

    Every frame (30 fps) the server sends about 13 bytes to the client while the client sends between 0 and 5 bytes to the server. By internet (sorry I wasn't specific) I meant that instead of using "localhost" I used by external IP address, so only one computer is involved. The ping ends up being more like 0.7 seconds, but still really noticeable and unplayable. I deactivated the bandwidth limitations on the client but it still has this delay.
  3. Here is my architecture design which runs very smoothly when connecting by localhost, but up to 1.5 seconds of lag when going through the internet, I am trying to find out why. Server Loop: Process all packets in queue -Read the packet into a string, each character is a key that is down on the client If it has been 1/30 seconds since last update -Update objects (player changes position based on keys down) -Send XY position of objects to client (in unreliable packet) Client Loop: Process all packets in queue -Read raw XY coordinates into local variables If it has been 1/30 seconds since last update -Send a string of all keys down to server (in unreliable packet) Render Scene I know its not the most efficient setup, as its just a mock-up version at the moment, but it seems extraordinarily slow considering there is only one object and only one client. Any ideas? EDIT: I'm using enet by the way
  4. I use them all the time in games with either 3D or 2D graphics and have not noticed any severe performance problems. Theoretically when using them for access the only operation is a regular dereference and copying a smart pointer just increments a counter somewhere.
  5. I just thought I'd share a header file I just created which I thought was pretty cool that allows you to call a function with arguments in a single string such as: #include "Generator.h" void TestFunc( int a, int b, const string& s ) { cout << s << "=" << a - b << endl; } int main() { string data = "3,4,Hello World"; CallFunctionNative( TestFunc, data ); cin.get(); return 0; } Output: Hello World=-1 Generator.h: #define MAX_RFC_PARAMS 10 #if !BOOST_PP_IS_ITERATING #define ENUM_PARAM_LIST_M(z, n, data) BOOST_PP_COMMA_IF(n) params.Get<remove_const<remove_reference<Arg ## n>::type>::type >( n ) class CParamList { public: CParamList( const vector<string>& data ) : m_vec(data) {} template<typename T> T Get( int n ) { return boost::lexical_cast<T>(m_vec[ n ]); } private: //Data vector<string> m_vec; }; template< typename FuncSig > void CallFunction( function< FuncSig > func, const string& params ) { vector<string> data; boost::algorithm::split( data, params, boost::is_any_of(",") ); CallFunctionInner( func, CParamList( data ) ); } #define BOOST_PP_ITERATION_PARAMS_1 ( 3, (1, MAX_RFC_PARAMS, "Generator.h" ) ) #include BOOST_PP_ITERATE() #elif BOOST_PP_ITERATION_DEPTH() == 1 //Counter for iteration #define I BOOST_PP_FRAME_ITERATION(1) template< BOOST_PP_ENUM_PARAMS(I, typename Arg) > void CallFunctionNative( void(*func)(BOOST_PP_ENUM_PARAMS(I, Arg)), const string& params ) { CallFunction( function< void(BOOST_PP_ENUM_PARAMS(I, Arg)) >( func ), params ); } template< BOOST_PP_ENUM_PARAMS(I, typename Arg)> void CallFunctionInner( function< void( BOOST_PP_ENUM_PARAMS(I, Arg) ) > func, CParamList& params ) { func( BOOST_PP_REPEAT( I, ENUM_PARAM_LIST_M, empty ) ); } #endif I figured it would be useful for possibly scripting or (what I was going to use it for) remote function calls on a server by a client. Anyone have an opinion?
  6. I am trying to design my first real network game but I am having trouble designing it (the game is a 2D 2 player shooting game). I figure that I will use UDP due to the obvious speed benefits and so far I figured as well that the clients would continually send the commands the player is trying to do (move forward, shoot, turn, etc.) while the server will continuously transmit information such as the new position of moving objects but I have on problem. Things like dynamic object creation and objects instantaneously changing state wouldn't work since in UDP packets may be lost, and since this isn't a continous movement like something moving forward, if the packet is lost the client may never know something changed. Can anyone offer any advice or even ideas for how to design things differently?
  7. When passed between the vertex and pixel shaders, is TEXCOORD0 modified somehow? Because if not, how does tex2D sample differently for each pixel if each one is given the same texture coordinate near a vertex? I also wonder because in NVIDIA FX Composer I made a large plane with only 1 segment in each direction and ran this shader struct VS_OUTPUT { float4 Pos : POSITION; float3 Test : TEXCOORD0; }; VS_OUTPUT mainVS(float3 pos : POSITION){ VS_OUTPUT Out = (VS_OUTPUT)0; Out.Pos = mul(float4(pos.xyz, 1.0), WorldViewProj); Out.Test = pos.xyz; return Out; } float4 mainPS(float3 Test : TEXCOORD0) : COLOR { return float4(0.0, sin(Test.x), 0.0, 1.0); } And yet I saw multiple green spots, where there should really only be one since only a few vertices are processed.
  8. Website at Sourceforge Virtual Game Directory (VGD) can run a program in a "virtual environment" where additional directories can be mounted on top of the working directory, where files/folders there override those in mounts below them/the working directory. File iteration is also modified so that all files in all mounts are included in the iteration (top mounts override lower ones as always). To Use: Create a text file that will be a "profile" for the application/game. In it write the following cmd C:\Path\To\Program\To\Run\program.exe mount C:\Directory\To\Mount mount C:\Another\Directory ... Then drag this text file onto VGD.exe to run the program. Right now the program is in extreme alpha and has only had limited testing but shows promise. I'm looking for help stress testing it in different scenarios and improving the README/description if its not clear. I'm also trying to find other uses besides just modding (as you can install a mod in a separate directory and mount it so you don't have to overwrite files in the game and back them up). Any clarification or errors please just post - and if there is an error post the program you used it with + version and the version of VGD. Also post your profile text. [Edited by - brwarner on January 31, 2010 9:18:32 PM]
  9. Ok thanks I got that working but yet another problem persists :( template<typename T, typename A> struct Test { }; template<typename T, typename A, typename B> struct Test { }; Templates can be damn annoying sometimes. 1>c:\users\tigeradmin\documents\visual studio 2008\projects\templatetest\templatetest\main.cpp(85) : error C2977: 'Test' : too many template arguments 1> c:\users\tigeradmin\documents\visual studio 2008\projects\templatetest\templatetest\main.cpp(79) : see declaration of 'Test' It seems you can't partially specialize functions, but you can't overload structs - I'm stuck between two stones here.
  10. template<typename T, unsigned n> void Func() { } template<typename T, unsigned n> void Func<T, 1>() { int a = 0; a++; } error C2995: 'void Func(void)' : function template has already been defined Triggered on the second function. EDIT: Yet this seems to compile fine, something about the extra argument template<unsigned T> void Func() { } template<> void Func<1>() { int a = 0; a++; }
  11. Well I made it specifically for function pointers as that's what I need it for. Another question, why does this: template<typename T, int n> void Func() { } template<typename T> void Func<T, 1>() { int a = 0; a++; } Result in error C2768: 'Func' : illegal use of explicit template arguments I'm just trying to specialize it
  12. Ok I'm glad that it works for function pointers, I'll try it. Otherwise I would use typedefs but I actually need to run this on a bunch of native windows functions so it's easier this way then writing a typedef for each of the dozen I need to run it on.
  13. Ok but my primary concern in that the argument J is going to be a C++ function so the type would be something like int(*)(int,char), will BOOST_TYPEOF work with that because I tried and it just complained that J was unexpected, where writing int(*)(int,char) worked perfectly.
  14. But it does work, this successfully compiles: template<typename T, T J> T Function() { return J; } That wasn't my question, mine was in that example is their anyway to get it to deduce the first template argument by the second one. Something like: Function<,4>() instead of having to write Function<int,4>()
  15. I have a template function that looks like this template<typename T, T J> void Func() { ... } Problem with this is, it means I must always specify the type: Func<int,5> When I really want to do Func<5> If I try however to write: template<T J, typename T> It obviously complains about T not existing at that point. Is there anyway I can not have to specify the type, because the types I am using are function pointers and they have long to write out typenames.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!