Stormeus

  • VC:MP Developer
  • oh god how did i get here im not good w computer
  • Posts: 1,128

EK.IceFlake

  • Hero Member
  • "We are the champions my fellahs" - Sufyan/VK.SuFy
  • Posts: 1,761
Re: Server Update Released (July 18)
« Reply #1, on July 18th, 2016, 07:54 PM »
Our problem isn't solved unfortunately as Lazy Angle [@VK.Angel.OfDeath] still wants to use 04rel003

.

  • VC:MP Beta Tester
  • .
  • Posts: 1,804
Re: Server Update Released (July 18)
« Reply #2, on July 18th, 2016, 07:59 PM »Last edited on July 18th, 2016, 08:16 PM
Quote from EK.CrystalBlue on July 18th, 2016, 07:54 PM
Our problem isn't solved unfortunately as Lazy Angle [@VK.Angel.OfDeath] still wants to use 04rel003
Out of @Stormeus 's hands I'm afraid. And frankly, not even his problem. If I may step out of my boundaries for a bit.
.

EK.IceFlake

  • Hero Member
  • "We are the champions my fellahs" - Sufyan/VK.SuFy
  • Posts: 1,761

.

  • VC:MP Beta Tester
  • .
  • Posts: 1,804
Re: Server Update Released (July 18)
« Reply #4, on July 18th, 2016, 08:01 PM »
Out of curiosity, what's in it for the guy that still wants to use 04rel003? Let me guess... text-draws and sprites?
.

Stormeus

  • VC:MP Developer
  • oh god how did i get here im not good w computer
  • Posts: 1,128
Re: Server Update Released (July 18)
« Reply #5, on July 18th, 2016, 08:07 PM »
Quote from EK.CrystalBlue on July 18th, 2016, 07:54 PM
Our problem isn't solved unfortunately as Lazy Angle [@VK.Angel.OfDeath] still wants to use 04rel003
The issue has been solved as of the latest release of the VC:MP server. The fact that you guys decided to stick with an outdated netgame version isn't an issue for us and we have no plans to backport fixes.

EK.IceFlake

  • Hero Member
  • "We are the champions my fellahs" - Sufyan/VK.SuFy
  • Posts: 1,761

VK.Angel.OfDeath

  • Newbie
  • Posts: 13
Re: Server Update Released (July 18)
« Reply #7, on July 18th, 2016, 08:44 PM »
Quote from . on July 18th, 2016, 08:01 PM
Out of curiosity, what's in it for the guy that still wants to use 04rel003? Let me guess... text-draws and sprites?
What CrystalBlue is saying is not true. I haven't updated to rel004 because it came out in the middle of a patch update I was doing for the server and I felt like at that time it wasn't 100 % necessary to convert to rel004 yet.  Now that the patch for our server is finished, I'll definitely convert to rel004.

When rel004 came out I did create a textdraw and a sprite class (on day 1) that replaced the old sprite and textdraw class and everything seemed to work just fine. But as always I am concerned about performance and I always want to make sure I am doing everything in the best way possible. KAKAN and CrystalBlue has told me in the past that in order to get the best possible performance you should put as much information in one stream as possible instead of dividing up the information into several streams. I don't really understand how that would matter when the size of the stream isn't that big, but I am definitely not the expert in client side scripting.

MEGAMIND

  • Hero Member
  • Developer of "Web-Net" search engine
  • Posts: 698

.

  • VC:MP Beta Tester
  • .
  • Posts: 1,804
