[PLUGIN] Network v0.3a update***

Post and try out addons that are currently in development.

Post » Mon Aug 22, 2011 3:24 pm

@noobdood

The only problem I can see with that is my game will require some pretty exact information, partially to cut back on server/client checks (for sync and anti-cheat) but for accuracy of movement.

My game will not be an "action game" but will have a lot of moving objects, so network traffic will probably be pretty hefty.

Thanks for the suggestion though. I did think of it but have not actually tried it yet, so I may still give it a go.

@newt
This. This exactly... I would rather it slows down the movement of everything, and "lag" the server to compensate for the slowest connection, in order to maintain integrity.

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
45
S
17
G
37
Posts: 2,853
Reputation: 25,966

Post » Tue Aug 23, 2011 3:22 am

Hey SOL..

To answer your questions:

1. Sending x,y angle, UID, and name every game tick is fine for a LAN game. Other than that, it causes too much network traffic for internet clients that don't support lots of bandwidth. There are a couple of solutions:
a. Send updates less often and then use a lerp to smooth movement. I show a simple example of this (lerp) in the netshooter .cap. Either way, over the internet with more than a couple clients..definitely need to send data less often. Valve's engines send updates every 3-4 frames and interpolate (lerp) to smooth the difference.

b. Use the RoundTripTime expression combined with player's speed/angle to "predict" their path/location. For example, send a packet that says "player 1 pressed the up arrow at angle X w/ velocity Y". Knowing that you can predict how fast he will be traveling and path is will take without ever getting new updates (i.e. if you know the player is traveling in a straight line then it makes no sense to send updates every tick for a path along that line). Having the RoundTripTime you will know what the lag is and can compensate (took 100 ms for packet to get to you so player is already moved further along that initially. If the remote peer takes their hand off of the up button then you immediately get that message and can predict based again on lag where the player stopped. Every few ticks the server can send the TRUTH out to everybody and everyone will get synchronized again. CAUTION: prediction does have it's shortfalls with games where movement can change rapidly so you have to send out the truth synchronization more frequently

c. Combine sends together vs sending lots of little ones out at a time..not sure if this applies in your case. However, try not to let your packets get bigger than MTU (1500 bytes).
d. Reduce the size of the packets through serialization. * This is not implemented in the plugin currently so I should be able to reduce bandwidth consumption by about 25% or so. Only problem with this method is that the way network data is constructed must change. Instead of being able to do a: playernum & : & angle &... I would have to define parameters that you would add like: param1 = int with playernum....kinda like the function object. This is a massive change to the plugin and I probably would fork the source and build up a new version.

2. Laggyness building over time. I'm not sure if it is a memory leak in the plugin as the core library ENET supports games with hundreds of players. Here is my guess with what is happening...you are sending out packets every tick..at first clients are able to handle things ok, but after a while packets start stacking up, ENET's automatic load handling takes over and starts dropping unrealiable packets (your x,y position packets) to help guarantee the reliable ones make it through. The more packets stack up the more that ENET will drop to maintain bandwidth levels.

Try doing an experiment and only send data once every 5 game ticks. See if the laggyness increases the same over time.


scidave2011-08-23 03:31:08
B
8
S
3
G
7
Posts: 835
Reputation: 5,313

Post » Tue Aug 23, 2011 2:13 pm

Well I did write a large reply, but the forum ate it since Tom hasn't increased the idle timeout beyond 4 seconds.

I will summarize by saying:
- Thank you!
- OK I will try those things
and
- You're awesome

~Sol

PS. Tom if you see this, PLEASE increase the idle timeout to like, 2 hours... It timed me out between logging in and writing a 200 word post... and I type around 60wpm.
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
45
S
17
G
37
Posts: 2,853
Reputation: 25,966

Post » Wed Aug 24, 2011 3:31 pm

scidave, can i take new version and replace it with the old version in \plugins and in \runtime? Will my projects work? And when version 0.4 will br ready? iamnp2011-08-24 15:32:13
B
2
G
1
Posts: 20
Reputation: 490

Post » Wed Aug 24, 2011 4:31 pm

[QUOTE=iamnp] scidave, can i take new version and replace it with the old version in \plugins and in \runtime? Will my projects work? And when version 0.4 will br ready? [/QUOTE]

Yup. That worked for me at least.
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009

Post » Wed Aug 24, 2011 10:34 pm

>> Will my projects work?
Yes, 0.3 doesn't introduce any breaking changes. 0.4 MIGHT..still doing testing, but changes will be minor and should only take a few minutes to clean up an old .cap.

>> And when version 0.4 will br ready?
If you give me $1000 I'll have it to you this weekend! :-) All joking aside I have player tracking 75% implemented, but I gotta admit I'm impressed with Jayjay's player tracking on his Pixel Online game so not sure how much it is needed. I have implemented adding an ID to all connections so you can check the ID on disconnect to remove a player...which was a missing feature.

The server/client combination will probably get pushed back to 0.5 or later as it isn't an essential feature right now. I'm more concerned with investigating/reducing bandwidth usage.
B
8
S
3
G
7
Posts: 835
Reputation: 5,313

Post » Thu Aug 25, 2011 6:56 am

scidave, okay i'll think about $1000
B
2
G
1
Posts: 20
Reputation: 490

Post » Thu Aug 25, 2011 3:20 pm

[QUOTE=scidave]I have implemented adding an ID to all connections so you can check the ID on disconnect to remove a player[/QUOTE]

YES!! Thanks SciDave!

I was using a "rotating pool" of 4095 ID numbers stored in each clients global variable ID. This meant that a player who was AFK for long enough to have 4095 clients join and disconnect has the next player steal his ID =/Jayjay2011-08-25 15:22:38
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009

Post » Tue Aug 30, 2011 11:26 am

I have a small problem, when I'm try to include more than 1 layout client loses connection with server.
How to go from Layout1 to Layout2 out of lose connetion?

It's showed in Netshooter example but I don't understand these.

Anyone can explain me step by step how to do this?Notsu2011-08-30 11:32:38
B
9
S
2
G
1
Posts: 21
Reputation: 992

Post » Tue Aug 30, 2011 3:39 pm

[QUOTE=Notsu] I have a small problem, when I'm try to include more than 1 layout client loses connection with server.
How to go from Layout1 to Layout2 out of lose connetion?

It's showed in Netshooter example but I don't understand these.

Anyone can explain me step by step how to do this?[/QUOTE]

If you select the Network plugin in layout 1 and tick the box "Global", it should stay connected across all layouts. This is because objects with the global property will automatically spawn across all layouts.
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009

PreviousNext

Return to Work-in-progress addons

Who is online

Users browsing this forum: No registered users and 0 guests