Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

150 Neutral

About phayer

  • Rank
  1.   But how does the component access the networking part of the application? How does the server component access NetworkServer?   How do you handle it on the client end? Do you read the package and then send it directly to the component on the given entity?
  2. I think you misunderstood. I'm not wondering how to structure my packets or what to put in them. I'm wondering how I should handle the data on the client side. Whats the cleanest way from receive data to processing it and updating entities?   What my clients send and doesn't send is more suited in a new topic I think.
  3. phayer

    Threading and networking

      Well, I'm locking the queues while I'm reading or writing to them. The current mechanism tries to;   Network thread -- Lock incoming queue and write to it, then unlock Lock outgoing queue and send packages, then unlock   Game thread -- Lock outgoing thread and write to it, then unlock Lock incoming queue and read from it, then unlock.   Just to minimize locking. Probably not perfect, but it works so far and I'm happy.       If any of you have any experience regarding entity-component-systems and how to integrate network to them easily while still keeping them flexible/extendable, the whole point of a entity-component-system, then please drop by in my other thread.
  4. Got some problems with coming up with how the state replication mechanics should work in a "entity component system"-design. I'm using the C++ port of artemis from vinova. No problems there, works great so far. For networking I'm using enet and I have a basic system up and going. I can send a "entity created with these components"-message, and the client creates a new entity which is identified by a unique ID(sent with the "entity created"-message).   All this is good, but the problem comes when I want to synchronize states across the network. How should I implement that on the server? Should there be a system that loops over and creates a packet for all the states that needs syncing? How should I implement this on the client?    My ideas so far; Server -- Since the server only sends states for object close to client I am currently;   Loop over all entites: 1. Check with all players, is the entity close? 1a. If so, does it need syncing? 1b. Yes; send a packet with the new state.     Client -- No idea..   If anyone have some tips, ideas, or could share how they solved this it would be great.  
  5. phayer

    Threading and networking

    Okey, so I implemented something that seems to work well;   2 threads and 2 queues.  1 thread for handling networking, 1 for the game. 1 queue for incoming data, 1 for outgoing data.   Does this seem like a reasonable design? I don't want to get hung up on this, but on the other hand I don't want to make a lot code smell -- Like, I don't want to spend a month later rewriting the entire network only because my prototype implementation was bad.
  6. So I'm stuck, and can't seem to figure out what the "right way" to solve this is.   I'm using enet - and the "enet_host_service" which takes care of sending and receiving data takes a timeout, like 10ms or 5000ms - whatever. The problem is; how large should this be? 1ms?   Cause the wait freezes the rest of the thread, of course. But if I have two threads, one that reads from the top of a list(simulation) and another one that writes to the bottom of the list(network) - wouldn't that impact performance hard and in some cases cause problems with locking?   Another thing I thought about was using zeromq(zmq) internally as I then don't have to think about locking, but I'm very unsure about zeromq when it comes to latency.   Any suggestions?
  7. Hi,   I'm currently in the process of making a "level generater" or whatever you call it. The whole concept evolves around it so I kinda don't want to have "non-pseudo-random levels".   This is the approach I'm going with atm;   I have many chunks which basically is a tile with game object placed on it. The tile has a list of other types of tiles that it is "connect-able" with in 8 directions. Up, down, left, right and the diagonals. This is all good and well. But here is the problem.    When the client connects to a server, the server sends a seed to the client. This seed is used to "random" which chunks to pick from the "connect-able" list. But if I expand(add chunks around) the tile at 0,0 the tile at 1,0 and at 0,1 both has to be connect-able to the chunk at tile 1,1.. And thisis where my logic crashes. Because, after a we tests it was crashing because it encountered impossible connections; Where 1,0 and 0,1 didn't didn't share a connect-able chunk.   And after about using 51 hours and smashing my head against the wall I've come here for ideas, tips, and inspiration..   One of the other things I'm worrying about is that it won't be "realistic" enough. That it would go like Jungle -> city -> beach -> airport in like 4 chunks, which is like all to small of a distance from a realistic point of view.     It doesn't have to be chunk-based solution - but it has be deterministic since I can't transfer all the data for the terrain all the time from the server to client. Aiming at a maximum of about 250 players per server.
  8. phayer

    How to fight lag?

    So what I should do is, the second I get some data, I chech if my interpolated entitys position isn't too far away from the position I just received. If it is; snap it in place. Then I start using the new velocity I just received?   How does this go for clients shooting at each other, or shooting at a AI?   And this method is applyable when using Box2d or some other physics engine on the server side?
  9. phayer

    How to fight lag?

    1. From what I understand from GafferOnGames.com 10-30 packets per second is "common"? And while we're talking packets, should I send one packet per entity update or pack many entity updates into one packet?   2. Well, I'm _trying_ to use interpolation - and if I have gotten anything right at all the, looking at both Valve/Source Engine & GafferOnGames the clients rendering time is delayed by some amount?   Is there any book specific to this topic? The only one I found on Amazon is just talking about the different techniques, not how to implement them. 
  10. Hi,   over the past weeks I've been trying to get the basics of how to "fight lag" implemented. So far things are going veeery slow, and I think I might have attacked it from the wrong angle.   Here is what  I have today; The server sends a update every 1/25th of a second. This updates includes; Ack, Ackbitfield[From www.gafferongames.com], Object ID, Position, Velocity. The client wait till it has received 10 packets before it starts rendering.   Now here it all stops and I'm sitting here with all these questions... How should I render it client side? I've tried to re-implement gafferongames code but I just can't seem to get it right, I still have plenty of jitter and lag - and that is when testing locally.    Why should I re-send a "position, velocity" packet from the past? I just can understand why I would send a position, velocity packet that is already in past time.   When receiving a packet on the client, should I include a time stamp from the server or should I use the clients time? Should I synchronize the time between the client & server? If so; how?   How should I handle player input "from the past"? Since the client is rendering 1/25th * 10 later than the server, how should I handle shooting? Like the player shooting a zombie that was there 1/25th * 10 of a second ago on the server but is currently right in front of him on his screen.
  11. Hi,   is there a possibility to have a sequenced unreliable packet in ENet? After reading gafferongames articles I got the impression that I need to have the sequence number, which makes sense when I'm gonna interpolate between them I need to know the order..   Or should I just use Reliable packets? Why should I resend a packet with state data for a time that has past in client rendering time?
  12. phayer

    Xna or Unity for first rpg?

    I would rather say MonoGame or Unity. MonoGame is a "clone" of the XNA framework with the added features of support for Linux and OSX, and more to come in the year.. Atleast that is what they MonoGuys are promising.. But still, all the things pointed out above still stands in a MonoGame vs Unity "battle"..
  13. phayer

    learning game development

    Sorry for not specifying; Yes, I was talking about WinForms/WPF - Swing is the Java counterpart you say? Got to google this. Never really gotten naked with Java.
  14. phayer

    learning game development

    I would suggest C# - kinda more fun and motivating to have some GUI easily available. Don't know how that is done in Java. Only used it for small console apps.
  15. phayer

    Simple game with cloudant

    I don't exactly see what you want to use CloudAnt for in a simple game?
  • Advertisement

Important Information

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

GameDev.net 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!