Re: Server Update Released (July 18)
« Reply #9, on July 18th, 2016, 09:10 PM »Last edited on July 18th, 2016, 09:13 PM
@VK.Angel.OfDeath To be honest, unless you're streaming the player position/rotation several times every frame from the client to the server through your scripts, I highly doubt that you'll slow down your server anyway (depending on how many clients you and what server you're hosting). If you need advice regarding streams in vcmp to know when there could be a performance issue, don't hesitate to ask.

On the server-side things are a bit more tricky. Since there's only one buffer/stream that you can use for all players. You are most likely forced into sending small packets very frequently to not make other players wait while you build up information into a dedicated buffer/stream that you send periodically to a single player.

I remember I had to think of a more flexible way of dealing with this when I worked on my plugin.

What I did was to allow each player to have a dedicated buffer/stream where I can store information without making the other players wait and also the option to have as many other buffers/streams where I can write data and send to however many players I want. So I could eliminate that need to flush buffers/streams as early as possible to make room for other players.

Dedicated player buffers/streams:
Code: [Select]
// Build up data for each player in "parallel" (kinda)
player_1.StreamFloat(2.43);
player_1.StreamFloat(1.43);
player_1.StreamFloat(4.43);

player_2.StreamString("ABC");
player_2.StreamInt(21753);

player_1.StreamInt(1234);
player_1.StreamInt(34782);

player_2.StreamByte(123);
player_2.StreamByte(42);
player_2.StreamByte(27);
player_2.StreamByte(98);

// Send the built up data and start again (or false to continue where I left)
player_1.FlushStream(true);
player_2.FlushStream(true);

And shared player buffers and streams:
Code: [Select]
local buffer_1 = SqBuffer(128);
local buffer_2 = SqBuffer(128);

buffer_1.WriteVector3(Vector3(1.11, 2.22, 3.33));
buffer_1.WriteVector3Ex(4.44, 5.55, 6.66);
buffer_1.WriteVector3(Vector3(7.77, 8.88, 9.99));

buffer_2.WriteString("abc");
buffer_2.WriteString("xyz");
buffer_2.WriteString("ijk");

player_1.SendBuffer(buffer_1);
player_2.SendBuffer(buffer_2);
player_3.SendBuffer(buffer_1);
player_4.SendBuffer(buffer_2);

Allowing for more flexible code when sending streams from server.
.

Stormeus

  • VC:MP Developer
  • oh god how did i get here im not good w computer
  • Posts: 1,128

.

  • VC:MP Beta Tester
  • .
  • Posts: 1,804
Re: Server Update Released (July 18)
« Reply #11, on July 18th, 2016, 09:23 PM »Last edited on July 18th, 2016, 09:26 PM
Quote from Stormeus on July 18th, 2016, 09:13 PM
@. Doesn't that functionality already exist in the Squirrel standard library with the blob class though?

http://squirrel-lang.org/squirreldoc/stdlib/stdbloblib.html
Yes but IIRC your streams don't allow sending blobs. Also, working with blobs to do streaming is a bit more complicated for VC:MP. First thing that comes to mind are strings. Because you have to create a 16bit (big endian) integer and then write up the string character by character (allows the scripter to easily introduce bugs). And also writing other kind of data is a bit weird since you need to add their specifier for how to be interpreted. Kinda like the format() function.


How it looks when trying to send a string with blobs:
Code: [Select]
local b = blob(128);

local str = "abc", len = str.len();

// Make the size 16bit big endian
// (squirrel is weird on bitwise. not even sure this works)
b.writen(((len >> 8) & 0xFF) | ((len & 0xFF) << 8), 'w');

// Write the string character by character
foreach (c in str)
{
    b.writen(c, 'b');
}

// Wait... how do I sent it to the player now?

How it looks when trying to send a position:
Code: [Select]
local b = blob(128);
b.writen(2.43, 'f');
b.writen(1.13, 'f');
b.writen(4.53, 'f');

You can certainly see that you're making it easy for the average vc:mp scripter to introduce bugs and ask a lot more questions then usual.
.

MEGAMIND

  • Hero Member
  • Developer of "Web-Net" search engine
  • Posts: 698

Doom_Kill3R

  • VC:MP Beta Tester
  • Infinite loops defy infinity by overflowing memory
  • Posts: 1,107

Anik

  • Sr. Member
  • Posts: 355