Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


phayer

Member Since 27 Jun 2012
Offline Last Active Apr 15 2014 02:45 AM

Topics I've Started

Entity-component system and networking

19 March 2014 - 02:08 PM

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.

 


Threading and networking

17 March 2014 - 08:36 AM

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?


Chunk based level generater

31 March 2013 - 11:52 AM

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.


How to fight lag?

21 March 2013 - 12:07 PM

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.


Unreliable, sequenced packet in ENet

08 March 2013 - 06:45 AM

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?


PARTNERS